Skip to content

Lower the openDox back-import ratchet after BUILD slice 2, and re-pin to the commit it measures - #9

Merged
brettheap merged 4 commits into
mainfrom
build/ratchet-after-slice-2
Sep 11, 2026
Merged

brettheap merged 4 commits into
mainfrom
build/ratchet-after-slice-2

Conversation

@brettheap

@brettheap brettheap commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)

The openXdox half of BUILD slice 2. It is required for this leg's validate to stay green once opensoft/openDox-code #9 lands, and it must land in the same window — the ratchet refuses an unrecorded FALL exactly as it refuses a rise.

Refs opensoft/openXfactory#656

The branch also carries a merge of openXdox-code main 208656fb (BUILD slice 3), taken as a merge commit because the repository ruleset declines a force push to an already-published branch — see § 6.


1. Two moves, and they are one act

was now
pyproject.toml opendox @ git+…@8e9ffa628e96 @da8aae969b40 — openDox-code #9's MERGE sha (= main after landing)
OPENDOX_BACK_IMPORTS 13 import-time / 19 deferred over six modules 9 / 19 over five
     "opendox/branch_session.py":    (1, 7),
-    "opendox/cli.py":               (5, 1),
+    "opendox/cli.py":               (3, 1),
     "opendox/serve.py":             (5, 2),
     "opendox/serve_project.py":     (0, 2),
-    "opendox/serve_workbench.py":   (1, 7),
-    "opendox/workbench.py":         (1, 0),
+    "opendox/serve_workbench.py":   (0, 7),

workbench.py reached (0, 0) and is DROPPED from the table — which is the refusal's own instruction ("drop a module from the table when it reaches (0, 0)"), not a liberty taken here.

The pin and the table are one act because the table is measured THROUGH the pin. _pinned_opendox_root() reads find_spec("opendox"), and validate installs whatever this line names. Bumping one without the other is the state the ratchet exists to refuse. The lane re-bumps this line to the MERGE sha once openDox-code #9 lands — a head sha in a pinned dependency is correct for review and wrong for main.

2. Why this PR is REQUIRED and not merely tidy — perturbation-proved

The old census, restored against the new openDox (both legs installed, pip install -e each):

E  Failed: openDox→openXdox back-imports FELL, per module (import-time, deferred):
   ['opendox/cli.py: (5, 1) -> (3, 1)',
    'opendox/serve_workbench.py: (1, 7) -> (0, 7)',
    'opendox/workbench.py: (1, 0) -> (0, 0)']
   — good, and the census in this file is now untrue. Update OPENDOX_BACK_IMPORTS to
   the observed values in the same act …
1 failed in 0.39s

That is this leg's required check going red on somebody else's merge, which is exactly what the ratchet was landed to make impossible to do quietly.

3. What openDox-code #9 actually did, and the nine it did not

Four of the thirteen, through a late seam of openDox's own (src/opendox/consumer_reach.py — the shape § 4.1 landed HERE, mirrored, including the narrow ModuleNotFoundError-by-name handling from its fix round 2): cli.py :72 :74, serve_workbench.py :49, workbench.py :70. opendox.workbench and opendox.serve_workbench now import with no openxdox installed.

None of the nine that remain is waiting on an author. Each needs a line openxFactory's docs/opendox-carve-manifest.yaml does not declare for its row — a multi-line import statement's continuation lines, the DashboardHandler mixin base list, the profile_openxfactory composition point — so all nine are owed a declared-edit ruling, enumerated on openDox-code #9 § 4.

4. The blind spot this slice found in this file's census — recorded, not papered over

def _demotion_retention_candidates(..., records_dir: str = gate_console.DEFAULT_RECORDS_DIR):

A default argument is evaluated when the def executes, i.e. at import time. _census counts ast.Import / ast.ImportFrom nodes and a default argument is neither, so a module can reach (0, n) in this table and still fail to import without openXdox. branch_session.py has 7 such sites and serve.py 2; both conversions were made at openDox-code, measured, and reverted rather than shipped as a census that reads better than the tree.

No change is proposed to _census here, and that is deliberate. It measures the right thing for what this leg can measure — a repository it consumes and does not write — and widening it would not close the gap anyway: the honest test is "does the module import", and this leg cannot run it. cli_gate.py:46 imports opendox.branch_session, which imports openxdox.gate_console, so importing openDox's modules from here re-enters this package. openDox-code #9 therefore asserts it at home, in a subprocess with openxdox blocked at the finder, and the comment above the table names the gap and points there. Whoever words the declared-edit ruling should see it; § 4.1's owner may want it in the surface enumeration too.

5. Validators

$ python -m pytest -q tests/test_leg_shape.py tests/test_dependency_direction.py --noconftest
24 passed in 1.42s

run in a venv carrying BOTH legs — openDox-code at #9's head (the commit this pin now names) and this branch — which is what makes the ratchet's 9/19 a measurement rather than a transcription.

FLOOR PART 1, the arrival verifier, phase B, on this branch:

OK …/xdox: openxdox_code (opensoft/openXdox-code) at opensoft/openxFactory@b075fd91dc8f
(opendox-carve-0), phase B — 92 row(s) arrived, 9 digest(s) verified, 81 declared-edit
row(s) within their lines, 4 unapplied; 6 of 6 declared replica(s) verified (byte-identical,
or — where the row declares lines — differing only on them); 99 file(s) under scripts,
src/openxdox, tests with none undeclared (1 scaffold, 0 replica, 2 created); scaffold
admissions checked against 3487e476d782
exit=0

Every figure is identical to § 4.1's landed line — 92 / 9 / 81 / 4 unapplied / 6 of 6 / 99 files / 2 created. Same flags as § 4.1: --dest-base 3487e476d782, the six --replica-at, and --allow-created src/openxdox/consumer_reach.py --allow-created tests/test_dependency_direction.py. Neither file this PR touches is under a declared root, so no row moves.

6. Sibling slice 3 has LANDED, and this branch carries it

build/declare-function-body-deps (#8, slice 3 — jsonschema, and the deferred allowlist now DERIVED from pyproject.toml via tomllib + packages_distributions()) merged to main as 208656fb432c6e5b6e00304a648e5313dc6be8de while this branch was open. It touches both of these files.

This branch has taken origin/main as a MERGE, not a rebase — the repository ruleset declines a force push, so a rebased history could not be pushed to an already-published branch. The merge is clean: slice 3's hunks are the allowlists at the top of the file and the dependency block's comment; this one's are OPENDOX_BACK_IMPORTS at 253+ and the opendox @ git+… line. Against main 208656fb, this branch's whole diff is still the two moves in § 1:

 pyproject.toml                     |  2 +-
 tests/test_dependency_direction.py | 47 ++++++++++++++++++++++++++++----------

Both validators in § 5 were re-run after the merge, in a venv that also carries jsonschema>=4.18 as slice 3's derived allowlist now requires — 24 passed, and the arrival line reproduces unchanged.

7. What this pull request does not touch

Nothing in openxFactory: no manifest, no pin file, no gitlink, no openspec/changes/. No moved_verbatim row, and no row at all — both files are outside this destination's declared roots.

🤖 Generated with Claude Code

Summary by Sourcery

Align the openDox dependency pin and back-import ratchet with BUILD slice 2.

Enhancements:

  • Update the recorded openDox back-import ratchet to reflect BUILD slice 2 reductions, including removing the fully resolved workbench module.
  • Document the measured dependency changes and the census limitations for the pinned openDox revision.

Build:

  • Re-pin the openDox dependency to the BUILD slice 2 commit being measured.

… to the commit it measures

openDox-code #9 removes four of the thirteen import-time `openxdox` reaches
through a late seam of openDox's own. The ratchet in
tests/test_dependency_direction.py refuses an unrecorded FALL as well as a
rise, so without this commit this leg's required `validate` goes RED the
moment that lands — proved here by restoring the old census against the new
openDox:

  Failed: openDox→openXdox back-imports FELL, per module (import-time,
  deferred): ['opendox/cli.py: (5, 1) -> (3, 1)',
  'opendox/serve_workbench.py: (1, 7) -> (0, 7)',
  'opendox/workbench.py: (1, 0) -> (0, 0)'] — good, and the census in this
  file is now untrue.

Two moves, and they are one act:

  pyproject.toml   opendox @ git+…@8e9ffa628e96 -> @f03988556643
                   (openDox-code #9's head; the lane re-bumps to the MERGE
                   sha once #9 lands — the ratchet measures whatever this
                   line names, so the two must not drift)

  OPENDOX_BACK_IMPORTS   13 import-time / 19 deferred over SIX modules
                      -> 9 import-time / 19 deferred over FIVE
                   cli.py (5,1)->(3,1); serve_workbench.py (1,7)->(0,7);
                   workbench.py (1,0)->(0,0) and therefore DROPPED from the
                   table, which is what the refusal above instructs.
                   branch_session.py, serve.py and serve_project.py unmoved.

The comment above the table now also records the nine that remain and WHY
none of them is waiting on an author: each needs a line openxFactory's
docs/opendox-carve-manifest.yaml does not declare for its row, so they are
owed a declared-edit ruling, enumerated on openDox-code #9 § 4.

And it records this census's one blind spot, found by slice 2 rather than
reasoned about: `_census` counts ast.Import / ast.ImportFrom nodes, so a
DEFAULT ARGUMENT that reaches the consumer (`records_dir: str =
gate_console.DEFAULT_RECORDS_DIR`) is invisible to it — branch_session.py has
7 such sites and serve.py 2. Converting their imports would have lowered this
census while the modules still could not be imported without openXdox. Both
conversions were made, measured and reverted at openDox-code, and openDox-code
now asserts the property directly (tests/test_consumer_reach.py imports each
converted module in a subprocess with `openxdox` blocked). That assertion
belongs there, not here: this leg measures a repository it does not write, and
cannot import openDox's modules to find out — `cli_gate` imports
`opendox.branch_session`, which imports `openxdox.gate_console`.

Arrival verifier, phase B, on this branch: OK — every row figure identical to
§ 4.1's landed line (92 / 9 / 81 / 4 unapplied / 6 of 6 / 99 files / 2
created).

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 11, 2026 01:04
@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR atomically advances the openDox pin to BUILD slice 2 and lowers the measured openDox→openXdox back-import ratchet, including removal of the zero-count workbench entry and documentation of the census limitations; validation confirms the updated measurement remains consistent after the sibling slice 3 merge.

