Repository navigation
Description
Roadmap Phase 3 (docs/contract_roadmap.md, epic #2812), next by the mechanical audit after safety (#2869): the import row is draft and carries 2 of the report's 17 open-defect cells (dockerfile 4 vs median 3, embedded_python 7 vs 3; both extraction in the cause table — and both claimed only by batch4-dual-keyword-overlaps' signal×language cross-product, the #2856 shape).
_c("import", "architecture", "declaration", "Dependency resolution and module loading", planted=True)Consumers: the statistical_auditor extraction-density group (SIGNAL_KEYS), two per-language fidelity coefficients (fidelity_table.py: dockerfile import: 0.75 and embedded_python import: 0.4286 — exactly 3/4 and 3/7, i.e. the table is currently pricing these two cells), the "Dependency Resolution" display row. The dependency graph itself (popularity, pagerank, blast radius, orphan→api conversion) is built by the sibling _dependency_capture, not by this count — which is what makes the count's unit a free choice this contract has to make.
The two open cells (finditer verdicts against corpus main)
- dockerfile = 4 (main 1 + a 1 + b 1 + c 1) — c.dockerfile's
FROM scratch.scratchis Docker's reserved empty base: no image is pulled, no layer is bound,_dependency_capturerecords an edge to a unit that cannot exist. Every other language's leaf file reads 0; the leafFROMopens a build stage (class_start's unit, a deliberate dual kept by func_start & class_start have no stated contract: 5 open cells are all collective-entry cross-product mis-marks, not rule defects #2856) but declares no dependency. The rule counts it because it counts theFROMkeyword, not the binding. - embedded_python = 7 (main 2 + a 2 + b 2 + c 1) — the chain (3) plus one
import machineper file. That line is not a plant:embedded_python.py's detection regex is^[ \t]*(?:import|from)\s+(?:machine|board|…)\b, so a file classifies as embedded_python only by carrying an import of a hardware module (ledgerembedded-python-per-file-classification:machine.idle()alone did not discriminate). The language's floor is therefore 4 > 3 by construction — an inherency of the classifier, not an extraction defect, and no rule edit can move it without changing what the language is. The cell needs its own ledger entry (intended-morphology) instead of batch4's cross-product.
Also visible from main with no red cell (rule_probe, crucible)
- apex 22/4f:
acct.Id,LoggingLevel.INFO,Account.Name— the second alternation counts anyreceiver.Memberreference. Apex has no import statement;Type.forName(is its only load form. apex import rule: re.IGNORECASE neutralises the [A-Z] guard, so every qualified reference (foo.bar) counts as an import #2671 scoped the guard; the contract removes the reference arm (C2). - scala 16/7f:
[\w.{}\s,]+swallows newlines, so a block of eightimportlines and thedefafter them is one hit (the samples show it) — the opposite failure of one-statement-one-hit. - shell 103/256f: the
.arm fires on any lone dot followed by a word —find -s . -mindepth,--init-path . unsupported_…,--playbook-dir . testns— a path argument, not a source command (C3 anchor: command position). - livecode 83/98f: 35 of the hits are
end module(a block closer),case "module"(a string), andmodule com.livecode.array(the file's own module declaration); the LCB import formuse com.livecode.foreignis not counted at all. - fortran 309/6f: bare
\b(USE|INCLUDE|IMPORT)\bcountsuse ysu (option1)inside a string literal, andIMPORT— host association inside an interface body, nothing external is bound. - abap 7/7f: bare
INCLUDEcounts the word inside a template string (|… ENHO include should not be in TADIR …|). - m4 2/7f:
include/Makefile \— a path whose first component is a directory namedinclude; the m4 form isinclude(. - agc_assembly 104/10f: bare
BANK(no operand, 26×),BANK 31(a numeric bank switch),TCF SETLOC(a label named SETLOC as an operand) — the capture's own reading is a symbolic operand in opcode position. - csharp: the alias directive
using Alias = Target.Namespace;binds a unit and is captured for the graph but not counted.
What the contract must state
- One hit is a statement or directive that binds an external unit — a module, package, header, library, file, stage or base image — into the current unit, in the language's dependency form. A re-export counts (it binds the unit to re-publish it); a dynamic loader call counts where it is the language's load form (
require(,import(,__import__(,Type.forName(,dofile(,load_extension(). - The unit is the statement, not the edge (the go/scala shape):
import (…),use a::{b, c};,import a, b,with a, b;are one hit each; the graph's edges are_dependency_capture's. One statement per line is one hit per line — a regex must not span statements. - A binding, not a reference or a self-declaration (the apex/livecode shape): a qualified name, a call through an imported symbol, a type annotation, the file's own
module/package/libraryheader, and host association (IMPORT) are invisible. - A named unit (the dockerfile/agc shape): a reserved no-op (
FROM scratch), a bare or numeric location directive, binds nothing. - The ambiguity anchor:
include,use,import,module,.fire only in statement/command position — not as a string word, a path component, a block closer or an argument. - One owner, with the stated duals kept: dockerfile
FROM(class_start, func_start & class_start have no stated contract: 5 open cells are all collective-entry cross-product mis-marks, not rule defects #2856), html<link href>(io's attribute reading, manifest-recorded), sqlite.read/.import(import's since io C2 io has no stated contract: javascript counts an identifier named path, sqlite counts every DML keyword, and tcl's source/close are claimed by two rules each #2841); markdown is the stated absence.
Done in the #2765/#2841/#2852/#2858/#2869 shape
docs/import_rule_contract.md, the sheet row → stated, one cross-language test_import_contract_<N>.py, engine PR labelled rosetta:rebless-owed, corpus PR with dockerfile c re-blessed 1 → 0 and a new intended-morphology entry for embedded_python's classifier floor, batch4's import half retired. Expected: import open defects 2 → 0 (dockerfile 3, embedded_python 7 ledgered inherency), no other corpus cell moves; bless scope names only the raw import count and the aggregates that read it (the graph must not move — _dependency_capture edits are limited to the same scratch/numeric exclusions).
Activity
import contract (#2875): state the rule contract, edit 15 rules on it…
import contract re-bless (gitgalaxy#2875): dockerfile leaf to 0, embe…