Skip to content

§ 3.4 S1: declare the web census and measure the boundary defect (three strict xfails) - #13

Merged
brettheap merged 2 commits into
mainfrom
build/s1-web-boundary-census
Sep 12, 2026
Merged

brettheap merged 2 commits into
mainfrom
build/s1-web-boundary-census

Conversation

@brettheap

@brettheap brettheap commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

What

Slice S1 — "Declare the census and measure the defect" of
docs/front-end-package-boundary.md (opensoft/openDox-spec #8 ->
a44ac06d), § 5. Applies the five rulings from the governing issue's
newest comment before this PR, opensoft/openXfactory#656 comment
5642758731

(Brett Heap, 2026-09-12T02:07:53Z: "RULED — § 3.4 front-end package
boundary ... every recommended answer adopted" / "RULED, same sitting ->
START S1-S3 NOW, with the note amended to carry these rulings").

No file under src/opendox/web/ moves. No route binding changes. This PR
only adds a declared census, a test that measures the boundary the tree
does not have yet, and the workflow wiring to run it without turning the
required check red.

Files added / changed

  • tests/fixtures/web_boundary_census.yaml (new) — the declared
    census: all 42 files under src/opendox/web/, each with a class
    (A/B/C/?), applying the five Q1-Q5 rulings against the note's own
    § 3.2 table. Only views/explorer.js actually reclassifies here,
    from ? to C (Q2: "neither explorer.js nor the drill banner is
    class B ... explorer.js is class C"). The other four rulings (Q1
    docs.js stays A/tail; Q3 repo-selector.js SPLITS at S4, stays ? here;
    Q4 /source/ moves at S6, viewer.js stays A; Q5 intent-feed.js fixed at
    S2) don't change any row S1 owns. Totals: A 20 files/11,702 lines, B 4
    files/1,597 lines, C 14 files/11,854 lines, ? 4 files/5,432 lines —
    42 files / 30,585 lines total, matching the live tree exactly (verified
    by the test itself, not just asserted).
  • tests/test_web_boundary.py (new) — the note's four boundary
    assertions (§ 4.5), plus one companion bookkeeping check:
    1. test_every_web_file_is_classified_exactly_once — unmarked,
      passes today. The ratchet: a new/renamed/removed file with no
      matching census row fails immediately. Also checks the fixture's own
      loc provenance against the tree (wc -l-equivalent), so a stale
      count is itself caught.
    2. test_no_ownership_violation_outside_class_b — xfail(strict=True).
      18 real sites today (10 gate prefix + 3 openxFactory adapter
      lanes + 5 openXdox projection routes), matching the note's own count
      exactly.
    3. test_every_relative_import_resolves_and_stays_in_class —
      xfail(strict=True). 7 real sites today: the note's own
      intent-feed.js dangling-import example (2 sites) plus 5 further
      class-A/C-imports-class-B sites the census itself footnotes
      (app.js -> gate.js, app.js -> swb-session.js,
      staging-workbench.js -> swb-create.js and -> swb-session.js,
      wheel.js -> dispose.js). See "A finding worth flagging" below —
      this is more than the note's closing paragraph counts.
    4. test_no_class_c_file_carries_a_governance_literal —
      xfail(strict=True). 1,377 hits across all 17 in-scope files
      (the 14 class-C files + the 3 declared class-A tails) against a
      closed word list (the eight controlled Status: words plus this
      tree's own stage vocabulary — COLUMN_KEYS, WHEEL_KEYS/
      WHEEL_LABELS, board.js's four columns, styles.css's four
      --st-* tokens, evidenced directly against the live tree, not
      guessed).
    5. test_declared_governance_literal_exemptions_are_real_and_out_of_scope
      — unmarked, passes today. Not one of the note's four; it gives
      the § 2.2 rule 3 exemptions (composed-model.js's
      COMPOSED_COLLECTIONS, doxbench-state.js's SCOPE_KINDS) teeth,
      per the note's "an exemption that is silence is how a literal
      survives a vocabulary sweep."
  • .github/workflows/validate.yml — adds tests/test_web_boundary.py
    to the explicit --noconftest pytest list, in this same commit, per
    the note's own instruction (§ 4.5 closing paragraph) and matching how
    its three neighbours were added.

A finding worth flagging (not resolved unilaterally here)

Implementing assertions 2 and 3 to their FULL stated width (not narrowed
to make a slice-attribution count come out even) surfaced two places
where the note's own text disagrees with itself about which slice(s)
close an assertion:

  • Assertion 2: § 4.5 point 2's per-site table reads "S4" for 14 of
    the 18 sites and "S6" for the remaining 4; the note's own closing
    paragraph instead says "2 by S5 and S6." I cited the closing paragraph
    in the xfail reason=, and recorded both readings in the reason text
    and the test's own comments, rather than picking one silently.
  • Assertion 3: the closing paragraph says "3 by S2." Read literally
    ("no class-A/C file imports a class-B module," § 4.5 point 3, with no
    narrower scope stated), this assertion has 7 real sites today, not
    2 — S2's own scope (dispose.js, wheel.js, styles.css) closes only
    the 2 unresolved intent-feed.js imports; the other 5
    (app.js->gate.js, app.js->swb-session.js,
    staging-workbench.js->swb-create.js/swb-session.js,
    wheel.js->dispose.js) are the same shape S3's view registry and
    S5's gate-loop contribution close, per § 4.1/§ 5 — not S2.

Neither disagreement breaks anything mechanically: xfail(strict=True)
only fires on an unexpected pass, so if S2 lands without closing all 7
sites, assertion 3 simply stays XFAIL (green check) rather than going
XPASS-then-red; the risk is only that a future author reads "3 by S2,"
removes the marker after S2 alone, and gets an immediate (and correct) red
check. Flagging it here rather than quietly re-scoping the test to match
the note's summary, since the note is a ruled/adopted record and I did not
want to unilaterally edit it out of S1's scope.

Verification (local run, matching validate.yml exactly)

python -m pytest -q tests/test_leg_shape.py tests/test_consumer_reach.py \
  tests/test_profile_registration.py tests/test_web_boundary.py --noconftest
73 passed, 3 xfailed in 1.82s

strict=True was also verified mechanically (not just asserted): a
throwaway patch that made assertion 2's check trivially pass while
leaving its marker in place turned it into a hard FAILED with
[XPASS(strict)], then the patch was reverted (working tree confirmed
clean by diff before committing).

Coordination

Scope is exactly the census data file, the test file, and
validate.yml's explicit list — no file S2 or S3 own. Q-L1: both new
files are new (no carve-manifest row to check); .github/workflows/ validate.yml carries no manifest row either (leg-assembled, confirmed
absent from docs/opendox-carve-manifest.yaml).

🤖 Generated with Claude Code

Summary by Sourcery

Declare and continuously measure the web front-end package boundary while preserving a green validation check until subsequent slices resolve the known defects.

New Features:

  • Add a declared census covering every file in the web front-end package, including classifications, line counts, and documented exemptions.
  • Add boundary checks for census completeness, route ownership, import resolution and class boundaries, and governance literals.
  • Wire the new boundary test into the validation workflow.],
  • bug_fixes=[],
  • enhancements=[
  • Introduce strict expected-failure checks that measure known front-end boundary defects while preventing regressions as later slices resolve them.
  • Record the adopted boundary rulings and identified inconsistencies in the census and test metadata.

CI:

  • Add the web boundary test to the explicit pytest validation command.

Tests:

  • Add census and boundary validation coverage, with one passing completeness check, one passing exemption check, and three strict expected-failure measurements.

docs/front-end-package-boundary.md (opensoft/openDox-spec #8 -> a44ac06d)
§ 4.5/§ 5 slice S1: land the src/opendox/web/ census as data
(tests/fixtures/web_boundary_census.yaml, 42 files, applying the five
rulings of opensoft/openXfactory#656 comment 5642758731 -- only
views/explorer.js reclassifies, "?" -> C per Q2) plus
tests/test_web_boundary.py with the note's four boundary assertions:

1. the census is complete (unmarked; passes today).
2. no file outside class B names a route another column declares
   (xfail(strict=True); 18 real sites today).
3. every relative import resolves, and no class-A/C file imports a
   class-B module (xfail(strict=True); 7 real sites today -- the 2
   RULED not_moved intent-feed.js imports plus 5 further class-boundary
   imports the census itself footnotes).
4. no class-C file, and no declared class-A tail, carries a governance
   literal (xfail(strict=True); every one of the 17 in-scope files trips
   at least one hit today).

Also adds a companion (unmarked) check that the two declared § 2.2 rule 3
exemptions (composed-model.js's COMPOSED_COLLECTIONS,
doxbench-state.js's SCOPE_KINDS) are real and out of assertion 4's scope,
per the note's "an exemption that is silence is how a literal survives a
vocabulary sweep."

.github/workflows/validate.yml adds the new test to its explicit
--noconftest list in this same commit, so the required check is never red
for a file three of whose four assertions are known-red.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 12, 2026 02:31
@sourcery-ai

sourcery-ai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

S1 establishes a checked-in census for all 42 web files and adds four boundary assertions—three strict XFAIL defect measurements plus one passing census ratchet—then runs the new test in CI without changing web sources or route bindings.

Flow diagram for S1 boundary checks

flowchart TD
    Start[Run test_web_boundary.py] --> CensusCheck[Verify every web file is classified once]
    CensusCheck --> DefectChecks[Measure boundary defects]
    DefectChecks --> Ownership[Ownership violations outside class B\n18 sites — strict XFAIL]
    DefectChecks --> Imports[Unresolved or cross-class imports\n7 sites — strict XFAIL]
    DefectChecks --> Literals[Governance literals in scoped files\n1,377 hits — strict XFAIL]
    Ownership --> Exemptions[Verify declared exemptions are real]
    Imports --> Exemptions
    Literals --> Exemptions
    Exemptions --> Result[Census and exemption checks pass\nDefect checks remain expected failures]
Loading

File-Level Changes

Change Details Files
Adds a complete, measured declaration of the web-package boundary census.
  • Lists all 42 web files exactly once with A/B/C/? classification, line counts, provenance, and slice-specific notes.
  • Records the five governing rulings, including the reclassification of explorer.js to class C.
  • Declares and validates the two governance-literal exemptions.
tests/fixtures/web_boundary_census.yaml
Introduces boundary tests that measure current defects while ratcheting future changes.
  • Validates census completeness, uniqueness, class values, and line-count provenance.
  • Checks route ownership, relative-import resolution/class boundaries, and governance literals.
  • Marks the three currently failing defect checks as strict XFAILs so unexpected fixes fail CI.
  • Adds a passing check ensuring declared exemptions are real and out of scope.
tests/test_web_boundary.py
Wires the new boundary test into the required validation workflow.
  • Adds tests/test_web_boundary.py to the explicit pytest invocation.
  • Keeps the workflow --noconftest-compatible and documents the strict-XFAIL behavior.
.github/workflows/validate.yml

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

@brettheap
brettheap marked this pull request as ready for review September 12, 2026 02:31

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

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

Four moderate review findings remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds an executable census and boundary checks for src/opendox/web, with known defects tracked as strict expected failures and wired into CI.

Changes:

  • Adds a line-count-verified YAML census.
  • Adds boundary, import, governance-literal, and exemption checks.
  • Runs the new test module in validation.
File summaries
File Reviewed changes and findings
tests/test_web_boundary.py Implements boundary measurements. Four moderate findings remain: the governance scan includes comments and identifiers; ? classifications lack phase enforcement; exemption checks do not verify declarations; and row-level exemptions are not cross-checked.
tests/fixtures/web_boundary_census.yaml Declares the classified frontend file inventory and exemptions.
.github/workflows/validate.yml Adds the boundary test module to CI validation.
Review details

Suppressed comments (3)

tests/test_web_boundary.py:132

  • This unmarked assertion never enforces the second half of its documented contract: ? is accepted by VALID_CLASSES and there is no current-slice/deadline check. After S4, a forgotten transitional row would still pass this ratchet, contrary to § 4.5 point 1; carry an explicit phase/allowlist and reject ? once S4 is reached (or update the assertion as part of S4).
    bad_class_rows = sorted(row["path"] for row in _ROWS if row["class"] not in VALID_CLASSES)
    assert not bad_class_rows, (
        f"row(s) with a class outside {sorted(VALID_CLASSES)}: {bad_class_rows}"
    )

tests/test_web_boundary.py:379

  • Checking identifier in text does not prove that the exempt symbol is still declared: a comment or unrelated string containing COMPOSED_COLLECTIONS/SCOPE_KINDS would satisfy this assertion after the real declaration was removed. Match a declaration/export (or parse the module) so this bookkeeping check cannot silently validate a stale exemption.
        assert exemption["identifier"] in text, (
            f"declared exemption names {exemption['identifier']!r}, which does not "
            f"appear in {path} -- the exemption is stale"

tests/test_web_boundary.py:367

  • The fixture repeats each exemption in row.exempt and in declared_exemptions, but this check only iterates _EXEMPTIONS; it never verifies the row-level fields. Those two sources of truth can drift while the companion test remains green, undermining the stated bookkeeping guarantee. Either remove the unused row fields or assert that the (path, exempt) pairs match the declared list before checking each exemption.
def test_declared_governance_literal_exemptions_are_real_and_out_of_scope() -> None:
    in_scope_paths = {row["path"] for row in _assertion_4_scope()}
    for exemption in _EXEMPTIONS:
  • Files reviewed: 3/3 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 tests/test_web_boundary.py Resolved
Copilot (PR review, tests/test_web_boundary.py:330) caught that
`_governance_literal_violations` ran the word-boundary regex over each
file's raw text, so a `//`, `/* */` or `<!-- -->` comment describing the
pipeline in prose counted the same as a real runtime literal. Verified
against the live tree: views/model.js:8-9's own "docs -> clusters ->
possibles -> staged picks -> proposals -> realized" sentence and
views/board.js:1-5's "Four lifecycle columns -- brainstorm, staged,
active proposals, realized/archived" both trip six of the eight watched
words as pure prose; styles.css carries 197 `/* */` blocks, starting
with line 1's own "grown verbatim from the staged mockup". Left
unstripped, S7 parameterizing every genuine literal would still not
turn the assertion green, which defeats its purpose as the S7 ratchet
(note `docs/front-end-package-boundary.md` § 4.5 point 4).

`_strip_comments_for_scan` blanks comment syntax per extension
(`.js`: `//` + `/* */`, quote-aware so a comment marker inside a string
literal is left alone; `.css`: `/* */` only; `.html`: `<!-- -->`) to
spaces, preserving every newline so `_line_of` still reports the
correct line for a surviving match. Verified this does not silently
empty the assertion: comment-stripped hits fall from 1,377 to 841
across the 17 in-scope files, and every file still carries at least one
hit (minimum 3, in views/outline-model.js) -- so the assertion keeps
failing today for a real, in-code reason and `strict=True` cannot XPASS
out from under S1. `validate`'s explicit list
(tests/test_leg_shape.py tests/test_consumer_reach.py
tests/test_profile_registration.py tests/test_web_boundary.py
--noconftest) still reports 73 passed, 3 xfailed, unchanged in shape.

Not fixed here, flagged in the xfail reason on the same footing as
assertions 2/3's own fidelity-over-tidiness notes: a bare identifier or
property access that only reads a snapshot schema key (`s.documents`,
`s.clusters`) still trips the sweep even though note § 2.2 rule 3
treats a schema key as distinct from a rendered word. Left for S7 (or a
further amendment) to decide against the real sites it parameterizes.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 12, 2026 03:07
@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.

🔵 Needs a closer look

The census does not enforce the documented S4 cutoff, and strict xfails accept unexpected exceptions.

Review details

Suppressed comments (4)

Previously missed (1) — in code that hasn't changed since the last review.

tests/test_web_boundary.py:197

  • This xfail accepts any exception as an expected failure because raises is omitted; strict=True only rejects XPASS, so a bug in _route_ownership_violations() (or a malformed census causing a KeyError/FileNotFoundError) would keep CI green as XFAIL instead of failing the check. Restrict the marker to the known assertion failure so unexpected test errors remain visible, and apply the same guard to the other two strict markers below.

This issue also appears in the following locations of the same file:

  • line 273
  • line 454

tests/test_web_boundary.py:111

  • This assertion never enforces the documented S4 cutoff for transitional ? rows: it only checks path coverage, duplicates, classes, and LOC, so the four current ? entries can remain indefinitely while this unmarked test still passes. §4.5 says a ? row must fail after S4; add a phase-aware/explicit S4 census guard (or revise the contract so this test no longer claims to enforce that cutoff).
def test_every_web_file_is_classified_exactly_once() -> None:
    real = _real_web_files()
    declared = set(_ROWS_BY_PATH)

    missing_rows = sorted(real - declared)

tests/test_web_boundary.py:275

  • As with the other strict marker, omitting raises makes every exception from the import scanner an expected XFAIL; an implementation/parser error could therefore be silently accepted by CI. Add raises=AssertionError so only the intended failing assertion is tolerated.
@pytest.mark.xfail(
    strict=True,
    reason=(

tests/test_web_boundary.py:456

  • This strict marker also treats unexpected exceptions from the governance scan as an expected XFAIL because raises is unspecified. Add raises=AssertionError so scanner regressions or fixture errors fail validation rather than being hidden by the known defect marker.
@pytest.mark.xfail(
    strict=True,
    reason=(
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap
brettheap merged commit e86deb2 into main Sep 12, 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