--stdin on every model-reading verb, and delete the mgtt surface - #4
Merged
Conversation
Loader.read_model resolves the model THROUGH the injected resolve callback, so a piped model needs no core change — only a resolver that answers one reserved name. Read to EOF because in_channel_length fails on a pipe; memoised because stdin drains once. The verbs become a library (writ_cli, unwrapped) with Writ a thin executable over it: an executable's modules cannot be linked into a test, and the sentinel is worth checking without running the binary. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Flags are stripped before positionals are counted, which is what makes this unambiguous where a bare verb would not be: query, derive and compare all take further positionals after the model, so dropping it would just shift the rest left. compare refuses --stdin before the positional: it fills the NEW side, and the two spellings would otherwise parse identically with one of them silently comparing backwards. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
query finds its questions by convention — MODEL.writ -> MODEL.claims — and a model read from stdin has no beside. It resolved <stdin>.claims and reported a file nobody named. --claims overrides the sibling and is required with --stdin, which now errors saying so. Every existing invocation is unchanged: the convention is still the default. Matches check, which has had the flag all along; the tour's 'there is no --claims flag on it' is corrected.
The translation lives in mgt-tool/mgtt2writ now. writ is a language; a dialect for one third-party product does not belong in its tree, and a second such reading would have made it a collection of bridges wearing a language's name. Removes tooling/mgtt/, the verb, its help entry, its tests and fixture, docs/mgtt-bridge.md (moved to mgtt2writ as docs/reading.md), and the README section. --stdin stays: it is a general convenience for any generated model, not a concession to this bridge. See mgt-tool/mgtt docs/decisions/0001-where-the-writ-bridge-lives.md.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Two things, in the order they have to happen: add the general capability, then remove the special case.
--stdin— additive, nothing breaksEvery model-reading verb gains
--stdin. It is a general convenience for any generated model, not a concession to one bridge: a model that arrives on a pipe never has to touch the disk.--stdinis stripped before positionals are counted, which is what makes it decidable.query,deriveandcompareall take further positionals after the model, so dropping it silently would shift the rest left; with the flag removed, the remaining arity is fixed and the sentinel goes into the model slot the verb already has. No verb, and nothing in the engine, learns that stdin exists.Two shapes needed a decision:
compare OLD.writ --stdin—--stdinfills the new side and must follow the old model, orcompare --stdin baseline.writandcompare baseline.writ --stdinwould strip to the same one positional and one of them would silently compare backwards.query --stdin NAME --claims FILE—queryfinds its questions by convention (MODEL.writ→MODEL.claims), and a piped model has no beside; it resolved<stdin>.claimsand reported a file nobody named.--claimsoverrides the sibling and is required with--stdin, which now says so. The convention stays the default, so every existing invocation is unchanged, and this matchescheck, which has had the flag all along.docs/tour.mdlisted "there is no--claimsflag on it" under things that will catch you once — the worst place for a stale rule. Corrected there, in the cheat sheet, and in the README table.Deleting the mgtt surface
The translation now lives in mgt-tool/mgtt2writ.
writ is a language. SQL is a notation standard that does not move; mgtt is a product with a schema that does. One such reading is defensible — a second would make writ a collection of bridges wearing a language's name, and deferring that to a trigger nobody would notice was the wrong call.
Removed:
tooling/mgtt/(1643 lines),tooling/cli/cmd_mgtt.ml, the dispatch arm, the help entry,tests/unit/test_mgtt.mland its fixture,docs/mgtt-bridge.md(moved to mgtt2writ asdocs/reading.md), and the README section. 3167 deletions, 4 insertions.Nothing in writ names mgtt now.
Verification
make testgreen — 26 test binaries, includingtest_stdin: 14 checks.make lintclean apart from four files with pre-existing drift (cmd_sql.ml,mcp/bin/*,sql_ast.ml) that I deliberately left alone.The pipeline it enables, verified end to end against the real binaries:
Rationale: ADR 0001.