// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2026 SubLang International // Generated by slc (DR-009): FSM introspection pins. // The PINNED topology was derived from the artifact at build time; any // unintended structural change to the machine fails this test. import { describe, expect, it } from 'vitest'; import { findMachineConfig, pinIntrospection } from "./.slc-verify/verify.js"; import * as fsm from "./verify.fsm.js"; const PINNED = { "initial": "ready", "captain": [ { "state": "initialVerification", "actor": "player", "sourceItem": "VERIFY-1", "player": "", "role": "tester", "resultKeys": [ "needsBossReply", "verified" ], "onDone": [ { "index": 0, "target": "firstAudit", "guarded": true }, { "index": 1, "target": "awaitBossReply", "guarded": true }, { "index": 2, "target": "failed", "guarded": false } ], "onError": [ { "index": 0, "target": "failed", "guarded": false } ], "on": {} }, { "state": "firstAudit", "actor": "player", "sourceItem": "VERIFY-2", "player": "", "role": "auditor", "resultKeys": [ "hasFindings", "needsBossReply", "noFindings" ], "onDone": [ { "index": 0, "target": "firstRoundFix", "guarded": true }, { "index": 1, "target": "verified", "guarded": true }, { "index": 2, "target": "awaitBossReply", "guarded": true }, { "index": 3, "target": "failed", "guarded": false } ], "onError": [ { "index": 0, "target": "failed", "guarded": false } ], "on": {} }, { "state": "firstRoundFix", "actor": "player", "sourceItem": "VERIFY-5", "player": "", "role": "tester", "resultKeys": [ "fixed", "needsBossReply", "rebuttedAll" ], "onDone": [ { "index": 0, "target": "secondAuditAfterFix", "guarded": true }, { "index": 1, "target": "secondAuditAfterRebuttal", "guarded": true }, { "index": 2, "target": "awaitBossReply", "guarded": true }, { "index": 3, "target": "failed", "guarded": false } ], "onError": [ { "index": 0, "target": "failed", "guarded": false } ], "on": {} }, { "state": "secondAuditAfterFix", "actor": "player", "sourceItem": "VERIFY-3", "player": "", "role": "auditor", "resultKeys": [ "hasFindings", "needsBossReply", "noFindings" ], "onDone": [ { "index": 0, "target": "secondRoundFix", "guarded": true }, { "index": 1, "target": "verified", "guarded": true }, { "index": 2, "target": "awaitBossReply", "guarded": true }, { "index": 3, "target": "failed", "guarded": false } ], "onError": [ { "index": 0, "target": "failed", "guarded": false } ], "on": {} }, { "state": "secondAuditAfterRebuttal", "actor": "player", "sourceItem": "VERIFY-4", "player": "", "role": "auditor", "resultKeys": [ "hasFindings", "needsBossReply", "noFindings" ], "onDone": [ { "index": 0, "target": "secondRoundFix", "guarded": true }, { "index": 1, "target": "verified", "guarded": true }, { "index": 2, "target": "awaitBossReply", "guarded": true }, { "index": 3, "target": "failed", "guarded": false } ], "onError": [ { "index": 0, "target": "failed", "guarded": false } ], "on": {} }, { "state": "secondRoundFix", "actor": "player", "sourceItem": "VERIFY-6", "player": "", "role": "tester", "resultKeys": [ "fixed", "needsBossReply", "rebuttedAll" ], "onDone": [ { "index": 0, "target": "unreviewedFix", "guarded": true }, { "index": 1, "target": "disputed", "guarded": true }, { "index": 2, "target": "awaitBossReply", "guarded": true }, { "index": 3, "target": "failed", "guarded": false } ], "onError": [ { "index": 0, "target": "failed", "guarded": false } ], "on": {} } ], "quiescent": [ { "state": "ready", "final": false, "on": { "BOSS_REQUEST": [ { "index": 0, "target": "initialVerification", "guarded": true } ] } }, { "state": "awaitBossReply", "final": false, "on": { "BOSS_REPLY": [ { "index": 0, "target": "initialVerification", "guarded": true }, { "index": 1, "target": "firstAudit", "guarded": true }, { "index": 2, "target": "secondAuditAfterFix", "guarded": true }, { "index": 3, "target": "secondAuditAfterRebuttal", "guarded": true }, { "index": 4, "target": "firstRoundFix", "guarded": true }, { "index": 5, "target": "secondRoundFix", "guarded": true } ], "BOSS_REQUEST": [ { "index": 0, "target": "initialVerification", "guarded": true } ] } }, { "state": "failed", "final": false, "on": { "BOSS_REQUEST": [ { "index": 0, "target": "initialVerification", "guarded": true } ] } }, { "state": "verified", "final": true, "on": {} }, { "state": "unreviewedFix", "final": true, "on": {} }, { "state": "disputed", "final": true, "on": {} } ], "rootOn": { "BOSS_INTERRUPT": [ { "index": 0, "target": "initialVerification", "guarded": true }, { "index": 1, "target": "firstAudit", "guarded": true }, { "index": 2, "target": "secondAuditAfterFix", "guarded": true }, { "index": 3, "target": "secondAuditAfterRebuttal", "guarded": true }, { "index": 4, "target": "firstRoundFix", "guarded": true }, { "index": 5, "target": "secondRoundFix", "guarded": true } ], "BOSS_REPLY": [ { "index": 0, "target": "failed", "guarded": true } ] }, "interruptTargets": [ "initialVerification", "firstAudit", "secondAuditAfterFix", "secondAuditAfterRebuttal", "firstRoundFix", "secondRoundFix" ] } as const; describe("verify: FSM introspection", () => { it('matches the machine topology pinned at build time', () => { expect(pinIntrospection(findMachineConfig(fsm))).toEqual(PINNED); }); });