Skip to content

[APPS][Connections Part 2] Extract inline backend connection IDs#339

Draft
sdkennedy2 wants to merge 1 commit intomasterfrom
sdkennedy2/apps-inline-connection-id-manifest
Draft

[APPS][Connections Part 2] Extract inline backend connection IDs#339
sdkennedy2 wants to merge 1 commit intomasterfrom
sdkennedy2/apps-inline-connection-id-manifest

Conversation

@sdkennedy2
Copy link
Copy Markdown
Collaborator

@sdkennedy2 sdkennedy2 commented May 6, 2026

Motivation

This is part 2 of the connection ID manifest stack. After part 1 adds manifest plumbing with empty allowlists, this PR introduces the smallest useful static analysis behavior: inline string literal connectionId values in same-file action-catalog calls.

Changes

Adds extract-connection-ids.ts and wires it into backend proxy generation so every export in a backend file receives the same sorted, deduped file-level union of inline connection IDs. This PR also refactors backend export discovery around enumerateBackendExports, keeping existing extractExportedFunctions behavior while making export-shape validation shared and testable.

Supported in this PR:

import { request } from '@datadog/action-catalog/http/http';

export function run() {
  return request({ connectionId: 'conn-id', inputs: {} });
}

The extractor recognizes named/default/namespace action-catalog imports from the package root and subpaths. It ignores unrelated calls with connectionId, ignores action-catalog object arguments that visibly lack connectionId, and fails closed for unsupported call shapes that could hide a connection ID.

Same-module identifiers, object members, and imported values are intentionally deferred to later PRs.

QA Instructions

  • Run NODE_OPTIONS=--experimental-vm-modules ~/.yarn/switch/bin/yarn workspace @dd/tests jest --config jest.config.ts ../plugins/apps/src/backend/discovery.test.ts ../plugins/apps/src/backend/extract-connection-ids.test.ts ../plugins/apps/src/index.test.ts ../plugins/apps/src/vite/index.test.ts ../plugins/apps/src/vite/dev-server.test.ts ../plugins/apps/src/upload.test.ts --runInBand.
  • Run ~/.yarn/switch/bin/yarn workspace @dd/apps-plugin typecheck.
  • Run ~/.yarn/switch/bin/yarn workspace @dd/tests typecheck.
  • Confirm unsupported identifier/template/member/call expressions still fail clearly in extractor tests.

Blast Radius

This affects apps backend function proxy generation and static analysis for action-catalog calls inside backend entry files only. It does not traverse imported local modules and does not add dependency on a connections registry.

Documentation

Copy link
Copy Markdown
Collaborator Author

sdkennedy2 commented May 6, 2026

@sdkennedy2 sdkennedy2 changed the title [APPS] Extract inline backend connection IDs [APPS][Part 2 of 4] Extract inline backend connection IDs May 6, 2026
@sdkennedy2
Copy link
Copy Markdown
Collaborator Author

@codex review
@cursor review

Copy link
Copy Markdown

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

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: b9320d3ef3

ℹ️ 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/extract-connection-ids.ts Outdated
exportNames,
id,
context.buildRoot,
extractConnectionIds(ast, id),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Follow or reject re-exported backend implementations

For supported facades such as export { run } from './impl' or import { run } from './impl'; export { run }, the transform registers run as a backend function but this call only scans the facade AST. If ./impl contains the inline action-catalog call with connectionId, the generated backend bundle still executes it while the manifest records an empty allowedConnectionIds, so those functions fail once the action requires that connection.

Useful? React with 👍 / 👎.

@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from b9320d3 to 3e1b24d Compare May 6, 2026 00:47
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from 9a1dbe0 to 04d954f Compare May 6, 2026 00:47
@sdkennedy2
Copy link
Copy Markdown
Collaborator Author

@codex review
@cursor review

Copy link
Copy Markdown

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

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: 3e1b24d7de

ℹ️ 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/extract-connection-ids.ts Outdated
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from 3e1b24d to 97a160d Compare May 6, 2026 00:54
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from 04d954f to d230cbd Compare May 6, 2026 00:54
@sdkennedy2
Copy link
Copy Markdown
Collaborator Author

@codex review
@cursor review

Copy link
Copy Markdown

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

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: 97a160dd20

ℹ️ 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/extract-connection-ids.ts Outdated
Comment thread packages/plugins/apps/src/backend/extract-connection-ids.ts Outdated
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from d230cbd to a91c48b Compare May 6, 2026 13:35
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from 97a160d to 9bcbfc1 Compare May 6, 2026 13:35
@sdkennedy2
Copy link
Copy Markdown
Collaborator Author

@codex review
@cursor review

Copy link
Copy Markdown

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

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: 9bcbfc188e

ℹ️ 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 on lines 272 to 276
exportNames,
id,
context.buildRoot,
extractConnectionIds(ast, id),
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve allowlists for re-exported backend handlers

When a .backend file uses the supported export { run } from './impl' shape, extractExportedFunctions still registers run, but this call only scans the wrapper file's AST, not the re-export source. If ./impl contains the action-catalog call with an inline connectionId, the generated manifest records allowedConnectionIds: [] for that backend function even though the bundled function will execute the action, so re-exported handlers are denied/misrepresented at runtime. The new enumerateBackendExports metadata includes source, but the transform discards it here.

Useful? React with 👍 / 👎.

Comment thread packages/plugins/apps/src/backend/extract-connection-ids.ts Outdated
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from 9bcbfc1 to a0cea42 Compare May 6, 2026 13:45
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from a91c48b to 9ce0085 Compare May 6, 2026 13:45
@sdkennedy2 sdkennedy2 changed the title [APPS][Part 2 of 4] Extract inline backend connection IDs [APPS][Connections Part 2] Extract inline backend connection IDs May 6, 2026
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from 9ce0085 to b89f346 Compare May 6, 2026 13:48
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch 2 times, most recently from 806c29a to 61615b2 Compare May 6, 2026 13:49
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from b89f346 to 5c93fa8 Compare May 6, 2026 13:49
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from 61615b2 to 5e1d743 Compare May 6, 2026 17:44
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from 5c93fa8 to 2234d86 Compare May 6, 2026 17:44
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from 5e1d743 to c5c7d75 Compare May 6, 2026 18:10
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from 2234d86 to 4769d38 Compare May 6, 2026 18:10
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-connection-id-manifest-upload branch from 4769d38 to 8aeb377 Compare May 6, 2026 18:28
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from c5c7d75 to 0affdd3 Compare May 6, 2026 18:28
Base automatically changed from sdkennedy2/apps-connection-id-manifest-upload to master May 6, 2026 20:21
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from 0affdd3 to a013be2 Compare May 6, 2026 20:42
@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 Bot commented May 6, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

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

@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from a013be2 to 5c281d2 Compare May 6, 2026 20:53
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/apps-inline-connection-id-manifest branch from 5c281d2 to c3c12a6 Compare May 6, 2026 21:10
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