Skip to content

Realize add-citation-remainder-report R2: the nightly wiring - #1111

Merged
brettheap merged 3 commits into
mainfrom
realize/citation-report-r2
Sep 18, 2026
Merged

brettheap merged 3 commits into
mainfrom
realize/citation-report-r2

Conversation

@brettheap

@brettheap brettheap commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-1 (openXfactory-1)

Claim: #1053 (comment)

Status: head 78258890, branch realize/citation-report-r2, 3 commits, working tree clean. Checks: every check green at this head, pytest-suite included (run 35366503026, 21m48s). Review threads: 2 opened by Copilot, both taken in 78258890, both replied to and both resolved; 0 unresolved. Not for landing by its author — the Rule 6 window and the merge are the orchestrator's, on Brett Heap's word.

What this realizes

add-citation-remainder-report § 2.2, realization slice R2: the nightly wiring. The packet was ratified by Brett Heap on 2026-09-17 — PR #1069 comment 5714138459, verbatim "ratify #1069", a BARE word taking D1–D7 at the RECOMMENDED option each and naming no veto, recorded in the packet's own .openspec.yaml (approved_by / approved_on). code_surface: openxFactory is non-empty, so the archive stays held behind merged-plus-green realization evidence; target_release: implemented, so no bundle is cut and no contract byte moves.

What landed before this, in order

PR merged merge sha
Patch B (signal grammar, out-of-root-link skip term, truncation predicates) #1097 2026-09-18T10:45:52Z c32749c3af5f6f43c316e24a9c963685f3943c76
R1 (the report CLI and its tests) #1100 2026-09-18T15:22:14Z 83166366d499d58b5e8801e0bb17e346c73fc8e6

Patch B landed before R1, which is the order R1's own body asked for, and git merge-base --is-ancestor c32749c3 HEAD confirms it is in this tree. This branch is cut from 83166366 itself — R1's merge commit is this branch's merge base, so every fence proof below reads against a base that carries the CLI the new step invokes. scripts/report-citation-remainder.py is present in the clone, and grep -c 'citation-remainder\.txt' …/tasks.md reads 0, confirming the tree carries Patch B's one-invocation § 2.2 rather than the superseded two-file sketch.

What R2 does

Three files, 547 insertions, 1 deletion.

path what
.github/workflows/doc-health-reusable.yml EDIT, +134 two steps in the finalize job, immediately after Upload report artifact (:2250-2254) and before every step that writes inside the openxFactory checkout
tests/citation_remainder/test_report_wiring.py NEW, +326 17 tests over the parsed workflow
openspec/changes/add-citation-remainder-report/tasks.md EDIT, +87/-1 § 2.2 ticked, with the realization record beneath it in § 2.1's shape

Commits:

sha subject
cda09bafd3979ddcf31df76f012253736c15a154 Run the citation remainder report from the doc-health nightly: one reading, one artifact, a clean-tree assertion
ae16d03277b868ee4ad4ec4ff597f284ea3b1f14 Record § 2.2 against the wiring this pull request carries, and name the run it does not
78258890bcefee4b35e711853af77188899f2f36 Date the artifact from a step that always reaches its own write, and say what the CLI actually does with a modified tree (bench round one)

The step, as shipped

      - name: Citation remainder report (advisory — add-citation-remainder-report § 2.2)
        id: citation-remainder
        # … 40 lines of reasoning, elided here, kept in the file …
        if: always()
        continue-on-error: true
        env:
          SUITE_RUN_DATE: ${{ steps.run.outputs.run_date }}
        run: |
          set -euo pipefail
          RUN_DATE="${SUITE_RUN_DATE:-$(date -u +%F)}"
          echo "run_date=${RUN_DATE}" >> "$GITHUB_OUTPUT"
          if ! python3 openxFactory/scripts/report-citation-remainder.py openxFactory \
            --json > citation-remainder.json; then
            echo "::warning::citation-remainder: the report did not run, so no reading was taken and no artifact is uploaded tonight; this is not a finding"
            exit 1
          fi
          if ! TREE_CLEAN="$(python3 -c 'import json;print(str(json.load(open("citation-remainder.json"))["tree_unmodified_at_head"]).lower())')"; then
            echo "::warning::citation-remainder: the reading could not be read back from citation-remainder.json, so no artifact is uploaded tonight"
            exit 1
          fi
          if [ "$TREE_CLEAN" != "true" ]; then
            STATE="$(python3 -c 'import json;print(json.load(open("citation-remainder.json"))["tree_state"])')"
            echo "::warning::citation-remainder: ${STATE}; the reading is not uploaded, so tonight is a HOLE in D6's series rather than a false point in it"
            exit 1
          fi
      - name: Upload citation remainder report
        if: always() && steps.citation-remainder.outcome == 'success'
        uses: actions/upload-artifact@v4
        with:
          name: citation-remainder-${{ steps.citation-remainder.outputs.run_date }}
          path: citation-remainder.json
          if-no-files-found: error
          retention-days: 90