Flow diagram for the openDox back-import ratchet update

flowchart LR
    Pin[openDox dependency pin<br/>f0398855] --> Measure[_pinned_opendox_root]
    Measure --> Census[OPENDOX_BACK_IMPORTS census]
    Census --> Ratchet[validate ratchet]
    Ratchet --> Result[9 import-time / 19 deferred<br/>over five modules]
    Result --> Drop[Drop workbench.py<br/>after reaching 0 / 0]
Loading

File-Level Changes

Change Details Files
Re-pin the openDox dependency to the BUILD slice 2 commit and update the back-import ratchet to its measured lower counts.
  • Change the git dependency pin to openDox-code commit f03988556643.
  • Record the measured reduction from 13/19 across six modules to 9/19 across five modules.
  • Remove workbench.py after its measured count reached (0, 0), and adjust cli.py and serve_workbench.py entries.
  • Expand the ratchet documentation to explain the slice, remaining declared-edit work, and the census blind spot around import-time default arguments.
pyproject.toml
tests/test_dependency_direction.py
Preserve validation coverage for the new pinned measurement and the merged sibling slice.
  • Validate the ratchet against both dependency legs installed at the pinned commits.
  • Run the dependency-direction and leg-shape tests successfully after merging slice 3.
tests/test_dependency_direction.py

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

…lice-2 ratchet branch

Slice 3's derived deferred-allowlist and this branch's ratchet lowering touch
the same two files and do not overlap: its hunks are the allowlists at the top
of tests/test_dependency_direction.py and the dependency block's comment, this
one's are OPENDOX_BACK_IMPORTS and the `opendox @ git+…` pin line. Merged
rather than rebased because this repository's ruleset declines a force push.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@brettheap
brettheap marked this pull request as ready for review September 11, 2026 01:05
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Sep 11, 2026

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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

Replace the unmerged openDox revision with its actual merge commit before approval.

Pull request overview

Updates the openDox dependency pin and back-import ratchet for BUILD slice 2.

Changes:

  • Updates the openDox Git dependency pin.
  • Lowers the recorded back-import counts and removes the completed workbench entry.
File summaries
File Description
tests/test_dependency_direction.py Records the reduced back-import counts.
pyproject.toml Updates the openDox dependency pin.
Review details

Suppressed comments (1)

pyproject.toml:84

  • This pins opendox to the head of openDox-code #9, which is still an open/draft PR rather than a merge commit. That contradicts the pin contract immediately above (“Pinned to the merge commit, never a range or branch”) and leaves validate/main resolving an unlanded revision; please wait for #9 to merge and replace this with its actual merge SHA before merging this change.
# jsonschema, BUILD-arc slice 3 (opensoft/openxFactory#656 comment 5627156620,
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

