Skip to content

B1b: codexFactory is a foreign owner to the doc-health nightly — owner slot via the openxfactory App - #853

Merged
brettheap merged 1 commit into
mainfrom
realize/codexfactory-identity-b1b
Sep 9, 2026
Merged

brettheap merged 1 commit into
mainfrom
realize/codexfactory-identity-b1b

Conversation

@brettheap

@brettheap brettheap commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Lane: provenance-autonomous-merge

Slice B1b of adopt-codexfactory-repository-identity, assigned by the 6.5 precheck ruling on codeXfactory/codexFactory#279: https://github.com/codeXfactory/codexFactory/issues/279#issuecomment-5604370445 (2026-09-09T15:25Z, under the 15:24Z precheck that found the four unassigned occurrences).

tests/doc-health/test_submodule_owner_tokens.py:264,275,286,378 landed with #831 ("doc-health-nightly: mint one App token per foreign owner") after the four B-slice drafts forked at 7681e409, so the identity sweep never saw the file. Its three fixture rows spelled xFactories/codexFactory as [email protected]:opensoft/codexFactory.git and used it as the same-org / not-foreign / no-slot control. After the 2026-09-09 transfer that repository is a foreign owner to opensoft/openxFactory, so a bare respell would have left three tests asserting something now false — hence RENAME, non-mechanical.

What the production change turned out to be, and why only this

#831's mechanism derives the owners dynamically from the aggregation's .gitmodules and lets actions/create-github-app-token@v2 resolve the installation from its own owner: input. No organization is named anywhere in doc-health-reusable.yml, so the moved core needs no new line of detection logic and no new secret — only its installation, which exists:

org App installation note
MedxSoft 4253636 openxfactory 157085693 the one the workflow comment already records
ledgerXfactory 4253636 openxfactory 160353680 second owner, admitted by #831
codeXfactory 4253636 openxfactory 160352673 runbook step 1.6, created 2026-09-09, all repositories, contents: write

App 4253636 is the App behind XFACTORY_APP_ID (the org secret is visibility: selected to opensoft/xFactory, the nightly's caller). One App, one installation per organization — exactly the shape the slot mechanism assumes.

What the flip DOES consume is the spare slot. FOREIGN_OWNER_SLOTS was "3" for two owners, and the file states the reason in its own words: "one spare slot so the next repoint is a .gitmodules edit and not a red nightly." From opensoft/xFactory#376 the governed set spans three (MedxSoft, ledgerXfactory, codeXfactory), which fills all three and leaves the next repoint to red the nightly in the refusal step — the #366 failure again, one organization later. So the count moves 3 → 4, with a fourth mint step and a fourth OWNER_/TOKEN_ pair in both the prepare and finalize jobs. That is precisely the procedure #831's own refusal message prescribes, carried out ahead of the flip rather than after it.

Today's still-opensoft URL is unaffected: at two owners the detection behaves exactly as it does on main (test_two_foreign_owners_now_fill_two_slots, which is today's real aggregation tree).

Test changes

  • Same-org controls move to submodules that genuinely stayed in opensoft — xFactories/OpsxFactory and openxFactory. Not xFactories/MedxFactory, which the ruling's parenthetical suggested: measured against the aggregation's main .gitmodules, MedxFactory lives in MedxSoft, so it would have turned a one-foreign-owner tree into a two-owner one.
  • test_installs_are_not_governed_and_do_not_demand_a_slot respells its governed row to codeXfactory/codexFactory and now proves the governed filter by the difference between two foreign rows: the governed one takes a slot; the installs/ one reaches neither a slot nor owners_all.
  • The broad-rewrite assertion resolves [email protected]:codeXfactory/codexFactory.git to credentialed(<codeXfactory installation token>, "codeXfactory", "codexFactory") — its own installation, not the caller-org token it used to receive as a same-org repository — with a still-opensoft submodule kept in the test so the broad key is still proved to serve everything else.
  • New test_the_moved_core_becomes_a_foreign_owner_and_gets_a_slot: runs the detection over the aggregation's post-Tick 2.5: wallet-validation is now a REQUIRED check via org ruleset 21538893 #376 governed shape (six rows, three organizations) and asserts count 3, exit 0, all three owners in slots, a mint step present in both jobs for whatever slot the moved core lands in (position is sort -u + locale, so it is looked up, not assumed), codeXfactory in owners_all, and slot 4 still empty. It measures the invariant, not a literal pin.
  • The behavioral fixtures now read FOREIGN_OWNER_SLOTS out of the workflow instead of typing 3: the over-the-limit refusal case derives its owner count from the declared one (a literal 4 would have stopped being over the limit the moment slot 4 landed), and clean_env's leak list covers every slot rather than the three someone listed by hand.
  • Zero opensoft/codexFactory occurrences remain in the file, including in prose — the two comments that would have carried one are worded without it, so the sweep closes here rather than leaving a literal to disposition.

