Repository navigation
feat(measurement): Advanced Measurement v2 contracts, migrations and route surface - #915
Merged
Merged
Conversation
…route surface The foundation for Advanced Measurement v2. Nothing here changes behaviour: every new route answers 501 until the services behind them land. It exists so the rest of the work can proceed against fixed contracts rather than invented ones. Adds schema v2 as a published plan shape with Branded/Non-brand assignments, frozen per-Group competitor identities, revision-frozen project identity, and query snapshots that keep a later rename from rewriting history. The v1 decoder is untouched and stored v1 plans stay byte-compatible; the version switch gains a v2 case, and a new any-version reader returns the union. The new compiled_checksum is a separate, nullable, separately indexed column rather than a redefinition of the existing checksum. They are not interchangeable: checksum hashes the whole document including revision, so reusing it as the publish guard would mean no two revisions could ever compare equal, and republishing identical content or reverting to an earlier configuration could never be recognised. Its index is deliberately non-unique, because a unique one makes reverting a plan impossible. Adds migrations v122 and v123 for the draft, query-set, template, discovery-config and idempotency-receipt tables, with the drizzle schema mirrored column by column and a test that fails when the two disagree, since that class of drift corrupts reads silently and nothing else catches it. Read surfaces now decode any schema version. Previously three call sites went through the v1-only reader, so the first published v2 revision would have turned plan reads, revision detail and the report adapter into 500s. The segment retirement guard now sees v2 plans too, which matters: it is what stops a segment being retired out from under an active revision. Execution and reporting refuse a v2 revision with a domain error and are marked as the seams the runner and reporting slices replace. Every behaviour is pinned by a test proven by reverting the production change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slice 1 of Advanced Measurement v2: the contracts, migrations and route surface
everything else builds on. Nothing here changes behaviour. Every new route
answers 501 until the services behind it land.
It exists so the remaining slices can be written against fixed contracts instead
of invented ones, and so four of them can run in parallel without fighting over
the same registration files.
Schema v2. A published plan with Branded/Non-brand assignments, frozen
per-Group competitor identities, revision-frozen project identity, and query
snapshots so a later rename cannot rewrite history. The v1 decoder is untouched
and stored v1 plans stay byte-compatible: the version switch gains a v2 case, and
a new any-version reader returns the union.
Two checksums, deliberately.
compiled_checksumis a new nullable column,not a redefinition of the existing
checksum.checksumhashes the wholedocument including revision, so reusing it as the publish guard would mean no two
revisions could ever compare equal, and neither republishing identical content
nor reverting to an earlier configuration could be recognised. Redefining it
instead would break byte-identity for already-published v1 rows. Its index is
non-unique on purpose: a unique index makes reverting a plan impossible, which
contradicts the rule that restoring old content creates a new revision.
Migrations v122 and v123 add the draft, query-set, template,
discovery-config and idempotency-receipt tables. The drizzle schema is mirrored
column by column with a test that fails when the two disagree, because that drift
corrupts reads silently and no other gate catches it.
Read surfaces now decode any schema version. Three call sites went through
the v1-only reader, so the first published v2 revision would have turned plan
reads, revision detail and the report adapter into 500s. The segment retirement
guard sees v2 plans too, which matters: it is what stops a segment being retired
out from under an active revision. Execution and reporting refuse a v2 revision
with a domain error rather than crashing, and are marked as the seams the runner
and reporting slices replace.
Every behaviour is pinned by a test proven by reverting the production change.
Backend only; nothing under
apps/webis touched.570 test files, 6776 tests, typecheck, lint and codegen all green.