Skip to content

Level the openDox-code leg scaffold for the carve (OQ-O): the import root - #3

Merged
brettheap merged 2 commits into
mainfrom
chore/level-scaffold-for-carve
Sep 9, 2026
Merged

brettheap merged 2 commits into
mainfrom
chore/level-scaffold-for-carve

Conversation

@brettheap

@brettheap brettheap commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Refs opensoft/openXfactory#656

RULING (Brett Heap, opensoft/openxFactory#656, 2026-09-09): "OQ-O → level the six scaffolds first, one small PR per repo (docs/, openspec/project.md, strict-check and pytest pins aligned)" — before any carve content, so that a carve failure is never confounded with a scaffold difference. This is one of the six.

What this changes — the import root

The memo's risk 2: "No editable install, no PYTHONPATH, no pyproject.toml, no conftest.py in any of the six. With src/ layout, import opendox does not resolve and validate goes red on the first carved commit." Per the memo's own P2a–d row and the OQ-O ruling, the import root belongs to the levelling pass, not to the leg's first move — so it exists and is proven green before any carved byte arrives.

file why
pyproject.toml (new) names the opendox package over a src/ layout; [tool.pytest.ini_options] is the rootdir anchor (without an ini table anywhere, pytest -q and pytest tests/ can disagree about the root and therefore about which conftest chain applies) and carries pythonpath = ["src"]
conftest.py (new) puts src/ on sys.path by hand, so the leg still imports under a runner that does not read that table, and so the arriving tests/ suites are collected beneath a real root conftest chain
tests/test_leg_shape.py test_import_root_exists + test_src_is_on_sys_path (proves the conftest ran, not merely exists) + test_branch_protection_evidence_exists
docs/branch-protection.md, README.md the policy-difference record and the ## Documentation doc index, level across all six

Both new files are CREATED at a destination and carry no manifest row — RULED OQ-C: the manifest declares what LEAVES openxFactory, never what a destination assembles.

The reference leg

This repository is the reference leg. Its validate already pinned pytest>=8,<9 and declared permissions: contents: read; the other three legs are aligned to it in their own PRs. Its workflow is therefore unchanged here.

Tests run locally

python -m pytest -q   → 12 passed   (pytest 8.4.2, the pinned major CI installs)
python -m pytest -q   → 12 passed   (pytest 9.1.1, host)

NOT DONE, deliberately

  • No carve content. Not one row of openxFactory docs/opendox-carve-manifest.yaml is placed by this PR. The carve is a later, separate PR under OQ-H (history-preserving git filter-repo).
  • No ruleset or branch-protection change. strict_required_status_checks_policy is false on the three opendox rulesets and true on the three openxdox ones. That is a repository setting outside a pull request's reach, and which policy the family standardises on is your call, not an author's. The difference is now written down in every docs/branch-protection.md instead of being discovered.

Asking for Brett Heap's separate word to land this (CODEOWNERS * @brettheap; admin merge).

🤖 Generated with Claude Code

Summary by Sourcery

Prepare the openDox code leg for the future carve by establishing and validating its src/ import root without adding carve content or changing repository rulesets.

New Features:

  • Establish the package import root for the src/-based openDox code leg before carved content arrives.
  • Add repository documentation indexing and record the existing branch-protection policy difference.

Enhancements:

  • Anchor pytest discovery at the repository root and ensure src/ is available on sys.path across runners.
  • Add scaffold tests covering the import root, active path configuration, and branch-protection evidence.

Build:

  • Add project metadata and setuptools configuration for the opendox package.

Documentation:

  • Add a README documentation index and document the branch-protection policy difference between the openDox and openXdox families.

Tests:

  • Extend leg-shape tests to verify the import root and branch-protection documentation are present and effective.

…root

Creates this leg's IMPORT ROOT before any carved content arrives — pyproject.toml
naming the opendox package over a src/ layout, with the pytest rootdir anchor and
pythonpath, plus a repository-root conftest.py that puts src/ on sys.path by hand
for a runner that does not read that table. Without it, import opendox does not
resolve under python -m pytest from the root and validate would go red on the
first carved commit for a reason that has nothing to do with the carve.

Both are CREATED files and carry no manifest row (RULED OQ-C). Also adds the
README doc index, records the strict-status-check policy difference between the
two families, and pins the levelled state in tests/test_leg_shape.py. No carve
content.

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 9, 2026 22:48

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

@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

This scaffold-only PR prepares the openDox leg for a future src/opendox carve by adding a pytest-anchored package/import root with a conftest fallback, proving it through shape tests, and levelling the documentation and branch-protection evidence; it intentionally adds no carved content or workflow/ruleset changes.

Flow diagram for validating the pre-carve scaffold

flowchart TD
    Start["Run validate"] --> Root["pytest anchors repository root"]
    Root --> Import["src/ is added to sys.path"]
    Import --> Shape["test_leg_shape.py verifies import-root evidence"]
    Shape --> Green["Scaffold passes before carve content arrives"]
Loading

File-Level Changes

Change Details Files
Add a dual-path import-root scaffold for the src/ package layout.
  • Declare the opendox package, setuptools src mapping, Python requirement, and pytest root/test-path/pythonpath configuration.
  • Add a root conftest.py fallback that inserts src/ into sys.path for runners that do not consume pytest configuration.
pyproject.toml
conftest.py
Add tests proving the scaffold and import-root prerequisites are present and active.
  • Verify the new scaffold files exist.
  • Assert src/ is present on sys.path, demonstrating that the import setup executed.
  • Verify branch-protection evidence is present.
tests/test_leg_shape.py
Record the repository documentation and branch-protection policy evidence required for scaffold levelling.
  • Add a Documentation index linking the branch-protection record.
  • Document the differing strict required-status-check policy without changing repository settings.
README.md
docs/branch-protection.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

The changes are low-risk scaffold additions with only minor documentation casing nits noted in review comments.

Pull request overview

This PR levels the openDox-code repository scaffold ahead of any carved implementation by establishing a reliable src/ import root (for both local runs and CI) and adding supporting scaffold documentation and validation tests.

Changes:

  • Add pyproject.toml + root conftest.py to make src/-layout imports (import opendox) resolve consistently under pytest.
  • Extend leg-shape tests to assert the import root exists, src/ is on sys.path, and branch-protection evidence documentation exists.
  • Add/update documentation to record branch-protection evidence and index docs/ from the README.
File summaries
File Description
pyproject.toml Defines the package root for a src/ layout and anchors pytest root/test discovery.
conftest.py Ensures src/ is on sys.path for pytest sessions to support imports without editable installs/PYTHONPATH.
tests/test_leg_shape.py Adds scaffold-level assertions proving the import root and branch-protection evidence file exist and that the conftest/config actually ran.
docs/branch-protection.md Records branch-protection evidence and the noted policy difference between repo families.
README.md Adds a docs/ index section and links the branch-protection evidence doc.
Review details

Suppressed comments (1)

docs/branch-protection.md:68

  • Inconsistent casing: this line uses openXdox while other references use openxdox. Keeping one canonical spelling makes cross-repo grep/search reliable.
which is here, in the openXdox family's matching file, and in the pull
  • Files reviewed: 5/5 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 thread docs/branch-protection.md Resolved
- Every posture assertion the levelling pass added now carries an explicit
  failure message, matching test_required_file_exists, so a red CI names the
  missing file instead of raising a bare AssertionError.
- Family prose names the REPOSITORIES (openDox / openXdox) rather than the
  lowercase project ids, which are reserved for project.yaml's project: key.
- docs/branch-protection.md's opening sentence about ruleset state rephrased.
- The manifest comment says why MACHINE-READ is the openXwallet precedent's
  own word rather than a truncation of machine-readable.

No behaviour change; every suite and validator re-run green.

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 9, 2026 22:58
@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

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.

🟢 Approval recommended

The changes are cohesive scaffold-level additions that align with the existing CI validate job and include tests that assert the new import-root behavior.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap

Copy link
Copy Markdown
Contributor Author

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

INDEPENDENT VERIFICATION of head ff670d59c815c52bd79ac38653060f9522c438e0 — PASS

  1. No carve content — PASS. Diff vs main touches only README.md, conftest.py (new), docs/branch-protection.md, pyproject.toml (new), tests/test_leg_shape.py (5 files, +135/-0). None of these paths appear in the manifest's 454 source/destination paths.
  2. Reference-leg alignment — N/A/confirmed: this is the reference leg. .github/workflows/validate.yml is untouched (already permissions: contents: read + pytest>=8,<9) — correctly not edited, per its own PR body, since it's digest-pinned by contracts/shape-pin.yaml for the other repo-shape files but the PR correctly treats the workflow as the alignment target rather than something to change here.
  3. Import root — PASS with a note. pyproject.toml: [project] name = "opendox", package-dir = {"" = "src"}, [tool.setuptools.packages.find] where = ["src"]; [tool.pytest.ini_options] sets minversion, testpaths = ["tests"], and the rootdir anchor pythonpath = ["src"]. conftest.py inserts src/ onto sys.path by hand for runners that don't read the ini table; tests/test_leg_shape.py::test_src_is_on_sys_path proves the mechanism actually ran (not merely present) — verified locally, 12/12 pass. python3 -c "import opendox" currently FAILS (ModuleNotFoundError), including with src/ manually added to sys.path: src/ contains only .gitkeep, no opendox/ directory. This is correct, not a defect — src/opendox/__init__.py has a manifest row (one of the 78 opendox_code src/ rows in docs/opendox-carve-manifest.yaml), i.e. it is carve content, and creating it now would violate check (1). The scaffold only had to prove the mechanism (sys.path wiring), which it does; the package itself is deferred to the carve PR (memo's P3).
  4. Assembly-root manifest — N/A (leg, not an assembly root).
  5. Tests / validate — python3 -m pytest -q at PR head: 12 passed. CI validate: SUCCESS. SonarCloud: SUCCESS (no findings — makes sense, this leg's workflow wasn't touched so there's no "new code" pytest-pin line to flag).
  6. Hygiene — Lane first line correct; **Refs opensoft/openxFactory#656** qualified; no closing keyword; both commits carry the exact two-line trailer; autoMergeRequest: null. One Copilot thread (casing consistency in docs/branch-protection.md), resolved with an on-point reply.
  7. Sequencing — no other open PRs on this repo; no landing-order constraint.

No FAIL/SHOULD-FIX items.

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