Coverage arithmetic

RENAME-class coverage at main: union 125/54 (B1–B4) + mapping key 2/1 (frozen by construction) + B1b 4/1 = 131/56.

Ordering

Lands AFTER #801 (merged e86eca35) and BEFORE opensoft/xFactory#376 (the aggregation .gitmodules flip); merge only on Brett Heap's word via lane provenance-autonomous-merge.

No path under openspec/ is touched, deliberately: the gated drafts #802/#805/#806 share that change's evidence file, and staying out of openspec/ keeps this PR outside the Rule 6 landing window.

Local verification

  • python3 -m pytest tests/doc-health -q → 1637 passed, 0 failed (371.7s). The changed file alone: 29 passed (28 tests before, 29 after).
  • The four other suites that read doc-health-reusable.yml (tests/openxwallet_pin/test_aggregation_lane_wiring.py, tests/avatar_runtime/test_ruled_values_pinned.py, tests/ideation-dashboard/test_nightly_lane.py, tests/ideation-dashboard/test_dashboard_source_seal.py) → 116 passed.
  • The full tests/ tree is left to the pytest-suite gate on this PR (~24 min there): the change adds passing tests only, so EXPECT_SKIPPED: "21" is unmoved and the MIN_SELECTED/MIN_PASSED floors only gain margin.

🤖 Generated with Claude Code

…he slot count keeps its spare

Lane: provenance-autonomous-merge

