You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
compilers: a compiler's output duties are checked by convention, not by the contract #967
A throwaway second compiler, registered through engine.NewWith at c387e25c, returned documents that engine.Run and irverify both accept although the design forbids them:
Services empty, although ir-design §2 says a document has at least one;
Sources empty, or with an empty Format and Hash;
Name cleared.
A cleared IRVersion or IDSpaces is caught.
Other duties hold only by convention:
Calling compile.Types.Violations() after interning is one; only compilers/openapi/openapi.go does it.
A recognition whose Format is zero is skipped silently (compilers/compilers.go).
When a new compiler package has no rules entry, the layering test's message says "not allowed for compilers", not that an entry is missing.
The shipped compiler meets every duty, so none of this shows today. The next compiler (#469, #470) will meet it one silent gap at a time.
Direction
A proposal:
State each duty in compilers.Compiler's doc.
Check the cheap ones where the engine or registry already holds the data: a document has a source table and at least one service, and each SourceInfo has a format.
Let irverify own the rest, and give the archtest message the fix.
Done when the throwaway compiler's violations above each produce a named error or violation.
Priority: P3, rule 3 (off the golden spec: another format's compiler). Return a document with no services and an empty source table from a compiler registered through engine.NewWith → no error, no diagnostic, no violation (morphic @c387e25c).
Activity