feat(reporters): render the API's named schema changes - #217
Merged
Conversation
The comment printed a JSON Patch path when a change sat inside an object: a column added to `ci_runs` read "Changed table · columns.17". The path indexes a baseline schema this process never holds, so the reporter could not resolve it into a name, and it dropped the element index entirely. Site#3855 adds `metadata.schemaChange.changes`, the same delta with every object named. Prefer it when the API sends it. The same run now reads "Added column public.ci_runs.statistics_payload_id". An API that predates the field still sends only the patch, and `entryFromOp` still handles it. Site's summary also drops the positional churn the patch carries: a column's attnum, which two databases at the same schema number differently, and every oid. Those lines disappear from the comment. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.

Query Doctor — 6 successful checks
More details via MCP → get_ci_run({ runId: "019fcf73-9854-79f3-acb7-272374a0f5b7" }) · view run · docs
3 queries read against main on assumed statistics of 10,000,000 rows per table. Sync production stats for costs measured against your real data.
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.
Goal
Pairs with Query-Doctor/Site#3855, which is the other half. A PR that adds one column should have the CI comment name that column.
This is the rendering half. Site computes the named list; this reads it. Merge Site first, or this changes nothing.
What
Before, a change inside an object printed as a patch path. On Site#3794, which adds
ci_runs.statistics_payload_id, the comment said:After, the same run reads:
The positional churn goes with it. Site's summary drops a column's
attnumand everyoid, so the· columns.3.orderand· oidlines stop appearing.How
buildSchemaChangeingithub.tsprefersmetadata.schemaChange.changesand falls back tobuildSchemaChangeView(operations).entryFromOpis untouched, so an API that predates the field renders as it does today.buildNamedSchemaChangeViewinschema-change.tsonly groups what the API sends. It infers nothing, because the inference is what produced the path in the first place:/tables/12indexes a baseline schema this process never holds.propertiesrenders as the entry's detail, so a column that changed type readsChanged column public.users.email · columnType, isNullable.An empty
changeswithchanged: truerenders nothing. Site deriveschangedfrom the patch, which still counts an oid that moved because the two snapshots came from different databases. That case leaves the gate row with nothing under it, which is worse than it sounds: the gate says the schema changed and lists no evidence. Site#3855 asks whether the gate should followchangesinstead. This PR does not decide it.Tests
github.test.tsrenders a run whose metadata carries both the patch and the named list, and asserts the comment contains the column's name and notcolumns.17. It fails on main with the exact string this fixes.schema-change.test.tscovers grouping by kind,propertiesas detail, and the empty list. The existing patch-path tests are unchanged and still pass, which is the fallback.Full suite 425 passed across 43 files.
npm run typecheckclean.