Copilot AI review requested due to automatic review settings September 11, 2026 01:06
`f03988556643` -> `551ad4d5a18f`. openDox-code #9 took three review findings
(a refusal message that named a remedy the extension points cannot provide;
a subprocess test that read ANY nonzero exit as "still reaches the consumer";
a fake `openxdox` parent left in `sys.modules`). None of the three touched an
import statement, so the census this file records is unchanged at
9 import-time / 19 deferred over five modules — re-measured against the
amended tree, not carried:

  branch_session.py (1, 7) | cli.py (3, 1) | serve.py (5, 2)
  serve_project.py  (0, 2) | serve_workbench.py (0, 7)

  python -m pytest -q tests/test_leg_shape.py tests/test_dependency_direction.py --noconftest
  24 passed

The lane still re-bumps this line to the MERGE sha once openDox-code #9 lands.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

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

Update the dependency pin and provenance, and qualify or correct the census limitation claim.

Review details

Suppressed comments (3)

pyproject.toml:106

  • The linked openDox-code #9 has advanced past f039885...; its current head is 551ad4d5a18fe97bce925e00d74ded615eafd418, whose follow-up fixes the consumer-reach refusal and its subprocess check. Pinning the earlier commit leaves this leg on the pre-fix behavior and contradicts the description that this line tracks #9's head; update it to the current head (then to the merge SHA when #9 lands).
    "opendox @ git+https://github.com/opensoft/openDox-code@551ad4d5a18fe97bce925e00d74ded615eafd418",

tests/test_dependency_direction.py:310

  • This now describes f03988556643 as #9's head, but the linked PR has moved to 551ad4d5a18fe97bce925e00d74ded615eafd418. Once the pin is updated, keep this provenance text in sync so the measured commit and the dependency source are unambiguous.
#: LOWERED BY BUILD SLICE 2 — `opensoft/openDox-code` #9, head `551ad4d5a18f`,
#: which this file's pin now names (`pyproject.toml`). The census RULED

tests/test_dependency_direction.py:334

  • The new claim that default arguments are this census's “one blind spot” is not true for the existing walker: it only recurses through list fields whose elements are ast.stmt, so it also skips imports in module-level except handlers and match cases (ExceptHandler/match_case are AST containers, not statements). Those imports can execute during module import and evade this ratchet; either make _census recurse through those containers with tests, or qualify this as only the blind spot currently observed.
#: WHICH IS THIS CENSUS'S ONE BLIND SPOT, RECORDED RATHER THAN PAPERED OVER:
#: `_census` counts `ast.Import` / `ast.ImportFrom` nodes, and a default
#: argument, an annotation or a decorator that reaches the consumer is none of
#: those. A module can therefore reach (0, n) here and still fail to import.
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 11, 2026 01:10

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

Replace the temporary upstream PR-head pin with the merge SHA and rerun the ratchet.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

pyproject.toml:106

  • Before this can land on main, replace the temporary PR-head pin with the merge SHA of openDox-code #9. GitHub currently reports 551ad4d5a18fe97bce925e00d74ded615eafd418 as that PR's unmerged head, and the PR description itself says a head pin is wrong for main; otherwise this leg's released installs will depend on an unmerged upstream branch. Re-run the ratchet after the merge SHA is available.
    "opendox @ git+https://github.com/opensoft/openDox-code@551ad4d5a18fe97bce925e00d74ded615eafd418",
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread pyproject.toml Resolved
openDox-code #9 merged to main at da8aae969b4057bd46d2550c265e5bb363142458.
Repoint pyproject.toml's opendox pin from the review-time PR head
(551ad4d5a18f) to that merge sha, and update the ratchet comment in
tests/test_dependency_direction.py to name it.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 11, 2026 01:17
@sonarqubecloud

Copy link
Copy Markdown

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

Sourcery assessment

Approved.

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

Update the PR description to match the merge SHA used by the dependency pin.

Review details

Suppressed comments (1)

pyproject.toml:106

  • The PR description still says this pin is 551ad4d5a18f (PR #9's head), but this changed line uses da8aae969b40... (the post-merge main commit). Since the ratchet is measured through the exact installed pin, please update the §1 table and related prose to the merge SHA actually used here, or change the pin if 551ad4d5a18f is intended.
    "opendox @ git+https://github.com/opensoft/openDox-code@da8aae969b4057bd46d2550c265e5bb363142458",
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap
brettheap merged commit 5da58ee into main Sep 11, 2026
4 checks passed
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