Repository navigation
refactor(apijson): split the api-json differential baseline into per-file fragments on a shared tools/referee/baseline store - #2084
Merged
Conversation
…aseline store A referee baseline kept as one generated file conflicts on every merge of two branches that re-record it. This package lays a baseline out as a directory: one JSON fragment per compared source file (<root>/<relative path>.json, the file's summary and its rows in key order) beside an index.json carrying the provenance and the aggregate figures, which must be a fold of the fragments. Write/Rewrite record all or the named roots, Read refuses a missing or unlisted fragment, Check/CheckRoots name every moved, added or removed row, missing or orphaned fragment and stale index figure or provenance line, and Verify holds a committed directory to itself without the reference toolchain. Row, summary and aggregate types and the ratchet policy stay with each referee. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…file fragments docs/project/api-json-differential-baseline.json (1.3 MB, re-recorded whole by every change under internal/translate/export) becomes the directory docs/project/api-json-differential/ on tools/referee/baseline: one fragment per compared source file holding the file's summary and its Metaclass.property rows as seven-bucket count vectors, and an index.json with the provenance and the aggregate figures, each a fold over the fragments. The fold reproduces the monolith exactly: same provenance, same 935 files, same 11,771 scorecard rows and every total and per-root figure, and the fresh report is byte-identical. The comparison now accounts per source file: a matched pair under the file our writer declares the element in, a pilot-only element under the pilot's file, each side's diagnostics under its own, an ownerless tree without a document under the file of the element that refers into it; fragmentsOf refuses an account outside the root's files and sameFigures holds the direct totals to the fold. pilot-apijson-diff gains -update -roots (re-record named roots and refold the index), -reindex (rebuild index.json from the committed fragments, no pilot) and -check -roots; the provenance guard, doc-counts, the hygiene workflow test, ci-changed-areas and mkdocs read the directory. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…aseline-fragments
…aseline-fragments Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential-baseline.json
…aseline-fragments
…aseline-fragments
Carries develop's Documentation.documentedElement movement (387 properties oursMissing -> presentEqual across 108 files) into the per-file fragments and the index; the fold equals develop's monolithic baseline. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…aseline-fragments
…aseline-fragments
…aseline-fragments
…aseline-fragments Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential-baseline.json
Re-recorded with pilot-apijson-diff -update on the merged tree. 66 fragments and index.json move; the folded totals equal develop's monolith at 67efcea (104,420 matched, 2,024,875 present-equal, 143,814 present-different, 305,457 ours-missing, 80,960 pilot-missing, 2,220,557 absent-both, 35,136 indeterminate, 534 pilot-nondeterministic). Movement comes from #1936: TransitionUsage.output, EventOccurrenceUsage/AcceptActionUsage/ SendActionUsage/TerminateActionUsage inherited features and inputs, and six newly matched elements. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Re-recorded with pilot-apijson-diff -update on the merged tree. Only the six examples/self-model fragments and index.json move (1,278 rows, 1,007 newly matched elements from #2043's self-model surfaces); the folded totals equal develop's monolith at 1b94d85 (105,427 matched, 2,045,067 present-equal, 144,702 present-different, 308,336 ours-missing, 81,780 pilot-missing, 2,244,567 absent-both, 35,440 indeterminate, 534 pilot-nondeterministic). Co-Authored-By: jason.han <hanhuijun@gmail.com>
examples/self-model/surfaces.sysml still named the removed monolith docs/project/api-json-differential-baseline.json as the ApiJsonDifferential oracle's baseline, which TestSelfModelGainedOraclesMatchTools rightly rejects; it now names docs/project/api-json-differential. The edit changes the examples corpus digest, so the three baselines that record it are re-recorded by their tools (pilot-apijson-diff -update -roots examples, pilot-diff -update, derived-census -update): provenance only, no row, verdict or figure moves. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
pilot-apijson-diff -update on the merged tree: 69 fragments and index.json move with #2093's objective/body-constraint export and #2109's bare-comment fix (develop's monolith moved the same rows). Totals: 935 files, 105,427 matched; present-equal 2,045,864, present-different 143,898, ours-missing 308,343, pilot-missing 81,606, absent-both 2,244,653, indeterminate 35,440, pilot-nondeterministic 534 — equal to develop's monolith on this tree. Co-Authored-By: jason.han <hanhuijun@gmail.com>
.gitattributes listed docs/project/*-baseline.json only, so the fragments under docs/project/api-json-differential/ were shown as source in a diff and counted in the language statistics; the directory's JSON is now linguist-generated, and tests/hygiene holds the attribute line. Co-Authored-By: jason.han <hanhuijun@gmail.com>
tools/referee/baseline.Rewrite stamped the checkout's provenance on fragments it had not re-measured, so -reindex after a pilot pin move produced an index the provenance guard accepted; it now refuses every provenance movement outside the inputs named like the replaced roots, naming the refresh command. It also read the committed directory strictly, so two branches that each added or removed a file of one root could not re-record that root after merging; the replaced roots' index entries and files are now skipped and re-recorded whole, while the other roots stay strict. scripts/ci-changed-areas.sh claims tools/referee/baseline/ for the apijson differential job. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
This was referenced Nov 11, 2026
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Merged
6 tasks done
…/apijson-baseline-fragments
6 tasks done
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.
What and why
Every PR that touches
internal/translate/export(or the metamodel it serializes) re-recorded the whole 1.3 MBdocs/project/api-json-differential-baseline.json, so two such PRs in flight always conflicted in one generated file. This PR replaces it with a directory of per-source-file fragments, built on a new shared mechanism so the other referee baselines can follow (one PR each).tools/referee/baseline(new, shared)A generic fragment-directory store, documented in
doc.go:<dir>/<root>/<relative path>.json— one fragment per compared source file, carrying that file's own summarySand its rowsmap[string]R, rows written one per line in key order; fragments sorted by root then file; invalid paths (empty, absolute,.., a root containing/) and duplicate identities refused.<dir>/index.json— the one shared file: the run's provenance (oracle.Record), the list of recorded files per root, and the aggregateA, which must be a fold of the fragments.Write/Rewrite(re-record all roots, or only the named roots and re-fold the index; with nothing replaced it rebuilds the index alone),Read(every listed fragment present and filed under its own root/file, no unlisted.json),Check/CheckRoots(provenance, then missing/orphaned fragments, moved/added/removed rows and moved per-file summaries, then stale index figures — with a-reindexhint when only the index is stale),Verify(the Java-free half: the committed directory against itself).api-json migrated onto it
docs/project/api-json-differential-baseline.json→docs/project/api-json-differential/(935 fragments in 9 roots +index.json). Rows are the sameMetaclass.propertyscorecard rows, now recorded per source file as a 7-bucket count vector (presentEqual, presentDifferent, oursMissing, pilotMissing, absentBoth, indeterminate, pilotNondeterministic); the global scorecard, the per-root reports and every total are folds over them.sysx:sourceDocument(notes, unowned expressions) are filed with the element outside the tree that refers into it;fragmentsOfrefuses any account filed under a file the root does not hold, andsameFiguresholds the run's directly summed totals to the fold of the fragments before anything is written or checked, so no figure can leave the fragments and still enter the totals.pilot-apijson-diff:-updaterecords all roots;-update -roots a,bre-records only those roots and re-folds the index;-reindexrebuildsindex.jsonfrom the committed fragments without the pilot (how anindex.jsonboth branches moved is resolved after their fragments merge);-checkholds the whole tree,-check -roots a,bthe named roots plus the committed rest.TestCommittedBaselineStatesThisRepositorysProvenance),doc_counts_test.go/make docs-counts, the hygiene workflow test,scripts/ci-changed-areas.sh(+ its test),mkdocs.yml(exclude_docs). New Java-free tests:TestCommittedIndexSumsItsFragments,TestProbeFragmentCarriesTheWholeComparison,TestFragmentsRefuseAnAccountOutsideTheRootsFiles,TestKeyOursFilesOwnerlessTreesWithTheirReferrer.docs/project/api-json-differential.md(layout, attribution,-update/-reindex/-check, conflict resolution, whyindex.jsonand the prose figures stay shared), AGENTS.md §6.2, changelog fragment.Files that remain shared, and why
docs/project/api-json-differential/index.json— provenance (pilot pin, corpus digests, library input) and the aggregate figures are whole-corpus facts. Two branches that both move a verdict still meet here, but the conflict is mechanical: take either side, let the fragments merge, run-reindex(no Java) and commit.docs/project/api-json-differential.md— states the aggregate figures and the ranked gaps;make docs-countsregenerates them from the index.How it was verified
Coverage proof
Round trip (develop monolith vs this branch's fragments,
-updateon the same inputs):build/pilot-apijson-diff/pilot-apijson-diff.jsonreport is byte-identical to the one produced by develop's tool on the same tree (cmpclean).Metaclass.propertyrows × 7 buckets) == monolith scorecard; per-root element/property/diagnostic sums == monolith roots; 56/56 checks equal.TestCommittedIndexSumsItsFragmentsre-proves the fold on every run, without Java.Mutations — each run as
go run -C tools ./cmd/pilot-apijson-diff -check -roots probeson a mutateddocs/project/api-json-differential/, baseline restored intact afterwards (control runs exit 0 before and after):Local gate
Head 7a3affd = the split commits merged with
develop@ daad0ae (through the go1.27.4 toolchain bump branch of #2126, 6814329, which contains it) (git merge --no-ffafter each develop move: ddc4a54 → c010f23 → ade067f → bd58fde → c4f55e0 → 11bf2f6 → cd95e32 → 67efcea → 6f9622b → 1b94d85 → 6ff0288 → 1362cf6 → 98d8eca → daad0ae). The only conflicting file on each move was the deleted monolithdocs/project/api-json-differential-baseline.json(modify/delete: develop re-recorded it, this branch removes it) — resolved by keeping the deletion and re-recording the fragments by tool on the merged tree, never by hand.make stdlib-snapshotunchanged.Fragment movement, by tool (
pilot-apijson-diff -updateon each merged tree; the fold of the fragments equals develop's monolith on the same tree every time):index.json; matched 104,414 → 104,420; present-equal 2,024,651 → 2,024,875, present-different 142,934 → 143,814, ours-missing 306,433 → 305,457, pilot-missing 80,902 → 80,960, absent-both 2,220,458 → 2,220,557, indeterminate 35,107 → 35,136, nondeterministic 534 → 534.examples/self-model/+index.json; 1,278 rows moved, 1,007 newly matched elements; totals now 935 files, 105,427 matched (18,097 ours-only, 26,894 pilot-only); 2,045,067 present-equal, 144,702 present-different, 308,336 ours-missing, 81,780 pilot-missing, 2,244,567 absent-both, 35,440 indeterminate, 534 pilot-nondeterministic. The round-trip script against develop's 1b94d85 monolith: all points equal.index.json; present-equal 2,045,067 → 2,045,864, present-different 144,702 → 143,898, ours-missing 308,336 → 308,343, pilot-missing 81,780 → 81,606, absent-both 2,244,567 → 2,244,653; matched/ours-only/pilot-only/indeterminate/nondeterministic unchanged (105,427 / 18,097 / 26,894 / 35,440 / 534). Round-trip script against develop's 6ff0288 monolith: every figure and row equal; the only differing point is theexamplesinput digest (develop's monolith predates thesurfaces.sysmlpath fix below). The derived-census and pilot-diff provenance guards hold on this tree, so neither needed re-recording.-checkhold without a re-record.-checkon the merged head holds without a re-record.apijsonselector addition and itscase_fit ci(pr): quick tier on every pull-request push, -race tier in the merge queue, both re-sharded #2118's tier harness unchanged, andscripts/ci-changed-areas-test.sh,tests/hygiene, build/vet/gofmt/lint, the tools tests andmake docs-countswere re-run on this head with go1.27.4. The full suite and the pilot-checkare those of aeaae6f, whose apijson inputs this merge leaves byte-identical..gitattributesmarkeddocs/project/*-baseline.jsongenerated but not the new fragment directory, so GitHub rendered every re-recorded fragment as source;docs/project/api-json-differential/**/*.jsonis nowlinguist-generated=true, andTestFragmentsAreMarkedGeneratedintests/hygieneholds the line.baseline.Rewritestamped the checkout's provenance on fragments it had not re-measured, so-reindexafter a pilot pin move produced an index the provenance guard accepted — it now refuses every provenance movement outside the inputs named like the replaced roots (-reindexvouches for nothing new,-update -roots Xonly forinputs[X]; a moved pin, bridge, errata digest or library needs the full-update), naming the refresh command. It also read the committed directory strictly, so two branches that each added or removed a file of one root could not re-record that root after merging — the replaced roots' index entries and files are now skipped and re-recorded whole while the other roots stay strict.scripts/ci-changed-areas.shclaimstools/referee/baseline/for theapijsondifferential job (test case + hygiene assertion). Dismissed: thetools/referee/baseline/doc.gopackage comment exceeds two lines as the repository's otherdoc.gopackage documents do. No fragment or index line moved; a real-reindexon the committed directory is a no-op.examples/self-model/surfaces.sysmlstill named the removed monolith as theApiJsonDifferentialoracle's baseline (TestSelfModelGainedOraclesMatchToolscatches it); it now names the directory. That edit moves theexamplescorpus digest, so the three baselines recording it were re-recorded by their tools (pilot-apijson-diff -update -roots examples,pilot-diff -update,derived-census -update): provenance digest only, no row, verdict or figure moved.All corpus
OPENSYSML_REQUIRE_*variables set:go build ./...go vet ./...,go vet -C tools ./...gofmt -l .make lintmake changelog-checkgo run -C tools ./cmd/derived-census -checkgo run -C tools ./cmd/pilot-apijson-diff -check(this head, full, with the pilot)make docs-countsgo test -count=1 ./...go test -C tools ./...referee/baseline,referee/apijson)go test -count=1 ./tests/hygienepython3 scripts/check-doc-ids.pybash scripts/ci-changed-areas-test.sh.agents/skills/reviewing-pull-requestsself-review againstREVIEW.md.gitattributesline above), fixeddoc.go)Sibling baselines (report only, unchanged here)
docs/project/pilot-differential-baseline.json(1.0 MB):provenance+totals+roots[], each root holdingfiles[]with one per-source-file verdict record (path,agreement,severityMismatch,openSysMLOnly,pilotOnly), plus a sharedunmapped[](1,334 entries) anderrata. Same shape as api-json — per-file rows under corpus roots with whole-corpus provenance/totals — so it maps directly ontotools/referee/baseline(fragment = one file's verdict record;index.json= provenance, totals, unmapped, errata) and would benefit: it is re-recorded by the same export/metamodel PRs and conflicts the same way.internal/semantic/metamodel/derived_census_baseline.json(849 KB):provenance,summary,totals(297 derived properties),silent[],structuredigest androots[]— but each root is a per-root record (file/element counts and arulesmap of 290 derived-property verdicts for the whole root), with no per-file breakdown. It is per-root/per-rule, not per-source-file in nature: the mechanism fits only at root granularity (one fragment per corpus root,index.json= provenance/totals/silent/structure), which would still separate two PRs that move different roots but not two that move the same root. Splitting it per file would need the census itself to account per file first — report only, left as is here.Checklist
make testandmake lintpass locallychanges/unreleased/api-json-baseline-fragments.changed.mdmake docs-countsrun (no gate count moved; the baseline changed shape, not figures)Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/cd6e9286509a4dbf82d4bee0d9cd7aa7
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/cd6e9286509a4dbf82d4bee0d9cd7aa7?variant=devin
Requested by: @HuiJun