`tests/doc-health/test_submodule_owner_tokens.py` landed with PR #831 after
the four B-slice drafts forked, so the identity sweep never saw it. Its three
fixture rows spelled `xFactories/codexFactory` as
`[email protected]:opensoft/codexFactory.git` and used it as the SAME-ORG,
not-foreign, needs-no-slot control. After the 2026-09-09 transfer that
repository is a FOREIGN owner to `opensoft/openxFactory`, so a bare respell
would have left three tests asserting something now false — the reason the
6.5 precheck ruling (codeXfactory/codeXfactory#279, 2026-09-09T15:25Z) classes
these four occurrences RENAME, non-mechanical, and assigns them to slice B1b
rather than folding them into #801.

WHAT THE PRODUCTION CHANGE TURNED OUT TO BE, and why it is only this: #831's
mechanism derives the owners DYNAMICALLY from the aggregation's `.gitmodules`
and lets `actions/create-github-app-token@v2` resolve the installation from
its own `owner:` input, so nothing in the workflow names any organization and
the moved core needs no new line and no new secret. The App behind
`XFACTORY_APP_ID` is App `4253636` (`openxfactory`); it already carries
installation `160352673` on `codeXfactory` (all repositories, `contents:
write`, created 2026-09-09), beside `157085693` on `MedxSoft` and `160353680`
on `ledgerXfactory` — one App, one installation per organization, exactly the
shape the slot mechanism assumes.

What the flip DOES consume is the SPARE slot. `FOREIGN_OWNER_SLOTS` was "3"
for two owners, and the file says why in its own words: "one spare slot so the
next repoint is a `.gitmodules` edit and not a red nightly". From
opensoft/xFactory#376 the governed set spans THREE — `MedxSoft`,
`ledgerXfactory`, `codeXfactory` — which fills all three and leaves the next
repoint to red the nightly in the refusal step, the #366 failure again one
organization later. So the count moves 3 -> 4 with a fourth mint step and a
fourth `OWNER_`/`TOKEN_` pair in BOTH the prepare and finalize jobs, which is
the procedure the refusal message itself prescribes, carried out ahead of the
flip rather than after it. Today's still-`opensoft` URL is untouched by all of
this: at two owners the detection behaves exactly as it does on main.

The tests now measure that, not a literal:

  * the same-org controls move to submodules that genuinely stayed in
    `opensoft` — `xFactories/OpsxFactory` and `openxFactory`. NOT
    `xFactories/MedxFactory`, which the ruling suggested: it lives in
    `MedxSoft` and would have made a one-foreign-owner tree into a two-owner
    one;
  * `test_installs_are_not_governed_and_do_not_demand_a_slot` respells its
    governed row to `codeXfactory/codexFactory` and now proves the filter by
    the DIFFERENCE between two foreign rows — the governed one takes a slot,
    the `installs/` one reaches neither a slot nor `owners_all`;
  * the broad-rewrite assertion resolves
    `[email protected]:codeXfactory/codexFactory.git` to the codeXfactory
    INSTALLATION token, not to the caller-org token it used to get as a
    same-org repository, with a still-`opensoft` submodule left in the test to
    prove the broad key still serves everything else;
  * new `test_the_moved_core_becomes_a_foreign_owner_and_gets_a_slot` runs the
    detection over the aggregation's post-#376 governed shape: three owners,
    return code 0, all three in slots, the moved core's slot has a mint step
    in both jobs, and slot 4 is still empty. The pre-flip shape is not
    duplicated — it is already
    `test_two_foreign_owners_now_fill_two_slots`, which is today's real tree;
  * the behavioral fixtures read `FOREIGN_OWNER_SLOTS` out of the workflow
    instead of typing `3`, so the over-the-limit refusal case is derived from
    the declared count and the `clean_env` leak list covers every slot rather
    than the three someone listed by hand.

No `openspec/` path is touched, deliberately: the gated drafts #802/#805/#806
share that evidence file and this PR must stay outside the Rule 6 landing
window. The coverage arithmetic is in the PR body.

Local: `pytest tests/doc-health` 1637 passed / 0 failed (371s), of which this
file is 29 (28 before). The four other suites that read this workflow
(`tests/openxwallet_pin/test_aggregation_lane_wiring.py`,
`tests/avatar_runtime/test_ruled_values_pinned.py`,
`tests/ideation-dashboard/test_nightly_lane.py`,
`tests/ideation-dashboard/test_dashboard_source_seal.py`) 116 passed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 9, 2026 16:33

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

🔵 Needs a closer look

It changes CI authentication behavior in a reusable workflow and relies on external GitHub App installations/owner topology that can’t be fully validated from the diff alone.

Pull request overview

This PR updates the doc-health reusable workflow and its fixtures to treat codeXfactory as a foreign submodule owner after the codexFactory repository transfer, ensuring the nightly can mint an installation token for the moved owner while preserving a spare foreign-owner slot.

Changes:

  • Increase FOREIGN_OWNER_SLOTS from 3 → 4 and add the corresponding “Mint app token for foreign submodule owner 4” + OWNER_4/TOKEN_4 wiring in both prepare and finalize.
  • Update tests/doc-health/test_submodule_owner_tokens.py fixtures to reflect codeXfactory as a foreign owner, move same-org controls to stable opensoft submodules, and derive slot-count expectations from the workflow instead of hardcoding.
  • Add a new behavioral test asserting the “moved core” is detected as a foreign owner and is assigned a slot while keeping at least one spare slot.
File summaries
File Description
tests/doc-health/test_submodule_owner_tokens.py Updates fixtures/expectations for the moved owner, derives slot count from workflow, and adds coverage for the third-foreign-owner scenario.
.github/workflows/doc-health-reusable.yml Expands foreign-owner token minting capacity (slots 3→4) and wires slot 4 through mint + rewrite steps in both jobs.
Review details
  • Files reviewed: 2/2 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.

`codeXfactory`, so the repository these fixtures used as the SAME-ORG,
not-foreign, needs-no-slot control is now the very thing that DEMANDS a slot.
Respelling the string alone would have made three tests assert something now
false, which is why the ruling classes it a rename that is not a `sed`:
@brettheap
brettheap merged commit 4d6796e into main Sep 9, 2026
11 checks passed
@brettheap
brettheap deleted the realize/codexfactory-identity-b1b branch September 9, 2026 18: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.

2 participants