Skip to content

Sync the TS SDK supervisor schema from its Task SDK source - #74415

Merged
pierrejeambrun merged 3 commits into
apache:mainfrom
astronomer:sync-ts-sdk-supervisor-schema
Oct 8, 2026
Merged

pierrejeambrun merged 3 commits into
apache:mainfrom
astronomer:sync-ts-sdk-supervisor-schema

Conversation

@pierrejeambrun

@pierrejeambrun pierrejeambrun commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Related

Why

The TS SDK read the supervisor wire schema straight from the Task SDK source (generate-supervisor.mjs pointed at ../task-sdk/.../execution_time/schema/schema.json) and no hook watched that source. So when #73806 added the SetExecutionTimeout comms message:

  • sync-go-sdk-schemas (watches the Task SDK source) refreshed the Go SDK → Go stayed correct.
  • Nothing fired on the TS side → src/generated/supervisor.ts went stale and reddened main, caught only once an unrelated ts-sdk change happened to run the local check.

This is the same drift class #74091 closed for the Dag schema on Go/Java — just the one cell the net was never stretched to: supervisor × TS.

How

Make the TS SDK vendor and sync both schemas in one hook, exactly the way sync-go-sdk-schemas does:

  • Vendor the supervisor schema into ts-sdk/schema/supervisor-schema.json (raw copy, like dag-schema.json), and point generate-supervisor.mjs at it instead of reaching cross-project.
  • Replace the single-schema sync-ts-sdk-dag-schema with sync-ts-sdk-schemas, backed by one sync_ts_sdk_schemas.py holding a VENDORED_SCHEMAS list of both entries and a refresh loop — modeled on sync_go_sdk_schemas.py. It is triggered by both Python sources, refreshes whichever vendored copy drifted, and fails loudly so the refresh gets reviewed and the types regenerated in the same commit.
  • check-ts-sdk-supervisor-schema now also triggers on the vendored copy, so a refreshed schema regenerates the types (the second, separate hook — regeneration can be a decision, not just a copy).

No change to supervisor.ts in this commit — the generator reads the vendored copy, which is byte-identical to the source, so output is unchanged from #74412.

How I verified it

  • sync-ts-sdk-schemas with both copies in sync exits 0 ("both match").
  • Corrupted both vendored copies: it refreshed both from source, printed the per-schema pnpm run generate:* recipe, exited 1, and self-healed.
  • Regenerating from the vendored copy leaves supervisor.ts unchanged.
  • ruff + YAML checks pass on the new script and configs.

No newsfragment: CI/build tooling only, no user-facing behavior change.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Claude Opus 4.8)

Generated-by: Claude Code (Claude Opus 4.8) following the guidelines

The TS SDK read the supervisor wire schema straight from the Task SDK
source and had no hook watching that source, so a schema change there —
a new comms message, say — regenerated the Go SDK (whose sync hook does
watch the source) but left `src/generated/supervisor.ts` stale, with
nothing to catch it until some unrelated ts-sdk change happened to run
the local check. That is how apache#73806 reddened main.

Vendor the supervisor schema into `ts-sdk/schema/` alongside the Dag
schema, and sync both from their Python sources in one
`sync-ts-sdk-schemas` hook — a `VENDORED_SCHEMAS` list the way
`sync-go-sdk-schemas` does it, replacing the single-schema
`sync-ts-sdk-dag-schema`. A schema change now refreshes the vendored
copy and fails loudly in the same commit instead of shipping a stale
generated file.
@pierrejeambrun
pierrejeambrun force-pushed the sync-ts-sdk-supervisor-schema branch from c09bcf2 to 9351668 Compare October 7, 2026 17:21
@pierrejeambrun
pierrejeambrun marked this pull request as ready for review October 7, 2026 17:28
@pierrejeambrun
pierrejeambrun requested review from jason810496 and a balanced review from Copilot October 7, 2026 17:28

Copilot AI 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.

🟡 Changes recommended

The new hook lacks regression tests and leaves several hook triggers and documentation references inconsistent.

5 open findings
What changed in this PR

Vendors the Task SDK supervisor schema in the TypeScript SDK and adds synchronization safeguards.

Changes:

  • Generates supervisor types from the vendored schema.
  • Consolidates Dag and supervisor schema synchronization.
  • Expands prek triggers for schema drift detection.
File Description
.pre-commit-config.yaml Adds the combined schema-sync hook.
ts-sdk/​.pre-commit-config.yaml Watches the vendored supervisor schema.
ts-sdk/​schema/​supervisor-schema.json Adds the vendored schema snapshot.
ts-sdk/​scripts/​generate-supervisor.mjs Uses the vendored schema.
ts-sdk/​scripts/​ci/​prek/​check_supervisor_schema.py Updates drift-check messaging.
ts-sdk/​scripts/​ci/​prek/​sync_dag_schema.py Removes the superseded single-schema sync.
ts-sdk/​scripts/​ci/​prek/​sync_ts_sdk_schemas.py Synchronizes both vendored schemas.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .pre-commit-config.yaml Outdated
Comment thread scripts/ci/prek/sync_ts_sdk_schemas.py
Comment thread .pre-commit-config.yaml
Comment thread .pre-commit-config.yaml
Comment thread ts-sdk/scripts/generate-supervisor.mjs
Update comments to reflect the correct hook name for syncing schemas.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, the direction LGTM.

Addresses the review on apache#74415:

- Move sync_ts_sdk_schemas.py to scripts/ci/prek/ beside sync_go_sdk_schemas.py
  and add test_sync_ts_sdk_schemas.py mirroring the Go sync's tests, so the
  refresh and report logic is covered (in-sync, stale, missing copy/source,
  and the per-schema and combined reports).
- List the script itself in the sync-ts-sdk-schemas files filter, so a change
  to its paths or report logic re-runs the hook, as sync-go-sdk-schemas does.
- Point generate-dag-schema.mjs at the renamed sync-ts-sdk-schemas hook.
- Update the selective-check comment and 04_selective_checks.md, which still
  described the dropped "defer ts-sdk regeneration to a follow-up PR" policy.
@pierrejeambrun
pierrejeambrun merged commit 3f55227 into apache:main Oct 8, 2026
159 checks passed
@pierrejeambrun
pierrejeambrun deleted the sync-ts-sdk-supervisor-schema branch October 8, 2026 11:41
hkc-8010 added a commit to hkc-8010/my-airflow-repository that referenced this pull request Oct 10, 2026
Drop the API date from the older-server comment, move the migrator test
imports to module level, and add first_task_reschedule_start_date to the
TS SDK's vendored supervisor schema that apache#74415 introduced.

Co-Authored-By: Claude <noreply@anthropic.com>
hkc-8010 added a commit to hkc-8010/my-airflow-repository that referenced this pull request Oct 12, 2026
Drop the API date from the older-server comment, move the migrator test
imports to module level, and add first_task_reschedule_start_date to the
TS SDK's vendored supervisor schema that apache#74415 introduced.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

3 participants