Repository navigation
refactor(apijson): render the differential record's figures from the baseline at docs build time - #2119
Merged
Conversation
…baseline at docs build time The scorecard headline, the per-root table and the figure columns of the present-different, pilot-missing and launch-ready gap tables of docs/project/api-json-differential.md were restated by hand and checked by TestRecordStatesTheBaselinesFigures, so every re-recording of the baseline rewrote the page and two branches re-recording it conflicted on the numbers. The page now carries doc-counts blocks: a sentence for the headline and the root table, and the hand-written adjudication rows keyed by (metaclass, property) for the tables. pilot-apijson-diff -site-blocks renders them from the committed baseline, scripts/mkdocs_suite_figures.py splices them in when the site builds (it now runs every generator in COMMANDS), and the referee test checks the generator against the baseline and refuses a figure typed into a block. The per-root and pilot-missing tables had drifted from the baseline unnoticed; rendered, they cannot. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…endered figures The page was excluded from the site, so the blocks the build renders had no consumer; it joins the pilot differential among the published records that are not in the navigation. 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)".
|
…fails on_pre_build rendered every generator in one call, so a failing pilot-apijson-diff dropped the test inventory's figures as well; each generator now renders on its own and a failure loses only its blocks. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…baseline-figures Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # tools/referee/apijson/doc_counts_test.go # tools/referee/apijson/main.go
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
docs/project/api-json-differential.mdrestated the baseline's figures by hand — the**Scorecard:**headline, the per-root table, and the figure columns of the present-different, pilot-missing and launch-ready gap tables — andTestRecordStatesTheBaselinesFigureschecked the restatement. Every re-recording ofdocs/project/api-json-differential-baseline.jsontherefore rewrote the page too, and two branches re-recording it conflicted on the numbers as soon as the first merged (the baseline changed in 77 of develop's last 413 first-parent commits, the page in 45).The figures now leave git:
<!-- doc-counts:begin apijson-… -->blocks. The scorecard and roots blocks hold a sentence; the three table blocks hold the hand-written adjudication rows keyed by (metaclass, property) with no figure column.go run -C tools ./cmd/pilot-apijson-diff -site-blocks(new,tools/referee/apijson/docfigures.go) renders the blocks from the committed baseline — the headline, the per-root table, and each table with its figure columns filled in; the launch-ready table is ranked by ours-missing and numbered at render time.scripts/mkdocs_suite_figures.pyruns every generator inCOMMANDS(doc-counts and the referee) and splices the text in when the site builds, refusing a block rendered twice.TestRecordStatesTheBaselinesFiguresnow checks the generator: the committed page states no headline and no gap figure, and the rendered page states the baseline's totals, every root's row and the top-25 ours-missing gaps in rank order.TestRenderBlocksFillsTheFiguresAndRefusesACommittedOnepins the rendering on a small report and the refusals (a figure typed into a sentence block, a figure column committed, a row the baseline lacks, a duplicated or unterminated block).exclude_docstonot_in_navinmkdocs.yml, so the site publishes the rendered record beside the pilot differential; it had no consumer otherwise. Flagging this: it is the one visible policy change here.The adjudication (which gaps are known, why, the in-flight overlap and derivation clause per row, the re-recording history) stays hand-written and committed. Rendering also surfaced that the committed per-root and pilot-missing tables had drifted from the baseline unnoticed (no test covered them); rendered, they cannot.
Composes with #2084 (
refactor/apijson-baseline-fragments, still open): this branch is cut fromdevelopand reads the baseline through one seam,readCommittedReport, which that PR's fragment reader replaces (Totalsfrom the folded index,Scorecardfrom the fragments,Rootsfrom the per-root summaries). The two will conflict only indoc_counts_test.go's reader lines and that seam.Measured: pairwise conflicts on the page, last 10 develop merges that touched it
Method: the 10 most recent first-parent merges into
developtouching the file; each merged PR head unwound to its last commit before it re-mergeddevelop(the pre-merge head); then every pair (45) merged in a scratch tree. "Before" isgit merge-tree --write-treeon the actual trees; "after" isgit merge-fileon the three versions of the page with the figures the build now renders removed (the same transformation this PR applies), since the historical trees cannot be re-rendered.docs/project/api-json-differential.mdThe 3 residual conflicts are two PRs each inserting a hand-written "Re-recorded on …" paragraph directly under the headline — adjacent prose insertions, which no layout of the figures resolves and which stay hand-written by design. For context, the baseline JSON itself conflicted in 9 of the same 45 pairs; #2084's fragments address that file.
How it was verified
go test -C tools ./referee/apijson(both tests above),go run -C tools ./cmd/doc-counts -check(already current),go run -C tools ./cmd/pilot-apijson-diff -site-blocksprints the five blocks.python3 scripts/mkdocs_suite_figures-test.py(6 tests, including the real baseline rendering into the real record) and the otherscripts/*-test.pythat readmkdocs.yml.mkdocs build --strict: the builtproject/api-json-differential/index.htmlcarriesScorecard: 935 files; 105427 elements matched …and no marker.go build ./...,go vet ./...,go vet -C tools ./...,gofmt -lempty,make lint,go test ./tests/hygiene.Checklist
make testandmake lintpass locally (lint; the relevant test packages and hygiene suite — the full race suite runs in CI)changes/unreleased/api-json-record-rendered-figures.changed.mdmake docs-countsstays currentLink 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