Skip to content

ci: re-record generated baselines on the ci:rebaseline label - #2122

Merged
HuiJun merged 6 commits into
developfrom
ci/rebaseline-label
Nov 11, 2026
Merged

HuiJun merged 6 commits into
developfrom
ci/rebaseline-label

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 both re-record a generated baseline conflict as soon as the first merges. The second then re-merges develop, takes develop's side of the generated file, re-runs the recorders (pilot-apijson-diff -update alone is about an hour), restates the figures and re-runs CI — for a PR that was otherwise ready. This makes that cycle a one-label operation.

.github/workflows/rebaseline.yml runs on pull_request labeled, guarded on github.event.label.name == 'ci:rebaseline' and on the head being a branch of this repository (head.repo.full_name == github.repository), and:

  1. checks the branch out at the labelled head (a branch that moved since the label fails: apply the label again), merges origin/develop with --no-ff; a conflict confined to the generated paths listed in GENERATED_PATHS takes develop's side (git checkout --theirs, or the deletion), any other conflicting file fails the run and names the files;
  2. provisions Go, Java 21 (the pilot JSON exporter), Python with grpcio-tools==1.83.0 (the version the committed stubs record), Node 24, buf by digest, the pinned pilot exporter, the corpora through .github/actions/corpora and the PSSM suite through its download script;
  3. runs the recorders in dependency order: make stdlib-snapshot, make proto-buf proto-ts proto-rust python-proto, pilot-apijson-diff -update, derived-census -update, the corpus gates with -update-pilot-corpora -update-spec-examples -update-pssm-migration -update-corpus-roundtrip -update-api-json-roundtrip, -update-structure-differential, -update-library-prefix-sweep, tests/export -update (goldens and .sha256 digests), tests/parser -run TestGolden -update, then make docs-counts;
  4. fails if the recorders changed anything outside the generated paths and the pages carrying a generated block, and fails outright if tests/corpus/testdata/training_examples_expected.txt changed — it is asserted clean, never re-recorded, and no step passes -update-training;
  5. runs scripts/rebaseline-movement.py (new): for every generated path it reads the records at the merge base, the PR head, develop and the merge commit, keys them the way each recorder writes them (verdict per corpus path, counts per root and property for the structure differential, per probe for the sweep, per root and rule for the derived census, per scorecard row and root for the api-json baseline, blob per golden), and classifies every record the fresh run moved against the merged tree: moved by this branch, by develop, by both (the merge's verdict, to adjudicate), or unexplained — a record neither side moved, or one a single side moved whose fresh value is not that side's. One unexplained movement stops the run before anything is committed;
  6. commits the re-recorded baselines with the movement summary as the message body (per baseline: records moved and by whose side; the api-json totals' ours-missing / present-different / present-equal / pilot-missing deltas; the census summary deltas; per-root matched/unmatched for the structure differential; verdict-class counts for the corpus expectations; files regenerated for goldens and stubs), pushes to the PR branch, removes the label (always()), and comments the same summary — or the failure — for adjudication (always()).

concurrency is per pull request without cancellation, permissions are contents: read at the top and contents: write / pull-requests: write on the job only.

Token. The checkout and push use secrets.REBASELINE_TOKEN when the repository defines it, else github.token. With github.token GitHub starts no pull_request run for the pushed head (events a workflow's own token raises do not trigger workflows), so the re-recorded head gets CI only on the next push or through a token with contents: write; the workflow header and CONTRIBUTING.md say so. Whether to add a PAT is a maintainer decision.

The generated paths deliberately exclude docs/project/pilot-{differential,xpect,rejection}-baseline.json: this workflow does not run those recorders (they need the Java validators and take a scheduled run), so a conflict there stays a hand-resolved one rather than silently taking develop's side. docs/project/api-json-differential (the fragment directory #2084 introduces) is listed so the allowlist is right whichever lands first; a path absent from every revision is skipped.

Documented in CONTRIBUTING.md (documentation conventions, beside the baseline guidance) and AGENTS.md §6.2.

How it was verified

  • python3 scripts/rebaseline-movement-test.py: 8 tests — attribution of each side's movement, an interaction neither side made (exit 1, the record named), a regenerated golden reported not attributed, the training expectation refused, every parser keyed the way its recorder writes, the summary file; the repository tests build a real git repository with a merge base, two sides and their merge. Registered in make scripts-coverage and the PR docs job.
  • go test ./tests/hygiene with the new tests/hygiene/rebaseline_workflow_test.go: the trigger is labeled alone, the job guards on the label and the same-repository head, the permissions split, the allowlist names the baselines and never the training expectation, every recorder is run, no step passes -update-training, no recorder runs after the movement check, no push before it, the label removal and the comment run always(), the corpora come from .github/actions/corpora.
  • go build ./..., go vet ./..., gofmt -l empty, make lint.
  • Not yet exercised on a real pull request: the task asks for a scratch PR with an intentional generated-file conflict against develop, labelled ci:rebaseline; that run is held until the merge coordinator releases the runners, and the run link will be added here.

Checklist

  • make test and make lint pass locally (lint, hygiene, the script's tests; the full race suite runs in CI)
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (CONTRIBUTING.md, AGENTS.md)
  • Changelog entry — none: a CI workflow, not a user-visible change
  • No baseline moved
  • No internal work-item labels 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

Two pull requests that both re-record a generated baseline conflict as soon
as the first merges; the second then re-merged develop, took develop's side
of the generated file, re-ran the recorders and restated the figures by
hand. The ci:rebaseline label now does that cycle in one workflow run:
merge origin/develop, take develop's side of a conflict confined to the
listed generated paths (any other conflict fails), run every recorder, refuse
a movement the merge does not explain, commit with the movement in the
message, push, remove the label and comment the movement for adjudication.

scripts/rebaseline-movement.py attributes each moved record to the side that
moved it against the merge base; a record neither side moved that the fresh
run moves is unexplained and stops the run. The training expectation is
never re-recorded; a recorder changing it fails the run.

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 02:58
…nt check

parse_census and parse_apijson keyed the rules and the scorecard rows only, so
a root figure the fresh run moved (oursRefused, pilotFailed, a root's file
count) passed the movement check unattributed.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…gh the environment, never take develop's side of a source fixture

A pull request in conflict with develop gets no pull_request run, so the
label could not start the workflow for the case it exists for; the branch
name reached the shell by expression interpolation; and the golden
directories hold the .sysml/.kerml/.ttl sources beside the goldens, which
the merge would have taken develop's side of. Comments trimmed to two lines.

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 found 6 findings. Devin automatically fixed all 6 findings.

Fixed by Devin (6)
  • Conflicted pull requests cannot start rebaseline — The workflow now triggers on pull_request_target labeled, which GitHub runs for a conflicted pull request too; the same label and same-repository guards apply, and the hygiene test pins the trigger.
  • Fixture conflicts erase branch source models — Under the golden directories only *.golden, .golden. and *.sha256 count as generated; a conflicting .sysml/.kerml/.ttl source fixture fails the merge step, and a recorder changing one fails the change check (hygiene test asserts both).
  • Changed baseline metrics bypass movement checks — parse_census and parse_apijson now key every root's full metadata (all fields but name/rules) as a record, so a moved oursRefused, pilotFailed or file count is attributed like any other record.
  • Workflow header exceeds comment length limit — Header cut to two lines; the cycle it replaces is described in CONTRIBUTING.md instead.
  • Generated-path comment exceeds length limit — Comment cut to two lines, as every other comment in the workflow.
  • Branch names execute commands during merging — The branch name now reaches the merge step through the BRANCH environment variable, never by expression interpolation into the shell.

View findings in Devin Review · Follow Devin's work

Devin Review

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun merged commit 3c7cd28 into develop Nov 11, 2026
40 of 62 checks passed
@HuiJun
HuiJun deleted the ci/rebaseline-label branch November 11, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant