Skip to content

[APPS][Connections Part 10] Enrich parsed backend module records#371

Open
sdkennedy2 wants to merge 1 commit into
sdkennedy2/refactor-action-catalog-module-scopefrom
sdkennedy2/enrich-parsed-module-record
Open

[APPS][Connections Part 10] Enrich parsed backend module records#371
sdkennedy2 wants to merge 1 commit into
sdkennedy2/refactor-action-catalog-module-scopefrom
sdkennedy2/enrich-parsed-module-record

Conversation

@sdkennedy2
Copy link
Copy Markdown
Collaborator

@sdkennedy2 sdkennedy2 commented May 15, 2026

Motivation

This is the second slice split out of the previous all-in-one module graph PR and is stacked on #373. Once scope analysis is reusable, ParsedModuleRecord can keep the static import/export/top-level binding facts needed by later resolver work without mixing in action-catalog or connection ID behavior.

Changes

ParsedModuleRecord now captures the static ES module facts that later graph traversal can consume:

export interface ParsedModuleRecord {
    id: string;
    ast: Program;
    scopeAnalysis: ModuleScopeAnalysis;
    staticDependencies: StaticModuleDependency[];
    unsupportedDependencies: ModuleDependency[];
    importsByVariable: Map<eslintScope.Variable, ImportBinding>;
    exportsByName: Map<string, ExportBinding>;
    starExports: StarExport[];
    topLevelBindingsByVariable: Map<eslintScope.Variable, StaticBinding>;
}

For example, given a backend module like this:

import { HTTP_ID as ACTIVE_ID } from './ids.js';
import * as shared from './shared.js';

const LOCAL_ID = 'conn-local';
const CONNECTIONS = { HTTP: 'conn-http' };

export { LOCAL_ID as EXPORTED_LOCAL_ID };
export { REMOTE_ID as EXPORTED_REMOTE_ID } from './remote.js';
export * as namespaceIds from './namespace.js';
export * from './star.js';

The associated record stores data shaped like this:

{
    staticDependencies: [
        { source: './ids.js', resolvedId: '/project/src/backend/ids.js' },
        { source: './shared.js', resolvedId: '/project/src/backend/shared.js' },
        { source: './remote.js', resolvedId: '/project/src/backend/remote.js' },
        { source: './namespace.js', resolvedId: '/project/src/backend/namespace.js' },
        { source: './star.js', resolvedId: '/project/src/backend/star.js' },
    ],
    importsByVariable: Map([
        [ACTIVE_ID_VARIABLE, {
            kind: 'named',
            importedName: 'HTTP_ID',
            resolvedId: '/project/src/backend/ids.js',
        }],
        [shared_VARIABLE, {
            kind: 'namespace',
            resolvedId: '/project/src/backend/shared.js',
        }],
    ]),
    exportsByName: Map([
        ['EXPORTED_LOCAL_ID', { kind: 'local', variable: LOCAL_ID_VARIABLE }],
        ['EXPORTED_REMOTE_ID', {
            kind: 're-export',
            importedName: 'REMOTE_ID',
            resolvedId: '/project/src/backend/remote.js',
        }],
        ['namespaceIds', {
            kind: 'unsupported',
            reason: 'namespace re-export',
            resolvedId: '/project/src/backend/namespace.js',
        }],
    ]),
    starExports: [
        { resolvedId: '/project/src/backend/star.js' },
    ],
    topLevelBindingsByVariable: Map([
        [LOCAL_ID_VARIABLE, { kind: 'const', expression: STRING_LITERAL_NODE }],
        [CONNECTIONS_VARIABLE, { kind: 'const', expression: OBJECT_EXPRESSION_NODE }],
    ]),
}

Unsupported export and binding records intentionally preserve the fact that a symbol exists even when the first resolver cannot statically evaluate that form. That lets follow-up resolver code distinguish “missing export” from “export exists, but this form is unsupported.”

QA Instructions

No manual QA; this is internal AST parsing metadata for the apps plugin backend module graph and is covered by CI.

Blast Radius

This affects backend apps module graph parsing. It adds static metadata to ParsedModuleRecord and updates existing module graph test builders, but it does not change runtime app behavior or customer-facing UI.

Documentation

Copy link
Copy Markdown
Collaborator Author

sdkennedy2 commented May 15, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sdkennedy2 sdkennedy2 changed the title Enrich parsed backend module records [APPS][Connections Part 9] Enrich parsed backend module records May 15, 2026
@sdkennedy2
Copy link
Copy Markdown
Collaborator Author

@codex review
@cursor review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/enrich-parsed-module-record branch from 9a457d1 to 16e895c Compare May 15, 2026 19:23
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/enrich-parsed-module-record branch from 16e895c to b47ee8d Compare May 15, 2026 20:49
@sdkennedy2 sdkennedy2 changed the base branch from master to graphite-base/371 May 15, 2026 20:54
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/enrich-parsed-module-record branch from b47ee8d to 5b543fa Compare May 15, 2026 20:54
@sdkennedy2 sdkennedy2 changed the base branch from graphite-base/371 to sdkennedy2/refactor-action-catalog-module-scope May 15, 2026 20:54
@sdkennedy2 sdkennedy2 changed the title [APPS][Connections Part 9] Enrich parsed backend module records [APPS][Connections Part 10] Enrich parsed backend module records May 15, 2026
@sdkennedy2 sdkennedy2 marked this pull request as ready for review May 16, 2026 19:13
@sdkennedy2 sdkennedy2 requested review from a team and yoannmoinet as code owners May 16, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant