Skip to content

ambientops #127: expose SPARK theatre, fix non-compiling backend_interface, honest verified stance#49

Open
hyperpolymath wants to merge 2 commits into
mainfrom
fix/spark-contracts-127
Open

ambientops #127: expose SPARK theatre, fix non-compiling backend_interface, honest verified stance#49
hyperpolymath wants to merge 2 commits into
mainfrom
fix/spark-contracts-127

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Refs hyperpolymath/standards#124 (estate proof-debt epic, sub-issue #127).

TL;DR — foundation-first verification overturned PR#48

PR#48 (merged, prior session) added RUST-SPARK-STANCE.adoc claiming the audit's "SPARK theatre" finding was inaccurate and the safety-critical specs were "Strong". Adversarial re-verification (gnat/gnatprove + a 2-agent static SPARK-RM swarm, then dynamically spot-confirmed on origin/main) found PR#48's coverage matrix is comprehensively FALSE. The original 2026-05-18 audit was right: the entire total-update/ada/dnfinition SPARK story is theatre — and it never even compiled.

Verified evidence (file:line, on origin/main)

  • backend_interface.ads: Transaction_Item.Package used an Ada reserved word as a field name → no compiler accepts it (never compiled). Install/Remove/Upgrade/Upgrade_System/Autoremove are functions with in out params = illegal SPARK (RM 4.5.2) under SPARK_Mode (On).
  • snapshot_manager.adb:4pragma SPARK_Mode (Off) (entire rollback body unanalysed) and never compiled (:93 calls Create_Btrfs_Snapshot declared :145, no forward decl). Headline Rollback_To_Snapshot Post depends on reversibility_types.adb:26-32 System_State_Matches_Snapshot = pragma Unreferenced (ID); return True; (hardcoded vacuous oracle) + fail-permissive disjunction.
  • safety_boundary.adb:6pragma SPARK_Mode (Off); safety_boundary.ads:78+ Safe_* are functions with in Out params (illegal SPARK). No privilege/scope/bound model exists at all.
  • safety_invariant.ads: legal SPARK but tautologies over ghost state the real (SPARK_Mode Off) enforcement path never updates.

What this PR genuinely delivers (no theatre, no fake green)

  1. Real bug fix: backend_interface.ads PackagePkg (zero references anywhere) — the unit now compiles (gnat exit 0).
  2. Honest SPARK boundary: backend_interface.adspragma SPARK_Mode (Off) with documented rationale (it is genuinely non-SPARK by design).
  3. Sound Ada 2022 contracts: Pre'Class/Post'Class on the SPARK-legal query ops (Get_Name/Search/Get_Package_Info), Pre on Register_Backend, and six non-empty-ID Pres on plugin_registry.ads — runtime-enforced (-gnata) and the spec for the OWED refactor.
  4. Verified, honest stance: false coverage matrix flagged SUPERSEDED; new verified-correction section with the evidence above + precisely-scoped OWED programme.

Honest scope — NOT closeable here

The real fix is a large genuine programme (tracked #127, must not be faked): state-mutating functionprocedure redesign across the interface + every backend + safety_boundary; bring the safety bodies into SPARK_Mode (On); fix the elaboration error; replace the hardcoded-True ghost oracle with a real state model. Only then can the safety-critical contracts be gnatprove-discharged. This PR makes the truth visible and the foundation honest; it does not claim verification that does not exist.

🤖 Generated with Claude Code

hyperpolymath and others added 2 commits May 18, 2026 22:24
…oundary + sound contracts

Foundation-first verification (gnatprove + gnat) found backend_interface.ads
was SPARK theatre that NEVER COMPILED:
- Transaction_Item.Package used an Ada reserved word as a field name
  (no compiler accepts it) -> renamed Pkg (zero references anywhere).
- Install/Remove/Upgrade/Upgrade_System/Autoremove are *functions* with
  an in-out controlling parameter -> illegal SPARK (RM 4.5.2), yet the
  unit was pragma SPARK_Mode (On). gnatprove could never analyse it.

Changes (genuine, no theatre, no fake green):
- backend_interface.ads: real bug fix (Package->Pkg, now compiles, gnat
  exit 0); honest pragma SPARK_Mode (Off) with documented rationale;
  added sound Ada 2022 Pre'Class/Post'Class on the SPARK-legal query ops
  (Get_Name/Search/Get_Package_Info) + Pre on Register_Backend (runtime
  -gnata enforced; also the spec for the OWED SPARK refactor).
- plugin_registry.ads: strengthened with non-empty-ID preconditions on
  Unregister/Get_Plugin/Get_Plugin_Metadata/Enable/Disable/
  Is_Plugin_Enabled (was: only Register_Plugin had a Pre).

OWED (tracked standards#127, must NOT be faked): state-mutating
function->procedure redesign across backend_interface + backend_guix +
backend_nix to make the modification path legal SPARK; only then can
backend_interface/plugin_registry be gnatprove-discharged.

Refs hyperpolymath/standards#124

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adversarial re-verification (gnat/gnatprove + 2-agent static SPARK-RM
swarm, dynamically spot-confirmed on origin/main) found PR#48's 'Strong'
SPARK coverage matrix comprehensively FALSE:
- snapshot_manager.adb:4 pragma SPARK_Mode(Off) — entire rollback body
  unanalysed; never compiled (call@:93 of fn declared@:145, no fwd decl);
  headline Post rests on reversibility_types.adb:31
  System_State_Matches_Snapshot = hardcoded 'return True'.
- safety_boundary.adb:6 SPARK_Mode(Off); safety_boundary.ads:78+ Safe_*
  are functions with in Out param (illegal SPARK), no escape; no
  privilege/scope/bound model exists (only Is_Valid(Token)).
- safety_invariant.ads legal SPARK but tautologies over ghost state the
  real (SPARK_Mode Off) path never updates.
Original 2026-05-18 audit ('SPARK theatre') was right; #48 was wrong.

RUST-SPARK-STANCE.adoc: false coverage matrix flagged SUPERSEDED;
added verified-correction section with file:line evidence, what this PR
genuinely delivers, and the precisely-scoped OWED programme.

Refs hyperpolymath/standards#124

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant