Skip to content

chore(apps): deprecate legacy backend runtime global#457

Draft
Scott-Meyer wants to merge 1 commit into
masterfrom
scott.meyer/datadog-apps-backend-runtime-entry
Draft

chore(apps): deprecate legacy backend runtime global#457
Scott-Meyer wants to merge 1 commit into
masterfrom
scott.meyer/datadog-apps-backend-runtime-entry

Conversation

@Scott-Meyer

@Scott-Meyer Scott-Meyer commented Jul 16, 2026

Copy link
Copy Markdown

What and why?

Preserve the exact backend-function behavior existing customer code was built against while introducing the stable SDK migration path. Customer handlers historically receive only backendFunctionArgs and may read the raw runtime context through globalThis.$, so changing either behavior would be breaking.

How?

  • Keep invoking customer handlers with only their declared backend arguments.
  • Retain globalThis.$ as a deprecated compatibility shim, with a comment requiring a future breaking release and customer migration before removal.
  • Execute the generated entry in behavioral tests that verify exact argument preservation and legacy global access.

Related PRs

QA

  • yarn workspace @dd/tests test:unit packages/plugins/apps/src/backend/virtual-entry.test.ts --runInBand
  • Apps-plugin TypeScript checks, ESLint, and Prettier

@Scott-Meyer
Scott-Meyer force-pushed the scott.meyer/datadog-apps-backend-runtime-entry branch from 4da1a0a to 86682ae Compare July 17, 2026 01:01
@Scott-Meyer
Scott-Meyer force-pushed the scott.meyer/datadog-apps-backend-runtime-entry branch from 86682ae to 145ec69 Compare July 17, 2026 01:18
@Scott-Meyer Scott-Meyer changed the title fix(apps): keep backend runtime context private chore(apps): deprecate legacy backend runtime global Jul 17, 2026
lines.push('');
lines.push('/** @param {import("./context.types").Context} $ */');
lines.push('export async function main($) {');
lines.push(' // Deprecated compatibility shim: existing customer functions may read');

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is intentionally retained compatibility debt. Historical bundles call handlers with only ...backendFunctionArgs and may read raw context from globalThis.$; changing either behavior would break existing customer functions. The SDK/runtime bridge is the migration path, and removal requires a breaking release.

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