Skip to content
pi-c S1 storage-substrate proof
Login

S1 storage-substrate proof

Status: PASS for the isolated substrate probe; API extraction remains a proposal. No context source was modified and no production harness API was introduced.

What actually ran

make test-context / make test-context-sanitize use a fixed allowlist of current context C/schema/Makefile inputs copied into private qualification snapshots. They compile the actual vendored SQLite/libfossil and current context code through its existing CTX_NO_MAIN testing seam. They do not borrow upstream objects or use the real context database.

The C probe mutates a real embedded Fossil technote, real context capture state, and a host fixture row in one outer SQLite transaction. It checks:

  1. COMMIT: all changes survive closing/reopening the database.
  2. Explicit ROLLBACK: none of the attempted changes survives reopen.
  3. Duplicate-key statement failure followed by explicit ROLLBACK: both sides remain at the prior committed version.
  4. Negative control: COMMIT substituted for ROLLBACK must fail the technote-body oracle, not merely fail for an unrelated setup reason.

Normal and full ASan/UBSan builds passed. Leak detection is not claimed. Every temporary HOME, database, Fossil/XDG configuration, and scratch directory was removed. Main independently reran both modes and checked that no private.* directories remained. The unit also received independent review.

Evidence

Main's verified runs:

Independent review runs:

Each retains source/schema snapshots and hashes, compiler/argv logs, the probe and deliberately incorrect mutant binary, binary hashes, proof logs, and private-path cleanup evidence. latest-run.txt identifies the latest invocation, not necessarily a production-qualified source revision.

The wrapper preserves GATED exit2 for missing inputs/tools or invalid modes. Local source snapshots are deliberate retained evidence, not live databases. The probe runs with an empty inherited environment and private HOME/CTX_DB/Fossil/XDG paths.

What this does not prove

This is not a power-loss/crash simulation, concurrent writer test, migration/rebuild preservation test, CLI-wide regression suite, or Fil-C qualification of the whole context engine. Remote Fil-C in S0 covered the small qualification fixtures/corpus, not this SQLite/libfossil probe. All production harness contracts remain NOT RUN.

It also does not make archive_batch() composable: that function still owns its BEGIN/COMMIT. A production embedding requires a deliberate change in context itself, not copied consumer-side archive code.

Review the API proposal: one host-owned SQLite connection and outer transaction, with context borrowing a connection-scoped handle. Preparation/migration/repository opening happens explicitly outside active writes; context operations return errors rather than exiting, and the host owns commit/rollback and publication.

The key unresolved decision is integrity/lifetime policy: libfossil currently requires foreign_keysOFF, initialization has process-global components, and runtime relationships cannot silently depend on SQLite REFERENCES enforcement. Do not implement the public API or runtime schema until that boundary and its tests are approved.