Skip to content

[APPS][Connections Part 7] Add reusable module graph walker#364

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
sdkennedy2/module-graph-walker
May 13, 2026
Merged

[APPS][Connections Part 7] Add reusable module graph walker#364
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
sdkennedy2/module-graph-walker

Conversation

@sdkennedy2
Copy link
Copy Markdown
Collaborator

@sdkennedy2 sdkennedy2 commented May 13, 2026

Motivation

Split the reusable module graph traversal helper out from the connection ID extraction PR so reviewers can evaluate the graph-walking behavior independently.

Changes

This PR adds walkModuleGraph, a small backend AST parsing helper that walks collected app-local module records from a backend entry module. The helper owns reachability mechanics only: it visits each reachable collected module once, follows parseable app-local static dependencies, and fails closed when the collected graph is incomplete or contains unsupported local dependency facts.

For example, a later connection ID consumer can use the helper to collect IDs from every reachable module without reimplementing graph traversal:

const connectionIds = new Set<string>();

walkModuleGraph(entryId, moduleRecords, buildRoot, ({ moduleId, record }) => {
    for (const connectionId of extractConnectionIds(record.ast, moduleId)) {
        connectionIds.add(connectionId);
    }
});

return [...connectionIds].sort();

The helper deliberately does not know about action-catalog calls, connection ID values, Vite collectors, manifests, or dev-server execution. Those behaviors remain in the next PR in the stack.

QA Instructions

Added focused unit coverage for reachability traversal, cycle handling, dependency skip rules, and fail-closed graph gaps. Also ran the apps plugin typecheck and scoped lint coverage for the new helper.

Blast Radius

This adds a reusable internal helper under backend/ast-parsing. It is not wired into production or dev execution until the next PR consumes it.

Documentation

@sdkennedy2 sdkennedy2 changed the title Add reusable module graph walker [APPS][Connections Part 7] Add reusable module graph walker May 13, 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. You're on a roll.

ℹ️ 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/reachable-module-graph-call-sites branch from ce6fdd3 to 4780d00 Compare May 13, 2026 17:26
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/module-graph-walker branch from 156e956 to 48e0a11 Compare May 13, 2026 17:26
@sdkennedy2 sdkennedy2 marked this pull request as ready for review May 13, 2026 17:37
@sdkennedy2 sdkennedy2 requested review from a team and yoannmoinet as code owners May 13, 2026 17:37
): ParsedModuleRecord {
return {
id,
ast: parseAst('export const value = true;') as Program,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocker, is it possible to use ensureProgram here? Or no?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. 👍

@sdkennedy2 sdkennedy2 changed the base branch from sdkennedy2/reachable-module-graph-call-sites to graphite-base/364 May 13, 2026 20:25
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/module-graph-walker branch from 48e0a11 to 36b022a Compare May 13, 2026 20:28
@sdkennedy2 sdkennedy2 changed the base branch from graphite-base/364 to sdkennedy2/reachable-module-graph-call-sites May 13, 2026 20:28
Base automatically changed from sdkennedy2/reachable-module-graph-call-sites to master May 13, 2026 20:41
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 223970c into master May 13, 2026
8 of 9 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the sdkennedy2/module-graph-walker branch May 13, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants