Repository navigation
fix(efficacy): the layering probe reads what import tariff loads - #127
Conversation
The probe classed each module by what it imports, then looked for domain modules importing Flask or a database driver, which by that definition there never are. It now walks the import closure of the package's __init__, relative and absolute imports alike, and reports every module in it that imports Flask, Werkzeug, Jinja or a database driver. Without a package entry the reading is missing, not zero. Closes #125 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPGzmuB6WLaUppMRKY
…gh every initializer An import inside a function body, the factory's lazy import of the web module that the specification allows, is not what import tariff loads, so the closure and the names it counts skip function bodies. A dotted import runs every package initializer on its way, so each one joins the closure. Files are named by their path under the package, which tells two initializers apart. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPGzmuB6WLaUppMRKY
|
Codex review, round 1 (gpt-6-astra, high): two findings, both real, both fixed.
Also: closure entries are now paths under the package ( |
…riff loads Only a type checker reads such a branch, so the closure skips its body and takes its else branch. The planted store names Flask and the web module under the guard; neither reads as loaded. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPGzmuB6WLaUppMRKY
|
Codex review, round 2 (gpt-6-astra, high): one finding, real, fixed.
Probes self-test 19/19, trace clean. Round 3 follows. |
…module An import under if __name__ == "__main__" runs only for a script, so the closure skips it as it skips a type-checking guard. Where a package and a module share a name, the package is what Python imports, so the resolver takes it first. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPGzmuB6WLaUppMRKY
|
Codex review, round 3 (gpt-6-astra, high): three findings. Two fixed, one by design.
Probes self-test 21/21, trace clean. Round 4 follows. |
An inverted guard, if __name__ != "__main__", runs on import, so its imports count. The planted store carries one over sqlite3. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPGzmuB6WLaUppMRKY
|
Codex review, round 4 (gpt-6-astra, high): one finding, real, fixed.
Probes self-test 22/22, trace clean. Round 5 follows. |
…river from .sqlite3 import x imports tariff.sqlite3, so the layering count reads only absolute imports; the relative ones the closure already follows. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DpT5xPGzmuB6WLaUppMRKY
|
Codex review, round 5 (gpt-6-astra, high): three findings. One fixed, two by design.
Probes self-test 23/23, trace clean. Round 6 follows. |
|
Codex review, round 6 (gpt-6-astra, high): two findings, both by design, nothing new.
The loop ends here: six rounds, six real findings fixed with a test each, five answered by design. Ready for the owner's review. |
The layering probe could never report a violation: a module that imports Flask or sqlite3 was classed web or persistence by that fact, and the probe then asked whether a domain module imports either. It now reads the contract the spec states,
import tariffworks without Flask and without touching the database.probes.py, structure scriptlayering_violationsover the import closure;import_closurelisted beside itprobes.py, self-teststore.pyreached through an absolute import is a violation;web.py, never imported, is outside; a root without__init__reads missing. 17 checksreport.pydocs/coverage.md, ch. 8.6.3For the owner before merging. This row sits in the Design radar axis and read 0 for every arm of round 5c. Under ADR-021 a fixed instrument means every reading round is re-scored. The structure probe needs no model call, so a re-score of 5c's 75 trials is CPU time only, but it is a decision: merge now and re-score 5c and 5d's reused trials, or hold this until round 5d is scored and reported and let round 6 be the first to read it.
Closes #125
🤖 Generated with Claude Code
https://claude.ai/code/session_01DpT5xPGzmuB6WLaUppMRKY