Skip to content

Enforce validate as a required status check (closes 1.5) - #2

Merged
brettheap merged 2 commits into
mainfrom
chore/enforce-validate-required-check
Sep 6, 2026
Merged

brettheap merged 2 commits into
mainfrom
chore/enforce-validate-required-check

Conversation

@brettheap

@brettheap brettheap commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

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

The verifier found that tasks.md item 1.5 -- a branch-protection ruleset requiring the validate check, created in EVALUATE mode and promoted to ACTIVE once that check has reported once -- was never done in this repository. gh api repos/opensoft/openDox-code/rulesets showed only the two pre-existing org-sourced rulesets (PR-required, Copilot review), neither of which names a status check, and classic branch protection returned 404. PR #1's body claimed "§ 1.3-1.5" compliance, which overstated the work.

This PR adds a repository-level ruleset (id 22364973) requiring the validate status check on main. It was created in evaluate mode before this PR existed, so this PR's own validate run is the "reported once" evidence, and it is promoted to active before merge -- full history in the new docs/branch-protection.md, linked from README's Posture section. PR #1's body is being corrected separately to say § 1.3-1.4 with a pointer here for 1.5.

Refs opensoft/openXfactory#656

🤖 Generated with Claude Code

https://claude.ai/code/session_011HB5MkaME9RsTPctRtYQ4a

Summary by Sourcery

Enforce the validate check on main and document the repository’s branch-protection posture.

Bug Fixes:

  • Require the validate status check before merging changes to main through a repository-level branch-protection ruleset.

Enhancements:

  • Document the repository ruleset, its activation history, and the correction to the earlier compliance claim.

Documentation:

  • Link the branch-protection documentation from the README posture section.

tasks.md item 1.5 was never done in PR #1: no repository ruleset or
branch protection named the `validate` check as required, so nothing
actually gated a merge on it passing (the two org-wide rulesets only
require a PR and a Copilot review). This adds a repository-level
ruleset (id 22364973) requiring the `validate` status check on `main`,
created in EVALUATE mode ahead of this PR and promoted to ACTIVE once
`validate` reported on this PR's own head commit -- see
docs/branch-protection.md for the full evidence line.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011HB5MkaME9RsTPctRtYQ4a
Copilot AI lite review requested due to automatic review settings September 6, 2026 02:03

@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 11 hours and 49 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds documentation and README visibility for repository ruleset 22364973, which requires validate on main, including its EVALUATE-to-ACTIVE history and the correction to PR #1’s compliance claim.

File-Level Changes

Change Details Files
Document and link the repository-level ruleset that requires the validate status check on main. docs/branch-protection.md
README.md

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

Changes are documentation-only and align with the stated branch-protection enforcement goal, with only minor clarity improvements suggested.

Pull request overview

This PR closes the repository’s “1.5” posture gap by documenting and enforcing a required validate check on main via a repository-level GitHub ruleset, and linking that posture evidence from the README.

Changes:

  • Add documentation evidence for the repository-level ruleset requiring the validate status check on main.
  • Update the README Posture section to point to the new branch-protection documentation.
File summaries
File Description
README.md Adds a Posture note linking to the branch-protection evidence and stating validate is required on main.
docs/branch-protection.md Documents the required-status-check ruleset and its EVALUATE→ACTIVE activation history as compliance evidence.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

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

Comment thread docs/branch-protection.md Resolved
Comment thread docs/branch-protection.md Outdated
Comment on lines +37 to +39
Copilot review, but neither names a status check, and classic branch
protection was never configured (`404 Branch not protected`). The one PR
this project merged before this one (#1, bootstrapping posture) landed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed: named the exact command (gh api repos/opensoft/openDox-code/branches/main/protection) that returned the 404.

- use the literal ruleset enforcement values (`evaluate`/`active`) in
  the section header, matching the API/UI field values used in the
  body text
- name the exact command used to establish that classic branch
  protection was never configured, since this file is itself serving
  as evidence
- PR #1's body is now actually corrected (this PR's own comment
  thread), so the doc's claim is true rather than forward-looking

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011HB5MkaME9RsTPctRtYQ4a
Copilot AI review requested due to automatic review settings September 6, 2026 02:06
@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

@brettheap
brettheap merged commit 580f61d into main Sep 6, 2026
4 checks passed

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

Changes are documentation-only and low-risk, with one minor Markdown formatting improvement suggested for readability.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread docs/branch-protection.md
Comment on lines +38 to +41
protection was never configured — `gh api
repos/opensoft/openDox-code/branches/main/protection` returned `404 Branch not
protected`. The one PR this project merged before this one (#1, bootstrapping
posture) landed without `validate` being a required check — a gap this file,
brettheap added a commit that referenced this pull request Sep 19, 2026
… that is a refusal (#32)

# Follow-up #2 to openDox-code#30: the four it registered and did not take

#30 landed with four findings **registered**, because its head was capped after the second push. This is the act that takes them. Each is measured against a full checkout of **`5c867137`** — never with `PYTHONPATH`, for the reason `docs/runtime.md` § 8 now records.

| # | what | origin |
|---|---|---|
| 1 | a **linked worktree**'s metadata was not bound by descriptor, so its index stayed pathname-bound | [#30 thread on `local_git_adapter.py:2124`](#30 (comment)) — **ruled by the holder** |
| 2 | `identity.RefusedError` was translated **nowhere**, so a store refusal the act did not pre-empt was a **500** | [#30 thread on `config.py:584`](#30 (comment)) |
| 3 | the whitespace fallback read a **local path** as an authority | same thread |
| 4 | the served-database guard's other two acts had **no case** | [#30 thread on `cli.py:829`](#30 (comment)) |

## 1. A linked worktree is the third shape, and the binding did not reach it

`-C /proc/self/fd/<n>` binds the working directory, and for the two shapes this act creates that **is** the repository — a bare repository is its own git directory, a checkout's is `.git` inside it — so `rev-parse --git-dir` answers a **relative** name and the index joins onto the held root. A linked worktree is neither. **Measured on git 2.43.0:**

| | linked worktree |
|---|---|
| `<worktree>/.git` | a **file** naming an absolute path |
| `rev-parse --git-dir` (through `-C`) | `<main>/.git/worktrees/<name>` — **absolute**, holds the INDEX, holds neither `objects/` nor `refs/` |
| `rev-parse --path-format=absolute --git-common-dir` | where `objects/` and `refs/` actually are |

`resolve` serves that shape **writable**, with a case landed since § 3.6, so the pathname branch was live for a supported corpus.

**Ruled by the holder on #30:** bind both directories by descriptor and **keep linked worktrees writable** — making them read-only would reverse what § 3.6 landed with its own case. `metadata_held_open` opens the two `O_NOFOLLOW` and names them `GIT_DIR` and `GIT_COMMON_DIR` as `/proc/self/fd/<n>`, inherited by every call. **Measured end to end** before it was written: `rev-parse`, `hash-object -w`, `read-tree`, `update-index`, `write-tree`, `commit-tree` and `update-ref` all behave as they do without them, the commit lands on the worktree's own branch, the main branch is untouched, and the temporary index lands inside the held git directory.

**What the case does not do, and why it says so.** It does not rename the git directory under a running write: git enumerates worktrees through `<common>/worktrees/<name>` to decide whether a branch is checked out elsewhere, so re-pointing that name mid-write makes `update-ref` refuse with `cannot lock ref … unable to resolve reference` — git's own bookkeeping, through a name no descriptor of ours binds, and nothing to do with this finding. An absence that is measured and written down is not the same as one nobody noticed.

## 2. A store refusal is a refusal, not a crash — the class, not the instance

`repository_act` refuses a credential-bearing remote and so does `identity.CoordinationStore`: layering, not duplication, and the two readings are deliberately not identical. Nothing translated the store's — `app.py` caught `RepositoryActRefused` and **nothing else** — so a value one of them refuses and the other accepts left the route as an unhandled exception, which FastAPI answers **500**.

It has happened twice, and both times it was closed one shape at a time: `…?mode=1;token=…` on #26, where the act accepted what the store refused, and `/srv/repos/a:b@c.git`, **measured a 500 at `5c867137`** (the new case reproduces it there as a raw `identity.RefusedError`). `except identity.RefusedError` → **409** on the three routes that call an act writing through the store ends the class: a refusal is a refusal, named by shape and never by value.

## 3. A local path is not an authority

The whitespace fallback #30 added — for `user:pa ss@host:path`, which both the refusal's class and the redactor's excluded — read the whole head before the last `@`. So `/srv/my repos/a:b@c.git`, a directory whose name holds a colon and an at-sign and a perfectly legal `git push` destination, was **refused** by the store and **replaced with `<redacted-url>`** by the printer.

**Git's own rule is the test, and it is about the first colon:** the `[user@]host:path` form is recognised only when nothing before that colon is a `/`. It separates the two cases exactly, which is why it is this rule and not "a head holding any slash":

| value | before the first `:` | verdict |
|---|---|---|
| `ci:hun/ter2@github.com:o/r.git` | `ci` | an authority — #25's password-containing-a-slash hole **stays closed** |
| `/srv/my repos/a:b@c.git` | a path | a local path, not judged |

Both halves of the pair take it, because both made the same misreading.

## 4. The database guard's other two acts are measured

`refuse_a_database_the_api_will_not_read` is called from `apply()`, from `runtime migrate --plan` and from `runtime reset`, and only `apply()` had a case — "one line each and visible in the diff" is not a measurement. The new case is the schema guard's twin: a real schema with a coordination table in it, a migration DSN that reaches this database, a declaration naming another, both verbs refusing with the table still there, and both going through once the declaration agrees.

**It passes against `5c867137`, and the docstring says so** rather than letting it read as a regression test: it pins wiring that was untested, and it earns its place by what it catches later — which is exactly how the schema guard came to be missing from two of its three acts.

## 5. And the regression this PR's own item 1 introduced, closed here

`write_back` declares exactly two kinds — `CORPUS_READ_ONLY` and `WRITE_PATH_UNREACHABLE` — and a caller may branch on `err.refusal.kind`; the module has been repaired for this before (round 13's `_repository_root`, which refused with a kind this operation does not declare). Entering `metadata_held_open` at the `with` statement put its work **outside** `_write_back_bound`'s handler, and one of those calls had been **inside** it: the `rev-parse --git-dir` that used to be a single line computing `named_git_dir`. **Measured at `97a1b37e` with the real adapter, both raw:**

| what fails | what escaped `write_back` |
|---|---|
| `open_no_follow_chain` on the worktree's git directory | `FileNotFoundError` |
| `rev-parse --git-dir` — the probe itself | `GitCommandFailed` |

The second row is the wider half and the review did not reach it: that probe runs for **every** shape, so an ordinary bare repository or checkout could leak it too — this branch regressed the promise on the **common path**, which is the same class item 2 above closes at the API boundary.

The translation belongs to the helper, because the helper owns both the probes and the opens: it catches `GitCommandFailed`, `OSError` and `RuntimeError` (a symlink loop raises the last, which is why the root probe catches it), closes any descriptor it had already taken, and refuses with `WRITE_PATH_UNREACHABLE` naming the failure **class** and not git's stderr. One case drives both rows, the probe row on an **ordinary** repository, and it fails against `97a1b37e` with the raw `GitCommandFailed`.

## Measured (python 3.12.3, pytest 8.4.2, postgres 16.15, git 2.43.0)

Every figure was measured at **`acbb6d46`** — this branch with `origin/main` **merged** in (openDox-code#31, § 3.7's conformance factory; no rebase) — with the `runtime` extra made UNIMPORTABLE and no ambient git configuration, and holds at the current head **`f8678ad`**, which adds only the workflow's record of it and the triple's floors. **This description is edited in the same act as that record.**

| run | result |
|---|---|
| the required `validate` job's own invocation (`--noconftest`, the six hermetic modules) | **360 passed, 1 skipped** |
| of which `tests_runtime/test_local_git_adapter.py` | 138 passed |
| `python -m pytest -q tests_runtime/` with `OPENDOX_TEST_DATABASE_URL` set | **573 passed** |
| `python -m pyflakes src/opendox/runtime/*.py tests_runtime/*.py` | clean |
| the required job's **triple** (`tests/` 725+2 skipped, S7 residue 13, hermetic six 361+1 skipped) | selected **1099**, passed **1096**, skipped **3** |

**The triple's floors move up with the cases that raised them** — `MIN_SELECTED` 1096 → 1098 → **1099**, `MIN_PASSED` 1093 → 1095 → **1096**, `EXPECT_SKIPPED` unchanged at 3 because no file turned into skips. Clause (d)'s floors are a ratchet: an act that adds cases raises them, so a number that later goes down is what they exist to catch.

**And they were measured on the merged tree, not derived from it.** This branch had moved them once already, to 1087/1084, measured before any of #31's tests existed; the merge **discarded that side** and took main's 1096/1093, and then the floors were moved again from a real run of the three invocations. `1096 + 2 = 1098` is a check on the reading — the rule #31 wrote into that block when it moved the floors three times — and not its source.

**Three of the four new cases fail at `5c867137`** — `'GitRunner' object has no attribute 'held_environment'`, `/srv/my repos/a:b@c.git` refused as an authority, and the raw `identity.RefusedError` that is the 500. The fourth is the coverage case above, which passes there by design.

## Sequencing

openDox-code#31 (§ 3.7, the conformance factory) landed first (`93ccc3dd`), and this branch took it by **merge** (`d6cb2621`), never by rebase. The one conflict was the triple's floors and it is resolved **to main's side**, because #31 had re-pinned them three times as it measured and those are the true floors at `93ccc3dd`; this branch's own move was then re-made from a run over the merged tree. Nothing else in that file collided: #31 added a line to the first list, and this branch's hunks are the figure block and the floors.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Lane: openxfactory-4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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