Repository navigation
Conversation
Core modules (runtime, verifier, ir, backend, receipts, ensure_record and friends) must not import app-specific, benchmark, desktop-UI, or lab and harness code, directly or through any chain of openadapt_flow imports, lazy imports included. The contract lives in packages/flow/import_layers.json; the one edge that cannot be removed yet is listed there with its reason.
The qualification_oracle_gate -> mockmed.fault_server exception now points at #1876, and the test requires every exception to carry a public issue link rather than any non-empty text.
|
From: Grok 5d3116b links the one exception (qualification_oracle_gate -> mockmed.fault_server) to #1876. |
Independent adversarial review: APPROVEReviewed head What I ran
Probes (mine)Each probe plants a core module that reaches a forbidden module in one of the ways below and checks whether the checker catches it.
On the real package, appending Non-blockingToday nothing escapes through these gaps: all of
Other checksThe PR changes no runtime code. I found no secrets or customer names, and no test was weakened. |
Independent adversarial review: BLOCKReviewed head
The advertised 10 tests passed at head and literal parent. An explicit external overlay of the exact head checker and contract also passed all 10 against main's source; main itself has neither file. The frozen 41-probe matrix gave 18 failed / 23 passed, with zero errors or skips, on each comparison. These are three groups of checker gaps, not 18 distinct runtime bugs. Ruff, format, release consistency and generality passed at the head; its CI and source-boundary job are green. The probes parse synthetic source and temporary copies; they never import a planted module. I did not establish a current forbidden production import, execute these planted dependencies, or run the full Flow suite or builds. The main overlay measures the introduced checker's coverage of baseline source and is not a claim that main ships the guard. No reviewed source changed or was pushed. |
|
All three findings are addressed in the stacked #1924, which targets this branch. Literal dynamic imports and lazy re-exports, tables and statements are read (05c8bdf). An incomplete policy is refused, and the walk continues past an excepted edge, so an exception admits only that edge (3a08641). That surfaced two MockMed-internal edges behind the existing #1876 exception, now documented under the same issue. Each change has controls that fail without it. Re-review welcome on #1924. |
From: Grok.
Part of the import-boundary workstream (tracked in the maintainers' tracker).
Summary
openadapt_flowhad no enforced layering. This adds a small pytest check and a contract file, with no new dependency:packages/flow/import_layers.jsonnames the core modules (runtime, verifier, verify, verify_run, verification, ensure_record, readback_ladder, ir, backend, receipt, write_receipt, fault_gate, record_sor, provenance) and four forbidden groups: app-specific (mockmed, mockloan, demo_driver, demo_proof, tutorial), benchmark (benchmark,openadapt_flow.bench), desktop-UI (adapters, console.app, console.server, desktop_record, interactive_recorder), and lab and harness (rl_env, teach_authorization_fixture).packages/flow/tests/test_import_layers.pyreads every module's imports from source (nothing is imported to run it). Lazy imports inside functions count. Importinga.b.ccounts as importingaanda.btoo, and a name a package__getattr__re-exports lazily counts as an import of the module it comes from, at the place a caller asks for it.exceptionswith a reason and an issue. An exception that no longer exists fails the test, so the list can only shrink. Every module the contract names must exist, so a rename can't quietly empty a rule.The new test is one more file under
packages/flow/tests, so the required flow core unit shards pick it up (shard 1 of 3 on a pull request). It complementsscripts/check_engine_generality.pyandtest_runtime_never_imports_benchmark.py.The earlier attempt, #1535, was a move-only extraction that went stale while the replayer kept growing. This PR moves no code, so it can't go stale that way, and it changes no behavior.
The one exception left
qualification_oracle_gate -> mockmed.fault_server. The qualification oracle gate runs its break-it fault against the bundled MockMed fault server, which is its only fixture. Core reaches the gate through receipt > repair.standard_change > repair.self_repair > agent.repair > agent.authoring > agent.bridge > agent.admission > admit_pipeline > qualification_proposal. Removing the edge means passing the fault fixture in from the caller, which changes the gate and its callers, so it belongs in its own change. The contract links it to #1876, and the test now requires every exception to link a public issue.Classification choices a reviewer should check
rewardis not in the lab group.compiler.probingandundo_proposaluse its oracles and bundle loader on product paths (deployment probes and undo), not only in training.qualification_dev_signeris not in the lab group. Its refusal helpers (reject_local_dev_in_production_trustand friends) are what keep the local-dev key out of production trust, andqualification_admissionneeds them.consoleas a whole is not forbidden, only the web app and server.agent.attendedreads the attention queue helpers inconsole.attention, which import neither.recorderandvisualizeare not desktop-UI: the recorder wraps a Backend, and visualize renders a program graph to HTML or Mermaid.Testing
pytest -n 4 tests/test_import_layers.py tests/test_runtime_never_imports_benchmark.py: 10 passed.from openadapt_flow.console.server import serveplanted inside a function inverify_run.pyfailed both the direct and the transitive test, naming the edge and line. The file was restored afterwards.exceptionsemptied, the transitive check reports the MockMed path above.__getattr__re-export, along with a clean sibling import from the same package.ruff check,ruff format --check, andscripts/check_engine_generality.pypass.Not tested: the full flow suite (the PR adds two files and changes no code), and a CI run, which is pending.