Skip to content

[APPS][Connections Part 8] Traverse backend module graph for connection IDs#362

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
sdkennedy2/refactor-connection-id-extraction-modules
May 13, 2026
Merged

[APPS][Connections Part 8] Traverse backend module graph for connection IDs#362
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
sdkennedy2/refactor-connection-id-extraction-modules

Conversation

@sdkennedy2
Copy link
Copy Markdown
Collaborator

@sdkennedy2 sdkennedy2 commented May 13, 2026

Motivation

Use the backend-build module graph from #353 and the reusable walker from #364 to find action-catalog calls in reachable backend helper modules.

Changes

This PR adds the connection-ID-specific layer on top of the collected module graph and reusable graph walker. It introduces extractConnectionIdsFromModuleGraph and createBackendConnectionIdCollector, then wires graph-derived allowlists into production upload and dev backend execution.

The traversal starts at the real backend entry module, visits reachable app-local modules through walkModuleGraph, and runs the existing same-module connection ID extractor against each reached module. Connection ID values must still be defined in the same module as the action-catalog call site. Imported connection ID values are intentionally unsupported in this PR and continue to fail closed.

QA Instructions

Updated focused unit coverage for reachable helper modules, same-module connection ID values, graph cycles, unsupported graph shapes, production manifest enrichment, and dev execution allowlists. Also ran apps plugin typecheck and scoped lint coverage for the graph extraction and Vite integration paths.

Blast Radius

This changes apps plugin backend connection ID analysis for upload and dev execution by using reachable backend build modules instead of only the backend entry file. It preserves conservative fail-closed behavior and does not add imported connection ID value tracing yet.

Documentation

@sdkennedy2 sdkennedy2 changed the title Refactor connection ID module graph extraction [APPS][Connections Part 7] Refactor module graph connection ID extraction May 13, 2026
@sdkennedy2 sdkennedy2 changed the title [APPS][Connections Part 7] Refactor module graph connection ID extraction [APPS][Connections Part 7] Traverse backend module graph for connection IDs May 13, 2026
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/reachable-module-graph-call-sites branch from 3058275 to 583c810 Compare May 13, 2026 13:50
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch from 2524101 to 040ba08 Compare May 13, 2026 13:50
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/reachable-module-graph-call-sites branch from 583c810 to 9a8d0b2 Compare May 13, 2026 13:54
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch 2 times, most recently from 56d16d9 to 28d9e55 Compare May 13, 2026 16:10
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/reachable-module-graph-call-sites branch 2 times, most recently from c3f66bf to a00cd6b Compare May 13, 2026 16:41
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch from 28d9e55 to 5c15008 Compare May 13, 2026 16:41
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/reachable-module-graph-call-sites branch from a00cd6b to ce6fdd3 Compare May 13, 2026 17:00
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch from 5c15008 to 9f34e97 Compare May 13, 2026 17:00
@sdkennedy2 sdkennedy2 changed the base branch from sdkennedy2/reachable-module-graph-call-sites to graphite-base/362 May 13, 2026 17:21
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch from 9f34e97 to bc0061e Compare May 13, 2026 17:22
@sdkennedy2 sdkennedy2 changed the base branch from graphite-base/362 to sdkennedy2/module-graph-walker May 13, 2026 17:22
@sdkennedy2 sdkennedy2 changed the title [APPS][Connections Part 7] Traverse backend module graph for connection IDs [APPS][Connections Part 8] Traverse backend module graph for connection IDs May 13, 2026
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch from bc0061e to e08b6dc 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

walkModuleGraph(entryId, modules, buildRoot, ({ moduleId, record }) => {
// Resolve connection IDs while visiting the reachable graph so this
// step can later receive graph-aware value-resolution context.
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.

Essentially this allows us to support in the future traversing modules to find the connectionId. Currently the connection id needs to be defined in the same module as the action-catalog function call.

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.

In effect, if the user keeps adding to their backend, parsing connection IDs will slow down the more modules they add?

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.

Per unique backend function entry that is correct (since we do a build per backend function).
I figured we could start simple so its easy to reason about and the iterate and performance optimziations.

@sdkennedy2 sdkennedy2 marked this pull request as ready for review May 13, 2026 17:43
@sdkennedy2 sdkennedy2 requested review from a team and yoannmoinet as code owners May 13, 2026 17:43
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. What shall we delve into next?

ℹ️ 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".


walkModuleGraph(entryId, modules, buildRoot, ({ moduleId, record }) => {
// Resolve connection IDs while visiting the reachable graph so this
// step can later receive graph-aware value-resolution context.
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.

In effect, if the user keeps adding to their backend, parsing connection IDs will slow down the more modules they add?

beforeEach(() => {
jest.restoreAllMocks();
mockViteBuild.mockClear();
mockViteBuild.mockReset();
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/nit, but I think mockClear is fine (generally we should be calling jest.clearAllMocks() in an afterEach anyways). IIRC, the last .mockImplementation call wins?

@sdkennedy2 sdkennedy2 changed the base branch from sdkennedy2/module-graph-walker to graphite-base/362 May 13, 2026 20:28
@sdkennedy2 sdkennedy2 force-pushed the graphite-base/362 branch from 48e0a11 to 36b022a Compare May 13, 2026 20:33
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch from e08b6dc to 0dededb Compare May 13, 2026 20:33
@sdkennedy2 sdkennedy2 changed the base branch from graphite-base/362 to sdkennedy2/module-graph-walker May 13, 2026 20:33
Base automatically changed from sdkennedy2/module-graph-walker to master May 13, 2026 20:49
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch from e2addec to e580213 Compare May 13, 2026 20:51
@datadog-prod-us1-3
Copy link
Copy Markdown

datadog-prod-us1-3 Bot commented May 13, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 938eea6 | Docs | Datadog PR Page | Give us feedback!

@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/refactor-connection-id-extraction-modules branch from e580213 to 938eea6 Compare May 13, 2026 20:56
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit ec10389 into master May 13, 2026
6 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the sdkennedy2/refactor-connection-id-extraction-modules branch May 13, 2026 21:05
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