Boundary Hygiene Lint
Goal
A sibling to crate-dag-lint.py asserting concrete ori_llvm:: or ori_backend::
imports outside the one designated CodegenBackendChoice adapter/dispatch module
do not exist in oric. Platform linking, packaging, execution, and diagnostics
consume ori_codegen::EmittedArtifact and shared toolchain types; they do not form
an exempt second concrete-backend boundary.
Context
plans/canonical-consumer-boundary’s crate-dag-lint.py +
consumer_registration_check.py (both read in full during research) are the direct
structural template: doc-comment-exclusion via //-stripping so a rustdoc
cross-reference never counts, fail-closed-on-empty-parse, two-directional check
(stale-entry + unregistered-consumer shape, adapted here to
scattered-import-outside-boundary + boundary-module-drift shapes).
Implementation sketch
- Author
compiler_repo/scripts/backend-boundary-lint.py, reusingcrate-dag-lint.py’s doc-comment-stripping (_references_module) and fail-closed-on-empty-parse discipline. - Check every
ori_llvm::orori_backend::import incompiler_repo/compiler/oric/src/**; anything outside the designated adapter/dispatch module fires a violation. - Check that linker, sysroot, packaging, process-launch, cache, and diagnostic code accepts only
EmittedArtifact/shared toolchain data and never matches concrete backend identity. - Wire
--self-testcovering a synthetic positive plus negative fixtures for an out-of-boundary LLVM import, native-backend import, and post-dispatch backend match. - Wire
--warn-onlyintolefthook.yml+test-all.sh(bedding-in mode, mirroringcrate-dag-lint.py’s own rollout).
Spec references
plans/canonical-consumer-boundary/content/consumer-registration-lint--s-e26ee405.md (direct precedent).
Work items
- Author
backend-boundary-lint.pywith two-directional concrete-import and post-dispatch-match checks plus positive/negative--self-testfixtures; wire--warn-onlyinto lefthook + test-all.sh.