KB-FB9A

marker_kind / marker_literal Contract (recheck-7 blocker E)

3 min read Revision 1

06 - marker_kind / marker_literal Contract (recheck-7 blocker E)

Load-bearing impl: check_marker() + MARKER_KINDS + MARKER_GRAMMAR in the SSOT artifact. Rationale here.

The defect

marker_literal and marker_kind were not constrained as one consistent pair by the exact extractor grammar. A record could carry a marker_kind of one kind and a marker_literal valid for another (or a typo), producing an ambiguous marker registry.

The fix — closed enum + per-kind literal grammar + consistency

  • marker_kind ∈ the closed enum {DOC_STATUS, SUPERSEDED_BEGIN, SUPERSEDED_END, ENVELOPE_EXCLUDE_BEGIN, ENVELOPE_EXCLUDE_END, AUTHORITY_BOUNDARY}.

  • marker_literal must match the extractor grammar for that exact kind, byte-for-byte:

    kind allowed literal (regex)
    DOC_STATUS ^<!-- DOC_STATUS: (ACTIVE_AUTHORITY|SUPERSEDED_NON_AUTHORITY) -->$
    ENVELOPE_EXCLUDE_BEGIN ^<!-- ENVELOPE:EXCLUDE-BEGIN -->$
    ENVELOPE_EXCLUDE_END ^<!-- ENVELOPE:EXCLUDE-END -->$
    SUPERSEDED_BEGIN ^<!-- SUPERSEDED_NON_AUTHORITY BEGIN(: <text>)? -->$
    SUPERSEDED_END ^<!-- SUPERSEDED_NON_AUTHORITY END -->$
    AUTHORITY_BOUNDARY ^<!-- AUTHORITY_BOUNDARY…-->$
  • The record encodes both marker_kind and marker_literal; no prose alias for a marker.

Fail-closed statuses

  • MARKER_KIND_UNKNOWN — kind not in the enum.
  • MARKER_KIND_LITERAL_INCONSISTENT — literal is valid for a different kind than declared.
  • MARKER_LITERAL_NOT_ALLOWED — literal matches no kind's grammar.
  • MARKER_LITERAL_MISMATCH — control byte / grammar miss for the declared kind.

(G-MARKER-KIND-LITERAL-CONSISTENCY, doc 06.) Duplicate same-kind markers fail closed unless explicitly allowed (e.g. exactly one DOC_STATUS per member — ACTIVE_SCOPE_MARKER_DUPLICATE).

Computed evidence (doc 07)

check_marker() in --selftest: a valid DOC_STATUS marker is accepted; kind=FOOMARKER_KIND_UNKNOWN; kind=DOC_STATUS with an ENVELOPE:EXCLUDE-BEGIN literal → MARKER_KIND_LITERAL_INCONSISTENT; kind=DOC_STATUS with literal <!-- DOC_STATUS: ACTIVE --> (typo) → MARKER_LITERAL_NOT_ALLOWED.

Back to Knowledge Hub knowledge/dev/reports/architecture/t1-fix7-blueprint-patch-after-codex-recheck-7-constitution14-ssot-2026-06-09/06-marker-kind-literal-contract.md