Skip to content

S2 (#359): characterize the model_path filter semantics - #366

Merged
Polichinel merged 1 commit into
developmentfrom
seam/361-characterize-model-path-filter
Nov 28, 2026
Merged

Polichinel merged 1 commit into
developmentfrom
seam/361-characterize-model-path-filter

Conversation

@Polichinel

Copy link
Copy Markdown
Collaborator

Closes #361. Story 2 of epic #359. Tests only — no production code changed.

The finding

This repository sets model_path = None on a store right after building it, in four places. The comment says it suppresses an automatic filter, which reads like defensive tidying.

It is not. Driven on the real DatastoreModule, offline:

⭐ The injection does not add a filter — it overwrites the one the delivery asked for. A delivery that explicitly asks for name="un_fao" searches for chrome_box, the views-models directory name, and nothing in the answer says it was rewritten. So without those four lines the delivery reads files it did not write, and the query that looks most specific is the one silently replaced. That is C-77's hazard in its most expensive form, and it was an argument until now rather than a measurement.

Two more, from the same measurements:

  • model_name = "" injects nothing — the rule tests truthiness, not presence. This is the case a substitute is most likely to get wrong, because suppression then looks like it is working when it is not.
  • With model_path cleared, the delivery's own filters pass through exactly. Both directions are needed: a store that dropped the name filter rather than leaving it alone would satisfy the first direction while being unscoped in a different way.

No network is involved. DatastoreModule.__init__ builds an Appwrite client and makes no request, so the whole injection is reachable by replacing the file manager it holds. Reaching for that private attribute is deliberate and explained in the test: the alternative is a hand-written stand-in, which would test this file's understanding of pipeline-core rather than pipeline-core. It asserts the attribute exists with a message telling the next person what to do if it is renamed.

At the builder level

  • ⚠️ Only four of the six store-construction sites clear model_path. The two that keep it are the partner write stores, deliberately — that store only uploads.
  • What keeps that safe is narrower than it looks, and the PR says so rather than overclaiming: upload_data falls back to model_path.model_name when name is None, and the port's signature stops name being omitted but not a None or empty value passed explicitly. What covers that today is the three call sites passing a declared constant — real, but not a guard. Validating the value in the port would close it properly; that is a behaviour change, so it is not in this story.
  • The two partners' partner-builders take different arguments on purpose — crafd a prepared AppwriteConfig, unfao the path manager — and S3 (#359): funnel the six store-construction sites into one factory per partner #362 keeps that. Asserted, so unifying them becomes a visible decision rather than a tidy-up. Confirmed sound: crafd really does resolve the audience connection once per delivery and pass the same config object to both the write store and the read-back, which is what vpp_018 §3 requires.

Validation

On the supported interpreter (3.11.15 in views-models/envs/views-postprocessing):

Check Result
pytest -k model_path 7 passed
tests/test_store_construction.py 29 passed, was 18
Full suite 636 passed, 1 failed, 3 skipped, 41 xfailed
ruff 0.14.13 clean
Each of the four model_path = None lines deleted in turn 4 of 4 reddened exactly the right test

The one failure is test_the_installed_runtime_dependencies_match_the_lockfile, pre-existing and failing identically on clean development (views-models#757).

Five findings from /code-review high, fixed rather than shipped

  1. 🔴 The header cited line numbers from the wrong version. It quoted pipeline-core :262 / :426-428 from the installed 3.3.5 while this repository declares >=3.6.0 with 3.6.0 in the lock — and told the reader that the story's own citation had "moved". There is no 3.6.0 copy on this machine to check either claim against, so neither was mine to assert. The line numbers are gone; the rule is quoted as code, for the reason store_port.upload already gives about its own citation. (One sub-claim in the review was itself wrong — the copy I read is 3.3.5, confirmed from its dist-info, not 3.3.4 — but its main point was right and is what mattered.)
  2. ⚠️ The guard on name was described as closing a hazard it only half closes. Now states exactly what it does and does not prove, including that name="" fails differently again — no fallback, and an artifact delivered with an empty metadata name.
  3. ⚠️ The env helper did not clear pre-existing APPWRITE_* variables first. C-81 records that a populated shell has twice made tests here pass for the wrong reason, and the two fixtures this repository already has both clear first. It now clears — and discovers the declared coordinate tuples by shape rather than by a hand-written per-partner list, which was the same enumeration conftest.py argues against.
  4. ⚠️ The builder-shape helper keyed on a parameter name and would have produced one actively false diagnosis plus three TypeErrors on a rename. It now refuses to guess and says what to do.
  5. ⚠️ Three assertions used .get("name") == None, which accepts both "absent" and "present and null". Those are different outcomes: an injected null scopes every query to name == None and matches nothing — the wrongly-scoped failure wearing the costume of suppression. Now asserts absence. The difference was measured with a subclass, so nothing in site-packages was modified.

Noted, not done here

📌 tests/test_findability.py:137 greps the builder's source text for the literal "store.model_path = None". The new behavioural test covers the same property and survives a harmless rewrite, which the source grep does not. Deleting the weaker guard is the right follow-up but it is another file's test and outside this story — flagging rather than doing it.

📌 reports/falsification_2026-11-25_nothing_is_broken.py remains untracked and is not in this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9

Story 2 of epic #359. Tests only — no production code changes.

This repository sets `model_path = None` on a store after constructing it, in
four places, with a comment saying it suppresses an automatic filter. That
read like defensive tidying. It is not, and this story measures why.

Driven on the REAL DatastoreModule, offline (its constructor builds an
Appwrite client and makes no request, so the injection is reachable by
replacing the file manager it holds):

  - with model_path carrying a truthy model_name, the store does not merely
    ADD a name filter — it OVERWRITES one the caller supplied. A delivery
    asking for name="un_fao" searches for "chrome_box", the views-models
    directory name, with nothing in the answer saying it was rewritten. That
    is C-77's hazard in its most expensive form: the query that looks most
    specific is the one silently replaced.
  - model_name = "" injects nothing (the rule tests truthiness, not presence),
    which is the case a substitute is most likely to get wrong, because
    suppression then looks like it is working when it is not
  - with model_path cleared, the delivery's own filters pass through exactly

Also recorded, at the builder level:

  - only FOUR of the six store-construction sites clear model_path. The two
    that keep it are the partner WRITE stores, deliberately
  - what keeps that safe is narrower than it looks: upload_data falls back to
    model_path.model_name when `name` is None, and the port's signature stops
    `name` being OMITTED but not a None or empty value passed explicitly. What
    covers that is the three call sites passing a declared constant — real,
    but not a guard, and said so rather than overclaimed
  - the two partners' partner-builders take different arguments on purpose
    (crafd a prepared AppwriteConfig, unfao the path manager), which #362
    keeps. Asserted, so unifying them is a visible decision

Validation on the supported interpreter (3.11.15):

  - pytest -k model_path: 7 passed
  - tests/test_store_construction.py: 29 passed, was 18
  - full suite: 636 passed, 1 failed, 3 skipped, 41 xfailed. The failure is
    test_the_installed_runtime_dependencies_match_the_lockfile, pre-existing
    and failing identically on clean development (views-models#757)
  - ruff 0.14.13: clean
  - each of the four `model_path = None` lines deleted in turn: each reddens
    exactly the test that should catch it, four for four

Five findings from /code-review high, fixed rather than shipped:

  - the header cited pipeline-core line numbers from the INSTALLED 3.3.5 while
    this repo declares >=3.6.0, and told the reader the story's own citation
    had moved. No 3.6.0 copy exists on this machine to check either claim, so
    the line numbers are gone and the rule is quoted as code instead
  - the guard on `name` was described as closing a hazard it only half closes
  - the env helper did not clear pre-existing APPWRITE_* first, which C-81
    records as having made tests here pass for the wrong reason twice; it now
    clears, and discovers the declared tuples by shape instead of by a
    hand-written per-partner list
  - the builder-shape helper keyed on a parameter name and would have produced
    one false diagnosis plus three TypeErrors on a rename; it now refuses to
    guess
  - three assertions used `.get("name") == None`, which accepts both "absent"
    and "present and null". Those are different outcomes — an injected null
    scopes every query to name == None and matches nothing. Now asserts
    absence, and the difference was measured with a subclass rather than by
    modifying anything in site-packages

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9
@Polichinel
Polichinel merged commit fb56a93 into development Nov 28, 2026
4 checks passed
@Polichinel
Polichinel deleted the seam/361-characterize-model-path-filter branch November 28, 2026 23:18
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.

1 participant