# HoldFast compiler, editor and debugger interoperability

Diagnostics, navigation, edits and proof inspection share compiler facts and
exact source identities. The [pure language server](../lsp-prototype/) serves
the checked pure subset.
[Release boundary](../../language/first-release/#release-boundary) · [Delivery plan](../../plan/#holdfast-whole-system-authoring-proposal)

## Standards and shared boundaries

Exchange immutable source snapshots and convert coordinates at protocol
boundaries. Apply formatting through an explicit edit. Check, emission and
build follow the [source-preserving command policy](../authoring-tools/#compiler-commands-and-publication).

Qualify each adapter against its named consumer and identified producer.
Native DWARF needs an executable producer and ABI. Native DAP additionally
needs a qualified execution backend and matching debug information.

LSP uses JSON-RPC 2.0. Qualify the advertised features against the
[LSP 3.17 specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/).
DAP defines its own requests, responses and events. Both use length-framed UTF-8
JSON. Pin exact specifications, schemas and client/server revisions. Capability
exchange advertises implemented optional services and grants no target authority.
[DAP specification](https://microsoft.github.io/debug-adapter-protocol/specification) ·
[DAP schema](https://github.com/microsoft/debug-adapter-protocol/blob/main/debugAdapterProtocol.json)

Qualify readers separately for native DWARF 5 and the packet adapter's verified
DWARF v4 sidecar. [DWARF 5 and its errata](https://dwarfstd.org/dwarf5std.html) ·
[Upstream incorporation rules](https://github.com/symbiogenesis/HoldFast/blob/main/THIRD-PARTY.md)

The compiler is the server's sole source of syntax, resolution, types, elaboration
and source maps. Reuse `core-diagnostics` judgments. HoldFast-server qualification is
separate from the Rocq editor and R-05-018a workflow.
[Contextual diagnostics](../../language/core-design/#typed-holes-and-invalidation) ·
[R-05-018a](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-05-018a)

Versioned semantic snapshots serve analysis, refactoring and generation. Link
generated definitions to the request, generator, instantiation and source inputs.
Debug mappings add final-image sites. Editor recovery can diagnose incomplete
source and suggest repairs. Splicing, theorem reuse and production emission
require checked inputs.
[Compiler services](../../extensions/metaprogramming/#compiler-services-and-runtime-information)

Exports bind the file digest, input closure, compiler, configuration, target,
supported scope and completion in standard metadata or a hash-bound manifest.
The HoldFast wrapper checks freshness and completion against the requested
inputs before handing the export to an independent consumer for format interpretation.

Host development uses stdio with separate logs. Resident VerifiedOS services
use delegated compartment transport and supervision. Scope document and debug
access to delegated workspaces and targets. URIs, settings and protocol
capabilities confer no file, process, network or hardware authority. Fix protocol
and features at composition, advertise that profile and refuse incompatible offers.
[VerifiedOS transport](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/implementation/userspace-porting.md#zed-the-reference-editor) ·
[R-12-043a](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-12-043a)

Host development tools provide untrusted diagnostics. Before admitting a resident
attacker-facing endpoint or interchange reader, inventory exact framing, encoding,
schema profile and descriptor identities. Admission requires verified copy-once
Narcissus parsing, its lowering and independent descriptor review. Bounded JSON
libraries and successful transcripts supply no such evidence.
[Wire-format inventory](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/assurance/wire-format-inventory.md) ·
[R-05-042](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-05-042) ·
[R-05-043](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-05-043) ·
[R-05-046](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-05-046)

The priced host slices leave resident profiles and parser selection open.
[Tooling plan](../../plan/#tooling-and-metaprogramming) · [Scope](../../plan/#planning-basis-and-scope)

Before qualification, bound header/body bytes, JSON nesting, document/workspace
size, outstanding requests, result size and worker time. For malformed, truncated
or over-budget input, return bounded errors or close the session as permitted.
Handle request correlation, cancellation, shutdown and disconnect independently of
worker completion. Discard abandoned and late results.

## Language Server Protocol

| Surface | Required behavior for the declared supported language subset |
| --- | --- |
| Lifecycle and documents | Initialize/capabilities, initialized, shutdown/exit, open/change/save/close, workspace changes and dependency-file invalidation |
| Diagnostics | Located lexical, syntax, name, type, resource and proof-obligation failures; distinguish unsupported features, unfinished work, timeout and stale results |
| Navigation and discovery | Hover, completion, signature help, definition/type-definition, references, document/workspace symbols and semantic tokens, using compiler-resolved identities |
| Refactoring | Prepare/perform rename and code actions as source edits tied to the current document versions; reject ambiguous, capturing or stale edits |
| Proof interaction | Inspect typed holes, local hypotheses, loans/captures, expected exits, theorem subjects and assumptions; show erased/proof information separately from runtime values |

Advertise each provider after its success and refusal cases pass. Pure
navigation requires a checked buffer. At a single unfinished expression, the
server can check temporary replacements and suggest visible values of the
required type. The original buffer keeps its diagnostic.
[Pure navigation](../lsp-prototype/#pure-navigation-increment) ·
[Recovery completion](../lsp-prototype/#single-expression-recovery-completion)

Show resolved receiver modes/views, explicit argument modes and inferred types on
request. Resource conflicts show both accesses and the exit obligation. Snapshot
suggestions are version-bound edits that preserve order, effects and lifetimes,
with argument movement explicit. Exhaustive `Option`/`Result` templates use
resolved constructors and resource-bearing outcomes. Propagation preserves cleanup
and restoration. Preserve proof status and authority. Advertise semantic features
only with a supporting producer.
[Authoring surface](../../language/surface-grammar/#ergonomic-authoring-and-bounded-collection-iteration) ·
[Lint and assist scope](../authoring-tools/#lint-policy)

Semantic tokens use compiler-resolved facts and a declared legend. Test legend
interpretation, Unicode and edit invalidation. Advertise each full, range or
delta provider after qualification. Qualified producers can add standard folding,
selection ranges, inlay hints and call/type hierarchies.

Versioned overlays take precedence over disk. Bind results to the document
version and source/dependency/tool/configuration generation. Invalidate the
affected closure conservatively until precise dependency analysis qualifies.
Clear or mark diagnostics on close or dependency removal. Discard superseded replies.

Convert parser half-open UTF-8 byte spans and one-based diagnostic columns to
zero-based LSP positions in the advertised encoding. The current server
always selects UTF-16, including when a client lists UTF-8. Test non-ASCII
comments and supported strings,
supplementary characters, LF/CRLF/bare-CR, edits before diagnostics and invalid
ranges inside encoded characters. [Parser coordinates](../parser/#bounded-increment)

Keep diagnostics and hover available to standard clients. A richer proof view
can use a versioned, capability-advertised extension with a schema, source and
dependency identities, statuses and cancellation. Recovery, holes and cached
goals are presentation only. Report a completed batch verdict with its exact
artifact and environment evidence. [Batch acceptance](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-05-018a)

## Compiler inspection API

HoldFast has no language-independent typed-AST interchange contract. ESTree
describes JavaScript syntax and Clang exposes compiler-specific views with
different stability boundaries. HoldFast compiler services own versioned schemas
for their stable public views.
[ESTree](https://github.com/estree/estree) · [Clang tooling](https://clang.llvm.org/docs/Tooling.html) ·
[Metaprogramming contract](../../extensions/metaprogramming/#compiler-services-and-runtime-information)

| View | Information to expose for the declared supported subset |
| --- | --- |
| Concrete syntax | Tokens, comments/trivia, half-open source spans, syntax structure and explicit missing/error nodes; enough information for source-preserving tools |
| Resolved and typed syntax | Declaration and reference identities, binding/scope links, inferred types, implicit arguments and selected instances |
| Elaboration | Desugared and generated definitions, concrete specializations and origin links to source requests, generators and instantiations |
| Analysis and proof state | Effects, ownership/loan facts, resource grades, obligations, assumptions, erasure decisions and each result's current status |
| Lowering | The compiler's own intermediate representations, control/data-flow edges, concrete layouts and source-to-final-instruction mappings when the corresponding backend exists |

Use the same producers for bounded type-at-location, explain-obligation and
inspect-expansion queries and bulk exports. Before advertising a view, publish
its machine-checkable schema, version policy and independent client fixtures.
A JSON CLI or local API can transport these views. Expose LLVM/MLIR
representations only from producers that use them. Compatibility exports can
use the native pipeline.

Bind responses and exports to schema/compiler versions, immutable sources and
dependencies, configuration, target/ABI and producer stage. Declare node and
symbol ID lifetimes, scope, coordinate units, cross-file references, unavailable
fields and partial, refused, timed-out and checked statuses. Keep verdicts scoped
to the checked stage. Claims about executable sites also bind image and layout.

Independently check source reconstruction, nested scopes and shadowing, inferred
and explicit arguments, generated origins and erasure. Change a dependency,
compiler option and target to test stale queries, edits and cross-snapshot handles.
Test malformed versions, unsupported views, incomplete input and truncation
status. Inspection is read-only. Checked generation retains its own obligations.

### Pure development snapshot increment

`python tools/run.py holdfast inspect SOURCE` gives the pure worker five seconds
to export snapshot schema 7. The snapshot binds exact UTF-8 source, URI,
`pure-default-v1` configuration, `gallina-pure-v1` target and producer
identity, including Python, compiler, parser and locked inputs.
[Schema](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/inspection.schema.json) · [Exporter](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/inspection.py) · [Resolution worker](../lsp-prototype/#pure-navigation-increment)

A complete snapshot publishes these views. Spans use half-open UTF-8 byte
offsets. Handles identify nodes, symbols and scopes within one snapshot.

| View | Contents |
| --- | --- |
| `concrete` | Ordered tokens, whitespace and comments whose exact spellings concatenate to the source, including all original line endings |
| `syntax` | The bounded checked AST in preorder, with node roles, list indices, parent and child links, and scalar values where applicable. `Nat.SaturatingSub` has distinct qualifier and builtin leaves. |
| `symbols` and `occurrences` | Declaration kinds, spans, documentation, structured scalar or callable types, authored origins and resolved uses. Equal spellings can identify different bindings. |
| `expressions` | Each literal, name, call, operation and group in syntax order, paired with its scalar type. A call has the result type, and its callee has the callable type. |
| `scopes` | Lexical module, function and block scopes, including expression bodies, with parent, child and declaration links. A named argument has the caller's use scope and links to the callee's parameter. |

`available_from` gives visibility by byte offset. Parameters enter at the body
start, locals after initializers and callables after their declarations. The
producer checks source coverage, span order, spelling, type and identity shape,
and view completeness.

Use `holdfast inspect SOURCE --query REQUEST.json` to query a snapshot. Each
request includes `schema` 7, the `snapshot` digest and the `operation`. The
optional `limit` ranges from 1 to 256.

| Operations | Selector and result |
| --- | --- |
| `symbols`, `tokens`, `syntax`, `expressions`, `scopes` | List the chosen view in source order. |
| `symbol-at`, `type-at` | Use `offset` to select the resolved identifier under the cursor. Positions outside occurrences return an empty result. |
| `token-at` | Use `offset` to select the containing concrete piece, including trivia. |
| `syntax-at`, `expression-at`, `scope-at` | Use `offset` to select the innermost containing node, typed expression or scope. |
| `references` | Use a `symbol` handle to list occurrences, including the declaration. |
| `syntax-children`, `expression-type` | Use a `node` handle to list its children or retrieve its expression type. |
| `scope-symbols` | Use a `scope` handle to list its direct declarations. |

Queries reject offsets inside UTF-8 characters or CRLF, cross-snapshot handles
and stale bindings. EOF selects nothing. Capped results give `partial`,
`complete: false` and `result-limit`. Only `checked` exits zero.

Bulk caps are 65,536 source bytes, 1,024 declarations, 4,096 occurrences,
16,384 concrete pieces, 8,192 each for syntax nodes and expressions, 2,048
scopes and 1,048,576 output bytes. Unavailable, timed-out, unsupported and
refused snapshots give status and reason without complete facts.

`holdfast inspect SOURCE --snapshot EXPORT.json [--query REQUEST.json]` serves
queries offline after rechecking bindings, exact source reconstruction, spans,
handles, tree links and each view's structural inventory.
[Offline reader](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/inspection_reader.py) · [Reader controls](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_holdfast_inspection_reader.py)

### Mathematical generated origins

Export with `python tools/run.py holdfast-parser inspect-math SOURCE --output EXPORT.json`.
Use `--workspace` and `--lock` for a locked package and `--module` to select
by name. Query with the selected module's authored file as `SOURCE`.

For a generated location, run
`python tools/run.py holdfast-parser inspect-math SOURCE --snapshot EXPORT.json --gallina MODULE.v --query REQUEST.json`.
The request uses `schema` 1, the `snapshot_sha256` as `snapshot`,
`operation` equal to `generated-origin` and the zero-based UTF-8 byte position
as `generated_offset`. Use `module.v` from [source-map export](#generated-source-maps)
for standalone source or extract the selected module text from the
[locked build bundle](../elaboration-prototype/#locked-mathematical-packages).

The offline reader checks the exact Gallina digest and each origin's snippet,
ordered lines and source spans. A checked response returns the digest and one
origin or empty `items`. Arithmetic proofs map to operation and enclosing
declaration spans. Preludes, unmapped helpers, line ends and EOF return empty.
Changed Gallina, incomplete elaboration and invalid coordinates refuse. Lookup
uses published origins without a parser, compiler or kernel.
[Schema](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/math_inspection.schema.json) ·
[Controls](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_holdfast_math_inspection.py)

Use `inspect-expansion` to look up generated chunks by authored declaration
handle, source byte offset or both. Each snapshot publishes expansions for its
selected module. A handle from an imported module has an empty expansion in
that snapshot, even if its byte spans overlap the selected module's spans.
With both selectors, each result must match the handle and the position.
The reader checks that every origin's source span falls inside its declaration
span and that the recorded handle agrees with the enclosing declaration in
the selected module. These checks also apply when verifying a bulk export.

Use `specialization-at` with an authored UTF-8 byte `offset` to inspect the
innermost recorded generic call in the selected module. The result contains
the half-open call span, resolved declaration handle and concrete type
arguments. The mathematical producer records calls whose type arguments
resolve to `Nat` or `bool`, including inferred arguments, explicit arguments
and inferred calls to qualified imports. Positions outside recorded calls
return empty. The offline reader uses the same records as the bulk export.

For a locked snapshot, add `--workspace WORKSPACE --lock LOCK` to the offline
command to recheck package inputs and compare the resulting dependency digests
with the publication. The workspace must contain `SOURCE` at its declared
module path. A changed dependency refuses under the old lock. A revised lock
requires a fresh snapshot and fresh query handles. With just `--snapshot`,
the reader checks the retained publication against the supplied source and
optional Gallina bytes. Refused offline queries exit nonzero.

### Retained lowering snapshots

Run `python tools/run.py holdfast-parser lower-sync SOURCE --output MODULE.c`
to retain the C and `python tools/run.py holdfast-parser inspect-lowering SOURCE --output EXPORT.json`
to retain its inspection snapshot. To verify a snapshot or query it without
invoking the parser, elaborator or lowerer, use
`python tools/run.py holdfast-parser inspect-lowering SOURCE --snapshot EXPORT.json --c-source MODULE.c`.
Add `--query-json REQUEST.json` to query a view. A request accepts `schema` 1 or 2
and can include `binding.snapshot_sha256` as `snapshot` to require that exact
publication. Re-export schema-1 snapshots to bind the complete projection and
receipt payload in schema 2.

| Operation | Selector and result |
| --- | --- |
| `c-line-origin` | Select a one-based `c_line` and return the authored span, generated line and associated operation receipts. |
| `source-to-c` | Filter by one-based `line`, `declaration`, zero-based UTF-8 `source_offset`, or their intersection to find C ranges and erased source sites. |
| `erased-proofs` | List erased sites, optionally filtering by `declaration` and `kind`. |
| `operation-receipts` | List operation receipts, optionally filtering by `declaration`, `c_symbol` or `rocq_theorem`. |
| `resolved-calls` | List resolved statement calls to functions in the module, optionally filtering by `caller` and `callee`. |
| `two-phase-calls` | List recorded receiver calls, optionally filtering by `caller` and `callee`. |
| `c-signatures` | List authored runtime function signatures with the emitted C declaration and definition header, optionally filtering by `declaration`. |
| `c-function-at` | Select a one-based `c_line` to find the authored runtime declaration whose prototype or definition contains that line. |
| `lowering-receipt` | Summarize the lowering stage, input digests, view counts and pending external producers. |

Authored spans use half-open UTF-8 byte offsets. Authored positions use
one-based lines and Unicode code-point columns. C ranges use inclusive one-based
lines, with zero marking erased sites. The default query cap is 256 results.
Use `limit` from 1 to 256 to reduce it. Truncation reports `partial` and
`complete: false`. The reader checks the schema, snapshot digest, exact source
and C bytes, source-map digest and receipt projections. It checks that authored
positions agree with span starts and that coordinates stay within the inputs.
Each operation receipt's authored span must lie inside a mapped statement
with the same declaration and emitted C line range. Each mapped runtime
statement must lie within its owning emitted C function body. These checks
apply to snapshot verification and every query, including maps for emitted
implementation and disposal methods. Function prototypes, definition headers
and closing braces must occur in C code outside comments and literals. The
reader accounts for backslash-newline splices when locating them. It refuses
inconsistent origins before returning a view.
Snapshot and C inputs each have a 4 MiB cap. Refused queries exit nonzero.
The exported facts describe the C11/Clight lowering stage and carry the pending
external producer identities for deployed evidence.
[Schema](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/lowering_inspection.schema.json) ·
[Controls](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_holdfast_sync_dwarf_inspect.py)

With `source_offset`, `source-to-c` returns the sites whose authored spans
contain that byte position. This distinguishes statements and proofs on the
same line. The end of each span is excluded. Unmapped positions and end of
file give an empty result. Offsets inside a UTF-8 character or CRLF pair,
and offsets outside the source, refuse.

The reader checks that each inline `assert` or `proof` receipt has exactly one
erased source-map site with the same declaration and authored span, and that the
span starts at the recorded keyword. Missing and duplicate sites refuse.
Standalone theorems, lemmas and definitions have receipt entries without C map
sites.

Call queries include the authored expression and the generated C line range.
Resolved statement calls include the callee's authored declaration span.
Two-phase calls include the receiver expression, mode and receiver field path.
Use the exact caller and callee symbols from the lowering receipt as filters.
The reader checks statement origins and callee declarations, matches receiver
calls to their source-map sites and requires a distinct emitted callee token
within the C range of each recorded call. Duplicate authored call sites or
resolved statement entries refuse. A name inside a comment, string literal or
character literal cannot support a call site.
The query inventory covers the call sites recorded by the synchronous lowerer.

The `c-signatures` query lists the receipt's authored runtime functions in
source order. Each item includes `source_span`, `source_signature`, the exact
`c_signature` shared by the prototype and definition, and the one-based
`c_prototype_line` and `c_definition_line`. The C signature shows hidden
backing and composite-result parameters when the lowerer emits them. The
reader requires a unique matching pair in the bound C and checks that the
declaration span encloses its authored runtime map sites. Generated helpers
and proof-only declarations are outside this view.

`c-function-at` returns the same declaration and signature fields plus
`c_definition_end_line`, the selected `c_line`, its exact `c_text` and `c_site`
(`prototype` or `definition`). The definition range includes the header and
closing brace and covers lines without a statement map, such as local storage
declarations. Lines outside the authored definitions and prototypes give an
empty result. The reader checks the lowerer's unindented closing brace and
requires each mapped runtime site for that declaration to lie inside its C body.

## Syntax grammars and highlighting

The distributed [editor syntax assets](../highlighting/) implement this boundary
with generated Tree-sitter/TextMate assets, pinned independent consumers, the
shared canonical corpus and explicit recovery dispositions.

Distribute [Tree-sitter grammars and queries](https://tree-sitter.github.io/tree-sitter/3-syntax-highlighting.html)
for syntax-aware consumers and a
[TextMate grammar](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide)
for lexical highlighting clients. These are editor assets, separate from LSP
semantic tokens and from the compiler's typed trees. The
[Menhir development grammar](../parser/) remains the syntax owner: generate
secondary assets where possible and otherwise check them against the same
versioned corpus. An editor parser cannot authorize semantic acceptance or
replace the compiler frontend used by LSP.

Pin grammar/query and editor revisions. Test comments, strings, nested syntax,
generic/dependent constructs, malformed/incomplete edits and embedded-language
boundaries where supported. Exercise each distributed grammar in its intended
consumer and test Tree-sitter incremental results against a fresh parse after
the same edit. Record known recovery differences without presenting recovered
syntax as accepted HoldFast. Source-preserving tools use the compiler's qualified
concrete-syntax view when exact language correspondence is required.

## Diagnostic and semantic-index exports

Export batch diagnostics and static-analysis findings as
[SARIF 2.1.0](https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html),
with stable rule identifiers, severities, source regions, related locations,
applicable fixes and code flows where the producer supplies them. Preserve
unsupported, unfinished, timeout and refusal outcomes; an empty findings list
does not imply that analysis completed. Retain the input closure and producer
identity in the report or an explicitly bound companion manifest. Diagnostic
export consumes the same judgments as LSP rather than reimplementing analysis.
Validate the pinned schema and import into an independent consumer; independently
expect Unicode locations, cross-file findings and fix edits, and corrupt locations,
rule references and completion status to require visible rejection or degradation.

### Qualified pure batch SARIF

`python tools/run.py holdfast sarif <source> ... --schema <schema.json> --output <report.sarif>`
exports the current pure `Nat`/`bool` diagnostic producer used by LSP. Its actual
consumer is the pinned offline `sarif-tools` importer, providing portable batch
review of multiple development files without a running language server. The
qualified scope is 1–16 independent UTF-8 source files, each at most 65,536 bytes;
the report is bounded to 1 MiB, 4,096 findings and 64 JSON nesting levels. Each
pure diagnostic worker has the existing five-second budget. Sources remain
unchanged, and output is atomically published after source, producer and schema
freshness checks. The report cannot alias a source or the external schema.

Stable rules are `HOLDFAST-SYNTAX`, `HOLDFAST-NAME`, `HOLDFAST-TYPE`, `HOLDFAST-ENCODING`,
`HOLDFAST-UNSUPPORTED`, `HOLDFAST-LIMIT`, `HOLDFAST-TIMEOUT` and `HOLDFAST-INTERNAL`.
An ordinary source rejection is a completed check with error findings; unsupported,
limited, timed-out and failed checks set standard `executionSuccessful: false`
and visible error notifications. Empty findings alone never supply completion.
`properties.holdfast` binds the exact source URI/byte hashes, configuration, target,
current compiler/runtime identity, supported scope, per-file outcomes and report
bytes. These are development analysis judgments, with `unqualified: true`;
neither a clean report nor its integrity binding supplies a source theorem.

`--format-fixes` additionally requests the existing canonical formatter in its
bounded worker. A `HOLDFAST-FORMAT` warning carries an explicit whole-file replacement
using SARIF byte regions; this is a preview, and the command applies no edit.
An unavailable requested formatter emits `HOLDFAST-FORMAT-UNAVAILABLE` and incomplete
status. The current producers supply no related locations, code flows or semantic
fixes, so those fields are absent. Findings in different batch files preserve
their own source associations; imports and wider semantic producers retain their
existing owners and unsupported verdicts.

Reports use the exact external OASIS SARIF 2.1.0 schema recorded with the
[reader pins and licence review](https://github.com/symbiogenesis/HoldFast/blob/main/THIRD-PARTY.md#independent-sarif-importer).
Supply that file explicitly; these commands download nothing.
`holdfast sarif-validate <report.sarif> --sources <source> ... --schema <schema.json>`
rechecks the schema, report binding, current producer and exact ordered inputs,
including source bounds, rule references, UTF-16 source regions, fix ranges and
consistent completion status. Both commands exit nonzero for rejected or
incomplete analysis, preserving the report for inspection. A changed report,
source, producer, scope or schema is refused before handoff.

`holdfast sarif-qualify-reader --reader-directory <wheels> --schema <schema.json> --output <report.json>`
runs the exact-pinned importer from verified external wheels in an isolated
Python process, with a 15-second process budget and 64 KiB output bounds. Its
independently expected real fixtures cover Unicode/space file URIs, CRLF sources,
cross-file finding associations, source locations, canonical-format fix bytes and
unsupported analysis. The stock importer independently interprets rule/severity,
path and line records; the harness additionally checks the imported UTF-16 regions
and applies the standard byte replacement independently of the exporter.
Malformed and stale handoffs refuse through the HoldFast wrapper before import;
stock `sarif-tools` alone grants no freshness or completion guarantee. The
[behavioral controls](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_holdfast_sarif.py) additionally exercise
supplementary-character coordinates, every unavailable worker outcome, missing
findings, corrupt messages/rules/status/fixes, malformed JSON and publication
aliases. The pure lexer permits Unicode in line comments only; its adapter's
same-line supplementary-character control claims coordinate conversion alone.

Export offline definitions, references, implementations and symbol relationships
through [SCIP](https://github.com/scip-code/scip). Pin its Protobuf schema and
consumer. Bind the index bytes and source/configuration/dependency identities
through the companion manifest; document symbol-identity rules, index scope and
omissions. Import and query it
without a running language server; test shadowing, imports, generated definitions,
specializations and deleted/renamed dependencies against independently expected
navigation. The HoldFast wrapper refuses a stale index as current source evidence
and distinguishes an incomplete index from a verified absence of references
within the qualified scope; the stock reader supplies no such verdict. SCIP is a navigation
projection, not the typed AST or the complete analysis/proof-state interface.

### Locked mathematical package index

Run `python tools/run.py holdfast-parser scip WORKSPACE LOCK --output DIRECTORY`
with a fresh destination directory after
[locking a mathematical package](../elaboration-prototype/#locked-mathematical-packages).
The bundle contains `index.scip`, `manifest.json`, the exact authored module
files at their package paths, and one generated Gallina file per module under
`__generated__/`. A SCIP v0.10.0 reader can open the index offline. Positions
are half-open UTF-8 byte columns. Its project root identifies the bundle's
absolute location. Rebuild at the new location after moving a bundle.

The [elaborator recorder](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/package_navigation.py) retains
value-parameter bindings, callable definitions, looked-up value names and
interface methods at their resolved sites. A concrete method has an
implementation relationship to its checked interface method. A call
instantiated at concrete `Nat` or `bool` type arguments links to the generic
definition. The instantiated call has its own generated occurrence at the
authored call range. The [exporter](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/scip.py) locates
each compiler-named Gallina definition in the exact emitted module and links
its generated symbol to the authored declaration. Source globals carry the
package name and content-bound instance, module path, spelling and declaration
offset. A parameter's local symbol uses its declaration offset within its
document. Identical spellings can resolve to different declarations.

Before handing an index to an offline consumer, run
`python tools/run.py holdfast-parser scip-check WORKSPACE LOCK DIRECTORY`.
This rebuilds against the current compiler and locked closure and compares all
published bytes, including the schema-bound manifest and generated documents.
A changed dependency or lock needs a fresh export. Use `--require-complete`
before interpreting an empty authored-reference result. This mode qualifies
scalar expression-bodied definitions with `Nat` and `bool` parameters,
positional calls and complete name-use coverage. Wider syntax can supply
positive locations and relationships. The manifest lists each such module as
incomplete. Record fields, general type references, and
generated helper internals are outside this coverage. Qualification budgets
allow 100,000 occurrences and 32 MiB of serialized index in addition to the
locked build's own limits.
Run `python tools/run.py holdfast-parser qualify-scip-reader READER` with the pinned
Linux ARM64 SCIP v0.10.0 executable to replay both package revisions in the
independent reader. [Behavioral controls](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_holdfast_scip.py)

## Build integration

Expose selected build targets, source roots, dependencies, options and build
operations through the [Build Server Protocol](https://build-server-protocol.github.io/docs/specification).
Consume the actual package/build graph and exact tool configuration; the language
server must not guess a second graph. Pin BSP and a consuming IDE/build client,
with declared capabilities, operation bounds, cancellation and completion states.
Qualify multiple targets/configurations, generated sources, failed/cancelled builds
and dependency changes; a stale or partial graph cannot publish a successful
current build. A build request invokes the existing batch producer and reports
its exact verdict and artifact identities, never interactive proof acceptance.

For actual C/C++ bridge invocations, export
[`compile_commands.json`](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
with exact argument arrays, working directories and source/output associations.
An independent tooling consumer must recover the same includes, defines and target
flags, including paths with spaces. This export describes bridge compilations;
it neither replaces HoldFast's module graph nor assumes every build has a C stage.

### Locked mathematical package builds

`holdfast-parser bsp WORKSPACE LOCK [LOCK ...]` serves BSP 2.1.1 over length-framed
stdio on the native parser lane. Pass one to eight locks created by
[`lock-package`](../elaboration-prototype/#locked-mathematical-packages). Supply the
workspace's file URI in `build/initialize`, then send `build/initialized`.
`workspace/buildTargets` exposes every package in each checked configuration.
The target URI binds the exact lock bytes and package name. Dependencies point to
targets in that configuration. The `holdfast-locked-package` data includes the
edition, target, package instance, declared input hashes and locked producer.
Each lock's root exposes the batch compile operation. Supply a separate root
lock to compile a dependency by itself.

`buildTarget/compile` runs the existing `build-package` command for one root at a
time, with its locked options and a 180-second process budget. Success carries
the batch verdict, module digests and exact generated bundle URI and SHA-256 in
`holdfast-batch-build` data. `buildTarget/sources` reports the declared HoldFast files
and, following success, the corresponding generated Gallina files. Outputs live
in a private directory for the session. A changed dependency or lock requires
a new checked graph. A failed build returns its exit status and bounded diagnostic.
`$/cancelRequest` interrupts the active process group and suppresses publication.
The package build's verdict is mathematical elaboration. Kernel replay and the
packet compiler are separate operations.

Run `python tools/run.py holdfast-parser qualify-bsp-client` for the
[pinned bsp.nvim client](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/bsp_client.py). Its Neovim
project loader reads five targets from three configurations in a workspace
whose path contains a space. The qualifier compares the two generated modules
and their bundle against the direct batch build. The client cancels an active
build, receives the compiler's unknown-name diagnostic for a broken root,
and observes the stale graph after the imported provider changes. It checks
the server's clean shutdown after these requests. [BSP 2.1.1 specification release](https://github.com/build-server-protocol/build-server-protocol/releases/tag/v2.1.1)

For the [packet walkthrough](../packet-walkthrough/), pass
`--compile-commands NEW_DIRECTORY` to `holdfast-parser packet-example`. The new
directory retains the generated C, compiled executable and compilation database.
The database records the same working directory and argument vector passed to
the successful C compiler process, including the translation unit and output.
`holdfast-parser qualify-compile-commands /usr/lib/llvm-21/bin/clang-scan-deps`
checks this build and a cross-compiled RISC-V object with an explicit target,
include path and definition. The [Clang reader](https://github.com/symbiogenesis/HoldFast/blob/main/THIRD-PARTY.md#independent-compilation-database-reader)
recovers the expected translation units, included files, options, working
directories and outputs with spaces in their paths.

## Compiler decisions and performance traces

Expose optimization decisions using an
[LLVM remarks](https://llvm.org/docs/Remarks.html) compatibility exporter for the
declared supported subset, initially YAML where a selected reader supports it.
Report pass/site identities, performed or missed transformations, analysis reasons
and source/IR origins. Keep HoldFast-specific legality, proof, resource and cost causes
in a documented extension or bound compiler-service record rather than inventing
standard fields. This serialization adds no LLVM dependency to the native path.
Qualify an independent reader and independently chosen applied/missed/refused
cases, including generated and optimized-away sites. A remark reports a decision;
it supplies no transformation-preservation proof or target speedup measurement.

The pure compiler exports the decisions of its required-static specialization
pass with `python tools/run.py holdfast remarks SOURCE --output REMARKS.yaml`.
The LLVM YAML pass name is `holdfast-static-specialization`. Each record names the
containing generated Gallina function or constant and points to the authored
call in one-based lines and Unicode code-point columns. `File` is the
UTF-8 percent-encoded source basename. The `Callee` argument
locates the original declaration. Each `GeneratedFrom` argument identifies an
enclosing call whose specialization produced this site, outermost first.

| LLVM tag and decision | Meaning |
| --- | --- |
| `!Passed Specialized` | All required-static arguments were closed. The compiler substituted them and replaced the call with its specialized body. |
| `!Missed SymbolicStaticArgument` | The generic definition retains the call. The `String` argument identifies the static inputs that a later instantiation may supply. |
| `!Failure SpecializationRefused` | Static checking or specialization failed at this call. The `String` argument carries the compiler diagnostic and its location. |

An explicit UTF-8 percent-encoding prefix protects diagnostic strings that
LLVM's YAML reader cannot represent verbatim.

The leading YAML comment binds the source basename and exact bytes, compiler
and runtime identity, target, decision count, and either the emitted Gallina
digest or the compiler refusal. The command returns failure for refused
source and publishes the decisions reached before it stopped. A syntax error
can therefore yield an empty stream with a refusal in its header. Recording
allows 256 decisions and one MiB per file. Exhaustion preserves the previous
file. Run `python tools/run.py holdfast remarks-validate SOURCE REMARKS.yaml` to
recompile and compare every byte, including the decision order and bindings.

Run `python tools/run.py holdfast-parser qualify-remarks /usr/lib/llvm-21/bin/llvm-remarkutil`
with the [pinned Ubuntu ARM64 reader](https://github.com/symbiogenesis/HoldFast/blob/main/THIRD-PARTY.md#llvm-optimization-remark-reader).
LLVM converts the exported YAML to its native bitstream, decodes it, and counts
the decisions per function. The [qualification](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/remarks_reader.py)
compares every decoded field, including callee and instantiation origins, with
independently selected records and checks the calls present in the generated
Gallina. A runtime value supplied to a static parameter produces a located
failure with the original argument diagnostic. Controls cover malformed YAML,
changed source and a valid LLVM record naming the wrong generating call.

Export compiler phase and nested-work timings as Chrome Trace Event JSON or a
native Perfetto trace, according to the selected consumer's
[supported formats](https://perfetto.dev/docs/getting-started/other-formats).
Identify parsing, resolution, elaboration, generation, proof work and lowering,
with explicit clock/time units, worker identities, counters and input/tool
identities. Bound recording overhead and size; mark dropped events, incomplete
spans and cancellation. An independent viewer must recover expected ordering,
nesting and durations from a deterministic fixture. The recorder and HoldFast
validation wrapper bind those events and completeness metadata in the export
manifest; malformed timestamps and overflow/truncation cannot produce a complete
measurement claim. Compiler traces
measure the compiler run, separately from emitted-program WCET and constant-time
evidence. Runtime profiling or coverage formats need their own named consumers
and commissioning; these compiler exports do not implement them.

## Debug Adapter Protocol

### Packet assembly simulator

The simulator backend runs the four packet assembly controls on the single-hart
Sail development model. Its source view is the exact assembly passed to the
assembler, including the call and trap harness. The assembler supplies a line
for each expanded instruction. Each retirement must match the encoding at its
mapped address. The session records SHA-256 identities for that source, the
resulting ELF, the simulator executable and its configuration.
[Backend](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/simulator_debug.py)

Run the passing control at its packet-view length query with
`python tools/run.py holdfast-parser debug-simulator --command "until 102" --command stack --command step --command "eval c13.length"`.
At line 102, PC `0x80000164`, the stack shows `main` called from `_start` at
line 20. One machine step retires `cgetlen`, making `c13.length` available as
4. Use `--command source` to see the numbered assembly and `--control tag-trap`
to inspect the cleared tag before its fault. Commands accept register names and
observed fields. The register bits and tag come from Sail's merged-register
writes. Length and permissions come from executed queries on that register and
expire on its next write. On success, `cgetperm` reports 2 for the payload view,
granting data loads alone. Unobserved fields such as base, sealing and provenance
report `unavailable`. Evaluation grants no memory access.

Each control first runs to HTIF completion within 256 instructions. For a
requested stop, the backend reruns the exact image with Sail's native PC stop
and an instruction limit one beyond the expected stop. The complete prefix
of instruction and effect records must agree. The selected controls have unique
PCs along their execution paths. Calls, returns and trap entries determine
the available stack frames. Disconnect expires the stop handle. Reconnect
repeats the stop and issues a fresh handle. Each run has a ten-second deadline.
After execution, the backend rejects traces larger than 128 KiB before reading
them. Sessions inspect development assembly. Source-level
HoldFast debugging additionally requires [exact-image debug information](#dwarf-native-debug-information).

Run `python tools/run.py holdfast-parser debug-simulator --qualify` in a lane with
a configured simulator and profile. To select the installation used for the
four controls explicitly, append
`--simulator /root/build/verifiedos-model/c_emulator/sail_riscv_sim --profile /root/build/verifiedos-model/config/verifiedos.json`
to either command. Use `python3` inside Linux. Qualification checks independently
expected PCs, stacks, register values, capability observations, disconnect and
reconnect, exhausted inspection budgets and refused commands. The passing
control retires 95 instructions and exits with HTIF 0. The tag, bounds and
permission controls each reach the trap handler with cause 28 and HTIF 284.
[Qualification](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/simulator_debug_check.py) ·
[Malformed and stale controls](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_simulator_debug.py)

### Adapter lifecycle

Provide a DAP adapter over an explicitly identified execution backend. Qualify
simulator debugging first; physical-target support requires the actual target
adapter and authenticated lifecycle authorization. A Gallina translation or
syntax tree alone supplies no runtime to debug.

The baseline session supports initialize, launch or attach for its declared
backend, configurationDone, source breakpoints, threads, stackTrace, scopes,
variables, continue, pause, next, stepIn, stepOut and disconnect, together with
the corresponding stopped, output and termination events. Honor the DAP startup
ordering and client path/line/column conventions. DAP coordinates have their own
declared conversion; do not reuse LSP coordinates implicitly. Each stopped state
has a generation; frame and variable handles expire on resume, restart, target
replacement or disconnect. Distinguish adapter termination from debuggee exit.

Resolve breakpoints against the exact image and its matching source/debug
sidecar. Report relocated positions and unverified breakpoints explicitly when
a line has no executable site. Source stepping accounts for inlining,
specialization and optimized control flow. Display optimized-away, erased,
uninitialized and unavailable values honestly. A suspended async frame is a
logical task frame only when the compiler/runtime supplies its mapping; it is
not an invented operating-system thread or physical stack frame.

Evaluation is bounded, read-only inspection of the stopped program's available
values. Refuse calls, writes, capability fabrication and access beyond delegated
authority. Pretty printers and DWARF expression evaluation obey the same limits.
Memory/register inspection requires explicit backend support and authority;
missing CHERI tag, bounds, permissions, sealing or provenance information is
reported unavailable, never reconstructed as live authority from an integer.
Mutation, arbitrary command execution, reverse execution, data breakpoints and
hot reload remain unadvertised unless separately contracted and qualified.

VerifiedOS's [debug lifecycle](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-15-078) excludes production Debug
Module access. Development/RMA entry retains
[authenticated authorization and crypto-erase](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-15-079).
The [trigger-module exclusion](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-15-079a) applies in every lifecycle
state: no hardware breakpoints or watchpoints may be assumed. Use simulator
breakpoints or bounded external single-step/PC comparison on an authorized target,
reporting the latter's cost and limits. Never patch executable memory or add a
trigger comparator to make a DAP request work. A debug session's perturbed timing
is not WCET, constant-time or production-admission evidence.

### Packet debugger editor qualification

The [packet adapter](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/dap_server.py) serves framed DAP
stdio over the Sail simulator and a verified assembly DWARF sidecar. It reports
breakpoint readiness after validating and launching the target. Configuration
completion reports a stop at the entry instruction. The selected source
coordinates are native paths, with the client's declared line and column bases.

On Ubuntu 26.04 ARM64, run the [two-client qualifier](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/dap_clients.py)
with the installed Sail executable and its matching JSON profile.

```text
python3 tools/run.py holdfast-parser qualify-dap-clients --simulator SIMULATOR --profile PROFILE
```

Neovim nvim-dap and Emacs Dape place an executable and a comment-line
breakpoint in the generated packet assembly. Each client observes the stop
and caller stack, reads a capability and an erased proof, and steps the length
query before observing length 4. Each session exercises step-over, step-out
into the caller, expired frame and variable references, a refused write
expression, and exit and termination.
The report binds the client, protocol reference, harness, simulator, profile,
source, image and sidecar identities. The [native DAP controls](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_holdfast_dwarf_dap.py)
also exercise trap, disconnect, invalid launch and transport cases.
[Upstream pins and terms](https://github.com/symbiogenesis/HoldFast/blob/main/THIRD-PARTY.md#independent-editor-clients)

## Debugger backend protocols

When a selected simulator or authorized development target needs integration with
an existing debugger engine, qualify the
[GDB Remote Serial Protocol](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Remote-Protocol.html)
for that connection. DAP remains the editor-facing adapter; DWARF remains the
native information format. If an integration drives GDB itself, separately
qualify [GDB/MI](https://sourceware.org/gdb/current/onlinedocs/gdb.html/GDB_002fMI.html)
instead of scraping its human-readable CLI. Neither protocol is required by a
backend that already provides its contracted DAP execution services directly.

Freeze the permitted packet/command subset, transport, target/register description
and CHERI tag/bounds/permission encoding. Exercise an independent engine against
known stops, stepping, registers, capability metadata and reconnect/target changes;
test stale stop state, truncated packets, unsupported commands and unauthorized
reads or mutation. Standard debugger support must not imply unavailable hardware
triggers, executable patching or production debug access. Preserve all DAP
inspection and lifecycle restrictions at this backend boundary.

## DWARF native debug information

Emit source-level debug information from the compiler's own representations,
carrying it through optimization, allocation, ABI lowering, linking and final
image composition. Describe compilation units, source files/lines/columns,
subprograms, lexical scopes, parameters/locals, concrete types/layouts, inlined
calls, address ranges and changing variable locations. Supply external stack
unwind descriptions sufficient for the qualified call/return and trap-frame
inspection; this introduces no runtime exception unwinder.

Map generics to their concrete specializations while retaining source identity.
Describe union discriminants, fields, arrays and concrete dependent indices where
represented. Ghost terms, proofs, resource grades and erased indices have no
fabricated runtime storage. Mark absent locations and optimization effects;
do not point an unavailable local at a recycled register. Identify generated
helpers and prologues so stepping can distinguish authored operations from
compiler work.

The target profile must specify register numbering, capability-sized locations,
pointer/address distinctions and unwind rules for its exact purecap ABI. Use
standard DWARF encodings where adequate and document every required CHERI/HoldFast
extension with independent reader controls. A generic RV64 debugger is not
presumed capability-aware. Consult the
[assigned language codes](https://dwarfstd.org/languages.html): obtain an assignment
or document a temporary code in DWARF's user range; never claim another language's
code as HoldFast's or invent a registered `DW_LANG_HoldFast` value.

Bind the debug sidecar to the final stripped/composed executable bytes, layout,
source closure, compiler/options and target/ABI identities. DWARF file checksums
and build identifiers aid matching; the package's exact-image binding remains
required. Any executable/layout change invalidates the match. Reproducible path
mapping must not leak host directories or silently substitute changed source.
Validate addresses against the final image, including dead elimination and
instruction encoding, rather than an intermediate object alone.

Keep ELF/DWARF readers in producer/debug compartments under
[R-13-010](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/spec.md#r-13-010). Symbols, debug and unwind metadata stay outside
execution SRAM under R-13-010c. The package contract governs whether they live
in host sidecars or the authenticated store.
[VerifiedOS requirements register](https://github.com/symbiogenesis/VerifiedOS/blob/main/docs/requirements-register.md#131-the-admitted-artifact) No loader,
install-path parser, admission certificate or capability authority is introduced
by a debug sidecar.

## Generated-source maps

To find the HoldFast source of a generated Gallina proof, run
`python tools/run.py holdfast-parser source-map SOURCE --output NEW_DIRECTORY`.
The mathematical compiler elaborates a standalone module with word equations
enabled. The directory contains its exact `module.v`, a version 3
`module.v.map` and a companion `manifest.json`. The text map follows the
[first edition of ECMA-426](https://ecma-international.org/publications-and-standards/standards/ecma-426/).

Run `python tools/run.py holdfast-parser source-map-query SOURCE DIRECTORY --node /usr/local/bin/node --line LINE --column COLUMN`
at a position in that Gallina file. The command accepts and returns one-based
UTF-16 coordinates. A declaration maps to its authored start. A generated
arithmetic statement and its proof map to the operation that required the
equation. Each map embeds the original text under a `holdfast-source:` URI
containing its SHA-256 and escaped filename. Offline readers can open the
embedded source after the bundle moves. The lookup command also returns the
verified local file URI. The manifest preserves both the operation and its enclosing
declaration as half-open UTF-8 byte ranges, together with the generation stage.
The source map gives the same location throughout each nonempty emitted line.
Compiler preludes, hoisted shared literals, separators, line ends and module
wrappers report `unmapped`. Native instruction locations and unwinding belong
to the [DWARF producer](#dwarf-native-debug-information).

The [lookup wrapper](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/gallina_source_map.py) regenerates
the three files from the current source, mathematical compiler, parser and
interpreter. It verifies their exact bytes before passing the map to the stock
Node.js reader. Use `python tools/run.py holdfast-parser qualify-source-maps --node /usr/local/bin/node`
on the qualified Linux ARM64 setup to exercise Unicode, proof origins after
literal sharing, unmapped locations and stale inputs.
[Reader pin](https://github.com/symbiogenesis/HoldFast/blob/main/THIRD-PARTY.md#independent-gallina-source-map-reader)
· [Qualification controls](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/source_map_check.py)

## Generated development tests

`python tools/run.py holdfast generated-tests` exercises source coordinates,
synchronous LSP overlays and pure formatting. It installs the pinned generator
and its dependency in a disposable environment using the manifest's Python
minor version and the locked tool runtime. The command runs with Python's
`-I` isolation, exact generator pins and an explicit dependency cooldown.
[Campaign implementation](https://github.com/symbiogenesis/HoldFast/blob/main/tools/toolchain/generated_tests.py) · [Dependency terms](https://github.com/symbiogenesis/HoldFast/blob/main/THIRD-PARTY.md#generated-development-tests)

Check UTF-8 and UTF-16 coordinates, atomic edits and invalidation, current
snapshots, and token and comment preservation across repeated formatting.
Independent source and overlay models avoid production coordinate and edit
helpers. An isolated diagnostic stub bounds transitions. Real producer and
protocol controls run separately.

Defaults cap properties at 64 examples, traces at 32 actions, documents at
4,096 UTF-8 bytes and processes at 60 seconds. Reports bind seeds, settings,
inputs and tools. Timeouts and replay failures leave the campaign incomplete.
Minimized data replays without the generator. Seeded faults check code-point
to UTF-16 conversion, sequential edit coordinates and rollback after a later
invalid edit. [Replay fixtures](https://github.com/symbiogenesis/HoldFast/blob/main/tools/tests/test_holdfast_generated_tests.py)

The [native syntax campaigns](../parser/#generated-syntax-campaigns) use Menhir's
generation and interpreter facilities. Both campaigns exercise development
tools. Source correspondence, kernel replay and client qualification require
their own evidence.

## Package-owned acceptance cases

Place a schema-1 TOML case manifest beside its inputs. Run a complete manifest
or select named cases with repeatable `--case NAME`. Add `--list` to preview
the selected cases. Cases run in manifest order.

```console
python tools/run.py holdfast-parser test-package examples/copy_service.cases.toml
```

Each `[[case]]` has a unique `name` and a `kind`. Paths resolve inside the
manifest directory. `native` elaborates and lowers `source`, compiles its C11
`harness` with the lowered output, and checks execution at `-O0` and `-O2`.
`replay` checks `source` or `workspace` and `lock` with cold Rocq and
`rocqchk`, reporting the emitted Gallina or locked source endpoint. `reject` checks
`source` or `workspace` and `lock` and requires the expected diagnostic
`kind`, `line`, and `column`. Use `message_contains` to specify the required
diagnostic text. Setup errors and unexpected diagnostics fail the case. Each
result records its own evidence endpoint.
[Copy-service manifest](https://github.com/symbiogenesis/HoldFast/blob/main/examples/copy_service.cases.toml) ·
[Independent package trial](../../plan/#q25bb)

## Qualification and delivery

Each adapter needs a named client, an identified producer and supported
subset, exact backend and client pins, resource limits and executable
acceptance fixtures. Advertise only supported capabilities. The
[release contract](../../language/first-release/#qualification) governs the
basic workflow on independent software clients.

| Increment | Required positive and negative controls |
| --- | --- |
| LSP | Exercise the advertised features in two independent clients and a wire harness; unsaved edits, Unicode positions, rename capture, imported-file changes/deletion, configuration changes, cancellation and deliberately late old-generation responses; unfinished proofs never report batch acceptance |
| DAP | Run an image with independently expected stops, stepping, frames and values; test disconnect during startup, target exit, stale handles after continue/restart, source/image mismatch, erased/optimized values, unauthorized reads/evaluation and production-target refusal; distinguish simulator results from physical-target evidence |
| DWARF | Independent verifier/reader plus an end-to-end DAP consumer check unoptimized and optimized images with inlining, generic instances, relocated/removed code, spills, changing locations, CHERI values and unwinding; corrupt/truncate sections and alter source/image/layout to require bounded refusal of false mappings |
| LSP and DAP transport | Fragmented/coalesced frames, byte lengths with Unicode, malformed JSON, unknown requests, unsupported capabilities, limits, cancellation and clean shutdown; logs never corrupt the protocol stream and no rejected input publishes accepted artifacts |

The [pure LSP client qualifier](../lsp-prototype/#acceptance-and-remaining-qualification)
checks the advertised editing features. New coverage needs independently
chosen positive and negative cases, with exact source, tool, client,
backend and image identities as applicable. Source and value observations
must match the artifact actually executed. Protocol qualification covers
the adapter's behavior. [Local validation](https://github.com/symbiogenesis/HoldFast/blob/main/AGENTS.md#tool-execution-and-validation)
