Skip to content

doc-health preflight: initialize governed repos' nested submodules so MedxEHR's make validate can recompute its pinned digest - #651

Merged
brettheap merged 1 commit into
mainfrom
fix/preflight-medxehr-nested-submodule
Sep 4, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/preflight-medxehr-nested-submodule

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Lane: doxbench-stewardship

Symptom

Every doc-health nightly report's Preflight section carried a standing FAIL:

FAIL: MedxEHR `make validate` — REFUSED pin-submodule-uninitialized: spec is
not an initialized submodule checkout, so the pinned digest cannot be
recomputed. Presence is not identity and an unreadable surface must fail
rather than degrade.
Remediation: run `git submodule update --init --recur…

(e.g. health/reports/2026-09-04.md on opensoft/xFactory.)

MedxEHR's lockstep pin validator (scripts/validate-pins.py, invoked by
make validate → shape-validate) recomputes each leg's pinned digest from
the leg's own object store, and correctly refuses
pin-submodule-uninitialized — fail-closed — when a leg sits present only
as an empty gitlink. The nightly's prepare/finalize jobs init every
governed repo's own gitlink (xFactories/<repo>) plus openxFactory's own
nested openXwallet gitlink, but never MedxEHR's own nested legs.

Survey: nested submodules across the governed repos

Checked every governed repo's (xFactories/*) .gitmodules at origin/main,
and cross-checked against the latest nightly's Preflight section to see which
ones actually run make validate (and therefore a pin-digest recompute) today:

Repo Nested submodule(s) Preflight entrypoint Currently affected?
MedxEHR spec (MedxSoft/MedxEHR-spec), code (MedxSoft/MedxEHR-code) make validate YES — the standing FAIL fixed here
LedgerxFactory LedgerxAvatar, LedgerxWallet (none) — no validator entrypoint found no
MedxFactory MedxAvatar make validate (passes: OK) no — passes today without the nested init
MedxChart openChart (none) — no validator entrypoint found no
MedxPractice openPractice (none) — no validator entrypoint found no
AdxFactory none (none) n/a
HealthLinc none (no .gitmodules) make validate (passes: OK) n/a
OpsxFactory none make validate (passes: OK) n/a
codexFactory none bash validate-docs.sh (passes: OK) n/a

Only MedxEHR is both (a) declaring nested submodules AND (b) running a
make validate that recomputes a pin digest against them through preflight
— so it is the only one that fails today. preflight.py's _entrypoints()
only invokes make validate when a repo's own Makefile declares a
validate: target; LedgerxFactory/MedxChart/MedxPractice have none, so their
nested submodules never enter the preflight path currently. MedxFactory does
run make validate and does pin MedxAvatar, but its check is not a
digest-recompute over an uninitialized-submodule refusal, so it passes as-is.

Mechanism

Extended the Init governed submodules only step in both the prepare
and finalize jobs of .github/workflows/doc-health-reusable.yml, mirroring
the existing openXwallet nested-init pattern exactly (same style: narrowly
scoped by name, guarded on the leg's .gitmodules declaration, not
--recursive, comments explaining why):

if git -C xFactories/MedxEHR config --file .gitmodules \
     --get submodule.spec.path >/dev/null 2>&1; then
  git -C xFactories/MedxEHR submodule update --init spec
else
  echo "MedxEHR declares no spec gitlink at this pin; skipping the nested init"
fi
if git -C xFactories/MedxEHR config --file .gitmodules \
     --get submodule.code.path >/dev/null 2>&1; then
  git -C xFactories/MedxEHR submodule update --init code
else
  echo "MedxEHR declares no code gitlink at this pin; skipping the nested init"
fi

Both jobs need it independently: finalize runs on its own fresh checkout
and re-invokes doc-health.py with no --family flag, so run_suite()'s
preflight branch runs a second time there and its result is what
--report-out actually renders into the published report — not prepare's
copy.

Fail-closed / not swallowed: neither if guard suppresses a real init
failure — the guard only skips the init when MedxEHR's .gitmodules doesn't
declare the leg. If git submodule update --init itself fails (auth,
network, bad pin), the step exits non-zero under Actions' default
bash -eo pipefail, which fails the job — the same behavior the existing
openXwallet init already relies on.

Scoped to MedxEHR only, deliberately: the file's existing comments state a
considered reason to avoid a blanket --recursive (it would additionally
pull installs/omnigent-install and every domain's nested submodules into
every run) — nothing found that forbids a second named nested init
alongside the openXwallet one, and the survey above shows no other governed
repo needs one today.

Local proof

Cloned MedxSoft/MedxEHR fresh into a scratch directory and checked out the
pinned commit currently recorded for xFactories/MedxEHR in
opensoft/xFactory's .gitmodules (d9808975581158ccdfd30e5d110a175ff28aefc5),
with spec/code left uninitialized (git submodule status showed both
with a leading -):

  1. Reproduced the symptom: make validate failed exactly as the nightly
    report shows — REFUSED pin-submodule-uninitialized: spec is not an initialized submodule checkout... / make: *** [Makefile:52: shape-validate] Error 2.
  2. Ran the exact commands the new step adds (the two guard+init blocks
    above, run from inside the MedxEHR clone) — both guards passed, both
    submodules cloned and checked out at their pinned commits
    (spec → 07b4362f4769…, code → e64307d04c39…).
  3. Re-ran make validate: exit code 0. Full pass —
    validate-repository-naming.py, validate-manifest.py,
    validate-pins.py (spec/code gitlink==pin, both tree digests
    recompute, shape-pin ok), code/scripts/validate.py
    (OK MedxEHR repository checks clean), code/scripts/harness.py
    (OK harness: positive green, 8 negative fixtures fired...).

Test / check results

  • python3 -c "import yaml; yaml.safe_load(open('.github/workflows/doc-health-reusable.yml'))" — OK (actionlint not available in this environment).
  • python3 -m pytest tests/openxwallet_pin/test_aggregation_lane_wiring.py tests/doc-health/test_workflow_guards.py tests/doc-health/test_workflow_contract.py -q — 37 passed.
  • python3 -m pytest tests/doc-health -q -k "workflow or reusable" — 34 passed, 1518 deselected.
  • python3 -m pytest tests/doc-health/test_neutrality_dispatch.py tests/doc-health/test_readiness_output_fail_closed.py tests/doc-health/test_modified_block_currency_reporting.py tests/avatar_runtime/test_ruled_values_pinned.py tests/ideation-dashboard/test_nightly_lane.py -q (every other file grep -rln 'doc-health-reusable' tests/ matched) — 171 passed.

No Python code changed — this PR is workflow YAML only.

Not stopped on anything

No stated reason found anywhere in the file forbidding a second named
nested init; the openXwallet comments explain only why --recursive is
avoided, which this fix also avoids.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 [email protected]

The nightly's prepare and finalize jobs init every governed repo's own
gitlink (xFactories/<repo>) plus openxFactory's nested openXwallet
gitlink, but not MedxEHR's own nested legs. MedxEHR's lockstep pin
validator (scripts/validate-pins.py, run by 'make validate' inside
doc-health's preflight family) recomputes each leg's pinned digest from
the leg's own object store and correctly refuses
pin-submodule-uninitialized when spec/code sit uninitialized — a
standing FAIL in every nightly report.

Mirror the existing openXwallet nested-init pattern (narrowly scoped,
guarded on the leg's .gitmodules declaration, fail-closed) for
MedxEHR's spec and code legs, in both the prepare and finalize jobs
(finalize re-runs the full suite on its own fresh checkout and its
result is what the published report renders).

Surveyed the other governed repos' nested submodules
(LedgerxFactory/{LedgerxAvatar,LedgerxWallet}, MedxFactory/MedxAvatar,
MedxChart/openChart, MedxPractice/openPractice): none of them currently
run a pin-digest recompute through preflight the way MedxEHR does (per
the latest nightly report's Preflight section), so only MedxEHR's legs
are inited — the narrowest mechanism for the failure actually observed.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 4, 2026 13:08

@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.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

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.

🟢 Approval recommended

The change is narrowly scoped workflow hardening to initialize required nested submodules and aligns with the existing openXwallet nested-init pattern.

Pull request overview

Updates the reusable doc-health workflow to ensure MedxEHR’s nested submodules are initialized so its make validate preflight can recompute pinned digests (avoiding the standing pin-submodule-uninitialized refusal seen in nightly reports).

Changes:

  • Initialize xFactories/MedxEHR nested submodules spec and code (guarded on .gitmodules declarations) in the prepare job.
  • Mirror the same nested submodule initialization in finalize, since it runs on a fresh checkout and re-runs preflight.
  • Extend the inline rationale/comments to document why named nested init is used instead of --recursive.
File summaries
File Description
.github/workflows/doc-health-reusable.yml Adds guarded nested submodule initialization for MedxEHR (spec, code) in both prepare and finalize to unblock doc-health preflight’s make validate.
Review details

Suppressed comments (1)

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

  • Same as in prepare: if xFactories/MedxEHR isn’t present in this checkout, the current guard will log “declares no … gitlink” even though the directory is missing. Add an explicit directory presence check to keep logs accurate and avoid silently treating a missing checkout as “no declaration”.
          if git -C xFactories/MedxEHR config --file .gitmodules \
               --get submodule.spec.path >/dev/null 2>&1; then
            git -C xFactories/MedxEHR submodule update --init spec
          else
            echo "MedxEHR declares no spec gitlink at this pin; skipping the nested init"
          fi
          if git -C xFactories/MedxEHR config --file .gitmodules \
               --get submodule.code.path >/dev/null 2>&1; then
            git -C xFactories/MedxEHR submodule update --init code
          else
            echo "MedxEHR declares no code gitlink at this pin; skipping the nested init"
          fi
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

Comment on lines +298 to +309
if git -C xFactories/MedxEHR config --file .gitmodules \
--get submodule.spec.path >/dev/null 2>&1; then
git -C xFactories/MedxEHR submodule update --init spec
else
echo "MedxEHR declares no spec gitlink at this pin; skipping the nested init"
fi
if git -C xFactories/MedxEHR config --file .gitmodules \
--get submodule.code.path >/dev/null 2>&1; then
git -C xFactories/MedxEHR submodule update --init code
else
echo "MedxEHR declares no code gitlink at this pin; skipping the nested init"
fi
@brettheap
brettheap merged commit b421682 into main Sep 4, 2026
8 checks passed
@brettheap
brettheap deleted the fix/preflight-medxehr-nested-submodule branch September 4, 2026 13:30
brettheap added a commit that referenced this pull request Sep 4, 2026
…dxchart-overlay-boundary (64 -> 65)

Lane: openxfactory-max001

STEP (2) OF THE TWO-REPOSITORY ACT THIS PACKET'S OWN PROMOTION FORCED, on
Brett Heap's word "land it when green then do medxpractice" (2026-09-04).

Archiving `create-medxchart-overlay-boundary` promotes
`openspec/specs/medxchart-overlay-boundary/spec.md`, and codexFactory's
`repository_gate_floor` for this repository ENUMERATES that surface exactly,
so the new spec arrived OFF the floor and reddened the REQUIRED `pytest-suite`
in THREE places — `tests/review_lane_pin/test_floor_snapshot.py`'s LQ-A7
coverage assertion AND both of its negative controls, which guard the ordering
of that same surface and fail with it by construction — plus the advisory
`merge-master-approval` lane at stage `floor_incomplete`. That is the guard
working: a spec the floor does not carry is a spec the floor does not protect.

THE ORDER IS FORCED AND IT IS THE RUNBOOK'S
(`docs/repository-gate-floor-repair-runbook.md` in the pinned core):
codexFactory regenerates at an openxFactory commit that ALREADY carries the
new path, and only then may this pin advance onto it. codexFactory's half
landed as PR #197, MERGE COMMIT (not squash) `bfb8bde39f61d3eb4a768cdc7117a3bbc1418d2d`,
2026-09-04T14:05:07Z, regenerated by
`scripts/merge_master/generate_specs_floor_block.py` at openxFactory
`2a3b29c8` — THIS pull request's own archive commit, the first tree in
existence carrying the new path. codexFactory `main` was re-verified at that
same commit by `git ls-remote` immediately before this advance rather than
assumed: it returned `bfb8bde39f61d3eb4a768cdc7117a3bbc1418d2d refs/heads/main`.

FIVE SITES MOVE, IN ONE LOGICAL CHANGE, because the tests fail if any of them
disagree:

  contracts/review-lane-pin.yaml               core_commit  79198ac4 -> bfb8bde3
  .github/workflows/merge-master-approval.yml  PINNED_CORE_COMMIT (same)
  .github/workflows/merge-master-approval.yml  core checkout ref: (same)
  .github/workflows/pytest-suite.yml           core checkout ref: (same)
  contracts/review-lane-floor-snapshot.yaml    re-copied at the new commit

and the snapshot's declared witnesses move with it: `entry_count` 64 -> 65,
`sha256` 07e9f64d... ->
13f650b663f5dc836fa268ada40d5e5de7c38c8ede337d840f8004aeefd7312a.

THE SNAPSHOT IS A WITNESS AND WAS NOT HAND-EDITED (CSC-C7). It is a byte copy
of the floor at the pinned core, and BYTE IDENTITY WAS GATED, not asserted:
the completion script REFUSES unless (a) `bfb8bde3` is an ancestor of
codexFactory `origin/main` and (b) the sha256 of
`git show <sha>:scripts/merge_master/openxfactory-review-authority-floor.yaml`
equals the recorded value. Both gates passed. Verified three independent ways:
sha256 as above over 12599 bytes; GIT'S OWN CONTENT ADDRESSING — the vendored
file's blob sha equals the one codexFactory's tree carries at that path and
commit, `39289deafa9cce609e2f7600a8996cac683cad1e`; and the freshness
comparison in `test_floor_snapshot.py` — which SKIPS when the core is absent —
was additionally run WITH the core on disk (`PINNED_CORE_CHECKOUT=...`):
56 passed, ZERO skipped, so the byte-for-byte assertion CI performs actually
ran here.

THE FLOOR GREW BY EXACTLY ONE AND IT IS THE SPEC. No chokepoint arrives with
it. The whole diff against `79198ac4`: one added entry line, the generated
block's three regeneration fields (`generated_at` and its `--ref`
`c236c6b1` -> `2a3b29c8`, `entry_count` 56 -> 57), and the document's two
"8 + 1" self-descriptions moving 64 -> 65. The EIGHT hand-reasoned chokepoints
are untouched. Coverage MEASURED on this branch's tree: 57 tracked paths under
`openspec/specs`, all 57 floored, 0 uncovered, 0 dead.

THE PIN NAMES `bfb8bde3` WHILE THE FLOOR WAS GENERATED AT `2a3b29c8`, AND THE
BRANCH HEAD IS LATER THAN BOTH — the same shape #647 shipped, and MEASURED
rather than waved through: `git ls-tree -r --name-only <ref> openspec/specs`
returns the IDENTICAL 57-path set at `2a3b29c8` and at the head (the commit
between them is a Copilot fix to one archived-change file, which promotes
nothing), and `2a3b29c8` is an ancestor of the head.

NO COLLISION, MEASURED. `main` (`96aa61a3`) carries 56 tracked spec paths and
this branch 57 — main's set is a PROPER SUBSET, so no spec exists on main that
`2a3b29c8` failed to enumerate. The two commits main gained since this branch
was cut (#651 doc-health preflight, #648 nightly-refresh source seal) promote
no capability and add no spec, so neither can shorten the floor. One
regeneration at one tree is sufficient and the second-lander remedy is not
engaged.

HISTORICAL PROSE PRESERVED. The four live literals moved; every remaining
`79198ac4` in these files is history describing the 12:25 advance (PR #195,
its regeneration tree, the ancestry chain) and was left standing. The prior
notes gained a forward pointer rather than a rewrite.

LIVE CLAIMS RE-MEASURED, NOT CARRIED OVER. The divergence paragraph's counts
(sixty-four -> sixty-five, fifty-six -> fifty-seven spec paths), the
`pinned_members` counts (SIXTY-FOUR -> SIXTY-FIVE, FIFTY-SIX -> FIFTY-SEVEN),
and the snapshot's `generated_at` non-member note (`c236c6b1` -> `2a3b29c8`)
all move with the pin. Historical sentences do not.

LOCKSTEP RE-MEASURED RATHER THAN CARRIED OVER: both xFactory judging surfaces
still name `f4702f64`, read 2026-09-04 AT THIS ADVANCE directly off xFactory
`main` (`merge-master-approval.yml` line 146 and `council-convening-lane.yml`
line 302), so `lockstep.status` stays `diverged` and the obligation to
converge at a future re-point ceremony stands undischarged. THE GAP WIDENED BY
ONE MORE ENTRY, not by a new kind of divergence. That value is written SHORT
in the prose on purpose: this file's own guard
`test_the_pin_carries_exactly_one_commit_shaped_value` permits exactly ONE
40-hex token in it, and that one is `core_commit` — writing `f4702f64` in full
reds the required suite, which is how the constraint was found rather than
assumed.

TWO ADVANCES IN ONE DAY IS THE FEATURE'S CADENCE AND A THIRD IS ALREADY OWED.
Every openxFactory archive promoting a NEW capability owes one, because the
floor is an EXACT ENUMERATION. `add-subject-establishment` paid it at
12:25:19Z and this packet at 14:05:07Z, one hundred minutes apart. The sibling
`create-medxpractice-overlay-boundary` will take the floor 65 -> 66; folding
it into #197 would have put a DEAD entry on this tree, which is the state
LS-A2 exists to prevent. One regeneration per landed tree, in order.

Validated: `pytest tests/review_lane_pin` = 55 passed, 1 skipped, 18 subtests
(that one skip being the freshness comparison, separately exercised green with
the core present: 56 passed, 0 skipped); `openspec validate --all --strict` =
90 passed, 0 failed; `scripts/validate-sequenced-after.py .` passed and
`--ledger-diff` consistent (165 rows); `pytest tests/sequenced_after` = 162
passed; doc-health `--single-repo` finding set still BYTE-IDENTICAL to main
(6 critical / 4 error / 27 warning / 16 info, 0 new regressions); all four
YAML files re-parse.

Refs #608

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv
Lane: openxfactory-max001
brettheap added a commit that referenced this pull request Sep 4, 2026
…lay-boundary

Lane: openxfactory-max001

MERGED, NOT REBASED — force-pushing is forbidden here and this branch carries
merged bot rounds. Taken because #654 read CONFLICTING at `dd76e7fe`, and a
conflicting pull request does not DISPATCH its `pull_request` workflows at all:
only `merge-master-approval` (a `pull_request_target` lane) ran at that head,
which is why the REQUIRED `pytest-suite` never appeared rather than never
finished.

MAIN GAINED THREE COMMITS since `48dc9b67`: #651 (doc-health preflight
initializing MedxEHR's nested submodules), #648 (nightly-refresh source seal)
and #643 (ARCHIVE of `add-consumer-identity-namespace`). Only the third
collides, and only in two files.

ONE CONFLICT, IN README.md, AND BOTH SIDES ARE KEPT. Two archives landed the
same day and each inserted its row at the top of `Archived changes:`. Resolved
by keeping BOTH rows — this packet's above `add-consumer-identity-namespace`'s,
newest-lander first, which is the order that list already reads in. Neither
row is edited, shortened or merged into the other. The two ACTIVE-section
removals (one per side) sat in different regions and auto-merged; verified
after the fact that neither active row survives.

THE LEDGER AUTO-MERGED AND THE ROWS ARE NAMED RATHER THAN COUNTED. Against
`origin/main` the merged ledger differs in EXACTLY ONE row, and it is ours:

  create-medxchart-overlay-boundary: active -> archived, moved_by "#654"

Main's own row from #643 —
`add-consumer-identity-namespace: {state: archived, class: co-modifier, ..., moved_by: "#643", moved_on: "2026-09-04"}`
— is carried verbatim from main's side, unstamped by this lane. No partner
flipped on either side, so NO MOVEMENT LOG ENTRY IS OWED by this merge, and
`tests/sequenced_after/test_sweep.py` is byte-identical to main's copy, so
main's MOVEMENT LOG lines are retained verbatim rather than re-derived.

THE FIVE PIN SITES ARE KEPT AT OURS, DELIBERATELY. Main did NOT advance its
review-lane pin in these three commits: it still names `79198ac4` with the
64-entry floor. `bfb8bde3` is STRICTLY AHEAD of it (codexFactory PR #197 merged
at 14:05:07Z, with `79198ac4` as an ancestor), and taking main's side would
re-introduce the very `floor_incomplete` refusal this branch exists to repair.
So `core_commit`, both `merge-master-approval.yml` literals,
`pytest-suite.yml`'s core checkout `ref:` and the vendored snapshot
(`entry_count` 65, `sha256` 13f650b6…) all stand at ours. Nothing of main's is
discarded by that: `bfb8bde3` contains `79198ac4` by ancestry.

NO FLOOR COLLISION, MEASURED. #643 promotes into an EXISTING capability
(`credential-contracts`, a MODIFIED block) and adds NO spec path, so `main`
still carries 56 tracked paths under `openspec/specs` against this branch's 57
— main's set remains a PROPER SUBSET, no spec exists on main that `2a3b29c8`
failed to enumerate, and the second-lander regeneration remedy is not engaged.

Gates on the merged tree: `openspec validate --all --strict` 89 passed, 0
failed (32 active + 57 specs — one fewer active than before the merge because
#643 archived its own); `validate-sequenced-after.py .` passed (32 active, 2
declaring); `--ledger-diff` consistent, 165 rows, active co-modified/sole
20/13 -> 19/13 on #643's archive; `pytest tests/review_lane_pin
tests/sequenced_after` 217 passed, 1 skipped, 18 subtests, and
`tests/review_lane_pin` 56 passed / ZERO skipped with `PINNED_CORE_CHECKOUT`
set, so the byte-for-byte snapshot comparison ran here too.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv
Lane: openxfactory-max001
brettheap added a commit that referenced this pull request Sep 9, 2026
…6) (#831)

* doc-health nightly: mint one App installation token per governed submodule owner

The nightly has produced 0 artifacts since 2026-09-05, from two defects in
the same block of `doc-health-reusable.yml` — the credential rewrites that
let `Init governed submodules only` clone a submodule set that spans
organizations. Both are fixed here; neither alone would return the run to
green.

DEFECT A, opensoft/xFactory#366 — one foreign owner only. `Detect foreign
submodule owners` refused any count above one, because
`actions/create-github-app-token` mints ONE owner per step and the second
mint+rewrite pair "has to be written by hand". The aggregation then admitted
a second: commit 99f1643 ("Repoint the LedgerxFactory submodule at
ledgerXfactory, its own enterprise org", 2026-09-07 16:49Z) left
`xFactories/MedxFactory` and `xFactories/MedxEHR` on `MedxSoft` and moved
`xFactories/LedgerxFactory` to `ledgerXfactory`, so from 2026-09-08 the
nightly died in that step before a single bundle was built (opensoft/xFactory
runs 34180399272, 34303636250). The pairs are now written: three numbered
mint slots, guarded on their own slot output, and one rewrite step that
credentials every filled slot. Above the slot count it still refuses, still
names the owners, and now names the exact edit that raises the ceiling.

DEFECT B — one URL FORM only. Both rewrites keyed on `[email protected]:`, and
`xFactories/MedxEHR`'s own `.gitmodules` declares its `spec`/`code` legs as
`https://github.com/MedxSoft/MedxEHR-{spec,code}.git`. So the first nightly
after the nested-leg init landed (#651, `b4216821`, 2026-09-04 13:30Z) died
`fatal: could not read Username for 'https://github.com': No such device or
address` — runs 33939303830 (09-05), 34006720351 (09-06), 34076748501
(09-07), the three nightlies before defect A moved the failure one step
earlier. `.gitmodules` is the authority on the URL as well as the owner and
is free to spell either form, so each owner is credentialed in both.

WHAT IS NOT CHANGED. The broad `[email protected]:` org rewrite stays and stays
broad — longest prefix wins, so the per-owner keys narrow it rather than
replace it, and the zero-foreign and one-foreign paths behave exactly as
before. The App's permissions are untouched: the same `XFACTORY_APP_ID` /
`XFACTORY_APP_PRIVATE_KEY` pair, no `permission-*` inputs, no
`|| github.token` fallback on any foreign mint. The self owner is
deliberately NOT given an https key: every `opensoft`-owned governed
submodule and every nested leg the init touches under one is declared
`[email protected]:`, and a narrow `https://github.com/opensoft/` key would also
capture the checked-out repository's own origin URL that the report-delivery
lanes push through.

ONE OPERATOR ACT REMAINS, AND IT NOW SAYS SO. Measured 2026-09-09 as an
admin of all three organizations: the `openxfactory` App (id 4253636) is
installed on `opensoft` (installation 145372182, all repositories) and on
`MedxSoft` (157085693, all repositories) — and `ledgerXfactory` has NO App
installations at all (`GET /orgs/ledgerXfactory/installations` →
`total_count: 0`). `create-github-app-token` cannot mint for an organization
it is not installed on, so slot 2 will not resolve until someone installs the
App on `ledgerXfactory`. `LedgerxFactory` is private, so there is no
anonymous fetch to fall back to, and `SUBMODULE_TOKEN` is not configured on
opensoft/xFactory. Rather than sweep a corpus with a governed repository
silently missing — a gate, quietly narrowed — the rewrite step fails the run
with a finding that names the organization, the slot, and the operator act.
The mint steps carry `continue-on-error` for exactly that reason: it is not a
fallback, it is what lets the failure be named instead of being this action's
own API error.

VALIDATION. `tests/doc-health/test_submodule_owner_tokens.py` (19 tests):
structural assertions that the slot count is written in ONE place and equals
the mint steps present in BOTH jobs, that each mint reads its own slot and
defers its failure, that both URL forms are written per owner with `--add`
(`insteadOf` is multi-valued), that the broad rewrite stays broad, and that
the two jobs' blocks are byte-identical after a YAML round trip; plus
behavioral tests that RUN the two shell steps against synthetic `.gitmodules`
trees and read the resulting git config back through `git ls-remote
--get-url`, because "longest prefix wins" is a property of git. Zero, one,
two and four foreign owners are all exercised, as is a filled slot whose
token is empty. 19 passed, 0 skipped; the 277 tests of every module that
reads this workflow pass unchanged.

Refs opensoft/xFactory#366, opensoft/xFactory#346, #591

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun

* Take a review note on the rewrite step: a slot count that did not arrive is its own refusal

`SLOTS` reaches the rewrite step from the detection's output. An empty or
non-numeric value would make the loop a no-op — `[ 0 -lt "" ]` aborts under
`set -e` with git's own "integer expression expected", and `[ 0 -lt 0 ]`
simply loops zero times — and in the second shape the step reports SUCCESS
having credentialed no owner at all. That is a silent pass on exactly the
path opensoft/xFactory#366 is about, so the step now refuses by name instead,
in both jobs. Two tests, one behavioral over the empty/zero/non-numeric
values and one structural for the twin.

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun

* Take Copilot's placeholder note, and inherit the environment the hermeticity shim lives in

TWO REVIEW NOTES, ONE OF THEM DECLINED IN HALF.

Copilot asked for two things about the behavioral tests: stop using
`ghs_`-shaped placeholder tokens, and stop asserting the full rewritten URL.

The first is taken. A `ghs_`-prefixed literal reads as a real installation
token to a secret scanner and to a human, and neither cost is worth the
realism; the placeholders are now `medx-installation-token`,
`ledger-installation-token` and `caller-org-token`, which also say what they
are at the point of failure.

The second is declined, with the reason written next to the fixture: "longest
prefix wins" is precisely a claim about the WHOLE resolved string, so a
substring or suffix check would still pass for a rewrite that routed the right
owner to the WRONG token — the exact failure this file exists to catch.
`x-access-token:` stays in the expectation because it is the literal git
rewrite target, not a credential.

Separately, the two subprocess fixtures no longer hand the steps a hardcoded
`PATH`. `tests/hermeticity.py` works BY PATH, so replacing the environment
stepped around the shim, and a hardcoded PATH is also how a suite that passes
on a runner fails on a developer's machine. They now inherit the environment
and remove only what could leak in — the ambient git config vars and every
name the steps themselves read.

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun

* One place builds the credentialed URL the rewrite must produce

Copilot's second round (it recommends approval; this was its remaining note):
the three behavioral tests each typed a full credential-bearing URL as a
literal, which some review and CI environments redact to `******github.com/...`
and which is three places for the expectation to drift from the rewrite it
checks. A `credentialed(token, owner, repo)` helper now builds it, so the
routing a test claims is readable as "this owner routes to this token" instead
of having to be reassembled by eye.

The half asked for and NOT taken: raising a custom AssertionError that does not
print the URLs. Strict equality on the WHOLE string is the "longest prefix
wins" claim, and pytest's own diff is the most useful thing a reader gets when
it breaks; suppressing it would trade a real diagnostic for the appearance of a
secret that is not one — these are placeholder strings that never leave a
`GIT_CONFIG_GLOBAL` under `tmp_path`.

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun

* Take Codex P2: the documented PAT fallback gets the https form too

Codex, on PR #831: when `XFACTORY_APP_PRIVATE_KEY` is absent but the caller
supplies the documented `SUBMODULE_TOKEN`, every per-owner mint is skipped by
its `HAS_APP_KEY` guard — and with it the only step that wrote an
`https://github.com/<owner>/` rewrite. The pre-checkout broad rewrite gives
the PAT the ssh form ONLY, so a private https leg such as MedxEHR's `spec`
stayed unauthenticated and `Init governed submodules only` still failed
despite a valid fallback credential. That is defect B of xFactory#366 living
on in the fallback path, and the finding is correct.

Codex offered two remedies and this takes the first: honor the fallback rather
than delete it from the contract. A new step, guarded on `HAS_APP_KEY !=
'true'`, credentials the https form for every owner `.gitmodules` declares,
from `SUBMODULE_TOKEN || github.token` — the same chain the broad step uses.
A PAT is not an installation token, so it needs no slot, only the owner list;
the detection now also emits `owners_all` (self and foreign, deduplicated) for
exactly this reader.

SCOPED TO DECLARED OWNERS, WHICH IS WHY IT IS A SEPARATE STEP rather than a
second line in the pre-checkout rewrite. A broad `https://github.com/` key
would also capture the checked-out repository's own origin URL that the
report-delivery lanes push through; per-owner keys cannot reach it — and
`.gitmodules` is not readable before the checkout anyway.

Seven tests, four of them behavioral over the real step: the private https leg
resolves to the fallback token, a self-owned https leg does too, an owner
nobody declared is left untouched (the origin case), an empty owner list is a
no-op rather than a failure, and the App path and the fallback path are proven
mutually exclusive. 28 passed / 0 skipped; 187 more in every module coupled to
this workflow, including the openXwallet lane-wiring order guard around `Init
governed submodules only`.

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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