Skip to content

2026-09-09 PR 374 migration and hash review

Reviewed checkpoint/evaluation migration and cohort-hash invariants without changing application code.

Work Done

Reviewed mono PR 374 at c93862d. Confirmed with native schemas Pixi runtime that cohort changes retain stale hashes, arbitrary hashes are accepted, and migration UTC timestamp encoding differs from Pydantic JSON encoding for content hashes. Five existing schema tests pass. Static migration review found missing provenance and general-child reference rewrites, plus unconditional NULL lineage. Production occurrence was not checked; no database migration was executed. History/tombstone loss is explicitly documented. No application code or PR comments were changed.

Pitfalls

The SDK knowledge page is a dated 2.1.0 snapshot; current source is authoritative. Fresh-database Alembic tests cannot validate backfill branches over populated rows. datetime.isoformat() and Pydantic JSON disagree on UTC +00:00 versus Z.

Improvements

Add populated migration fixtures covering source history, comments, provenance, children and lineage. Treat the cohort hash as derived rather than writable data; check create and merged-update paths against the same canonicalization contract.

Follow-up

User confirmed production has no provenance links deriving from benchmarks and only comments are relevant children; these are not practical deployment blockers. Changed cohort hashing to sorted unique patient IDs in schema and migration; stored patient snapshots remain unchanged. Added order/duplicate regression test. Six schema tests, lint and typecheck passed. Nx validation was unavailable because workspace Nx dependencies were missing. Application changes remain uncommitted. Timezone investigation: live API hashes Pydantic JSON; this and the older Artefact migration instead use datetime.isoformat(), so the UTC encoding mismatch is not unique to this PR. No timezone or default/recomputation change was made.

Derived hash enforcement

Removed the empty hash default on user request. A before-validator validates the patient list and derives the hash unconditionally from sorted unique IDs, so merged updates and supplied hashes cannot retain a stale cohort identity. Regenerated schema families with no generated changes. Added five focused cases; all ten schema tests, formatting, lint and typecheck pass. Application changes remain uncommitted; pre-existing staged set-hash edits were preserved. Full Nx validation is still unavailable without workspace dependencies. Timezone mismatch is unchanged.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close