4.7 KiB
PBS Verification and Safety Checks Specification
Status: Draft v1 (Quality-Gate Baseline)
Applies to: test-backed safety gates for backend compiler stages and integration regression safety checks against runtime
1. Purpose
This document defines the minimum safety/verification quality gates that must be enforced for executable backend pipelines.
Its purpose is to keep safety measurable and deterministic across:
- lowering,
- optimization,
- emission,
- and runtime integration boundaries.
2. Scope
This document defines:
- mandatory compiler-stage safety checks for executable pipeline stages,
- conditional integration safety regression checks against runtime line,
- and evidence requirements for safety-related support claims.
This document does not define:
- full runtime verifier algorithm internals,
- formal proof of all runtime safety properties,
- or one mandatory verifier/optimizer architecture.
3. Authority and Precedence
Normative precedence:
docs/pbs/specs/2. Governance and Versioning.mddocs/pbs/specs/12. Diagnostics Specification.md20. IRBackend to IRVM Lowering Specification.md21. IRVM Optimization Pipeline Specification.md15. Bytecode and PBX Mapping Specification.md13. Conformance Test Specification.md- This document
If a rule here conflicts with higher-precedence authorities, it is invalid.
4. Normative Inputs
This document depends on:
docs/pbs/specs/12. Diagnostics Specification.md13. Conformance Test Specification.md15. Bytecode and PBX Mapping Specification.md20. IRBackend to IRVM Lowering Specification.md21. IRVM Optimization Pipeline Specification.md
5. Safety Gate Model
5.1 Gate S-U: Compiler-Stage Safety Unit Tests (Required)
For executable pipelines, S-U must cover stage-level safety checks at minimum:
LowerToVMsafety checks:- deterministic control-flow lowering checks,
- deterministic function-id assignment checks,
- mandatory slot/return shape checks,
- mandatory callsite form checks.
OptimizeIRVMsafety checks:- semantic-preservation regression checks,
- deterministic output checks for same input graph,
- profile-compatibility checks (
vm_profile).
EmitBytecodesafety checks:- deterministic function/code layout checks,
- host-backed pre-load form checks (
HOSTCALL,SYSC), - deterministic rejection for malformed emission candidates,
- minimum debug-attribution output checks.
- deterministic diagnostics identity for required rejection surfaces (
code,severity, primary attribution when applicable).
This gate is mandatory regardless of backend maturity stage.
5.2 Gate S-I: Integration Safety Regression With Runtime (Required for Executable Backends)
For backends that emit executable artifacts, S-I must cover integration safety at minimum:
- valid pre-load host path that loader patches and runtime executes,
- rejection of out-of-bounds
HOSTCALLindex, - rejection of unused
SYSCdeclarations, - rejection of raw
SYSCALLin pre-load artifact, - rejection of host ABI mismatch (
arg_slots/ret_slots), - rejection of missing capability at load-time,
- valid VM-owned intrinsic path,
- repeatability across declared runtime line.
When executable artifact emission is not present, S-I may be explicitly deferred.
6. Evidence Requirements
Safety claims must map to gate evidence:
- S-U evidence is required for baseline safety posture,
- S-I evidence is required for integration-ready safety claims,
- and published safety-related support claims must remain evidence-backed and current.
For executable backends, evidence should include deterministic regression fixtures that prove pipeline order and stage-boundary safety behavior.
7. Deterministic Failure Taxonomy Expectations
Backend safety checks should expose stable rejection families at minimum:
MARSHAL_FORMAT_*,MARSHAL_LINKAGE_*,MARSHAL_VERIFY_PRECHECK_*.
This taxonomy complements existing diagnostics contracts and does not replace runtime loader/verifier error surfaces.
8. Explicit Deferrals
The following are intentionally deferred:
- full formal verifier obligation catalog,
- formal proof frameworks for optimizer equivalence,
- and richer standardized source-map formats beyond v1 minimum hooks.
9. Non-Goals
- Replacing runtime or bytecode authority.
- Freezing optimizer/verifier internal architecture prematurely.
- Defining performance tooling in a safety specification.
10. Exit Criteria
This document is healthy when:
- required stage-level safety checks are test-backed,
- executable backends have explicit S-I status (
pass/fail/deferred), - integration safety regressions are preserved in tests,
- and safety-related support claims remain evidence-backed.