"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.INTEGRATED_INCIDENT_MATRIX = exports.INTEGRATED_MATRIX_BOUNDARY = exports.AGREEMENT_PROBE_IDS = exports.INCIDENT_SURFACES = exports.REQUIRED_INCIDENT_IDS = void 0;
exports.validateIntegratedIncidentMatrix = validateIntegratedIncidentMatrix;
exports.assertCompleteIntegratedIncidentMatrix = assertCompleteIntegratedIncidentMatrix;
exports.REQUIRED_INCIDENT_IDS = [
    "DS-0122-001-bootstrap-self-recovery",
    "DS-0122-002-control-plane-trajectory-burn",
    "DS-0122-003-command-callability-drift",
    "DS-0122-004-native-protocol-schema-drift",
    "DS-0122-005-completed-task-lifecycle-drift",
    "DS-0122-006-compact-context-pack-omission",
    "DS-0122-007-explicit-selection-conflict",
    "DS-0122-008-scan-evidence-instability",
    "DS-0122-009-installed-runtime-warning",
    "DS-0122-010-manual-authoring-policy-conflict",
    "DS-0122-011-runtime-acceptance-misclassification",
    "DS-0122-012-current-cycle-attribution-gap",
    "DS-0122-013-mode-balance-recovery-loop",
    "DS-0122-014-pattern-derived-decomposition",
    "DS-0122-015-prompt-guardrail-delivery-drift",
    "DS-0122-016-prompt-ownership-drift",
    "DS-0122-017-spec-registry-lifecycle-omission",
    "DS-0122-018-compact-collection-empty-page",
    "DS-0122-019-command-input-contract-drift",
    "DS-0122-020-spec-source-mutation-contradiction",
    "DS-0122-021-runtime-provenance-conflation",
    "DS-0122-022-global-protocol-option-pagination"
];
exports.INCIDENT_SURFACES = [
    "agent-bootstrap",
    "artifact-context",
    "authoring-policy",
    "collection-pagination",
    "command-availability",
    "command-descriptors",
    "examples",
    "generated-contracts",
    "lifecycle-state",
    "mode-balance",
    "mutation-policy",
    "native-manifests",
    "prompt-ownership",
    "prompt-resolution",
    "protocol-schemas",
    "recovery-guidance",
    "runtime-actions",
    "runtime-attribution",
    "runtime-provenance",
    "scan-evidence",
    "selection-recovery",
    "source-transitions",
    "spec-registry",
    "trajectory-policy"
];
exports.AGREEMENT_PROBE_IDS = [
    "bootstrap",
    "trajectory",
    "command-contract",
    "protocol",
    "lifecycle",
    "context-pack",
    "selection",
    "scan",
    "provenance",
    "authoring-mode",
    "prompt",
    "registry",
    "pagination",
    "source-transition",
    "strict-cycle"
];
exports.INTEGRATED_MATRIX_BOUNDARY = Object.freeze({
    acceptedReconciliation: ".day-shift/planning/00-emergent-agent-inference-burn-and-workflow-reliability/phases/05-integrated-regression-and-release-acceptance/milestones/01-eliminate-cli-cycle-failures-and-inference-burn/reconciliation.md",
    runtimeEvidence: Object.freeze(["repository-source", "repository-dist"]),
    installedQualificationMilestone: "03-qualify-supported-and-installed-runtimes",
    deferredCorrectiveRowsAllowed: false
});
const rows = [
    {
        incidentId: "DS-0122-001-bootstrap-self-recovery",
        title: "Compact bootstrap repeated or expanded its own orientation lane",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["agent-bootstrap", "recovery-guidance", "runtime-actions"],
        authoritativeSources: ["src/cli/commands/agent/index.ts", "src/lib/agent-context/workflow-actions.ts"],
        regression: {
            path: "tests_v2/cli/agent/command-surface.test.js",
            testName: "default compact agent output is terminal for the bootstrap lane"
        },
        sensitivity: {
            reproducedFailure: "Routine compact orientation was marked incomplete and recommended another orientation or broad audit expansion.",
            correctedSignal: "One compact bootstrap response is lane-complete, omits its own argv, and reserves full orientation for explicit audit use."
        },
        agreementProbe: "bootstrap",
        expectedOutcome: "closed",
        recovery: {
            availability: "callable",
            argv: "day-shift agent --format json --detail compact",
            preconditions: ["a supported Day Shift workspace is selected"]
        }
    },
    {
        incidentId: "DS-0122-002-control-plane-trajectory-burn",
        title: "Routine lifecycle trajectories exceeded bounded control-plane work",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["trajectory-policy", "agent-bootstrap", "recovery-guidance"],
        authoritativeSources: ["src/lib/agent-trajectory-budget/index.ts", "src/cli/commands/agent/index.ts"],
        regression: {
            path: "tests_v2/cli/agent/trajectory-budget.test.js",
            testName: "representative lifecycle trajectories remain within aggregate call and byte ceilings"
        },
        sensitivity: {
            reproducedFailure: "Bootstrap, handoff, review, and closeout guidance repeated control-plane calls and omitted explicit excluded evidence classes.",
            correctedSignal: "Each representative lane records bounded calls and bytes, exclusions, decision completeness, retry taxonomy, and recovery evidence."
        },
        agreementProbe: "trajectory",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-003-command-callability-drift",
        title: "Discovery advertised non-executable command containers and planned entries",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["runtime-actions", "command-availability", "native-manifests", "examples"],
        authoritativeSources: ["src/lib/output/command-availability.ts", "src/lib/output/command-inventory.ts", "src/lib/output/tool-manifest.ts"],
        regression: {
            path: "tests_v2/cli/commands/drift-validation.test.js",
            testName: "command validation rejects callable availability outside the runtime descriptor intersection"
        },
        sensitivity: {
            reproducedFailure: "Command search, manifests, examples, and validation presented containers or registry-only descriptors as executable.",
            correctedSignal: "Callable availability is the runtime-action and descriptor intersection; non-callable entries remain inspection-only and never become native tools."
        },
        agreementProbe: "command-contract",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-004-native-protocol-schema-drift",
        title: "Native manifests advertised a protocol schema different from selected output",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["protocol-schemas", "native-manifests", "generated-contracts"],
        authoritativeSources: ["src/lib/output/tool-manifest.ts", "src/lib/automation-protocol/index.ts", "src/generated/automation-protocol/v1/schemas.ts"],
        regression: {
            path: "tests_v2/cli/commands/tool-manifest.test.js",
            testName: "global shell and structured protocol selection project matching manifest schemas"
        },
        sensitivity: {
            reproducedFailure: "Protocol-v1 native tools referenced a schema inconsistent with the globally selected envelope protocol.",
            correctedSignal: "Static v1 and v2 manifests select matching generated schema references and remain invariant outside protocol fields."
        },
        agreementProbe: "protocol",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-005-completed-task-lifecycle-drift",
        title: "Completed task state was reported as not ready",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["lifecycle-state", "artifact-context", "recovery-guidance"],
        authoritativeSources: ["src/lib/planning/artifact-lifecycle.ts", "src/lib/doctor/action-relevance.ts", "src/lib/agent-context/index.ts"],
        regression: {
            path: "tests_v2/cli/doctor/scoped-health.test.js",
            testName: "completed tasks do not produce TASK_NOT_READY across context and scoped doctor"
        },
        sensitivity: {
            reproducedFailure: "Canonical completed readiness produced TASK_NOT_READY while adjacent doctor evidence reported no blocker.",
            correctedSignal: "Shared lifecycle classification makes context, planning navigation, and doctor agree that completed tasks advance to closeout."
        },
        agreementProbe: "lifecycle",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-006-compact-context-pack-omission",
        title: "Requested compact context packs were silently omitted",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["artifact-context", "agent-bootstrap", "recovery-guidance"],
        authoritativeSources: ["src/lib/agent-context/index.ts", "src/lib/output/budget.ts", "src/cli/commands/agent/index.ts"],
        regression: {
            path: "tests_v2/cli/agent/context-pack-budget.test.js",
            testName: "compact context-pack requests return bounded evidence or a typed no-write error"
        },
        sensitivity: {
            reproducedFailure: "Compact context accepted the context-pack option, omitted the requested pack, and still reported complete success.",
            correctedSignal: "The bounded pack includes byte and completeness evidence, while invalid or unsatisfiable requests fail before success output."
        },
        agreementProbe: "context-pack",
        expectedOutcome: "closed",
        recovery: {
            availability: "callable",
            argv: "day-shift agent context --artifact <path> --include-context-pack --format json --detail compact",
            preconditions: ["the selected planning artifact exists", "the requested pack budget is supported"]
        }
    },
    {
        incidentId: "DS-0122-007-explicit-selection-conflict",
        title: "Explicit artifact selection contradicted stored-selection precedence",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["selection-recovery", "artifact-context", "recovery-guidance"],
        authoritativeSources: ["src/lib/work-selection/index.ts", "src/lib/agent-context/index.ts", "src/cli/commands/work-selection/index.ts"],
        regression: {
            path: "tests_v2/cli/work/selection-lifecycle.test.js",
            testName: "explicit selection wins and stale stored writes return complete executable recovery"
        },
        sensitivity: {
            reproducedFailure: "A caller-selected artifact was rejected when it differed from local stored selection and compact recovery omitted replacement preconditions.",
            correctedSignal: "Read paths honor explicit precedence; stored-selection writes use revision tokens and return complete stale-recovery evidence."
        },
        agreementProbe: "selection",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-008-scan-evidence-instability",
        title: "Unchanged scan evidence regenerated incomplete identity on every read",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["scan-evidence", "artifact-context", "trajectory-policy"],
        authoritativeSources: ["src/lib/scan-safety-evidence/index.ts", "src/lib/agent-context/index.ts"],
        regression: {
            path: "tests_v2/cli/agent/scan-safety.test.js",
            testName: "scan evidence is stable until relevant inputs invalidate its identity"
        },
        sensitivity: {
            reproducedFailure: "Each context read generated a timestamped incomplete scan result that prior evidence could never satisfy.",
            correctedSignal: "Stable input identity permits evidence reuse, relevant changes invalidate deterministically, and reads remain no-write."
        },
        agreementProbe: "scan",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-009-installed-runtime-warning",
        title: "Supported Node execution emitted an experimental module warning",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["runtime-actions", "runtime-provenance", "examples"],
        authoritativeSources: ["src/cli/index.ts", "src/cli/commands/version/index.ts", "src/lib/runtime/runtime-provenance.ts"],
        regression: {
            path: "tests_v2/cli/runtime/runtime-provenance.test.js",
            testName: "version construction and representative commands produce no unsuppressed stderr"
        },
        sensitivity: {
            reproducedFailure: "CommonJS version-command construction required ESM Commander and printed an ExperimentalWarning on every installed invocation.",
            correctedSignal: "Version command factories reuse the asynchronous Commander constructor and representative supported-Node commands have empty stderr."
        },
        agreementProbe: "provenance",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-010-manual-authoring-policy-conflict",
        title: "Planning guidance independently authorized unsupported manual writes",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["authoring-policy", "examples", "recovery-guidance"],
        authoritativeSources: ["src/lib/planning/authoring-policy.ts", "src/lib/planning/verb-policy.ts", ".day-shift/agents.md"],
        regression: {
            path: "tests_v2/cli/planning/verb-policy.test.js",
            testName: "canonical authoring policy requires CLI provenance or one named manual exception"
        },
        sensitivity: {
            reproducedFailure: "Agent guidance restricted manual authoring but separately permitted it for convenience or clarity.",
            correctedSignal: "One authoring policy permits only command-owned writes or the three explicit manual-exception classes."
        },
        agreementProbe: "authoring-mode",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-011-runtime-acceptance-misclassification",
        title: "Runtime-sensitive acceptance could be planned as contract-only work",
        criterionIds: ["P5-AC-05", "P5-AC-06", "P5-AC-08"],
        surfaces: ["mode-balance", "runtime-attribution", "authoring-policy"],
        authoritativeSources: ["src/lib/planning/mode-balance.ts", "src/lib/planning/full-set-expansion.ts", "src/lib/planning/task-readiness-review.ts"],
        regression: {
            path: "tests_v2/cli/planning/creation.test.js",
            testName: "runtime acceptance metadata propagates and blocks contradictory task ordering"
        },
        sensitivity: {
            reproducedFailure: "Runtime-sensitive parent criteria could be diluted by inferred child modes or a late contract-only sequence.",
            correctedSignal: "Parent criterion IDs are authoritative and full-set preflight requires a runtime or hybrid breakout in the allowed position."
        },
        agreementProbe: "authoring-mode",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-012-current-cycle-attribution-gap",
        title: "Dirty file presence could masquerade as current-cycle runtime evidence",
        criterionIds: ["P5-AC-05", "P5-AC-06", "P5-AC-08"],
        surfaces: ["runtime-attribution", "lifecycle-state", "runtime-provenance"],
        authoritativeSources: ["src/lib/planning/task-cycle-runtime-attribution.ts", "src/cli/commands/task-baseline/index.ts"],
        regression: {
            path: "tests_v2/cli/task/baseline.test.js",
            testName: "task baseline records post-readiness pre-write identity and rejects unattributed freshness"
        },
        sensitivity: {
            reproducedFailure: "Existing files, pre-existing dirty paths, or completion metadata could satisfy runtime breakout review without current-cycle work.",
            correctedSignal: "A stable baseline identity, fresh eligible paths, exact criteria, executable validation, and empty ineligible paths are required."
        },
        agreementProbe: "authoring-mode",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-013-mode-balance-recovery-loop",
        title: "Review loops repeated unchanged gates instead of executing the breakout",
        criterionIds: ["P5-AC-05", "P5-AC-06", "P5-AC-08"],
        surfaces: ["mode-balance", "lifecycle-state", "recovery-guidance"],
        authoritativeSources: ["src/lib/planning/planning-review.ts", "src/lib/planning/mode-balance.ts", ".day-shift/references/validation-and-review.md"],
        regression: {
            path: "tests_v2/cli/planning/planning-review.test.js",
            testName: "structured mode-balance blockers return the deterministic documentation-loop recovery protocol"
        },
        sensitivity: {
            reproducedFailure: "Milestone and phase review could reopen unchanged evidence or recommend another identical review instead of the authorized runtime task.",
            correctedSignal: "Read-only reviews return detect, execute breakout, verify freshness, rebuild reconciliation, then rerun milestone and phase review."
        },
        agreementProbe: "authoring-mode",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-014-pattern-derived-decomposition",
        title: "Familiar child counts could replace authored decomposition evidence",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["authoring-policy", "mode-balance", "lifecycle-state"],
        authoritativeSources: ["src/lib/planning/planning-heuristics.ts", "src/lib/planning/authoring-policy.ts", "src/lib/planning/full-set-expansion.ts"],
        regression: {
            path: "tests_v2/cli/planning/creation.test.js",
            testName: "phase and milestone full-set creation rejects pattern-derived count rationale atomically"
        },
        sensitivity: {
            reproducedFailure: "Planning could infer a conventional number of children without implementation, dependency, validation, rollback, or ownership evidence.",
            correctedSignal: "Authored target count and rationale are mandatory, one child remains valid, and invalid full-set preflight performs no writes."
        },
        agreementProbe: "authoring-mode",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-015-prompt-guardrail-delivery-drift",
        title: "Shipped guardrails were not proven in the prompt body agents resolved",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["prompt-resolution", "authoring-policy", "agent-bootstrap"],
        authoritativeSources: ["src/lib/prompts/prompt-rendering-evidence.ts", "src/lib/workspace-init/default-assets.ts", ".day-shift/prompts/user/task.next.md"],
        regression: {
            path: "tests_v2/prompts/canonical-policy.test.js",
            testName: "resolved prompt bodies contain canonical Phase 03 guardrails and active-source evidence"
        },
        sensitivity: {
            reproducedFailure: "A guardrail could exist in a packaged or repository copy while agents resolved a different stale body.",
            correctedSignal: "Generated context names the requested and active prompt path, source family, fallback trace, destination, and delivered guardrail body."
        },
        agreementProbe: "prompt",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-016-prompt-ownership-drift",
        title: "Prompt upgrades could overwrite user ownership or lose three-way provenance",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["prompt-ownership", "prompt-resolution", "recovery-guidance"],
        authoritativeSources: ["src/lib/prompts/prompt-materialization.ts", "src/lib/prompts/prompt-reconciliation.ts", "src/lib/prompts/prompt-upgrade.ts"],
        regression: {
            path: "tests_v2/cli/prompt/reconcile.test.js",
            testName: "prompt reconciliation preserves base user upstream hashes and explicit no-write decisions"
        },
        sensitivity: {
            reproducedFailure: "Latest delivery, user customization, and stale upstream content could be normalized without explicit ownership or preview identity.",
            correctedSignal: "Preview/apply classifies three-way hashes, protects user bytes, requires a decision and exact preview hash, and owns one selected write lane."
        },
        agreementProbe: "prompt",
        expectedOutcome: "closed",
        recovery: {
            availability: "callable",
            argv: "day-shift prompt reconcile preview --prompt <path> --format json",
            preconditions: ["the selected prompt exists", "latest delivery evidence is available or explicitly classified"]
        }
    },
    {
        incidentId: "DS-0122-017-spec-registry-lifecycle-omission",
        title: "Default registry discovery hid draft and other non-archived work",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["spec-registry", "command-descriptors", "recovery-guidance"],
        authoritativeSources: ["src/lib/spec-registry/list.ts", "src/lib/spec-registry/search.ts", "src/cli/commands/spec-status-filter.ts"],
        regression: {
            path: "tests_v2/cli/spec/search.test.js",
            testName: "spec search finds exact ids and titles for every non-archived lifecycle status by default"
        },
        sensitivity: {
            reproducedFailure: "Exact search for a registered draft returned an unqualified complete empty result and archived inclusion erased other filter intent.",
            correctedSignal: "Default overlap discovery includes all non-archived statuses, reports exclusions, and exposes narrow additive status recovery."
        },
        agreementProbe: "registry",
        expectedOutcome: "closed",
        recovery: {
            availability: "callable",
            argv: "day-shift spec search <query> --status <status> --format json",
            preconditions: ["the requested lifecycle status is known from exclusion evidence"]
        }
    },
    {
        incidentId: "DS-0122-018-compact-collection-empty-page",
        title: "Compact collections returned no useful first-page records",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["collection-pagination", "spec-registry", "command-availability", "native-manifests"],
        authoritativeSources: ["src/lib/output/collection-pagination.ts", "src/lib/output/pagination.ts", "src/lib/output/projection.ts"],
        regression: {
            path: "tests_v2/cli/runtime/compact-collection-pagination.test.js",
            testName: "compact collection commands return deterministic non-empty pages and exact cursor recovery"
        },
        sensitivity: {
            reproducedFailure: "Compact list, search, inventory, manifest, and discovery output could omit every record and force broad full-detail recovery.",
            correctedSignal: "Default compact pages contain records, stable IDs and counts, snapshot-bound cursors, exact continuations, and typed stale-cursor no-write failure."
        },
        agreementProbe: "pagination",
        expectedOutcome: "closed",
        recovery: {
            availability: "callable",
            argv: "day-shift <collection-command> --page-lane <lane> --page-cursor <cursor> --format json",
            preconditions: ["the cursor was emitted for the same unchanged command snapshot"]
        }
    },
    {
        incidentId: "DS-0122-019-command-input-contract-drift",
        title: "Descriptor requiredness and mutation semantics diverged from runtime",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["command-descriptors", "runtime-actions", "native-manifests", "examples"],
        authoritativeSources: ["src/lib/output/command-descriptors.ts", "src/lib/output/command-drift.ts", "src/lib/output/command-descriptor-projections.ts"],
        regression: {
            path: "tests_v2/cli/runtime/command-descriptors.test.js",
            testName: "descriptor inputs preserve runtime requiredness conditional semantics and examples"
        },
        sensitivity: {
            reproducedFailure: "Required spec update inputs were described as optional and command validation ignored runtime/mutation semantic contradictions.",
            correctedSignal: "Descriptor, Commander, native schema, example argv, mutation guard, recovery, and validation input contracts are compared deterministically."
        },
        agreementProbe: "command-contract",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-020-spec-source-mutation-contradiction",
        title: "Generic source.ref mutation was accepted then rejected without append-only history",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["mutation-policy", "source-transitions", "recovery-guidance", "spec-registry"],
        authoritativeSources: ["src/lib/spec-registry/source-transition.ts", "src/lib/spec-registry/document-io.ts", "src/cli/commands/spec-source-add/index.ts"],
        regression: {
            path: "tests_v2/cli/spec/source-add.test.js",
            testName: "spec source add atomically appends history and generic source mutation fails before writes"
        },
        sensitivity: {
            reproducedFailure: "Generic spec update accepted source.ref in one layer and rejected it later, with no atomic history-preserving transition.",
            correctedSignal: "Generic mutation rejects before execution and callable spec source add preserves identity, ordered history, provenance, and byte-identical failure paths."
        },
        agreementProbe: "source-transition",
        expectedOutcome: "closed",
        recovery: {
            availability: "callable",
            argv: "day-shift spec source add --id <id> --ref <ref> --reason <reason>",
            preconditions: ["spec id, next source reference, and reviewable reason are all known"]
        }
    },
    {
        incidentId: "DS-0122-021-runtime-provenance-conflation",
        title: "Source dist and installed evidence lacked one privacy-safe provenance contract",
        criterionIds: ["P5-AC-05", "P5-AC-06"],
        surfaces: ["runtime-provenance", "runtime-actions", "generated-contracts"],
        authoritativeSources: ["src/lib/runtime/runtime-provenance.ts", "src/lib/runtime/runtime-contract.ts", "src/cli/commands/doctor.ts"],
        regression: {
            path: "tests_v2/cli/runtime/runtime-provenance.test.js",
            testName: "required CLI surfaces expose identical sanitized provenance with warning-free stderr"
        },
        sensitivity: {
            reproducedFailure: "Repository source, compiled dist, and installed execution could be mixed without build identity, freshness, integrity, or privacy-safe origin evidence.",
            correctedSignal: "Every required surface projects one sanitized provenance schema with runtime source, versions, build, revision, dirty state, freshness, and integrity."
        },
        agreementProbe: "provenance",
        expectedOutcome: "closed"
    },
    {
        incidentId: "DS-0122-022-global-protocol-option-pagination",
        title: "Spaced global protocol selection broke emitted pagination identity",
        criterionIds: ["P5-AC-05", "P5-AC-06", "P5-AC-12"],
        surfaces: ["collection-pagination", "protocol-schemas", "trajectory-policy", "recovery-guidance"],
        authoritativeSources: ["src/cli/index.ts", "src/lib/output/pagination.ts", "src/lib/agent-trajectory-budget/index.ts"],
        regression: {
            path: "tests_v2/cli/agent/strict-cycle-accounting.test.js",
            testName: "spaced and inline protocol-v1 pagination continuations preserve command identity"
        },
        sensitivity: {
            reproducedFailure: "The command-identity scanner skipped inline protocol selection but treated the spaced option value as the command token.",
            correctedSignal: "Spaced and inline protocol-v1 pages are identical, and the emitted spaced continuation executes the next disjoint page."
        },
        agreementProbe: "strict-cycle",
        expectedOutcome: "closed",
        recovery: {
            availability: "callable",
            argv: "day-shift --protocol-version 1 commands manifest --format json --detail compact --page-lane tools --page-cursor <cursor>",
            preconditions: ["the cursor was emitted by the matching protocol-v1 manifest request"]
        }
    }
];
function freezeRow(row) {
    return Object.freeze({
        ...row,
        criterionIds: Object.freeze([...row.criterionIds]),
        surfaces: Object.freeze([...row.surfaces]),
        authoritativeSources: Object.freeze([...row.authoritativeSources]),
        regression: Object.freeze({ ...row.regression }),
        sensitivity: Object.freeze({ ...row.sensitivity }),
        recovery: row.recovery
            ? Object.freeze({ ...row.recovery, preconditions: Object.freeze([...row.recovery.preconditions]) })
            : undefined
    });
}
exports.INTEGRATED_INCIDENT_MATRIX = Object.freeze(rows.map(freezeRow));
const criterionIds = new Set(["P5-AC-05", "P5-AC-06", "P5-AC-08", "P5-AC-12"]);
const incidentIds = new Set(exports.REQUIRED_INCIDENT_IDS);
const surfaces = new Set(exports.INCIDENT_SURFACES);
const probes = new Set(exports.AGREEMENT_PROBE_IDS);
function validateIntegratedIncidentMatrix(candidate) {
    const findings = [];
    const seen = new Set();
    for (const row of candidate) {
        const id = typeof row?.incidentId === "string" ? row.incidentId : "";
        const finding = (code, message) => {
            findings.push({ code, ...(id ? { incidentId: id } : {}), message });
        };
        if (!/^DS-0122-\d{3}-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(id)) {
            finding("INCIDENT_ID_INVALID", "Incident identity must use the stable DS-0122-NNN-slug form.");
        }
        if (seen.has(id)) {
            finding("INCIDENT_ID_DUPLICATE", `Incident identity '${id}' appears more than once.`);
        }
        seen.add(id);
        if (!incidentIds.has(id)) {
            finding("INCIDENT_ID_UNKNOWN", `Incident identity '${id}' is not part of the reproduced 0.1.22 family set.`);
        }
        if (!nonEmpty(row.title)) {
            finding("INCIDENT_TITLE_MISSING", "Incident title is required.");
        }
        if (!Array.isArray(row.criterionIds) || row.criterionIds.length === 0) {
            finding("CRITERION_OWNERSHIP_MISSING", "At least one Phase 05 acceptance criterion is required.");
        }
        else if (row.criterionIds.some((criterionId) => !criterionIds.has(criterionId))) {
            finding("CRITERION_OWNERSHIP_INVALID", "Criterion ownership contains an unsupported acceptance identity.");
        }
        if (!Array.isArray(row.surfaces) || row.surfaces.length < 2) {
            finding("SURFACE_OWNERSHIP_INCOMPLETE", "Cross-surface ownership requires at least two surfaces.");
        }
        else {
            if (new Set(row.surfaces).size !== row.surfaces.length) {
                finding("SURFACE_OWNERSHIP_DUPLICATE", "Surface ownership must not contain duplicates.");
            }
            if (row.surfaces.some((surface) => !surfaces.has(surface))) {
                finding("SURFACE_OWNERSHIP_INVALID", "Surface ownership contains an unsupported surface identity.");
            }
        }
        if (!Array.isArray(row.authoritativeSources) ||
            row.authoritativeSources.length === 0 ||
            row.authoritativeSources.some((source) => !repositoryRelativeLocator(source))) {
            finding("AUTHORITATIVE_SOURCE_MISSING", "At least one repository-relative authoritative source locator is required.");
        }
        if (!repositoryRelativeLocator(row.regression?.path) || !nonEmpty(row.regression?.testName)) {
            finding("REGRESSION_LOCATOR_MISSING", "A repository-relative focused regression path and test name are required.");
        }
        if (!nonEmpty(row.sensitivity?.reproducedFailure) || !nonEmpty(row.sensitivity?.correctedSignal)) {
            finding("SENSITIVITY_EVIDENCE_MISSING", "Both reproduced-failure and corrected-signal sensitivity evidence are required.");
        }
        if (!probes.has(row.agreementProbe)) {
            finding("AGREEMENT_PROBE_INVALID", "The incident must select one supported bounded agreement probe.");
        }
        if (row.recovery) {
            if (row.recovery.availability !== "callable") {
                finding("RECOVERY_CLAIM_NONCALLABLE", "Recovery evidence may be present only for callable recovery.");
            }
            if (!nonEmpty(row.recovery.argv) ||
                !row.recovery.argv.startsWith("day-shift ") ||
                !Array.isArray(row.recovery.preconditions) ||
                row.recovery.preconditions.length === 0 ||
                row.recovery.preconditions.some((precondition) => !nonEmpty(precondition))) {
                finding("RECOVERY_EVIDENCE_INCOMPLETE", "Callable recovery requires exact argv and complete non-empty preconditions.");
            }
        }
        if (row.expectedOutcome !== "closed") {
            finding("CORRECTIVE_ROW_DEFERRED", "Integrated corrective rows must be closed; deferred or planned outcomes are invalid.");
        }
    }
    for (const requiredId of exports.REQUIRED_INCIDENT_IDS) {
        if (!seen.has(requiredId)) {
            findings.push({
                code: "INCIDENT_FAMILY_MISSING",
                incidentId: requiredId,
                message: `Required reproduced incident '${requiredId}' is missing.`
            });
        }
    }
    return findings;
}
function assertCompleteIntegratedIncidentMatrix(candidate) {
    const findings = validateIntegratedIncidentMatrix(candidate);
    if (findings.length > 0) {
        throw new Error(`Integrated incident matrix is incomplete: ${JSON.stringify(findings)}`);
    }
}
function nonEmpty(value) {
    return typeof value === "string" && value.trim().length > 0;
}
function repositoryRelativeLocator(value) {
    return nonEmpty(value) && !value.startsWith("/") && !value.split("/").includes("..");
}
