Skip to content

refactor(census): commit the derived census and round-trip ratchets as one record per line - #2124

Merged
HuiJun merged 13 commits into
developfrom
refactor/line-per-file-baselines
Nov 11, 2026
Merged

HuiJun merged 13 commits into
developfrom
refactor/line-per-file-baselines

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Two pull requests that re-record the same committed ratchet conflict as soon as the first merges, even when they moved different files or rules, because the file carries aggregate lines (a per-root file count, a totals block) that both re-recordings rewrite. This PR removes the shared lines from the layouts where they caused the conflicts, so git's line-based merge resolves two re-recordings that moved different records.

  • Derived census (internal/semantic/metamodel/derived_census_baseline.json): the committed baseline is now a header (provenance, structure, policy, each root's figures) and derived_census_records.tsv beside it, one sorted line per served rule and corpus root. The totals, the summary and the silent list are derived when the files are read, so a re-recording touches only the lines whose figures moved. go run -C tools ./cmd/derived-census -update writes both files; -check names the records that moved. TestDerivedCensusBaseline reads both files and pins the sort order.
  • RDF and API-JSON round-trip expectations (tests/corpus/testdata/{corpus,api_json}_roundtrip_expected.txt): the # files: <root> <count> header lines are gone; TestCorpusRoundTrip and TestCorpusAPIJSONRoundTrip derive each root's size from its records. Two branches that added or moved files under different roots no longer collide on the header.
  • The committed data was regenerated by the tools in their own commits (-update, -update-corpus-roundtrip -update-api-json-roundtrip) with every corpus present; no verdict or figure moved — only the layout.

Left as they are, with the measurement: structure_differential_expected.txt is already one line per root and property, and its root …: models, skipped, matched, unmatched line carries per-root figures that are not derivable from the property lines; library-and-prefix-sweep-outcomes.txt is already one line per probe; the pilot corpora, specification example, PSSM and training expectations are one line per file with no count header. The API-JSON baseline is #2084's.

Measured

Last 10 develop merges that touched each file; every pair of their pre-merge heads was merged with git merge-file on the committed layout (before) and on the same blobs rewritten into the new layout (after).

file pairs conflicting before after
tests/corpus/testdata/corpus_roundtrip_expected.txt 45 3 0
tests/corpus/testdata/api_json_roundtrip_expected.txt 45 2 0
internal/semantic/metamodel/derived_census_baseline.json (+ records) 36 1 0
internal/translate/export/testdata/structure_differential_expected.txt (unchanged) 45 3 3
docs/project/library-and-prefix-sweep-outcomes.txt (unchanged) 45 1 1

The census file was absent at the oldest heads, hence 36 pairs.

Follow-up

Once this lands, the ci:rebaseline workflow (#2122) needs derived_census_records.tsv in its generated-path list and its movement script needs the records layout; that goes into whichever of the two lands second.

How it was verified

  • go test ./internal/semantic/metamodel (TestDerivedCensusBaseline… reads the header and the records, checks every record names a served rule and a header root, and pins the sort order) and go test -C tools ./census/derived (new TestRecordsRoundTripThroughTheCommittedLayout, TestRecordsReproduceNamesTheRecordsThatMoved).
  • go test ./tests/corpus -run 'TestCorpusRoundTrip|TestCorpusAPIJSONRoundTrip' with the training, pilot and specification-example corpora present and required, against the re-recorded expectations.
  • The regenerated census compared record by record against the previous baseline: 2259 records, 0 moved, every root's figures equal; only provenance.recorded changed.
  • go build ./..., go vet ./..., gofmt -l . empty, make lint, go test ./tests/hygiene, go test -C tools ./....
  • The before/after table above, from git merge-file over the pre-merge heads of the last 10 develop merges that touched each file.

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/db2463db486544eb9f5b9e5a8389e7c3
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/db2463db486544eb9f5b9e5a8389e7c3?variant=devin
Requested by: @HuiJun


🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

devin-ai-integration Bot and others added 6 commits November 11, 2026 03:02
The RDF and API-JSON round-trip expectations restated every root's file count
in a "# files:" header, so two branches each adding a committed example
conflicted on the header while their records merged cleanly. Every file has
a record, so the reader counts the records under each root instead; the
corpus-size check is unchanged.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…header

go test ./tests/corpus -run 'TestCorpusRoundTrip|TestCorpusAPIJSONRoundTrip' -update-corpus-roundtrip -update-api-json-roundtrip

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…d per rule and root

The committed baseline keeps the provenance and each root's figures; the
records file beside it holds one sorted line per served rule and root, so
two branches that moved different rules merge without a conflict. The
totals, the summary and the silent list are derived when the files are
read; -update writes both files and -check names the records that moved.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Regenerated with go run -C tools ./cmd/derived-census -update over every
corpus root; no figure moved, only the layout.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration Bot and others added 2 commits November 11, 2026 03:44
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

devin-ai-integration Bot and others added 3 commits November 11, 2026 06:51
…file-baselines

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	internal/semantic/metamodel/derived_census_baseline.json
…members

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration devin-ai-integration Bot added the ci:full Run the full CI tier on this pull request, draft or not label Nov 11, 2026
@HuiJun
HuiJun merged commit a01d73f into develop Nov 11, 2026
199 of 317 checks passed
@HuiJun
HuiJun deleted the refactor/line-per-file-baselines branch November 11, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Run the full CI tier on this pull request, draft or not

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant