Repository navigation
docs: architecture and README drift from the implementation #64
Copy link
Copy link
Closed
Labels
priority:P2Rarer spec shapes, or an IR decision to settle before the emitterRarer spec shapes, or an IR decision to settle before the emittertype:docsDocumentation onlyDocumentation only
Description
Problem
Several places where the design docs and README no longer match the code they specify — each small, but these documents are declared normative, so drift is costly:
- Package layouts omit four real packages.
docs/architecture.md§3 and README's layout table list onlyir/(+irtest),compilers/*,pass/,emitters/*,engine/,cmd/morphic/. Missing:cmd/morphic-harness/,internal/harness/,internal/archtest/,ir/irverify/. The code is well-placed (the archtest comment explains whyinternal/harnesssits outside the layering) — the docs are what's stale. README's table also sayscmd/morphicimports "engine", but it importsirtoo. - §2.1 still shows the pre-rename contract.
architecture.md§2.1 showsParse(ctx, sources, Options); the method isCompilesince the frontend→compiler rename (refactor(compilers)!: rename frontend→compiler and backend→emitter #5).engine/engine.goalso retainsfront/frontsidentifiers and an"engine: parse %q"error prefix — worth renaming while touching it. emitter-design.md§2.1 contradicts the implemented registry philosophy. It prescribes a registry "populated by each target'sinit()— mirroring the compiler registry", but the actual compiler registry explicitly forbids init-time self-registration (compilers/compilers.go:46-47) and CLAUDE.md bans mutable globals. If uncorrected, Milestone 3 gets built against the wrong pattern citing "mirroring" as authority.architecture.md§3 lists a futurecompilers/swagger/directory whose job ("2.0 lift → openapi compiler") would require the sibling import the layering rules forbid — while Milestone 2's text says the lift lives inside the OpenAPI compiler. Drop the directory from the layout.- README documents one diagnostic format; the CLI prints three (path#pointer, bare IR ID, bare line:col). Document the fallback forms.
Proposed direction
One docs PR covering all five, plus the engine identifier rename if desired.
Acceptance
- Layout listings match
find . -type d; the compiler contract shown matchescompilers.Compiler; emitter-design's registration section matches the engine-composed pattern; README's diagnostic-format section matches actual output.
Metadata
Metadata
Assignees
Labels
priority:P2Rarer spec shapes, or an IR decision to settle before the emitterRarer spec shapes, or an IR decision to settle before the emittertype:docsDocumentation onlyDocumentation only
Activity
docs: refresh the package layout and testing strategy
OmarAlJarrah commentedon Aug 2, 2026
Items 1 and 4 are resolved by #227.
Item 4 —
compilers/swagger/is dropped fromarchitecture.md§3, with a line saying why there is no such directory: the lift normalizes to the OpenAPI 3.x shape and lives inside that compiler, so a sibling package calling intocompilers/openapiis the one import the layering rules in that same section forbid.Item 1 — both layout listings now match the tree.
architecture.md§3 was rewritten for the compiler split and includescmd/morphic-harness/,internal/harness/,internal/archtest/,internal/testspec/andir/irverify/; README's table gains the same, and itscmd/morphicrow saysengine+irrather thanenginealone. Both now point atinternal/archtest'srulesmap as the source of truth and give the command that derives the layout, so the next drift is a failing test rather than a stale table.Still open here: item 2 (§2.1 shows
Parsewhere the method isCompile;engineretainsfront/frontsidentifiers and an"engine: parse %q"prefix), item 3 (emitter-design.md§2.1 prescribes aninit()-populated registry, which the compiler registry explicitly forbids), and item 5 (README documents one diagnostic format; the CLI prints three).docs: point README's build section at the gate it now runs
OmarAlJarrah commentedon Oct 19, 2026
More drift between the design documents and the code at
c387e25c. Each row was checked against the type-checkedirpackage, the engine's pass list, or a compile.link · dedup · filter · version-slice · overlay · validate; §2.4: "the engine runsversion-slicebefore any emitter"validate(engine/passes.go); architecture.md §2.2 lists the rest as designed, not builtTypePlan.Alias, "dedup alias target"DocumentParamBind.Param string // Operation.Params nameHTTPParamBinding.Paramis aParamIDBodyPath *ir.PropPathHTTPParamBinding.BodyPath []PropID; response sideHTTPBinding.ResponseBodyPath *PropPathWhereispath | query | header | cookie | body | body_property | hostquerystringreadOnly → Only:[read][read, delete, query], as ir-design §5.2 says and the compiler emitsPatchImplicitOptionality == false*bool, nil meaning the protocol defaultCase(words []string, …)over "Naming.Canonicalword sequence"Canonicalis one lower_snake string; the split is implied, not statedInput|Output|Error|Multipart|Json|XmlJsonorXmlemitter"; §7:emitters/contract.goStreamingModeisnone | client | server | bidi""for every non-streaming operation, never"none", in all 1,521 compiled corpus documents that have operations (#978)irverifyrequires RFC 6901 syntax forProvenance.Pointer:/acme.v1.UserIdpasses,acme.v1.UserIdisir/provenance-pointer-malformed; the doc could say "one pointer segment"switch-completeness test"pass/validate.go)compilers/openapi/internal/schema/compose.go:533: "A two-variant {X, null} set collapses"oneOf: [X, {type: "null"}, {type: "null"}]lowers to a nullable XItem 3 of this issue (emitter-design §2.1's registry "populated by each target's
init()") still stands atc387e25c, lines 180–184.