Implements issue #3 (RFC-EXT-0003) slices on the post-3.0.0-beta.1 tree. PR-00/01/H-06: reproduce and fix sibling heading mode inheritance. build_units now pops the current and same-or-higher-level headings from the ancestor stack before deriving the inherited mode, so an unmarked heading can never inherit the previous sibling. Covered by the units matrix, conformance fixtures 22/23, and black-box heading_inheritance through check --emit/run/call. PR-02/H-08: the deterministic release archive now ships the complete verified stdlib/ tree. package.py and smoke.py recompute the runtime tree/alias digests, record them in RELEASE_INFO.json.stdlib, and fail on mismatch; smoke removes the bundle and requires a fail-closed run. Release discovery no longer falls back to the compile-time source tree (debug builds keep that development convenience). PR-03/H-04: one marqdo_host::CORE_RESOURCE_KINDS registry is used by both the CLI provider-manifest validator and every trusted host registration path; all six core kinds are rejected as provider name or declared kind before registration. H-03: docs/architecture/resource-operations.md records every reviewed resource_request operation and architecture_boundaries pins the exact allowlist; new domain operations are forbidden in core (ADR-0062). PR-04/H-01: remove math.parse/eval/substitute/simplify/differentiate from BUILTINS, HostOp, the runtime, the host kernel and the workspace (crates/marqdo-math deleted). Formula stays inert; Int/Float arithmetic stays. Math algorithms are a pure examples/math-library package plus an optional examples/math-backend ABI plugin that requests the math.compute capability (ADR-0061). Removed calls are static symbol.unknown; the math import namespace is released again. Tests/examples/specs migrated; new math_library black-box test. PR-05/06 Step A: ADR-0060 classifies @exec/@knowledge as the closed Core Modes and specifies the Proposed metadata-only Heading Annotations v1 (target 3.1, sem.invalid_mode_marker unchanged, Analysis v2 unchanged). ADR-0063 records the foreign F-A retention and deferred F-B removal. Docs/status/compatibility/changelog and the RFC-EXT-0003 evidence file are updated. Full local gate: cargo fmt PASS, clippy -D warnings PASS, workspace tests 586 passed/0 failed/2 ignored, python tools/ci 28 passed.
4.3 KiB
ADR-0060: Heading modes are core; heading annotations are declarative metadata
Status: Accepted (RFC-EXT-0003 H-05/H-07/H-13, post-3.0.0-beta.1).
Implementation status: core-mode classification is implemented and tested;
Heading Annotations v1 is Proposed and not implemented in this build (targeted
at 3.1.x). This ADR does not itself make annotations available.
Related: RFC-LANG-0002, ADR-0052, spec/mapping.md,
spec/heading-annotations-v1.md.
Context
@exec/@knowledge look like decorators, which invites the idea that a plugin
could redefine them, or add @agent/@test decorators that change whether a
section executes. That would make the same document executable in one installation
and inert in another, break check ↔ run binding equality, and let third-party
code affect capability and safety. At the same time, tools genuinely need
non-executable heading metadata (test selection, View folding, proof
obligations).
The current parser (crates/marqdo-frontend/src/units.rs::heading_declaration)
already treats a heading's first plain Text prefix as a closed mode token and
rejects any other leading @foo with sem.invalid_mode_marker
(tests/negative/01-invalid-mode-marker-case.expected.json). Analysis v2
units[] projects only id/kind/name/level/span/function; a section,
knowledge or namespace unit does not carry its effective mode or annotation
source.
Decision
- Two layers, one executor.
- Core Mode is the closed set
{@exec, @knowledge}. It alone decides whether a heading is callable/executable. Unmarked headings inherit the nearest ancestor mode (seespec/mapping.md§1.2, including the H-06 bugfix). There is no third executable mode and no plugin-defined mode. - Heading Annotations are an open, declarative, metadata-only extension layer. They never decide execution.
- Core Mode is the closed set
- Annotation syntax v1 (Proposed): an ATX heading's first plain
Textprefix may contain at most one core mode followed by zero or more@namespace.identifierannotations, then the semantic title. No parameters in v1; annotations do not inherit;semantic_name/FunctionId/anchors are derived only from the core mode + normalized title. A malformed/unknown annotation is a static error (annotation.unknownorannotation.malformed), not silently plain prose; ordinary body text may discuss@foo, and a heading-only spelling escape is part of the proposal. - No authority. An annotation may not add/remove callability, rewrite the AST or IR, reorder statements, change budgets, grant a capability, load native code or change an already-bound CallBinding. The runtime ignores annotations.
- Registration is data, not parse-time code. Allowed annotations come from
explicitly declared, version-pinned project/dependency resources (a static
manifest referenced from
marqdo.yaml), bound to project/lock identity and digest. Duplicate ownership, conflicting names, unknown versions and digest mismatches fail atcheckwithout executing anything. - Analysis projection is versioned. Do not silently add
effective_mode,mode_originorannotationsto Analysis v2units[]. Use a new Analysis v3 or a separateheading-annotations.v1sidecar carrying unit id, effective core mode, explicit/inherited origin, annotations, source module/span, function/unit id, and manifest owner/digest. Existing Analysis v2 consumers continue to validate unchanged. - Step split. Step A (accepted here) is this contract + parser test design + identity/schema prototype; Step B (3.1) implements descriptor loading, index, conflict checks, the sidecar/v3 projection and independent consumers. Until Step B ships, docs/STATUS must say Proposed/not implemented.
Consequences
- Core-mode behaviour (
@exec/@knowledge+ ancestor inheritance) is stable and cannot be overridden by installed tools; the H-06 fix changes only the buggy sibling case. - Tool authors get a safe metadata channel without a plugin parse hook; the runtime never needs to know tool names.
- Analysis v2 stays byte-compatible; new metadata needs a versioned sidecar/v3 and an independent black-box consumer before it can be claimed.
checkandrunstill agree on every call site regardless of which tools are installed.