docs: align architecture with the tree and document the oracles - #315
Open
OmarAlJarrah wants to merge 1 commit into
Open
docs: align architecture with the tree and document the oracles#315OmarAlJarrah wants to merge 1 commit into
OmarAlJarrah wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related gaps in the docs, grouped because both land in
README.mdaround the Buildingsection.
The docs describe a tree that has moved on. Corrected here:
docs/architecture.md§2.1 declared the compiler contract method asParse. It isCompile(
compilers/compilers.go:40). The preamble also disclaimed the whole signature as"illustrative"; it now names the file that declares it, and disclaims only the abbreviated
parameter types.
compilers/openapi/internal/overlay/, which landed after the treewas written. Added, in the dependency position
internal/archtestputs it in.docs/micro-compiler-design.md:4carried the same stale count in words ("thirteen internalpackages") and now derives instead of counting, exactly as docs/micro-compiler-design: the internal-package count is stale #299 asks.
pass/exports one symbol,Validate.README.md,docs/architecture.md(twice — the pipelinediagram and the §3 tree) and
docs/emitter-design.mdall listed six passes with nothing markingfive of them as unbuilt. Each now says which one exists; the designs stay, marked (planned), in
the same style the
emitters/*rows already used. The pass framework itself is pass: introduce the documented pass framework #67 and isuntouched here.
docs/emitter-design.md§2.1 prescribed a package-levelvar registrypopulated by eachtarget's
init(), citing "mirroring the compiler registry" as its authority —compilers/compilers.go:43says the opposite in its own words, and a mutable package global isbanned outright. Replaced with the engine-composed instance the compiler registry actually uses,
plus the reasoning, so the next reader does not re-derive the rejected shape. The §7 package tree
annotated
golang/emitter.gothe same way; fixed too.README.mddocumented one diagnostic rendering. There are two structural shapes, and thepointer inside the first takes three forms — a JSON pointer, a
line:colfrom the upstreamvalidator, and an empty pointer — all three of which come out of one compile. Documented, with
the advice to match on the code rather than on the pointer's shape.
README.md's Building block rangofmt -l .; the gate runsgofmt -l $(git ls-files '*.go')(
gate.yml:15). The two differ by every Go file under a git-ignored directory, so the documentedcommand prints hundreds of lines where it promises none. It also claimed
check-coverage.shenforces 100% "overall and per package" — the script computes one globalhit/total over the profile and never groups by package. Both corrected, and the redundant
go test ./...step dropped, sincecheck-coverage.shruns it.docs/architecture.md§6 restatedREADME.md's milestone table. The table now lives in oneplace; §6 keeps what only it says — why the milestones run in that order, each chosen to falsify
a specific claim the IR makes.
README.md's design-doc table listed six of the eight files indocs/. Both micro-compilerdocuments added.
No verification workflow had a runnable command anywhere.
grep -rn 'go test -run\|go run ./cmd/morphic-harness\|-fuzz' README.md docs/*.mdreturnednothing: the oracle sweep, golden regeneration, the conformance recipe, the fuzz targets and
scripts/verify-atomic-output.shwere each documented only by the code implementing them, and thesole copy of the regen command was a comment in
conformance_test.go. A newTesting and verification section covers all of them, plus
testdata/dangling/, which nodocument named at all.
docs/architecture.md§5 keeps describing what each mechanism is for andnow points at the commands rather than duplicating them.
Two things deliberately left out. Renaming
engine/engine.go'sfront/frontsidentifiers andthe user-visible
"engine: parse %q"error prefix — the last of theParse→Compileresidue — isa code change touching a package under the coverage gate, so it belongs in its own PR rather than
riding along with prose. And the count in
danglingcheck_test.go'sdanglingDircomment rottedthe same way
micro-compiler-design.md's did; filed as #314 rather than fixed here.Test plan
Documentation only — no production code changed. The full gate passes (
gofmt,go vet,golangci-lint run,go build ./...,./scripts/check-coverage.shat 100%).Every command the new section documents was run in this branch before it was written down:
go run ./cmd/morphic-harness testdata/conformance/openapiand against a single spec; exitcodes confirmed directly against the built binary —
0all-pass,1ontestdata/dangling/openapi/f04-composition.yaml,2with no args and on a missing path.go test ./internal/harness,go test ./ir -run TestNewBigVal_AcceptsDecimalForms,go test ./compilers/openapi -count=1.go test ./compilers/openapi -run TestConformance -update, and the claim that it is notglobal:
go test ./... -updatefails withflag provided but not defined. The command thatderives which packages accept it returns exactly
cmd/morphic,compilers/openapi,ir/irtest.go test ./compilers/openapi -run '^$' -fuzz FuzzCompile -fuzztime 30s— PASS.-fuzz Fuzzrefuses with "matches more than one fuzz test", which is why the documented form names one.
./scripts/verify-atomic-output.sh— all checks passed.A regeneration that changes nothing is indistinguishable from a broken
-update, so bothdirections were checked rather than assumed:
x-teamfromallof-inheritance.yamlreddenedTestConformancewith a named capabilityfailure, and
-updaterefused to rewrite the golden while that assertion was failing — so theflag cannot paper over a broken lowering. Adding a property the assertion does not name reddened
the golden comparison and
-updatethen rewrote it correctly.-updaterun failsin
TestConformance_TableNamesEveryCorpusSpec, the second mints the golden and passes — which iswhy the section says to re-run.
git statusconfirmed clean before committing.Counts and lists in the diff are derived, not transcribed: the fourteen internal packages from
ls -d compilers/openapi/internal/*/, theoverlay/gap fromcommagainst the tree in §3, thesole
passexport fromgrep '^func [A-Z]' pass/*.go, and the docs table fromls docs/*.md. Allinternal links were checked to resolve.
Closes #64
Closes #65
Closes #299