ONE invocation, ONE file, as tasks.md § 2.2 fixes it. --json is a boolean output-format flag taking no path (D2), so the redirect is shell-level. The script path is submodule-qualified like every sibling (:582, :1045, :2233) and the REPO_ROOT positional is openxFactory, because the CLI's own default is . (nargs="?", default=".") and . in this job is the aggregation tree — a different corpus, with a different remainder, that would be published as this repository's. The redirect target sits at the aggregation root, outside the scanned root, which is how D3(a)'s output-path fence holds structurally rather than by an exclusion list.

Run, not merely parsed. The step's shell was executed verbatim in the aggregation shape (a directory whose openxFactory entry is this clone), at this branch's head:

step exit: 0        (0 = the upload gate opens)
head           : 78258890bcefee4b35e711853af77188899f2f36
tree           : the tracked content read stands UNMODIFIED at this head
distinct tokens: 609 · inclusive remainder 85 tokens / 56 identities · filtered 46 · flagged entries 39
citation-remainder.json: 175,401 bytes, 1.5s wall · artifact would be `citation-remainder-2026-09-18`

Both failure branches were executed too, against purpose-built trees: a dirty checkout produced ::warning::citation-remainder: the tracked content read stands MODIFIED at this head … and exit 1; a root that is not a git work tree produced THE REPORT DID NOT RUN: … not a git repository on stderr, the cannot-run warning, and exit 1. Under continue-on-error both leave outcome == 'failure', so the upload is skipped and the night is a visible hole.

The figures above are a reading of a MOVING corpus, pinned to the run that produced them; they are not restated from R1's record and are not a claim about any later head. The three-readings caution R1's § 2.1 record carries (the shipped CLI's normalized issue-native reading differs from design.md D0(iv)'s headline by the three choices the spec fixes) applies to any comparison a reviewer makes against the packet's own tables.

What R2 does NOT do

  • No requirement of its own. All five are R1's. R2 makes the nightly run the report.
  • scripts/report-citation-remainder.py is untouched — git diff $BASE..HEAD -- scripts/report-citation-remainder.py | wc -l → 0.
  • § 2.3 (the committed first reading), § 2.4 (merged-plus-green) and all of § 3 stay open, unticked, in R3's hands and the archive's.
  • The aggregation caller does not move. opensoft/xFactory:.github/workflows/doc-health-nightly.yml already grants actions: write, contents: write, issues: write, pull-requests: write, and actions/upload-artifact@v4 needs no grant of its own. Neither new step declares permissions: or env:, and a test asserts it.
  • Nothing is committed back. D5 option 1 throughout; D3(a)'s exclusion machinery stays dormant, not live.
  • No required status check is added, and no gate. There is no --fail-on, and a test asserts there is none.

Q2 — artifact retention, measured, and D6 is satisfiable

90 days. D6 is measurable under D5 option 1; option 2 is not forced.

The plan and the brief both sent me to Settings → Actions → General in openxFactory. That is the wrong repository, and the measurement says so: a reusable workflow's artifacts belong to the caller, so every artifact this nightly has ever produced lives in opensoft/xFactory, and gh api repos/opensoft/openxFactory/actions/artifacts returns 0 artifacts. gh api repos/opensoft/xFactory/actions/permissions still exposes no retention field ({"enabled":true,"allowed_actions":"all","sha_pinning_required":false}), so the figure was read off the artifacts themselves:

60 consecutive artifacts in opensoft/xFactory every one expires exactly 90 days after its run started
worked example doc-health-report-2026-09-18, run 35299844095, started 2026-09-18T02:33:56Z, expires 2026-12-17T02:33:57Z

D6's N = 14 window fits six times over. retention-days: 90 is therefore kept, and it is no longer a departure argued from need: it matches the effective maximum rather than raising it, and it pins the series' lifetime against a later lowering of the repository default.

Q6 — a cannot-run records a skip, and does not red the nightly

Decision: continue-on-error: true plus an explicit ::warning:: on every failure path — the house's own habit, not the plan's recommendation. Three reasons, in order of weight:

  1. The packet's own requirement. The citation remainder report is advisory and gates nothing rules that "a tool able to exit non-zero acquires the meaning of a gate the first time anybody wires it into a required check", and that "PROMOTING THE REPORT TO A GATE SHALL BE A SEPARATE ACT ON A SEPARATE WORD". This is the first wiring of the report into anything, and it is not that word.
  2. This file's own habit for every optional lane. The neutrality lane immediately below carries continue-on-error: true and "records a graceful skip NOTE — never an error"; so do the cataloger, organizer, readiness and dashboard-image lanes.
  3. Measured, not assumed: the signal would be worthless. doc-health-nightly has concluded failure on all eight of its last scheduled runs (35299844095, 35174877222, 35048443668, 34921684313, 34799775414, 34733307293, 34667923153, 34555063717), each at step 50 Open regression issue. A ninth way to red a nightly that is already red buys nobody a signal they can act on.

Nothing is swallowed. Every non-zero path annotates with ::warning::, and the upload's outcome gate leaves the artifact absent — so a night without a reading is a visible hole in D6's series rather than a false point in it. The test test_every_failure_path_annotates_rather_than_swallowing_the_skip asserts mechanically that every exit 1 in the step's shell is preceded by a ::warning::, so the posture cannot decay into a silent skip.

Where my step lands, relative to the failure that reds the nightly today: the last run's finalize job numbered its steps 21 Run doc-health suite, 22 Upload report artifact, 23 Neutrality-drift lane commit-back, and failed at 50. My two steps become 23 and 24. They run, and they produce the artifact, on a red night.

The tree-state check: FOLDED under the same posture, and why the split would be the wrong way round

The resync that added the tree-state assertion flagged a genuine second decision: should a dirty checkout always red, even under the graceful-skip reading, on the argument that a dirty nightly checkout is a CI defect categorically unlike an advisory tool's unavailability?

Kept folded, on a fact measured in this workflow rather than reasoned about. A dirty checkout at this point in finalize is a foreseeable state of another lane doing its job:

  • the neutrality merge inside Run doc-health suite — the step above mine — can persist lane writes under openxFactory/health/neutrality-drift/;
  • the step immediately below mine exists precisely to commit them back (cd openxFactory; git status --porcelain health/neutrality-drift/ …);
  • and one of those paths is already tracked: git ls-files health/ lists health/neutrality-drift/baseline/codexFactory.yaml, so a re-recorded baseline is a tracked-content modification, which is exactly what the CLI's git diff --quiet HEAD reads;
  • the lane's input neutrality-drift defaults to true.

A split that always reds would therefore import a false red on the first night that lane persists anything. It writes nothing today — the 2026-09-18 run logged no neutrality lane writes — nothing to commit back, so the hazard is prospective, not live — but the wiring should not be one lane's activation away from reddening the estate's governance nightly.

What the check still guarantees, unchanged: a reading taken over a modified tree never enters D6's series, because the step exits non-zero and the upload's outcome gate suppresses it. And the ORDER is asserted as well as the check: test_the_reading_is_taken_before_any_step_that_writes_in_the_submodule finds every step whose run contains cd openxFactory and requires each to stand after the reading, so a later refactor cannot quietly move the reading behind a commit-back.

Test placement: a new module, not an addition to test_workflow_contract.py

New tests/citation_remainder/test_report_wiring.py. The resync fairly flagged that tests/doc-health/test_workflow_contract.py and test_workflow_guards.py already yaml.safe_load this same file and this same job, and that no packet rule decides between them. Reasons for the new module:

  • Attribution. A citation-report step that moves should red a citation-report test. Inside the doc-health contract file, the same breakage reads as a doc-health regression to whoever is on that family.
  • It is the plan's own prescription (R2.1), and it keeps this capability's test surface where every other body in this realization cites it: pytest tests/citation_remainder is one command covering R1's CLI tests and R2's wiring tests together.
  • The cost the resync named is paid anyway. "A second module parsing the same YAML" is 2.5 seconds of parse, and the mechanics are cribbed from test_workflow_guards.py (the load() / step(job, name) shape) exactly as the resync instructed, so there is one instrument and not two.

What the wiring test pins, and the proof that each assertion bites

17 tests, all against the parsed YAML, none against a live run. Each assertion was mutation-tested: the shipped step was broken 20 ways in turn and a named test caught every one.

the breakage caught by
bare scripts/report-citation-remainder.py test_the_script_path_is_submodule_qualified
REPO_ROOT positional dropped test_the_repo_root_positional_is_this_submodule_and_never_a_default
--include docs added test_the_argv_is_the_fixed_one_and_carries_no_refinement
redirect moved to openxFactory/citation-remainder.json test_the_reading_is_written_outside_the_scanned_root
--json given an operand test_the_json_flag_is_passed_with_no_operand
a second, human-readable invocation restored test_the_nightly_runs_the_report_exactly_once
--fail-on error smuggled in test_the_step_carries_no_fail_on_and_adds_no_gate
the tree-state check removed entirely test_the_tree_state_of_the_reading_is_checked_and_not_merely_printed
the tree-state branch warns but stops stopping test_the_tree_state_of_the_reading_is_checked_and_not_merely_printed
the tree-state warning removed test_every_failure_path_annotates_rather_than_swallowing_the_skip
the cannot-run warning removed test_every_failure_path_annotates_rather_than_swallowing_the_skip
continue-on-error dropped without a word test_every_failure_path_annotates_rather_than_swallowing_the_skip
the reading reordered after a submodule writer test_the_reading_is_taken_before_any_step_that_writes_in_the_submodule
upload gated on always() alone test_the_upload_is_gated_on_the_run_steps_outcome
if-no-files-found dropped test_an_empty_artifact_is_an_error_rather_than_a_silent_upload
retention-days shortened to 1 test_the_series_outlives_the_window_d6_measures_over
artifact name put back on the suite's run_date test_the_artifact_name_carries_a_date_even_when_the_suite_step_dies
the date fallback removed test_the_artifact_name_carries_a_date_even_when_the_suite_step_dies
the output written below a failure path test_the_artifact_name_carries_a_date_even_when_the_suite_step_dies
a secret smuggled into the step's env: test_the_step_asks_for_no_permission_the_job_does_not_already_hold

