Skip to content

openDox-code#33 residue: clause (d)'s untested refusals, the fixture-identity marker, --force's success path, and a magic-looking key - #34

Merged
brettheap merged 4 commits into
mainfrom
chore/33-registered-residue
Sep 22, 2026
Merged

brettheap merged 4 commits into
mainfrom
chore/33-registered-residue

Conversation

@brettheap

@brettheap brettheap commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

The openDox-code residue #33's own Copilot review left REGISTERED: R4, F4, F5, F6

Four items, none of them this branch's own invention. All four were found by
Copilot's review of #33, registered rather than taken because that PR was
capped, and stand in PROGRESS-runtime.md as "Idle from here" waiting for a
new brief. This is that brief, taken as one hygiene pass since all four are
small and three of the four land in the same file.

# what origin
R4 Pin the triple has six refusals; three had cases; FAILURES != 0 and ERRORS != 0 had none #33, comment 5738550542
F4 @requires_git sits on the fixture-identity test, which runs no git same comment
F5 --force's SUCCESS path is asserted nowhere same comment
F6 --literal-pathspecs on the ls-tree probe: the magic half is real, the glob half was never measured #33, comment 5738611955

Every measurement below was taken by running the thing, on git 2.43.0 (this
container's version, the same one every prior measurement in this file cites).

R4 — clause (d)'s two untested refusals (0fb990d)

The step has six refusal branches. Three already had cases before this PR
(a missing report, a report below floor, one skip more than pinned); the
other two — FAILURES != 0 and ERRORS != 0 — had none.

Two cases added, using the same isolation technique
test_one_skip_more_than_pinned_is_a_refusal already established: total - 19 on the main report keeps SELECTED and PASSED both at or above their
floors and SKIPPED exactly pinned, with one test moved from passed to
failed (or to errored) rather than from collected to skipped, so only the
clause under test can fire.

Proved against the mutation each forbids, by neutering one clause in a
scratch copy of the workflow and re-running the suite:

mutation result
[ "$FAILURES" = "0" ] replaced with true only test_a_failure_is_a_refusal_with_both_floors_and_the_skip_count_met fails (4 passed, 1 failed)
[ "$ERRORS" = "0" ] replaced with true only its sibling fails (4 passed, 1 failed)
both restored all 5 pass

tests/test_triple_pin.py: 3 → 5 passed.

F4 — the fixture-identity test runs no git, and was marked as if it did (2b78d54)

@requires_git sat on
test_the_fixture_is_the_shipped_seed_and_not_a_description_of_it. Every
assertion in it is hashlib.sha256 over the module-level _DOCUMENTS,
_SHIPPED_SIZES and _SHIPPED_DIGESTS dicts — nothing in the test shells
out to git. The marker dropped the digest guard — the one check standing
between this file and a fixture that has quietly drifted from the seed it
claims to mirror — on any runner without git, and moved EXPECT_SKIPPED
there for a reason that was never this test's own.

Removed. This runner has git, so the skipif condition was already false and
the test already ran and already passed — the fix makes the skip count
honest on a runner that does not have git; it moves nothing here. No new
case: a marker fix has no mutation of its own to prove against.

F5 — --force's success path, asserted nowhere until now (2b78d54)

Every existing exclusion case in this file reaches a configured ignore
file through GIT_CONFIG_GLOBAL, which -c core.excludesFile= disables.
None of them ever lays a .gitignore down inside the populated state, or
writes to $GIT_DIR/info/exclude — the two entrances --force on the add
actually exists for. Two cases added, each measured against --force
removed
:

case shape with --force removed
test_a_gitignore_copied_in_with_the_corpus_does_not_shrink_it a real .gitignore (*.md) written into shipped / POPULATED before transpose the commit succeeds short (only .gitignore staged), and the byte read-back names notes/alpha.md as excluded
test_an_info_exclude_written_after_init_does_not_shrink_the_corpus _git monkeypatched to write $GIT_DIR/info/exclude (*.md) right after init, before add nothing at all is staged (every document here is .md, and there is no companion file to survive), so the total-exclusion ValueError fires

Restored, both pass and every document plus the .gitignore itself is
byte-verified into the transposition.

The correction commit 521abb7c cannot make

Commit 521abb7c's own message describes
test_an_exclusion_this_act_cannot_reach_is_named_and_not_a_git_error as
driving "$GIT_DIR/info/exclude, written after init". That is wrong.
Re-reading the test as it stands (and as it stood at 521abb7c): both of its
cases drive the same GIT_CONFIG_GLOBAL excludes file as the test before
it (*.md and beta.md), with the switch taken out of _HARDENING and
--force monkeypatched off — the only way left to reach the "cannot reach"
sentence once the repair is in place. No case anywhere before this PR drove
$GIT_DIR/info/exclude, which is exactly the gap F5 names.

That commit is already pushed and merged; its message cannot be edited. This
paragraph is the correction. I checked every docstring and doc file in this
tree for the same misdescription (grep -rn "info/exclude" --include="*.py" --include="*.md") — nothing else repeats it, so nothing else needed fixing.

tests/test_conformance_corpus.py (F4 + F5 + F6 together): 18 → 21
passed
.

F6 — a magic-looking key is not a repository problem (40b1f80, tested in 2b78d54)

The ls-tree probe inside _committed_blob's exception handler parses a
leading : in the key as git pathspec magic before it ever asks the
tree. A key shaped like :!doomed.md — never committed, ordinary in every
other way — makes cat-file fail exactly like any absent key (does not exist in 'HEAD'), and then makes the probe itself exit 128 with
pathspec magic not supported by this command: 'exclude'. Before this PR,
that 128 read as "HEAD or the repository itself is the problem" — true of
the exit status, false of the key, which was simply never committed.

--literal-pathspecs on the probe closes it:

ls-tree --name-only HEAD -- ':!doomed.md'
before exit 128, fatal: :!doomed.md: pathspec magic not supported by this command: 'exclude'
after exit 0, empty — indistinguishable from any other absent key

Why the glob half is not a bug

The same finding raised a second concern: a key containing * might be
glob-expanded by ls-tree and match more than the caller intended.
Measured, on a tree holding alpha.md, beta.md and a file literally named
a*.md, all at the same directory depth (no nesting to hide an answer
behind):

pathspec matched
-- '*.md' nothing — none of the three
-- 'a*.md' only the file actually named that

git ls-tree does not expand a bare pathspec as a glob at all, with or
without --literal-pathspecs. So the flag is added here for the :-magic
case alone, proved by one new case:

test_a_magic_looking_key_is_named_absent_and_not_a_repository_problem —
measured against the fix reverted: 1 failed (this case only), 20 passed;
restored, 21 passed.

Figures, measured at 2b78d54 and stated at that commit in validate.yml

before (main, 1d4ac83c) after (2b78d54)
tests/ (the required job's first list) 733 passed, 2 skipped 738 passed, 2 skipped
the S7 residue 13 passed 13 passed — unchanged
the hermetic six 360 passed, 1 skipped 360 passed, 1 skipped — unchanged
the triple, summed by the step's own script selected=1109 passed=1106 skipped=3 failures=0 errors=0 selected=1114 passed=1111 skipped=3 failures=0 errors=0
pytest -q tests_runtime/ (DB-backed) — untouched by this PR, not re-measured

The pin moves with the act (7719161): MIN_SELECTED 1109 → 1114,
MIN_PASSED 1106 → 1111, EXPECT_SKIPPED still 3. Five cases, all
of them this PR's: two on test_triple_pin.py, three on
test_conformance_corpus.py. 1109 + 5 is a check on the reading and
not its source — the reading came from a run, quoted above.

What this PR does not touch

The OPENDOX pin lockstep and every pin file are untouched, per the brief.
tests_runtime/ (the DB-backed job) is untouched, so its 573 figure is not
re-measured or re-quoted here.

Summary by Sourcery

Harden conformance-corpus validation and complete the remaining refusal, fixture, force-add, and pathspec edge-case coverage.

Bug Fixes:

  • Make conformance-corpus handling treat keys that resemble Git pathspec magic as ordinary absent documents rather than repository errors.
  • Ensure corpus transposition preserves documents excluded through embedded .gitignore files or $GIT_DIR/info/exclude when force-adding.

Enhancements:

  • Remove the unnecessary Git requirement from the fixture identity test so its digest guard runs on runners without Git.
  • Add isolated coverage for failure and error refusals in the triple-pin validation.

CI:

  • Raise the triple-pin minimum selected and passed counts to reflect five additional passing tests while preserving the expected skip count.

Tests:

  • Add coverage for literal handling of magic-looking keys and both success paths of forced additions.

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

🤖 Generated with Claude Code

brettheap and others added 4 commits September 22, 2026 00:58
openDox-code#33 landed with Copilot's finding F6 (comment 5738611955)
REGISTERED rather than taken: the `ls-tree` probe inside `_committed_blob`'s
exception handler parses a leading `:` in the key as git PATHSPEC MAGIC
before it ever asks the tree, so a key shaped like `:!doomed.md` — never
committed, ordinary in every other way — makes the probe exit 128 with
`pathspec magic not supported by this command: 'exclude'` instead of the
ordinary rc-0-empty "absent" reading, and the branch that follows misreports
it as "HEAD or the repository itself is the problem".

`--literal-pathspecs` on the probe answers it. MEASURED on git 2.43.0 (this
container's version, matching every other measurement in this file): before
the fix, a probe of `:!doomed.md` exits 128 with the magic-parsing error;
after, rc 0 and an empty listing, indistinguishable from any other absent
key.

The other half of the same finding — a key CONTAINING `*` — was measured to
need no such guard, and this act adds none for it: `ls-tree` does not expand
a bare pathspec as a glob at all. Measured on a tree holding `alpha.md`,
`beta.md` and a file literally named `a*.md`, all at the same directory
depth: `-- '*.md'` matched NONE of the three, and `-- 'a*.md'` matched only
the file actually named that, with or without `--literal-pathspecs`. The
regression case proving both halves lands in the next commit, alongside R4
and F5, in `tests/test_conformance_corpus.py`.

Lane: openxfactory-4
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
openDox-code#33's Copilot review (comment 5738550542) named R4 on the "Pin
the triple" step: it has six refusals and three had cases before this act
(a missing report, a report below floor, one skip more than pinned); the
other two — `FAILURES != 0` and `ERRORS != 0` — had none.

Two cases added, each isolated the same way `test_one_skip_more_than_pinned_
is_a_refusal` already was: `total - 19` on the main report keeps SELECTED and
PASSED at or above their floors and SKIPPED exactly pinned, with one test
moved from passed to failed (or to errored) instead of from collected to
skipped, so only the clause under test can fire.

MEASURED against the mutation each forbids: with `[ "$FAILURES" = "0" ]`
neutered in the workflow, only `test_a_failure_is_a_refusal_with_both_floors_
and_the_skip_count_met` fails (4 passed, 1 failed); with `[ "$ERRORS" = "0" ]`
neutered, only its sibling fails. Restored, all five pass.

  tests/test_triple_pin.py   3 passed -> 5 passed

Lane: openxfactory-4
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Three of the four items openDox-code#33's Copilot review left REGISTERED
land here together, because all three touch this one file.

F4 (comment 5738550542) — `@requires_git` sat on
`test_the_fixture_is_the_shipped_seed_and_not_a_description_of_it`, which
shells out to no git at all: every assertion in it is `hashlib.sha256` over
the module-level `_DOCUMENTS`/`_SHIPPED_SIZES`/`_SHIPPED_DIGESTS` dicts. The
marker dropped the digest guard — the one check standing between this file
and a fixture that has drifted from the seed it claims to mirror — on any
runner without git, for a reason that was never this test's own. Removed;
this runner has git, so the skipif condition was already false and the test
already ran, and the pinned triple does not move because of it.

F5 (comment 5738550542) — `--force`'s SUCCESS path was asserted nowhere.
Every existing exclusion case reaches a CONFIGURED ignore file through
`GIT_CONFIG_GLOBAL`, which `core.excludesFile=` disables; none of them lays
a `.gitignore` down INSIDE the populated state or writes to
`$GIT_DIR/info/exclude`, the two entrances `--force` exists for. Two cases
added, each MEASURED against `--force` removed: the `.gitignore` case then
fails on the ordinary per-key exclusion ValueError (the commit succeeds
short, holding only the `.gitignore`, and the byte read-back names the first
missing document); the `info/exclude` case then fails on the total-exclusion
ValueError (nothing at all survives, since every document here is `.md` and
there is no companion file to remain staged). Restored, both pass.

Commit 521abb7's own message additionally MISDESCRIBED
`test_an_exclusion_this_act_cannot_reach_is_named_and_not_a_git_error` as
driving `$GIT_DIR/info/exclude` — it does not; both its cases are the same
`GIT_CONFIG_GLOBAL` excludes file as the test before it, with the switch and
`--force` monkeypatched out. That commit is already pushed and its message
cannot be corrected; the true description is in this act's pull request
body, and no doc or docstring in this tree repeats the wrong one (checked).

F6 (comment 5738611955) — the regression case for the previous commit's
`--literal-pathspecs` fix: `_committed_blob` on a key of `:!doomed.md`, never
committed, now raises the ordinary "does not hold ... at all" ValueError
rather than "cannot even ask its tree" — MEASURED to fail against the
previous commit reverted (1 failed, 20 passed) and pass restored.

  tests/test_conformance_corpus.py   18 passed -> 21 passed

Lane: openxfactory-4
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The pin floors may only rise, and only with the reading in the commit
message: five new passing cases landed over the previous three commits (two
on tests/test_triple_pin.py, three on tests/test_conformance_corpus.py), none
of them a new skip, so the old floors now carry five tests of slack a
regression could hide behind.

MEASURED over the tree of `2b78d54f` (this act's last content commit), by
running this job's three invocations and summing their JUnit reports with
this step's own script: tests/ 738 passed 2 skipped, the S7 residue 13, the
hermetic six 360 passed 1 skipped -- triple: selected=1114 passed=1111
skipped=3 failures=0 errors=0. tests_runtime/ is DB-backed and untouched by
this act, so it is not re-measured here.

NOT DERIVED: 1109 + 5 is a check on the reading, not its source.

  MIN_SELECTED   1109 -> 1114
  MIN_PASSED     1106 -> 1111
  EXPECT_SKIPPED 3    (unchanged)

Both new floors are exact against the measured run (margin 0), matching this
pin's own established discipline.

Lane: openxfactory-4
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 22, 2026 01:01
@sourcery-ai

sourcery-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR closes four registered review gaps by adding isolated refusal and --force success-path coverage, removing an unnecessary Git marker from fixture identity validation, and hardening absent-key probing against Git pathspec magic; the workflow pins are updated for the five new passing tests.

Sequence diagram for literal absent-key probing

sequenceDiagram
    participant Caller
    participant Corpus as conformance_corpus
    participant Git
    Caller->>Corpus: _committed_blob(repo, key)
    Corpus->>Git: cat-file probe for key
    Git-->>Corpus: key absent
    Corpus->>Git: ls-tree --literal-pathspecs HEAD key
    Git-->>Corpus: rc 0, empty listing
    Corpus-->>Caller: absent-key ValueError
Loading

Flow diagram for the expanded validation pin

flowchart LR
    A[Add five passing tests] --> B[Run tests and collect JUnit reports]
    B --> C[Triple sums selected=1114]
    C --> D[Triple sums passed=1111]
    D --> E[Workflow accepts the run]
    F[EXPECT_SKIPPED=3] --> E
Loading

File-Level Changes

Change Details Files
Expanded the triple-pin tests to isolate and reject nonzero JUnit failures and errors while preserving the selected, passed, and skipped thresholds.
  • Extended synthetic JUnit report generation to represent failures and errors.
  • Added one-failure and one-error refusal cases that assert each produces the sole clause (d) rejection.
  • Raised the selected and passed pin thresholds by five without changing the expected skip count.
tests/test_triple_pin.py
.github/workflows/validate.yml
Removed an inaccurate Git dependency from the fixture identity test so its digest guard runs on environments without Git.
  • Dropped the @requires_git marker from the hash-based fixture identity test.
  • Kept the test's digest, size, and document identity assertions unchanged.
tests/test_conformance_corpus.py
Added coverage for --force's successful handling of repository-local ignore rules during corpus transposition.
  • Tested a corpus-carried .gitignore containing a document-matching rule.
  • Tested a post-init $GIT_DIR/info/exclude rule by seeding it before git add.
  • Verified that all expected files, including .gitignore, remain staged and byte-identical.
tests/test_conformance_corpus.py
Made the ls-tree fallback treat keys beginning with Git pathspec magic syntax as literal absent keys.
  • Added --literal-pathspecs to the fallback ls-tree probe.
  • Added a regression test for the :!doomed.md key shape and its diagnostic classification.
  • Documented that bare wildcard characters do not require this protection.
src/opendox/conformance_corpus.py
tests/test_conformance_corpus.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

@sonarqubecloud

Copy link
Copy Markdown

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.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Completes conformance-validation residue by adding refusal and force-add coverage, removing an unnecessary Git dependency, and handling literal Git pathspecs safely.

Changes:

  • Adds failure/error refusal tests and updates validation thresholds.
  • Covers forced additions with .gitignore and info/exclude.
  • Handles magic-looking keys as literal paths.
File Description
tests/​test_triple_pin.py Adds failure and error refusal coverage.
tests/​test_conformance_corpus.py Adds fixture, force-add, and pathspec edge-case tests.
src/​opendox/​conformance_corpus.py Uses literal pathspec handling and forced adds.
.github/​workflows/​validate.yml Updates triple-pin thresholds.

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

@brettheap
brettheap marked this pull request as ready for review September 22, 2026 01:04

@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 1 day and 5 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit f8a1ece into main Sep 22, 2026
5 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

LANDED — lane openxfactory-4, 2026-09-22T01:07:26Z, PR #34 → f8a1ece (opensoft/openDox-code main; plain gate)

Hygiene residue of #33 (R4/F4/F5/F6): --literal-pathspecs on the ls-tree probe, the two untested pin-step refusals, the misplaced @requires_git, --force's success path asserted; triple 1114/1111/3; actor runtime; Brett's standing word 'keep going' (2026-09-22).

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