Yichus / Reference / API MCP tools
api_integrity_check
Complete typed causal order existence plus bounded per-cell race, stale-read, and declared Yichus/Spec checks. Inspect the returned claims: top-level ok and WebMCP isError describe tool execution, not whether properties hold. Default schema=legacy-2.2 retains verdicts.invariants; opt in to schema=3.0 for spec-verdict claims with typed subject, operation scope, completion and trust gaps. A declared model hold does not prove its implementation, and a sampled hold is inconclusive in 3.0. Truncated cells without a counterexample remain inconclusive; causal consistency alone does not certify model quality or database executions. TLC is not run; both schema views carry only a diagnostic sketch. For legacy-2.2, view=compact replaces only the inline sketch. For 3.0, it also deduplicates operations into an operationCatalog and uses numeric references in scopes and causal pairs. Both compact views carry a sketch hash and full-view retrieval request; view and schema are independent selectors.
Kind: IntegrityCheck. Family concurrency: MCP servers list it once api_tools opens that family. Origin: Yichus/Mcp::catalog.
CLI: yichus spec — the same native bounded/structural checker; the CLI requires a declared Property or StepProperty, while the MCP tool can inspect built-in invariants alone.
Parameters
sources(required, array) — JSON array of {fileName, source} Bosatsu files.module_name(optional, string) — Optional module name for the verdict (default Api).max_ops(optional, integer) — Optional schedule bound (default 8, hard cap 8); does not limit complete causal graph checking.view(optional, string) — Optional full (default) or compact. Compact retains the decision evidence and a retrieval reference for the diagnostic sketch. Unknown values are errors.schema(optional, string) — Optional legacy-2.2 (default) or 3.0. Select the evidence schema independently of view; unknown values are errors.
Examples
Each response was produced by calling this tool with the displayed request when these docs were generated, on files committed to the repository. A violated or refuted verdict is a successful call: the check ran and found what its example shows.
A counter read and written in one transaction: every check holds
Request
{
"sources": [
{
"fileName": "counters-one-transaction.bosatsu",
"source": "package Demo/CountersOneTransaction\nfrom Yichus/Data import Db\nfrom Yichus/IO import IO\nfrom Yichus/Transaction import TxTable, Outcome, stored_table, tx_bind, tx_read, tx_write, transaction\nexport bump, reset, counters\nexposes (Yichus/Data, Yichus/IO, Yichus/Transaction)\n\ncounters: TxTable[s, Int] = stored_table(\"counters\")\n\n# Read and write the counter inside one transaction.\ndef bump(db: Db, key: String) -> IO[Outcome[String, Unit]]:\n _ <- transaction(db)\n found <- tx_bind(tx_read(counters, key))\n value = match found:\n case Some(n): n.add(1)\n case None: 1\n tx_write(counters, key, value)\n\ndef reset(db: Db, key: String) -> IO[Outcome[String, Unit]]:\n _ <- transaction(db)\n tx_write(counters, key, 0)\n"
}
],
"view": "compact"
}
Response
{
"ok": true,
"tool": "api_integrity_check",
"specCount": 0,
"verdicts": {
"artifactClass": "tla-verdict",
"schemaVersion": "2.2",
"sources": {
"hash": "ca1d166bf801406310224e96bec4895c6b4409f8090909f1470a0007e1fea912",
"files": [
{
"name": "counters_one_transaction",
"sha256": "a7535e7a4a0cb38059c052c2c2fbe656d2b03b15a42aed7e9123d37667883cd1"
}
]
},
"module": "Api",
"bound": 8,
"truncatedOps": 0,
"interleavingsExplored": 3,
"uniqueOutcomes": 2,
"declaredSpecs": [],
"invariants": [
{
"invariant": "causal-consistency",
"verdict": "holds",
"kind": "built-in",
"method": "complete-causal-graph",
"detail": "the complete causal graph over 3 effect operations admits an ordering; schedule exploration remains separately bounded",
"spec": null,
"propertyLocation": null,
"modelBinding": null,
"counterexample": []
},
{
"invariant": "race-free:counters",
"verdict": "holds",
"kind": "built-in",
"method": "serialized-transactions",
"detail": "every operation on 'counters' runs inside a transaction and each read-then-write shares one (2 complete skeleton(s)); assuming the store runs each transaction serializably (the PostgreSQL adapter at SERIALIZABLE; the memory store one plan at a time in one process), whole transactions interleave only as serial orders",
"spec": null,
"propertyLocation": null,
"modelBinding": null,
"counterexample": []
}
],
"view": "compact",
"viewSchemaVersion": "1.0",
"specWitnessRef": {
"format": "TLA+",
"encoding": "UTF-8",
"sha256": "69e8ff4a7e9d08577e8de4436928ac3ad6f6676729715c8f6152adefa8e43d3f",
"bytes": 1119,
"retrieval": {
"tool": "api_integrity_check",
"arguments": {
"view": "full",
"module_name": "Api",
"max_ops": 8
},
"sources": "Resubmit the original sources with identical fileName and source bytes using the same checker version; compare source identities and the returned witness hash.",
"resultPath": "verdicts.specWitness"
}
}
}
}
Guarded intake handlers: the declared submission properties hold, the bounded race checks still flag the shared cell
Request
{
"sources": [
{
"fileName": "submission.bosatsu",
"source": "package Agora/Domain\n\nexport (\n SubmissionState(),\n UrgencyLevel(),\n Submission(),\n ValidationResult(),\n TransitionValidation(),\n assign_id,\n set_archived,\n submission_state_name,\n validate_submission,\n can_transition,\n same_state,\n is_one_of,\n validate_transition,\n is_terminal,\n valid_next_states\n)\n\nenum SubmissionState:\n Received\n Processing\n BriefReady\n Failed\n Judging\n Ranked\n Archived\n\nenum UrgencyLevel:\n Breaking\n Timely\n Timeless\n\nstruct Submission(\n id: String,\n user_id: String,\n url: String,\n advocate_argument: String,\n urgency_claim: UrgencyLevel,\n submission_time: String,\n state: SubmissionState\n)\n\nenum ValidationResult:\n Valid(submission: Submission)\n Invalid(reason: String)\n\nenum TransitionValidation:\n TransitionValid\n TransitionInvalid(reason: String)\n\ndef is_empty(value: String) -> Bool:\n match value:\n case \"\": True\n case _: False\n\ndef submission_state_name(state: SubmissionState) -> String:\n match state:\n case Received: \"Received\"\n case Processing: \"Processing\"\n case BriefReady: \"BriefReady\"\n case Failed: \"Failed\"\n case Judging: \"Judging\"\n case Ranked: \"Ranked\"\n case Archived: \"Archived\"\n\ndef assign_id(submission: Submission, id: String) -> Submission:\n match submission:\n case Submission(_, user_id, url, advocate_argument, urgency_claim, submission_time, state):\n Submission(\n id,\n user_id,\n url,\n advocate_argument,\n urgency_claim,\n submission_time,\n state\n )\n\ndef set_archived(submission: Submission) -> Submission:\n match submission:\n case Submission(id, user_id, url, advocate_argument, urgency_claim, submission_time, _):\n Submission(\n id,\n user_id,\n url,\n advocate_argument,\n urgency_claim,\n submission_time,\n Archived\n )\n\ndef validate_submission(\n id: String,\n user_id: String,\n url: String,\n advocate_argument: String,\n urgency_claim: UrgencyLevel,\n submission_time: String\n) -> ValidationResult:\n match is_empty(id):\n case True:\n Invalid(\"Submission ID must not be empty\")\n case False:\n match is_empty(user_id):\n case True:\n Invalid(\"User ID must not be empty\")\n case False:\n match is_empty(url):\n case True:\n Invalid(\"URL must not be empty\")\n case False:\n match is_empty(advocate_argument):\n case True:\n Invalid(\"Advocate argument must not be empty\")\n case False:\n match is_empty(submission_time):\n case True:\n Invalid(\"Submission time must not be empty\")\n case False:\n Valid(Submission(\n id,\n user_id,\n url,\n advocate_argument,\n urgency_claim,\n submission_time,\n Received\n ))\n\n# Each state's successors, listed in the order the states are declared.\ndef valid_next_states(from: SubmissionState) -> List[SubmissionState]:\n match from:\n case Received: [Received, Processing]\n case Processing: [Processing, BriefReady, Failed]\n case BriefReady: [BriefReady, Judging]\n case Failed: [Failed, Archived]\n case Judging: [BriefReady, Judging, Ranked]\n case Ranked: [Ranked, Archived]\n case Archived: [Archived]\n\ndef same_state(left: SubmissionState, right: SubmissionState) -> Bool:\n match left:\n case Received: right matches Received\n case Processing: right matches Processing\n case BriefReady: right matches BriefReady\n case Failed: right matches Failed\n case Judging: right matches Judging\n case Ranked: right matches Ranked\n case Archived: right matches Archived\n\ndef is_one_of(states: List[SubmissionState], target: SubmissionState) -> Bool:\n loop states:\n case []: False\n case [state, *rest]:\n if same_state(state, target): True\n else: is_one_of(rest, target)\n\ndef can_transition(from: SubmissionState, to: SubmissionState) -> Bool:\n is_one_of(valid_next_states(from), to)\n\ndef validate_transition(from: SubmissionState, to: SubmissionState) -> TransitionValidation:\n match can_transition(from, to):\n case True:\n TransitionValid\n case False:\n TransitionInvalid(\"Invalid state transition from ${submission_state_name(from)} to ${submission_state_name(to)}\")\n\ndef is_terminal(state: SubmissionState) -> Bool:\n match state:\n case Archived: True\n case Received | Processing | BriefReady | Failed | Judging | Ranked: False\n"
},
{
"fileName": "submission.spec.bosatsu",
"source": "package Agora/Spec/Submission\n\n# Spec-first declaration for the submission lifecycle (see\n# docs/brainstorms/2026-07-12-tla-driven-development-brainstorm.md).\n#\n# The model binds to the `submission_state` State cell in handler code and\n# reuses the domain's own `can_transition` — the spec's guard and the\n# handlers' guard are literally the same compiled function.\n#\n# Workflow:\n# day 0: yichus spec domain/submission.bosatsu specs/submission.spec.bosatsu \\\n# --output verdicts.json\n# -> every property inconclusive (\"awaiting implementation\")\n# later: add fixtures/intake_handlers_guarded.bosatsu to the input set\n# -> properties flip to holds (or violated, with a trace)\n\nfrom Agora/Domain import (\n SubmissionState, Processing, Received, Archived,\n can_transition, is_terminal, submission_state_name\n)\nfrom Yichus/Spec import Spec, StateModel, Transition, StepProperty\n\nexport (submission_spec)\n\nexposes (Agora/Domain, Yichus/Spec)\n\n# Guarded steps: move only when the domain relation allows it, else stay.\n# These model handlers that read-check-write with the same guard.\n\ndef to_processing(s: SubmissionState) -> SubmissionState:\n match can_transition(s, Processing):\n case True: Processing\n case False: s\n\ndef to_archived(s: SubmissionState) -> SubmissionState:\n match can_transition(s, Archived):\n case True: Archived\n case False: s\n\n# Every modeled step must be a legal transition of the domain FSM\n# (self-loops are legal in `can_transition`, so a guarded stay is fine).\ndef only_legal_steps(pre: SubmissionState, _: String, post: SubmissionState) -> Bool:\n can_transition(pre, post)\n\n# A terminal state is final: once Archived, no step may leave it.\ndef terminal_is_final(pre: SubmissionState, _: String, post: SubmissionState) -> Bool:\n match is_terminal(pre):\n case True: is_terminal(post)\n case False: True\n\nsubmission_spec = Spec(\n StateModel(\n \"submission_state\",\n Received,\n submission_state_name,\n [\n Transition(\"advance_to_processing\", to_processing),\n Transition(\"archive_submission\", to_archived)\n ],\n []\n ),\n [],\n [\n StepProperty(\"only-legal-steps\", only_legal_steps),\n StepProperty(\"terminal-is-final\", terminal_is_final)\n ]\n)\n"
},
{
"fileName": "intake_handlers_guarded.bosatsu",
"source": "package Agora/Intake/Guarded\n\n# Guarded intake handlers: read the current state and write only when the\n# domain's transition relation allows the move. The spec\n# (specs/submission.spec.bosatsu) models these with the same guard — same\n# compiled `can_transition` — and the bounded checker proves the pair safe\n# under every interleaving.\n#\n# The write must be lexically inside the handler `def`: the spec's\n# Transition binds by the binding name that performs the write.\n\nfrom Yichus/IO import pure, flat_map, IO\nfrom Yichus/UI import State, read, write\nfrom Agora/Domain import SubmissionState, Processing, Archived, can_transition\n\nexport (advance_to_processing, archive_submission)\n\nexposes (Agora/Domain, Yichus/IO, Yichus/UI)\n\ndef advance_to_processing(submission_state: State[SubmissionState]) -> IO[Unit]:\n flat_map(read(submission_state), current ->\n match can_transition(current, Processing):\n case True: write(submission_state, Processing)\n case False: pure(()))\n\ndef archive_submission(submission_state: State[SubmissionState]) -> IO[Unit]:\n flat_map(read(submission_state), current ->\n match can_transition(current, Archived):\n case True: write(submission_state, Archived)\n case False: pure(()))\n"
}
],
"view": "compact"
}
Response
{
"ok": true,
"tool": "api_integrity_check",
"specCount": 1,
"verdicts": {
"artifactClass": "tla-verdict",
"schemaVersion": "2.2",
"sources": {
"hash": "f1fddad55633783dd5678b744122533b9c558d0ad72479e7fa89bd9d2a72499e",
"files": [
{
"name": "submission",
"sha256": "b3d084f803cb81f7d6ee4ba4a2c9729f85f7657af9bafa3b57dde160a4d5a820"
},
{
"name": "submission.spec",
"sha256": "a66cc1246337977bc1d09ea98b87fe9639113ee95d50c2b1bc95b291f266b8ff"
},
{
"name": "intake_handlers_guarded",
"sha256": "1ebffc317bb692060283a7588e8db5c5060c11e060259e30964156afa9b38db1"
}
]
},
"module": "Api",
"bound": 8,
"truncatedOps": 0,
"interleavingsExplored": 6,
"uniqueOutcomes": 2,
"declaredSpecs": [
{
"ref": "Agora/Spec/Submission::submission_spec",
"location": "submission.spec:51:19"
}
],
"invariants": [
{
"invariant": "causal-consistency",
"verdict": "holds",
"kind": "built-in",
"method": "complete-causal-graph",
"detail": "the complete causal graph over 4 effect operations admits an ordering; schedule exploration remains separately bounded",
"spec": null,
"propertyLocation": null,
"modelBinding": null,
"counterexample": []
},
{
"invariant": "race-free:AnyCell",
"verdict": "violated",
"kind": "built-in",
"method": "bounded-interleavings",
"detail": "2 valid orderings over the cells unresolved handles may open produce differing effect sequences",
"spec": null,
"propertyLocation": null,
"modelBinding": null,
"counterexample": [
[
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "read",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:21:12",
"modelState": null,
"input": null
},
{
"index": 1,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:23:18",
"modelState": null,
"input": null
},
{
"index": 2,
"binding": "archive_submission",
"primitive": "read",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:27:12",
"modelState": null,
"input": null
},
{
"index": 3,
"binding": "archive_submission",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:29:18",
"modelState": null,
"input": null
}
],
[
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "read",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:21:12",
"modelState": null,
"input": null
},
{
"index": 2,
"binding": "archive_submission",
"primitive": "read",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:27:12",
"modelState": null,
"input": null
},
{
"index": 3,
"binding": "archive_submission",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:29:18",
"modelState": null,
"input": null
},
{
"index": 1,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:23:18",
"modelState": null,
"input": null
}
]
]
},
{
"invariant": "only-legal-steps",
"verdict": "holds",
"kind": "declared",
"method": "bounded-interleavings",
"detail": "6 interleaving(s) explored, every modeled step satisfied 'only-legal-steps'",
"spec": "Agora/Spec/Submission::submission_spec",
"propertyLocation": "submission.spec:51:19",
"modelBinding": "declared-only",
"counterexample": []
},
{
"invariant": "terminal-is-final",
"verdict": "holds",
"kind": "declared",
"method": "bounded-interleavings",
"detail": "6 interleaving(s) explored, every modeled step satisfied 'terminal-is-final'",
"spec": "Agora/Spec/Submission::submission_spec",
"propertyLocation": "submission.spec:51:19",
"modelBinding": "declared-only",
"counterexample": []
},
{
"invariant": "stale-read:only-legal-steps",
"verdict": "violated",
"kind": "declared",
"method": "bounded-interleavings",
"detail": "under read-capture semantics (a handler that reads the modeled cell before writing applies its declared step to the value it read, not the value at write time): 'archive_submission' steps the model Processing -> Received",
"spec": "Agora/Spec/Submission::submission_spec",
"propertyLocation": "submission.spec:51:19",
"modelBinding": "declared-only",
"counterexample": [
[
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "read",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:21:12",
"modelState": "Received",
"input": null
},
{
"index": 2,
"binding": "archive_submission",
"primitive": "read",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:27:12",
"modelState": "Received",
"input": null
},
{
"index": 1,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:23:18",
"modelState": "Processing",
"input": null
},
{
"index": 3,
"binding": "archive_submission",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_guarded:29:18",
"modelState": "Received",
"input": null
}
]
]
}
],
"view": "compact",
"viewSchemaVersion": "1.0",
"specWitnessRef": {
"format": "TLA+",
"encoding": "UTF-8",
"sha256": "73c684f6278b5c800b13b581bd3192c6b7a9e5fd5d6d967f4f19547f2564dc98",
"bytes": 1691,
"retrieval": {
"tool": "api_integrity_check",
"arguments": {
"view": "full",
"module_name": "Api",
"max_ops": 8
},
"sources": "Resubmit the original sources with identical fileName and source bytes using the same checker version; compare source identities and the returned witness hash.",
"resultPath": "verdicts.specWitness"
}
}
}
}
The near-miss twin: unguarded handlers violate the declared properties
Request
{
"sources": [
{
"fileName": "submission.bosatsu",
"source": "package Agora/Domain\n\nexport (\n SubmissionState(),\n UrgencyLevel(),\n Submission(),\n ValidationResult(),\n TransitionValidation(),\n assign_id,\n set_archived,\n submission_state_name,\n validate_submission,\n can_transition,\n same_state,\n is_one_of,\n validate_transition,\n is_terminal,\n valid_next_states\n)\n\nenum SubmissionState:\n Received\n Processing\n BriefReady\n Failed\n Judging\n Ranked\n Archived\n\nenum UrgencyLevel:\n Breaking\n Timely\n Timeless\n\nstruct Submission(\n id: String,\n user_id: String,\n url: String,\n advocate_argument: String,\n urgency_claim: UrgencyLevel,\n submission_time: String,\n state: SubmissionState\n)\n\nenum ValidationResult:\n Valid(submission: Submission)\n Invalid(reason: String)\n\nenum TransitionValidation:\n TransitionValid\n TransitionInvalid(reason: String)\n\ndef is_empty(value: String) -> Bool:\n match value:\n case \"\": True\n case _: False\n\ndef submission_state_name(state: SubmissionState) -> String:\n match state:\n case Received: \"Received\"\n case Processing: \"Processing\"\n case BriefReady: \"BriefReady\"\n case Failed: \"Failed\"\n case Judging: \"Judging\"\n case Ranked: \"Ranked\"\n case Archived: \"Archived\"\n\ndef assign_id(submission: Submission, id: String) -> Submission:\n match submission:\n case Submission(_, user_id, url, advocate_argument, urgency_claim, submission_time, state):\n Submission(\n id,\n user_id,\n url,\n advocate_argument,\n urgency_claim,\n submission_time,\n state\n )\n\ndef set_archived(submission: Submission) -> Submission:\n match submission:\n case Submission(id, user_id, url, advocate_argument, urgency_claim, submission_time, _):\n Submission(\n id,\n user_id,\n url,\n advocate_argument,\n urgency_claim,\n submission_time,\n Archived\n )\n\ndef validate_submission(\n id: String,\n user_id: String,\n url: String,\n advocate_argument: String,\n urgency_claim: UrgencyLevel,\n submission_time: String\n) -> ValidationResult:\n match is_empty(id):\n case True:\n Invalid(\"Submission ID must not be empty\")\n case False:\n match is_empty(user_id):\n case True:\n Invalid(\"User ID must not be empty\")\n case False:\n match is_empty(url):\n case True:\n Invalid(\"URL must not be empty\")\n case False:\n match is_empty(advocate_argument):\n case True:\n Invalid(\"Advocate argument must not be empty\")\n case False:\n match is_empty(submission_time):\n case True:\n Invalid(\"Submission time must not be empty\")\n case False:\n Valid(Submission(\n id,\n user_id,\n url,\n advocate_argument,\n urgency_claim,\n submission_time,\n Received\n ))\n\n# Each state's successors, listed in the order the states are declared.\ndef valid_next_states(from: SubmissionState) -> List[SubmissionState]:\n match from:\n case Received: [Received, Processing]\n case Processing: [Processing, BriefReady, Failed]\n case BriefReady: [BriefReady, Judging]\n case Failed: [Failed, Archived]\n case Judging: [BriefReady, Judging, Ranked]\n case Ranked: [Ranked, Archived]\n case Archived: [Archived]\n\ndef same_state(left: SubmissionState, right: SubmissionState) -> Bool:\n match left:\n case Received: right matches Received\n case Processing: right matches Processing\n case BriefReady: right matches BriefReady\n case Failed: right matches Failed\n case Judging: right matches Judging\n case Ranked: right matches Ranked\n case Archived: right matches Archived\n\ndef is_one_of(states: List[SubmissionState], target: SubmissionState) -> Bool:\n loop states:\n case []: False\n case [state, *rest]:\n if same_state(state, target): True\n else: is_one_of(rest, target)\n\ndef can_transition(from: SubmissionState, to: SubmissionState) -> Bool:\n is_one_of(valid_next_states(from), to)\n\ndef validate_transition(from: SubmissionState, to: SubmissionState) -> TransitionValidation:\n match can_transition(from, to):\n case True:\n TransitionValid\n case False:\n TransitionInvalid(\"Invalid state transition from ${submission_state_name(from)} to ${submission_state_name(to)}\")\n\ndef is_terminal(state: SubmissionState) -> Bool:\n match state:\n case Archived: True\n case Received | Processing | BriefReady | Failed | Judging | Ranked: False\n"
},
{
"fileName": "submission_unchecked.spec.bosatsu",
"source": "package Agora/Spec/SubmissionUnchecked\n\n# Models the UNGUARDED intake handlers\n# (fixtures/intake_handlers_unchecked.bosatsu) as written: each handler\n# writes its target state unconditionally, so each declared step is a\n# constant setter. The checker finds interleavings where these steps break\n# the domain FSM and reports them as source-located counterexample traces\n# with the model state at every step.\n\nfrom Agora/Domain import (\n SubmissionState, Processing, Received, Ranked, Archived,\n can_transition, is_terminal, submission_state_name\n)\nfrom Yichus/Spec import Spec, StateModel, Transition, StepProperty\n\nexport (submission_unchecked_spec)\n\nexposes (Agora/Domain, Yichus/Spec)\n\ndef set_processing(_: SubmissionState) -> SubmissionState:\n Processing\n\ndef set_ranked(_: SubmissionState) -> SubmissionState:\n Ranked\n\ndef set_archived_state(_: SubmissionState) -> SubmissionState:\n Archived\n\ndef only_legal_steps(pre: SubmissionState, _: String, post: SubmissionState) -> Bool:\n can_transition(pre, post)\n\ndef terminal_is_final(pre: SubmissionState, _: String, post: SubmissionState) -> Bool:\n match is_terminal(pre):\n case True: is_terminal(post)\n case False: True\n\nsubmission_unchecked_spec = Spec(\n StateModel(\n \"submission_state\",\n Received,\n submission_state_name,\n [\n Transition(\"advance_to_processing\", set_processing),\n Transition(\"rank_now\", set_ranked),\n Transition(\"archive_submission\", set_archived_state)\n ],\n []\n ),\n [],\n [\n StepProperty(\"only-legal-steps\", only_legal_steps),\n StepProperty(\"terminal-is-final\", terminal_is_final)\n ]\n)\n"
},
{
"fileName": "intake_handlers_unchecked.bosatsu",
"source": "package Agora/Intake/Unchecked\n\n# Unguarded intake handlers: each writes its target state unconditionally.\n# Individually innocent; under interleaving they can drive the submission\n# FSM through illegal transitions (e.g. rank a submission straight from\n# Received, or resurrect an Archived one). The spec\n# (specs/submission_unchecked.spec.bosatsu) models them as written and the\n# bounded checker reports the violating interleavings.\n\nfrom Yichus/IO import IO\nfrom Yichus/UI import State, write\nfrom Agora/Domain import SubmissionState, Processing, Ranked, Archived\n\nexport (advance_to_processing, rank_now, archive_submission)\n\nexposes (Agora/Domain, Yichus/IO, Yichus/UI)\n\ndef advance_to_processing(submission_state: State[SubmissionState]) -> IO[Unit]:\n submission_state.write(Processing)\n\ndef rank_now(submission_state: State[SubmissionState]) -> IO[Unit]:\n submission_state.write(Ranked)\n\ndef archive_submission(submission_state: State[SubmissionState]) -> IO[Unit]:\n submission_state.write(Archived)\n"
}
],
"view": "compact"
}
Response
{
"ok": true,
"tool": "api_integrity_check",
"specCount": 1,
"verdicts": {
"artifactClass": "tla-verdict",
"schemaVersion": "2.2",
"sources": {
"hash": "000eec190ba3c8e954ff5e3ed09e6ccc665e615a9e8ea70d2c579ece4e34a140",
"files": [
{
"name": "submission",
"sha256": "b3d084f803cb81f7d6ee4ba4a2c9729f85f7657af9bafa3b57dde160a4d5a820"
},
{
"name": "submission_unchecked.spec",
"sha256": "b029720b3579ae341af90f1a653116b0c54abd29a497a4ba5c54a247a7a1dace"
},
{
"name": "intake_handlers_unchecked",
"sha256": "30661ec1b92e70986104406ee7e0ea3003a563cd8282a48eb85c1527b06d032c"
}
]
},
"module": "Api",
"bound": 8,
"truncatedOps": 0,
"interleavingsExplored": 6,
"uniqueOutcomes": 1,
"declaredSpecs": [
{
"ref": "Agora/Spec/SubmissionUnchecked::submission_unchecked_spec",
"location": "submission_unchecked.spec:37:29"
}
],
"invariants": [
{
"invariant": "causal-consistency",
"verdict": "holds",
"kind": "built-in",
"method": "complete-causal-graph",
"detail": "the complete causal graph over 3 effect operations admits an ordering; schedule exploration remains separately bounded",
"spec": null,
"propertyLocation": null,
"modelBinding": null,
"counterexample": []
},
{
"invariant": "race-free:AnyCell",
"verdict": "violated",
"kind": "built-in",
"method": "bounded-interleavings",
"detail": "6 valid orderings over the cells unresolved handles may open produce differing effect sequences",
"spec": null,
"propertyLocation": null,
"modelBinding": null,
"counterexample": [
[
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:19:3",
"modelState": null,
"input": null
},
{
"index": 1,
"binding": "rank_now",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:22:3",
"modelState": null,
"input": null
},
{
"index": 2,
"binding": "archive_submission",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:25:3",
"modelState": null,
"input": null
}
],
[
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:19:3",
"modelState": null,
"input": null
},
{
"index": 2,
"binding": "archive_submission",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:25:3",
"modelState": null,
"input": null
},
{
"index": 1,
"binding": "rank_now",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:22:3",
"modelState": null,
"input": null
}
],
[
{
"index": 1,
"binding": "rank_now",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:22:3",
"modelState": null,
"input": null
},
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:19:3",
"modelState": null,
"input": null
},
{
"index": 2,
"binding": "archive_submission",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:25:3",
"modelState": null,
"input": null
}
],
[
{
"index": 1,
"binding": "rank_now",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:22:3",
"modelState": null,
"input": null
},
{
"index": 2,
"binding": "archive_submission",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:25:3",
"modelState": null,
"input": null
},
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:19:3",
"modelState": null,
"input": null
}
]
]
},
{
"invariant": "only-legal-steps",
"verdict": "violated",
"kind": "declared",
"method": "bounded-interleavings",
"detail": "'rank_now' steps the model Processing -> Ranked",
"spec": "Agora/Spec/SubmissionUnchecked::submission_unchecked_spec",
"propertyLocation": "submission_unchecked.spec:37:29",
"modelBinding": "declared-only",
"counterexample": [
[
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:19:3",
"modelState": "Processing",
"input": null
},
{
"index": 1,
"binding": "rank_now",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:22:3",
"modelState": "Ranked",
"input": null
}
]
]
},
{
"invariant": "terminal-is-final",
"verdict": "violated",
"kind": "declared",
"method": "bounded-interleavings",
"detail": "'rank_now' steps the model Archived -> Ranked",
"spec": "Agora/Spec/SubmissionUnchecked::submission_unchecked_spec",
"propertyLocation": "submission_unchecked.spec:37:29",
"modelBinding": "declared-only",
"counterexample": [
[
{
"index": 0,
"binding": "advance_to_processing",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:19:3",
"modelState": "Processing",
"input": null
},
{
"index": 2,
"binding": "archive_submission",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:25:3",
"modelState": "Archived",
"input": null
},
{
"index": 1,
"binding": "rank_now",
"primitive": "write",
"stateRef": "submission_state",
"location": "intake_handlers_unchecked:22:3",
"modelState": "Ranked",
"input": null
}
]
]
}
],
"view": "compact",
"viewSchemaVersion": "1.0",
"specWitnessRef": {
"format": "TLA+",
"encoding": "UTF-8",
"sha256": "194c750bbad09cbc466ff995da80a431dafde3ae7fa9721f0d5a75105d81aef7",
"bytes": 1090,
"retrieval": {
"tool": "api_integrity_check",
"arguments": {
"view": "full",
"module_name": "Api",
"max_ops": 8
},
"sources": "Resubmit the original sources with identical fileName and source bytes using the same checker version; compare source identities and the returned witness hash.",
"resultPath": "verdicts.specWitness"
}
}
}
}
Run tools in the browser: api-mcp.html?webmcp=1.
Read the result according to this tool’s scope: static checks, bounded execution checks, and descriptive diagrams answer different questions. A successful call is not a general approval of the program. The safety and permissions guide compares the checks and provides editable ownership, guard, and role examples.