Skip to content

chore(deps): types 1.49.0, Migrate golden handoff from the package - #410

Merged
ABB65 merged 3 commits into
mainfrom
chore/types-1.49-golden
Oct 4, 2026
Merged

ABB65 merged 3 commits into
mainfrom
chore/types-1.49-golden

Conversation

@ABB65

@ABB65 ABB65 commented Oct 4, 2026

Copy link
Copy Markdown
Member

What

  • @contentrain/types 1.47.0 → 1.49.0.
  • The Migrate golden handoff test reads MIGRATION_HANDOFF_GOLDEN from the package; the copied fixture tests/fixtures/migrate-handoff-golden.json is deleted, so producer and consumer test the same document.
  • The handoff summary reads plan_hash and order_id when the document carries them (older documents without them stay valid: unknown, never stale), and the sync logs both so a stale handoff left by an earlier delivery can be traced. Comparing against the expected order is separate work after the E2E.

Verification

  • pnpm typecheck clean; unit + integration suites: 2523 passed, 1 skipped.
  • New test: stamped and unstamped handoffs validate, and the summary carries the ids only when present.
  • Studio main CI was green (29904a1) before this push.

ABB65 added 2 commits October 4, 2026 13:05
The handoff golden now comes from MIGRATION_HANDOFF_GOLDEN in
@contentrain/types, so the fixture copy is deleted. The handoff summary reads
plan_hash and order_id when the document carries them, and the sync logs them
so a stale handoff left by an earlier delivery can be traced. Older documents
without them stay valid: unknown, never stale.
# Conflicts:
#	package.json
#	pnpm-lock.yaml
@ABB65

ABB65 commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

REVISE on ccecf0c (small).

1. The new ids are read from the customer's repo without a shape check. The handoff comes from a file in the customer's repository. validateMigrationHandoff does not look at plan_hash or order_id, and the new code puts them into the summary (client-facing) and into a console.info template as they are. I ran it: { ...golden, plan_hash: { a: 1 }, order_id: 'x\n[fake] line' } validates (null), and the summary carries planHash: {"a":1} and orderId: "x\n[fake] line". The log line would take the newline, so a crafted file can forge log lines.
Fix: accept the value only when it has the shape Migrate stamps. plan_hash is /^[0-9a-f]{16}$/ and order_id is /^ord_[0-9a-f]{24}$/ (Migrate's validateHandoff enforces the same). Anything else is treated like an absent field: unknown, not stale. One small helper used by both summarizeMigrationHandoff and the log line is enough. Please add a test with a non-string and a newline value.

2. The new test asserts conditionally. if (handoff.plan_hash) expect(...) passes silently if the golden ever loses the field, which defeats the point of a contract test. The 1.49 golden carries both, so assert them unconditionally (expect(summary.planHash).toBe(handoff.plan_hash)).

Checked and fine: lockfile diff is only types 1.47.0 to 1.49.0 and pnpm install --frozen-lockfile passes; the golden test and the handoff unit tests pass (8/8); the fixture deletion leaves no other reference. I am not giving a full ONAY yet, so I did not run the integration projects; I will on the revised head.

Both stamps come from the customer's repository. Only 16 hex chars for
plan_hash and ord_ plus 24 hex chars for order_id are read, the same
shapes Migrate's validateHandoff accepts. Anything else (a non-string,
a value with a newline) is unknown and never reaches the summary or the
log. The golden test now asserts the stamps unconditionally.
@ABB65

ABB65 commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

ONAY on e3c12c4.

  • Both REVISE points are fixed. readPlanHash (/^[0-9a-f]{16}$/) and readOrderId (/^ord_[0-9a-f]{24}$/) gate the summary and the console.info line; anything else (non-string, array, newline, wrong form) reads as unknown. The tests cover 42, an array, a trailing-newline hash and order id, ZZZZ and an empty string. The golden test no longer has conditional asserts: it asserts the 1.49 golden itself matches both shapes, then compares the summary.
  • Shapes match what Migrate really writes: its planHash (packages/runner/src/job.ts) is two 8-hex halves, i.e. 16 lowercase hex, and Migrate's validateHandoff enforces the same two regexes. The golden stamp round-trips, so no real hash turns into unknown.
  • Lockfile: only @contentrain/types 1.47.0 to 1.49.0; pnpm install --frozen-lockfile passes. No reference to the deleted fixture remains.
  • pnpm test:ci projects run separately with long timeouts and --maxWorkers=1: unit 2037 passed / 1 skipped, integration 487 passed, nuxt 274 passed. nuxt typecheck exit 0. eslint . has 0 errors (7 warnings, all in files this PR does not touch). Needed contentrain-query generate in the fresh worktree for the #contentrain client, as with any new worktree.

@ABB65
ABB65 merged commit d0755c3 into main Oct 4, 2026
2 checks passed
@ABB65
ABB65 deleted the chore/types-1.49-golden branch October 4, 2026 14:38
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