writ mgtt — read an mgtt architecture model as a writ model - #1
Merged
Conversation
The reduction is lossless because mgtt's expression language has six comparison operators and no arithmetic: the constants a model mentions cut each fact's value line into regions on which every predicate is constant. Regions no predicate separates are merged, so a single threshold costs two members rather than three.
Facts are the only varying cells; states and healthy are both predicates over them, so their agreement becomes a writ equation rather than a check the emitter performs. Kernel-only output, as writ sql emits.
Adds origination moves, without which propagation has nothing to relay and the model enumerates a single situation. Declines a model whose dependencies pair no can_cause with a triggered_by, and a fact compared both with a sibling and against a constant.
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.
Adds
writ mgtt, a reading of mgtt architecture models, in the tradition ofwrit sql: a foreign notation read into a model the user then owns, kernel-only output, declines named on stderr,--strictfor CI.Why it works
mgtt's expression language (
internal/expr/parser.go) has six comparison operators and no arithmetic. So the constants a model mentions cut each fact's value line into finitely many regions on which every predicate is constant — a region becomes a member, and two values in one region were already indistinguishable to mgtt's own engine. The crossing is lossless rather than approximate.Regions nothing separates are merged, so
connection_count < 500costs two members, not three.What it reports
The load-bearing finding is a law: a component is healthy exactly when it is in its default active state. mgtt derives one side from
healthy:and the other from the type's state guards, and nothing keeps them consistent. Here it is anequation, sowrit checknames the move and routes to the violation:Two decisions worth review
Facts are the only varying cells — there is no
statearrow. States andhealthyare both predicates over facts, so deriving both makes their agreement a real law rather than a check the emitter performs. Because a law's subject must be a declared type (§8.6), a component overridinghealthy:gets its own emitted type so its law ranges over it.Origination moves. Propagation only relays a failure, so without a move letting each component fail on its own the model enumerates one situation and every question answers vacuously. mgtt gets this from a scenario or a probe. Measured on a four-component model: 1 state without them, 36 states / 138 edges with.
Known gap
A fact compared both with a sibling fact and against a constant is not carried —
ready_replicas == desired_replicaswants an ordering,desired_replicas == 0wants regions, and both constrain the same cells. Behaviour is sound but lossy: the guards are refused so the moves are not emitted rather than emitted wrongly, and it is declined by name.Layout
tooling/mgtt/depends onwrit_jsonand nothing else — it never builds a model, so a malformed export cannot reach the engine. IO stays intooling/cli/cmd_mgtt.ml.make testgreen; 55 new checks intests/unit/test_mgtt.ml, including reading the emitted model back through the real front end (asserting on the text would pass just as happily if the text were confidently wrong).