Skip to content

docs: architecture and README drift from the implementation #64

Description

@OmarAlJarrah

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:

  1. Package layouts omit four real packages. docs/architecture.md §3 and README's layout table list only ir/ (+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 why internal/harness sits outside the layering) — the docs are what's stale. README's table also says cmd/morphic imports "engine", but it imports ir too.
  2. §2.1 still shows the pre-rename contract. architecture.md §2.1 shows Parse(ctx, sources, Options); the method is Compile since the frontend→compiler rename (refactor(compilers)!: rename frontend→compiler and backend→emitter #5). engine/engine.go also retains front/fronts identifiers and an "engine: parse %q" error prefix — worth renaming while touching it.
  3. emitter-design.md §2.1 contradicts the implemented registry philosophy. It prescribes a registry "populated by each target's init() — 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.
  4. architecture.md §3 lists a future compilers/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.
  5. 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 matches compilers.Compiler; emitter-design's registration section matches the engine-composed pattern; README's diagnostic-format section matches actual output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions