[APPS][Connections Part 11] Resolve static definitions through module graph by sdkennedy2 · Pull Request #374 · DataDog/build-plugins · GitHub
Skip to content

[APPS][Connections Part 11] Resolve static definitions through module graph#374

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 9 commits into
masterfrom
sdkennedy2/static-definition-resolution
May 18, 2026
Merged

[APPS][Connections Part 11] Resolve static definitions through module graph#374
gh-worker-dd-mergequeue-cf854d[bot] merged 9 commits into
masterfrom
sdkennedy2/static-definition-resolution

Conversation

@sdkennedy2

@sdkennedy2 sdkennedy2 commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Motivation

This is the next PR in the backend connection ID analysis stack. The previous PR enriches parsed backend module records with domain-neutral import, export, star export, and top-level binding facts. The imported connection ID integration needs a reusable way to resolve those facts through the backend module graph without embedding import/export traversal inside connection ID-specific code.

Changes

Adds a domain-neutral static definition resolver for parsed backend module records. Given an ESTree identifier reference in a module, callers can resolve it to a concrete top-level const binding, or to a structured unsupported result with a stable reason code.

Example:

// actions.backend.ts
import { HTTP_CONNECTION_ID } from './connections';

request({
    connectionId: HTTP_CONNECTION_ID,
    inputs: {},
});

// connections.ts
const SOURCE_CONNECTION_ID = 'conn-http';
export const HTTP_CONNECTION_ID = SOURCE_CONNECTION_ID;

For the HTTP_CONNECTION_ID identifier in actions.backend.ts, the resolver follows the named import into connections.ts and returns the exported top-level const binding:

export const HTTP_CONNECTION_ID = SOURCE_CONNECTION_ID;

It does not evaluate the initializer into a string. That value-level evaluation is handled by the follow-up static string resolver PR.

The resolver is demand-driven: it follows named imports, local export aliases, named re-exports, local import/export relays, and unambiguous star exports for one requested symbol at a time.

Supported cases:

  • Same-module identifier references to top-level const bindings
  • Named imports through source module exports
  • Local export aliases
  • Named re-export aliases
  • Local import/export relays
  • Unambiguous star exports
  • Explicit exports taking precedence over star exports

Unsupported cases return structured reason codes instead of throwing connection ID-specific errors.

Unsupported cases:

  • Missing module records
  • Missing exports
  • Ambiguous star exports
  • Import/export cycles
  • Default imports
  • Default exports and default re-exports
  • Namespace imports
  • Missing static bindings
  • Mutable bindings
  • Unsupported top-level declarations and binding patterns
  • Unresolved identifiers and declaration identifiers

The result includes hop metadata so the follow-up connection ID PR can translate generic resolver failures into existing fail-closed diagnostics without recomputing graph traversal.

QA Instructions

No manual QA needed. This is an internal AST-analysis helper with focused unit coverage and no manifest behavior changes in this PR.

Blast Radius

This only affects the High Code Apps backend AST parsing internals in @dd/apps-plugin. The resolver is not wired into connection ID extraction or manifest output until the next stack PR, so customer-visible behavior should be unchanged.

Documentation

sdkennedy2 commented May 15, 2026

Copy link
Copy Markdown
Collaborator Author

@sdkennedy2 sdkennedy2 changed the title Add static definition resolver [APPS][Connections Part 11] Resolve static definitions through module graph May 15, 2026
@sdkennedy2

Copy link
Copy Markdown
Collaborator Author

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27f2171ba2

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

Comment thread packages/plugins/apps/src/backend/ast-parsing/static-definition-resolution.ts Outdated
@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
@sdkennedy2 sdkennedy2 changed the base branch from sdkennedy2/enrich-parsed-module-record to graphite-base/374 May 18, 2026 14:15

@sarenji sarenji left a comment

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.

👏

@sdkennedy2 sdkennedy2 force-pushed the graphite-base/374 branch from 5b543fa to 4548a21 Compare May 18, 2026 15:36
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/static-definition-resolution branch from 99ec178 to af45faf Compare May 18, 2026 15:36
@sdkennedy2 sdkennedy2 changed the base branch from graphite-base/374 to master May 18, 2026 15:36
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 7b773c7 into master May 18, 2026
6 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the sdkennedy2/static-definition-resolution branch May 18, 2026 16:23
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