One of those sixteen was NOT caught by the first draft of the test, and it is recorded rather than quietly repaired: with the assertion written as "some exit 1 follows the field name", a tree-state branch that warns and then continues stayed green, because the exit 1 of the read-back branch a few lines above satisfied it. The test now cuts the != "true" branch out of the shell before asserting on it, and the reason is written in the test.

Scenario coverage — what this wiring is evidence for, by name

R2 realizes no requirement, so none of these is R2's to claim as realized. What the wiring and its test add is a different kind of evidence for three of the packet's 72 scenarios (counted in this tree: 5 requirements, 72 #### Scenario: blocks).

scenario (requirement) what R2 contributes the test
The tree read is not clean at the head printed (The citation remainder is reported) R1's fixtures cover the CLI's own declaration; R2 is that fact ENFORCED on the live nightly checkout, and ordered ahead of every step that could dirty it test_the_tree_state_of_the_reading_is_checked_and_not_merely_printed, test_the_reading_is_taken_before_any_step_that_writes_in_the_submodule
A reading is compared against an earlier reading (The reported population is derived from a stated recipe) a FIXED, non-drifting argv is what keeps each night's reading a later point in the SAME series rather than a differently defined one test_the_argv_is_the_fixed_one_and_carries_no_refinement, test_the_nightly_runs_the_report_exactly_once, test_the_script_path_is_submodule_qualified, test_the_repo_root_positional_is_this_submodule_and_never_a_default, test_the_json_flag_is_passed_with_no_operand
The report's own output is committed into the corpus (same requirement) under D5 option 1 the nightly commits nothing, so the scenario's antecedent never fires on this path — satisfied by construction, not made to pass test_the_reading_is_written_outside_the_scanned_root

Not claimed: A caller's refinement names the report's own output — the step passes no --include and no --exclude, so that scenario is exercised by R1's fixtures alone. What R2 adds is the assertion that the nightly never starts passing one.

D7's scope fences, and the whole file list

$ BASE=$(git merge-base origin/main HEAD)   # 83166366d499d58b5e8801e0bb17e346c73fc8e6
$ git diff $BASE..HEAD -- scripts/packet_reference.py | wc -l            0
$ git diff $BASE..HEAD -- scripts/report-citation-remainder.py | wc -l   0
$ git diff $BASE..HEAD -- scripts/validate-pin-registrations.py | wc -l  0
$ git diff $BASE..HEAD -- scripts/doc_health | wc -l                     0
$ git diff $BASE..HEAD -- openspec/specs | wc -l                         0
$ git diff --name-only $BASE..HEAD
.github/workflows/doc-health-reusable.yml
openspec/changes/add-citation-remainder-report/tasks.md
tests/citation_remainder/test_report_wiring.py
$ git status --porcelain | wc -l                                         0

No citation is edited, nothing cross-repository is resolved, no doc-health file moves, no promoted byte moves.

Validators

command result
python3 -m pytest tests/citation_remainder tests/doc-health -q 1998 passed, 7 warnings in 297.98s, exit 0
python3 -m pytest tests/citation_remainder/test_report_wiring.py -q 17 passed
python3 -m pytest tests/ -q -m "not postgres" (the required gate's own invocation, at the final head) 1 failed, 8108 passed, 21 skipped, 338 deselected, 384 subtests passed in 1762.42s. The one failure is tests/hermes_runtime_contracts/test_validator_cli.py::test_release_mode_field_is_preserved_on_the_real_repository[--require-realization-realization], and it is not this branch's: it is a wall-clock flake against that file's subprocess.run(…, timeout=30) on a loaded workstation, and it reproduces on main itself — the same test, the same parameterization, fails in a control clone at the merge base (83166366, none of this diff) in 47.41s under load average 8.66 with six concurrent suites from another lane, and passed in that same control an hour earlier when the box was quiet. Timed directly, the validator takes 25.5s in this branch and 28.0s in the control, so this branch is if anything the faster tree. pytest-suite on CI is green at this head (run 35366503026, 21m48s)
a bare python3 -m pytest -q from the clone root not usable as a control at all: it collects the materialized submodules' own suites and dies at collection with 10 errors. The gate's tests/ argument is what makes the run meaningful
python3 scripts/validate-code-surface.py . code_surface validation passed (every active declaration's head is admitted). — 47 active proposals, 47 declaring
python3 scripts/validate-sequenced-after.py . sequenced_after validation passed (47 active changes, 17 declaring the field). + archive-date and archive-date-vs-commit agreement passed
OPENSPEC_TELEMETRY=0 openspec validate add-citation-remainder-report --strict Change 'add-citation-remainder-report' is valid
OPENSPEC_TELEMETRY=0 openspec validate --all --strict Totals: 108 passed, 1 failed (109 items) — the one failure is add-chain-attestation, pre-existing and untouched by this branch's three-file diff. The brief expected TWO pre-existing failures; add-composed-view-authoring no longer fails, which is a fact about main and not about this branch
python3 scripts/validate-openspec-cli-pin.py --change add-citation-remainder-report --strict OK openspec-cli-pin: @fission-ai/[email protected] verified against its content address and every target validated --strict clean
scripts/proposal-support.py . verify proposal support verification ok
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/doc-health-reusable.yml'))" parses; finalize carries 52 steps, the new pair at indices 21 and 22, between Upload report artifact and Neutrality-drift lane commit-back
actionlint .github/workflows/doc-health-reusable.yml 9 findings before this edit, 9 after — all pre-existing shellcheck style/info notes elsewhere in the file; the new step contributes none
python3 scripts/doc-health.py --single-repo . exit 0, re-run at the final head. Diffed line-for-line against a same-kind control clone at the merge base: 93 severity lines each, IDENTICAL, headline identical (31 critical, 13 error, 28 warning, 21 info)

A note on that last row, because the first attempt looked like a regression and was not. The control clone initially reported two fewer release-inventory-drift errors (scripts/hermes_runtime_validation/catalog.py, release.py) — files this branch never touches, byte-identical in both clones. The cause is the family's own early return: with submodules unmaterialized the control hit the pinned openxdox_spec leg is not materialized … Run git submodule update --init --recursive openDox openXdox, which skips from the middle of a sorted comparison and drops every member after it. With the control's submodules materialized, the two runs are identical. Worth knowing before anyone diffs doc-health across clones again.

Bench round one — both Copilot threads taken in 78258890, both resolved

  1. The artifact could have uploaded dateless. steps.run.outputs.run_date is written by the LAST line of Run doc-health suite; a suite that fails earlier never writes it, and this lane is always() precisely so the reading survives such a night — the name would have been citation-remainder-. The neighbouring Upload report artifact is not exposed to this because it carries no if: and is simply skipped on that night; the exposure arrives with always(). The run step now publishes its own run_date, preferring the suite's value through env: (one date per run, shared with the doc-health report) and falling back to date -u +%F, written before every failure path, with the upload naming this step's output. Both branches were executed locally: with the suite date present the name is citation-remainder-2026-09-18; with it empty the fallback produces the same. One part of the report's stated mechanism was corrected rather than accepted, with a measurement: artifact names do NOT collide across runs (v4 immutability is per-run, and opensoft/xFactory holds five nights of semantic-sweep-bundle under that one name), so a dateless night would have uploaded fine and been unplaceable — the cost is the series, not the upload.
  2. A comment was broken and misdescribed the CLI. "the CLI's own header refuses a modified tree that standing" is not a sentence, and the CLI does not refuse: the spec requires it to "still produce the reading rather than refuse to run", declaring the state beside the head. The comment now says that, and says what the WIRING does with it. No behaviour moved.

DECISIONS RAISED

  1. tasks.md § 2.2 is ticked here, against brief-R2-wiring.md's instruction to leave the box for R3's writer. It is ticked on the tick rule's own first clause — "a [x] is either a diff in THIS pull request or a measurement recorded verbatim" — and on R1's landed precedent, which ticked § 2.1 in its own pull request although the realization plan's § 4 table named "R1's merge sha" as the ticker. The record beneath the box states in its first sentences what the tick does NOT claim: the first nightly run. If the reading should be the stricter one, unticking is one character and the record stands either way.
  2. The step's PLACEMENT is the brief's, and a later change may want to revisit it. The brief anchors the reading immediately after Upload report artifact, which puts it AFTER Run doc-health suite — the step whose neutrality merge can persist writes into the scanned checkout. Taking the reading BEFORE the suite would make a dirty tree impossible rather than merely handled, at the cost of steps.run.outputs.run_date not yet existing for the artifact name. I did not move it: the placement is decided in the brief and in the plan, the ordering guarantee that matters is asserted, and the hazard is dormant. Named here so the choice is visible rather than discovered.
  3. Q2's question was pointed at the wrong repository by both the plan and the brief. Recorded above rather than silently corrected.

Outstanding, and whose it is

The first doc-health-nightly run that actually produces the artifact — cited by run id and artifact name citation-remainder-<YYYY-MM-DD> — is § 2.2's other half and is not this pull request's to produce. It arrives within 24 hours of the merge on the aggregation's own cron (17 2 * * * in opensoft/xFactory:.github/workflows/doc-health-nightly.yml), or immediately by workflow_dispatch on that workflow by whoever holds it. Owner: the orchestrator, or brief-R3-ticks.md's writer, who carries it into § 3.3's realization comment and the archive pull request's evidence list. A merged workflow file is not evidence that a step ran.

Refs #1053.

Lane: openxfactory-1

🤖 Generated with Claude Code

brettheap and others added 2 commits September 18, 2026 15:40
…ading, one artifact, a clean-tree assertion

`add-citation-remainder-report` § 2.2, realization slice R2. Two steps in the
`finalize` job of `.github/workflows/doc-health-reusable.yml`, immediately after
`Upload report artifact` and before any step that writes inside the openxFactory
checkout, plus the parsed-YAML test that pins them.

ONE INVOCATION, ONE FILE, as `tasks.md` § 2.2 fixes it: `--json` is a boolean
output-format flag taking no path, so the redirect is shell-level and the report
writes `citation-remainder.json` AT THE AGGREGATION ROOT — outside the scanned
root, which is how D3(a)'s output-path fence holds structurally rather than by
an exclusion list. The script path is submodule-qualified and the `REPO_ROOT`
positional is `openxFactory`, because the CLI's own default is `.` and `.` here
is the aggregation tree: a different corpus, with a different remainder, that
would be published as this repository's.

TWO DECISIONS TAKEN RATHER THAN LEFT IN THE COMMENT.

Q6 (may a cannot-run red the nightly?) takes the house's own habit and not the
plan's recommendation: `continue-on-error: true` plus an explicit `::warning::`
on every failure path. The packet's own requirement says PROMOTING THE REPORT TO
A GATE SHALL BE A SEPARATE ACT ON A SEPARATE WORD, and this is not that word;
every other optional lane in this file records a graceful skip; and the
governance nightly has concluded `failure` on all eight of its last scheduled
runs for reasons owned elsewhere, so a ninth way to red it buys a signal nobody
can read. Nothing is swallowed: the warning annotates and the upload's `outcome`
gate leaves the artifact absent, so a night without a reading is a visible HOLE
in D6's series.

The tree-state assertion is FOLDED under that same posture rather than split out
to always red, and the reason is measured: the neutrality lane's merge inside
`Run doc-health suite` can persist writes under
`openxFactory/health/neutrality-drift/` — the very next step exists to commit
them back, and `baseline/codexFactory.yaml` is already tracked — so a dirty
checkout at this point is a foreseeable state of another lane doing its job, not
a defect worth reddening a nightly for. What it IS is a reading that must not
enter D6's series, which the warning and the absent artifact say exactly. The
lane wrote nothing on the 2026-09-18 run (`no neutrality lane writes`), so the
hazard is prospective; the step is ordered ahead of both commit-backs so it
stays that way.

`retention-days: 90` is kept and is now measured rather than argued: every
artifact in `opensoft/xFactory` — the CALLER, where a reusable workflow's
artifacts live, `opensoft/openxFactory` holding none of its own — expires
exactly 90 days after its run starts. D6's N = 14 window fits six times over.

The test module is new rather than an addition to
`tests/doc-health/test_workflow_contract.py`, so a citation-report step that
moves reds a citation-report test. Its assertions were mutation-tested, not
asserted: sixteen deliberate breakages of the shipped step, each caught, and one
that was NOT caught in the first draft (a tree-state branch that warns and stops
stopping) is why that test now cuts the branch out before asserting on it.

Refs #1053.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…he run it does not

The tick rule's first clause: a `[x]` is a diff in THIS pull request. The
wiring § 2.2 describes is that diff, and the record beneath the box says in its
own first sentences what the tick does NOT claim — the first
`doc-health-nightly` run that produces `citation-remainder-<YYYY-MM-DD>`, which
arrives on the aggregation's cron within 24 hours of the merge or immediately by
`workflow_dispatch`, and which lands in § 3.3's realization comment and the
archive pull request's evidence list. A merged workflow file is not evidence
that a step ran.

The record also carries the two decisions § 2.2 left open and the measurement
that closes D6's own open question: Q6 answered toward a graceful skip with an
annotation, the tree-state check folded under that same posture on the
neutrality lane's measured ability to dirty this checkout by design, and the
artifact retention read where a reusable workflow's artifacts actually live —
`opensoft/xFactory`, 90 days, sixty consecutive artifacts measured, against
D6's N = 14.

And the three scenarios this wiring is operational evidence for, each beside the
test that pins it, plus the one it is NOT evidence for and why.

Refs #1053.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 18, 2026 15:58

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 3 days and 3 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adds advisory nightly wiring that runs the citation remainder CLI once against the correct submodule, uploads only clean successful readings as 90-day artifacts, and uses dedicated structural tests to protect the invocation and workflow safety contract; the task record captures R2 while leaving first-run and later realization evidence outstanding.

File-Level Changes

Change Details Files
Wire the citation remainder report into the reusable nightly workflow as an advisory, artifact-only step.
  • Run the report exactly once against the openxFactory submodule with fixed JSON output redirected outside the scanned root.
  • Reject readings from failed or dirty checkouts with warnings while preserving nightly success via continue-on-error; upload only successful readings.
  • Store artifacts under run-date names with if-no-files-found: error and 90-day retention, without adding permissions or commit-back behavior.
.github/workflows/doc-health-reusable.yml
Add structural tests that enforce the workflow invocation, safety fences, ordering, failure handling, and artifact contract.
  • Parse the finalize job and pin the exact command, repository root, output location, step placement, and absence of refinement or gate flags.
  • Verify tree-state validation, warning coverage, outcome-gated upload, artifact contents, retention, and lack of step-level permissions or environment changes.
  • Keep the wiring tests in a dedicated citation-remainder module and document that runtime execution evidence belongs to a later nightly run.
tests/citation_remainder/test_report_wiring.py
Record the R2 nightly-wiring realization while explicitly leaving runtime and later realization evidence open.
  • Tick § 2.2 and document the two-step implementation, design decisions, measured artifact retention, and scenario evidence.
  • Distinguish merged workflow wiring from the first production artifact run, leaving § 2.3, § 2.4, and § 3 for subsequent work.
openspec/changes/add-citation-remainder-report/tasks.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Address the workflow upload/name-collision risks and strengthen the ordering guard.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds advisory nightly execution and artifact publication for the citation remainder report.

Changes:

  • Runs the report and uploads clean-tree readings.
  • Adds structural workflow tests.
  • Records R2 realization details in tasks.md.
File summaries
File Summary
.github/workflows/doc-health-reusable.yml Adds report execution and artifact upload. Findings: two moderate issues involving non-blocking upload handling and artifact-name collisions, plus one nit about inaccurate wording.
tests/citation_remainder/test_report_wiring.py Adds workflow safeguards. Finding: one moderate gap in modeling the suite’s in-step writer.
openspec/changes/add-citation-remainder-report/tasks.md Records realization and implementation decisions; no findings.
Review details

Suppressed comments (2)

.github/workflows/doc-health-reusable.yml:2343

  • The report is explicitly advisory and the run step is non-blocking, but this upload action is not. A storage failure or an immutable-name collision can therefore fail the entire finalize job and turn an otherwise successful nightly red, contrary to the Q6 non-gating posture; make the optional upload non-blocking and retain an explicit warning/skip signal for a missing artifact.
        uses: actions/upload-artifact@v4

tests/citation_remainder/test_report_wiring.py:230

  • This guard does not enforce the invariant stated by its name: it only finds steps containing cd openxFactory, while the Run doc-health suite step immediately above can itself persist neutrality writes under openxFactory/health/neutrality-drift/ (as the surrounding workflow comment acknowledges). A refactor that moves the reading relative to that writer would therefore remain green. Narrow the invariant to commit-back steps or model the suite's in-step writer explicitly.
    writers = [(i, s.get("name")) for i, s in enumerate(job["steps"])
               if "cd openxFactory" in (s.get("run") or "")]
    assert writers, "expected at least one commit-back step to order against"
    for i, name in writers:
        assert i > reading_at, f"{name!r} writes in the submodule at step " \
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…say what the CLI actually does with a modified tree

Bench round one on PR #1111, both threads taken.

`steps.run.outputs.run_date` is written by the LAST line of `Run doc-health
suite`, so a suite that fails earlier never writes it — and this lane is
`always()` precisely so the reading survives such a night. The interpolation
would have been empty and the artifact would have uploaded as
`citation-remainder-`, a series point with no date on it. The run step now
publishes its own `run_date`, preferring the suite's value through `env:` (one
date per run, shared with the doc-health report beside it) and falling back to
`date -u +%F`, and the upload names THIS step's output. The write stands before
every failure path, and a test asserts that ordering as well as the fallback.
(Copilot `PRRT_kwDOTAvnrs6jzmDm`.)

What is NOT the failure mode, measured rather than argued: artifact names repeat
freely across runs. `opensoft/xFactory` holds five nights of
`semantic-sweep-bundle` under that one name, runs `35299844095`, `35174877222`,
`35048443668`, `34921684313`, `34799775414`. A dateless name would not have been
rejected as a duplicate; it would have cost a series point nobody could place,
which is reason enough.

And the tree-state comment was broken in the middle and misdescribed the CLI
besides. The CLI never refuses a modified tree: it produces the reading and
declares the state beside the head, which is what the spec requires of it. What
the declaration withholds is the standing of a later point in the series taken
at that head, so the wiring keeps such a reading out of the series rather than
uploading one nothing can compare. (Copilot `PRRT_kwDOTAvnrs6jzmD-`.)

The `env:` this adds carries one non-secret value, and the test that asserted
"no `env:` at all" now asserts what it was always for: no `permissions:`, no
token, no secret.

Refs #1053.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 18, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Guard the tree_state read-back and complete writer-ordering coverage; reconcile the documented lifecycle details.

Review details

Suppressed comments (5)

.github/workflows/doc-health-reusable.yml:2355

  • Could this read-back be guarded like the TREE_CLEAN extraction above? With set -e, a missing or malformed tree_state makes this assignment fail and exits the step before the ::warning:: below; continue-on-error then hides that failure and leaves the skipped artifact without the promised annotation. Wrap the assignment in an if ! ...; then branch that emits the cannot-read warning before exiting.
            STATE="$(python3 -c 'import json;print(json.load(open("citation-remainder.json"))["tree_state"])')"

.github/workflows/doc-health-reusable.yml:2319

  • The PR description says neither new step declares env:, but this step does (SUITE_RUN_DATE), and the new test explicitly permits and asserts that handoff. Please reconcile the description with the shipped wiring (or remove the env block if the no-env claim is a requirement); otherwise the review/realization record is inaccurate.
        env:
          # PASSED THROUGH `env:` RATHER THAN INTERPOLATED INTO THE SCRIPT, the
          # house rule this file already polices for itself
          # (`test_untrusted_workflow_inputs_are_not_interpolated_into_bash`).
          SUITE_RUN_DATE: ${{ steps.run.outputs.run_date }}

openspec/changes/add-citation-remainder-report/tasks.md:536

  • This tick leaves the earlier realization-status paragraph at lines 380–384 saying that “§§ 2.2, 2.3 and 2.4 stay open” and that the nightly wiring is a later slice. After marking 2.2 [x] and recording R2 here, the packet states both that this task is complete and still open; please update or explicitly mark that earlier paragraph as historical so the lifecycle record has one state.
- [x] 2.2 **THE NIGHTLY WIRING**, at the size D5 rules. Under the recommended

tests/citation_remainder/test_report_wiring.py:227

  • This writer scan is incomplete: the current finalize job also has script-backed writers after this step. Ideation readiness lane (merge, persist, report link) persists the openxFactory index via --repo-root ., and Derive-possibles lane (merge, persist, report link) persists the possibles register; neither command contains cd openxFactory. Consequently, moving the report below either writer would leave this ordering test green despite violating the invariant it claims to enforce. Include these writer steps (or another authoritative writer manifest) in the assertion.
    writers = [(i, s.get("name")) for i, s in enumerate(job["steps"])
               if "cd openxFactory" in (s.get("run") or "")]

tests/citation_remainder/test_report_wiring.py:217

  • This test only orders the later cd openxFactory commit-back steps; the preceding Run doc-health suite can also write openxFactory/health/neutrality-drift/ through the neutrality merge. The current name claims coverage of every submodule writer, so it should be narrowed to the commit-back ordering it actually enforces.
def test_the_reading_is_taken_before_any_step_that_writes_in_the_submodule():
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sonarqubecloud

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

Brett Heap, 2026-09-18T20:02Z, in the lane session (verbatim): "land #1111 when green" — the landing word for this pull request (R2, the nightly wiring). Recorded here so the Rule 6 LANDING line can cite it. The decisions recorded in the body (Q6 graceful skip, tree-state folded, Q2 90 days, § 2.2 ticked in-PR, placement after the suite, not a draft) stand as written unless ruled otherwise on #1053.

Lane: openxfactory-1

@brettheap

Copy link
Copy Markdown
Contributor Author

FREEZE — lane openxfactory-1, session 393ade52-a921-4dd9-9dc5-224ebc056651, 2026-09-18T20:02Z: head 78258890 is the landing candidate; no further pushes to realize/citation-report-r2. Gates read: six required checks GREEN at this head, main's newest decided pytest-suite (cd6439f6) GREEN, 0 open review threads, no closing keyword. Word: Brett Heap "land #1111 when green" (comment 5735511925). Rule 6 LANDING follows.

Lane: openxfactory-1

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

LANDING — lane openxfactory-1, session 393ade52-a921-4dd9-9dc5-224ebc056651@Eagle, 2026-09-18T20:03:31Z, PR #1111 into opensoft/openxFactory main

Guard at 2026-09-18T20:03:36Z on head 78258890bcefee4b35e711853af77188899f2f36: six required checks SUCCESS (lane-line, openspec-cli-pin, pytest-suite, release-tag-gate, signed-execution-chain-gate, wallet-validation); closingIssuesReferences = []; 0 unresolved threads; main's newest decided pytest-suite = success; no other-lane open LANDING into opensoft/openxFactory main (who --landing). mergeStateStatus BLOCKED = the code-owner-review ruleset that never clears on the author's own account; admin merge on Brett Heap's recorded word (REALIZE add-citation-remainder-report R2 (nightly wiring); Brett Heap 2026-09-18 land #1111 when green (comment 5735511925)). Merge = merge commit.

@brettheap
brettheap merged commit 89d7975 into main Sep 18, 2026
17 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

LANDED — lane openxfactory-1, session 393ade52-a921-4dd9-9dc5-224ebc056651@Eagle, 2026-09-18T20:03:45Z, PR #1111 into opensoft/openxFactory main → 89d7975

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.

2 participants