Skip to content

feat(bin): add verified sovereign ledger replicas - #2473

Open
coreldh wants to merge 19 commits into
kunchenguid:mainfrom
coreldh:fm/c0815-fm-ledger-r5
Open

feat(bin): add verified sovereign ledger replicas#2473
coreldh wants to merge 19 commits into
kunchenguid:mainfrom
coreldh:fm/c0815-fm-ledger-r5

Conversation

@coreldh

@coreldh coreldh commented Aug 16, 2026

Copy link
Copy Markdown

Round 5 root cause and contract

The old verifier asked whether the two paths had different inode numbers. That was not the real property: the question is whether the second copy survives losing the disk that holds the primary.

Every command now enters through the single admit_pair(primary, replica, mode) chokepoint before it may read, compare, execute, or publish. Admission returns canonical validated paths and the identity evidence carried through publication.

By default, admission requires different st_dev values for primary and replica. A caller deliberately keeping both copies on one disk must name the trade-off with --allow-same-volume-without-device-redundancy; the waiver gives up device-loss redundancy but does not waive member-identity disjointness.

Local evidence: the focused suite reports 114 passed, 0 failed, 3 not verifiable; bind mount, directory hard link, and firmlink are individually recorded as NOT_VERIFIABLE on this host without substituting nearby cases. A real 32 MiB APFS image proved primary st_dev=16777231 and replica st_dev=16777240: cross-volume snapshot/verify and destruction recovery were accepted (2/0), while a replica beside the primary was refused (1/0). Cleanup confirmed the image detached and the file removed. The maintained mutation population records each of 53 mutants with exactly one substitution: killed=36 survived=17 void=0 harness_broken=0 denominator=53.

Intent

Complete sovereign-ledger round 5 review-r4 by individually recording bind-mount, directory-hard-link, and firmlink attacks as real refusals when constructible or explicit NOT_VERIFIABLE cases when this host cannot construct them, without substituting nearby passing cases. Preserve the distinct-volume admit_pair predicate, named same-volume waiver, publication identity binding, non-deleting cleanup, 114/0 behavioral suite, real APFS cross-volume proof, honest 53-mutant evidence, and maintainer-only merge authority.

What Changed

  • Add snapshot, refresh, and verification commands for four-member sovereign-ledger replicas, with distinct-volume admission, a named same-volume waiver, identity checks, atomic publication, and non-deleting failure handling.
  • Cover APFS cross-volume recovery and alias attacks, recording bind mounts, directory hard links, and firmlinks as real refusals or explicit NOT_VERIFIABLE cases when unavailable.
  • Add reproducible 53-mutant and publication-containment evidence, maintained fixtures and documentation, plus CI byte-comparison enforcement.

Risk Assessment

✅ Low: The repair correctly routes constructible directory hard links to the existing member-identity refusal and makes APFS cleanup retain all fixture state on detach failure while preserving successful detach-and-removal behavior.

Testing

At exact target 7f76826, the focused CLI suite passed 114/0 while separately recording bind mount, directory hard link, and firmlink as NOT_VERIFIABLE without substitutes; a real APFS volume proved cross-device snapshot/verify and safe detach, and all 53 single-substitution mutants regenerated to 36 killed/17 survived/0 invalid with byte-identical maintainer evidence. This is CLI-only, so screenshots were not applicable; reviewer-visible transcripts were captured instead.

Evidence: Behavioral and attack-case transcript

114 passed, 0 failed, 3 explicitly not verifiable

T1 complete, independent bundle preconditions
  PASS  verify REFUSES a nonexistent ledger directory
  PASS  snapshot REFUSES an incomplete primary bundle
  PASS  snapshot REFUSES a primary bundle without its contract
  PASS  snapshot REFUSES the same primary and replica directory
  PASS  snapshot atomically CREATES the complete second ledger bundle
  PASS  verify PASSES for the exact independent replica
  PASS  snapshot CREATES an executable-bit fixture bundle
  PASS  verify REFUSES a non-executable replica verifier
  PASS  verify REFUSES when exact bundle enumeration fails
T2 staleness is loud and refresh accepts only an append-only prefix
  PASS  verify names a verified stale replica and its refresh remedy
  PASS  refresh advances the verified append-only replica
  PASS  verify PASSES after refresh
  PASS  refresh REFUSES an equal-length replica rather than treating it as stale
  PASS  snapshot CREATES a non-prefix refresh fixture
  PASS  refresh REFUSES a verifying replica that is not a byte-exact prefix
  PASS  snapshot CREATES a shorter non-prefix refresh fixture
  PASS  refresh REFUSES a shorter verifying replica that is not byte-exact
  PASS  snapshot CREATES an empty-prefix guard fixture
  PASS  refresh promptly REFUSES an empty replica ledger under GNU head semantics even when the fixture verifier accepts it
T3 source loss leaves the four required fixture rulings provable
  PASS  fixture recheck reports all four removed sources as SOURCE_GONE
  PASS  redundancy verify PASSES after the four sources are gone
  PASS  replica returns exact ruling-1 text after source loss
  PASS  replica returns exact ruling-2 text after source loss
  PASS  replica returns exact ruling-3 text after source loss
  PASS  replica returns exact ruling-4 text after source loss
T4 every bundle-file symlink is refused before it can masquerade as a copy
  PASS  snapshot CREATES a ledger.tsv symlink fixture
  PASS  verify REFUSES a symlinked ledger.tsv
  PASS  snapshot CREATES a CONTRACT.md symlink fixture
  PASS  verify REFUSES a symlinked CONTRACT.md
  PASS  snapshot CREATES a fm-sovereign-ledger.sh symlink fixture
  PASS  verify REFUSES a symlinked fm-sovereign-ledger.sh
  PASS  snapshot CREATES a tests.sh symlink fixture
  PASS  verify REFUSES a symlinked tests.sh
T5 non-regular bundle members are refused before comparison or execution
  PASS  snapshot CREATES a non-regular member fixture bundle
  PASS  verify promptly REFUSES a FIFO bundle member
T6 replica bytes are compared before replica-controlled code can execute
  PASS  snapshot CREATES an ordering fixture bundle
  PASS  verify REFUSES a changed replica verifier
  PASS  changed replica verifier never executed
T7 divergence and extra files are detected and never repaired
  PASS  verify FAILS when replica contract bytes diverge
  PASS  snapshot REFUSES to overwrite a divergent replica
  PASS  verify REFUSES an unexpected replica file
  PASS  verify PASSES after fixture restore
T8 an invalid primary is never copied
  PASS  snapshot REFUSES a primary rejected by its own verifier
  PASS  rejected primary leaves no replica directory behind
T9 the st_dev predicate is portable and fail-closed
  PASS  snapshot CREATES an identity-check fixture bundle
  PASS  snapshot CREATES an identity-check replica bundle
  PASS  verify REFUSES equal numeric st_dev identities
  PASS  verify ACCEPTS distinct numeric st_dev identities
  PASS  verify REFUSES a nonnumeric st_dev identity
T10 hard links fall to the one device predicate by default
  PASS  snapshot CREATES a ledger.tsv hard-link fixture
  PASS  verify REFUSES a same-device pair containing hard-linked ledger.tsv
  PASS  snapshot CREATES a CONTRACT.md hard-link fixture
  PASS  verify REFUSES a same-device pair containing hard-linked CONTRACT.md
  PASS  snapshot CREATES a fm-sovereign-ledger.sh hard-link fixture
  PASS  verify REFUSES a same-device pair containing hard-linked fm-sovereign-ledger.sh
  PASS  snapshot CREATES a tests.sh hard-link fixture
  PASS  verify REFUSES a same-device pair containing hard-linked tests.sh
T11 adversarial ledger paths certify real copies that survive primary destruction
  PASS  snapshot CREATES an independent replica under a hash path
  PASS  verify CERTIFIES the independent replica under a hash path
  PASS  all four bundle members survive primary destruction under a hash path
  PASS  all four rulings remain byte-exact under a hash path
  PASS  snapshot CREATES an independent replica under a unterminated bracket path
  PASS  verify CERTIFIES the independent replica under a unterminated bracket path
  PASS  all four bundle members survive primary destruction under a unterminated bracket path
  PASS  all four rulings remain byte-exact under a unterminated bracket path
  PASS  snapshot CREATES an independent replica under a space path
  PASS  verify CERTIFIES the independent replica under a space path
  PASS  all four bundle members survive primary destruction under a space path
  PASS  all four rulings remain byte-exact under a space path
  PASS  snapshot CREATES an independent replica under a newline path
  PASS  verify CERTIFIES the independent replica under a newline path
  PASS  all four bundle members survive primary destruction under a newline path
  PASS  all four rulings remain byte-exact under a newline path
  PASS  snapshot CREATES an independent replica under a unicode path
  PASS  verify CERTIFIES the independent replica under a unicode path
  PASS  all four bundle members survive primary destruction under a unicode path
  PASS  all four rulings remain byte-exact under a unicode path
T12 the instrument distinguishes independent and non-independent replicas
  PASS  positive control REFUSES a fully symlinked replica under a hash path
T13 containment is an explicit property
  PASS  verify REFUSES a replica contained by the primary explicitly
  PASS  snapshot REFUSES a replica target contained by the primary explicitly
  PASS  verify REFUSES a primary contained by the replica explicitly
T14 st_dev reads are fail-closed under BSD and GNU stat semantics
  PASS  snapshot CREATES a stat-dialect primary fixture
  PASS  snapshot CREATES a stat-dialect replica fixture
  PASS  verify PASSES distinct st_dev identities with bsd stat semantics
  PASS  verify PASSES distinct st_dev identities with gnu stat semantics
  PASS  verify REFUSES when stat cannot establish a numeric st_dev identity
T15 the complete replica and primary device sets must be disjoint
  PASS  snapshot CREATES a cross-member identity fixture
  PASS  verify REFUSES cross-member shared storage by the device predicate
T16 round 5 attacks replace the independence predicate rather than extending it
  PASS  verify REFUSES a same-volume real copy by default
  PASS  verify explicit opt-out ACCEPTS a same-volume real copy
  PASS  verify REFUSES an APFS clone bundle by the device predicate
  NOT_VERIFIABLE  bind-mount attack: this host grants no unprivileged bind or nullfs mount; no nearby mount case substituted
  NOT_VERIFIABLE  directory-hard-link attack: this host refuses unprivileged directory hard-link creation; no symlink case substituted
  NOT_VERIFIABLE  firmlink attack: this host exposes no unprivileged fixture-creation API for OS-managed firmlinks; no symlink case substituted
  PASS  verify REFUSES a case-folded manifest collision by its real entry name
  PASS  verify REFUSES dot-dot traversal that resolves to the primary itself
  PASS  verify REFUSES a replica path symlinked to the primary parent
  PASS  refresh REFUSES a same-device pair before publication
  PASS  refresh refusal leaves the rejected replica byte-exactly unchanged
  PASS  verify reclassifies a non-regular member appearing after enumeration
T17 snapshot publication is bound to the destination created exclusively by admission
  PASS  snapshot race cannot redirect publication outside its admitted destination
T18 same-volume waiver preserves member independence and snapshot failure boundaries
  PASS  snapshot CREATES a waived ledger.tsv hard-link fixture
  PASS  same-volume waiver REFUSES a hard-linked ledger.tsv
  PASS  snapshot CREATES a waived CONTRACT.md hard-link fixture
  PASS  same-volume waiver REFUSES a hard-linked CONTRACT.md
  PASS  snapshot CREATES a waived fm-sovereign-ledger.sh hard-link fixture
  PASS  same-volume waiver REFUSES a hard-linked fm-sovereign-ledger.sh
  PASS  snapshot CREATES a waived tests.sh hard-link fixture
  PASS  same-volume waiver REFUSES a hard-linked tests.sh
  PASS  snapshot CREATES a waived cross-member fixture
  PASS  same-volume waiver REFUSES cross-member shared storage
  PASS  snapshot REFUSES unsupported directory identity before destination creation
  PASS  directory identity preflight leaves no replica destination
  PASS  snapshot identifies a retained partial after post-creation copy failure
  PASS  post-creation failure retains the partial replica directory
  PASS  TERM reports the retained or possibly-created replica destination
  PASS  TERM leaves the created partial replica directory in place

114 passed, 0 failed, 3 not verifiable
Evidence: Real APFS cross-volume trace

APFS disk image; snapshot and verify across st_dev 16777231!=16777240; clean detach

+ set -euo pipefail
+++ dirname tests/fm-sovereign-ledger-cross-volume.test.sh
++ cd tests/..
++ pwd
+ ROOT=/Users/admin/.no-mistakes/worktrees/aa652f3359ba/01M05B5RXBKXCJJXD4XYTA1YH2
+ TOOL=/Users/admin/.no-mistakes/worktrees/aa652f3359ba/01M05B5RXBKXCJJXD4XYTA1YH2/bin/fm-sovereign-ledger-redundancy.sh
+ FIXTURE=/Users/admin/.no-mistakes/worktrees/aa652f3359ba/01M05B5RXBKXCJJXD4XYTA1YH2/tests/fixtures/sovereign-ledger-redundancy
++ mktemp -d
+ TMP=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN
+ VOLUME_ROOT=
+ ATTACHED_VOLUME=no
+ trap finish EXIT
+ trap 'exit 129' HUP
+ trap 'exit 130' INT
+ trap 'exit 143' TERM
+ FAKE_HDIUTIL=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/fake-hdiutil
+ printf '%s\n' '#!/usr/bin/env bash' 'printf '\''%s\n'\'' "$*" >> "$CLEANUP_HDIUTIL_LOG"' 'exit "$CLEANUP_HDIUTIL_STATUS"'
+ chmod +x /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/fake-hdiutil
+ export CLEANUP_HDIUTIL_LOG CLEANUP_HDIUTIL_STATUS
+ CLEANUP_FAILURE=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure
+ CLEANUP_FAILURE_VOLUME=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure/volume
+ CLEANUP_FAILURE_LOG=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure.log
+ CLEANUP_FAILURE_DIAGNOSTIC=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure.diagnostic
+ mkdir -p /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure/volume/replica
+ :
+ :
+ CLEANUP_HDIUTIL_LOG=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure.log
+ CLEANUP_HDIUTIL_STATUS=1
+ cleanup_fixture /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure/volume yes /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/fake-hdiutil
++ cat /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure.log
+ '[' 'detach /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure/volume' = 'detach /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure/volume' ']'
+ grep -Fq 'retained scratch and image' /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure.diagnostic
+ '[' -f /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure/ledger-volume.dmg ']'
+ '[' -f /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure/volume/replica/ledger.tsv ']'
+ rm -rf -- /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-failure
+ CLEANUP_SUCCESS=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success
+ CLEANUP_SUCCESS_VOLUME=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume
+ CLEANUP_SUCCESS_LOG=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success.log
+ mkdir -p /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume/replica
+ :
+ CLEANUP_HDIUTIL_LOG=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success.log
+ CLEANUP_HDIUTIL_STATUS=0
+ cleanup_fixture /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume yes /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/fake-hdiutil
+ local scratch=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success volume_root=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume attached=yes hdiutil_command=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/fake-hdiutil
+ '[' yes = yes ']'
+ /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/fake-hdiutil detach /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume
+ attached=no
+ rm -rf -- /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success
+ '[' -n /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume ']'
+ '[' no = no ']'
+ [[ /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume != \/\v\a\r\/\f\o\l\d\e\r\s\/\c\q\/\x\f\4\q\c\b\9\j\0\q\z\c\2\d\b\h\1\7\3\m\f\l\b\m\0\0\0\0\g\n\/\T\/\t\m\p\.\h\E\u\B\H\k\M\z\Y\N\/\c\l\e\a\n\u\p\-\s\u\c\c\e\s\s/* ]]
++ cat /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success.log
+ '[' 'detach /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume' = 'detach /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success/volume' ']'
+ '[' '!' -e /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/cleanup-success ']'
+ '[' -d /dev/shm ']'
+ command -v hdiutil
+ VOLUME_ROOT=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume
+ mkdir /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume
+ hdiutil create -quiet -size 32m -fs APFS -volname fm-ledger-r5 /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume.dmg
+ ATTACHED_VOLUME=yes
+ hdiutil attach -quiet -nobrowse -mountpoint /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume.dmg
+ PRIMARY=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary
+ REPLICA=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume/replica
+ mkdir /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary
+ cp /Users/admin/.no-mistakes/worktrees/aa652f3359ba/01M05B5RXBKXCJJXD4XYTA1YH2/tests/fixtures/sovereign-ledger-redundancy/CONTRACT.md /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary/CONTRACT.md
+ cp /Users/admin/.no-mistakes/worktrees/aa652f3359ba/01M05B5RXBKXCJJXD4XYTA1YH2/tests/fixtures/sovereign-ledger-redundancy/fm-sovereign-ledger.sh /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary/fm-sovereign-ledger.sh
+ cp /Users/admin/.no-mistakes/worktrees/aa652f3359ba/01M05B5RXBKXCJJXD4XYTA1YH2/tests/fixtures/sovereign-ledger-redundancy/tests.sh /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary/tests.sh
+ chmod +x /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary/fm-sovereign-ledger.sh /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary/tests.sh
+ :
+ for number in 1 2 3 4
+ printf 'ruling-%s\t/source-%s\tZml4dHVyZQo=\n' 1 1
+ for number in 1 2 3 4
+ printf 'ruling-%s\t/source-%s\tZml4dHVyZQo=\n' 2 2
+ for number in 1 2 3 4
+ printf 'ruling-%s\t/source-%s\tZml4dHVyZQo=\n' 3 3
+ for number in 1 2 3 4
+ printf 'ruling-%s\t/source-%s\tZml4dHVyZQo=\n' 4 4
++ device_identity /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary
++ local identity
+++ stat -f %d /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary
++ identity=16777231
++ :
++ printf '%s\n' 16777231
+ PRIMARY_DEVICE=16777231
++ device_identity /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume
++ local identity
+++ stat -f %d /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume
++ identity=16777240
++ :
++ printf '%s\n' 16777240
+ REPLICA_PARENT_DEVICE=16777240
+ '[' 16777231 '!=' 16777240 ']'
+ /Users/admin/.no-mistakes/worktrees/aa652f3359ba/01M05B5RXBKXCJJXD4XYTA1YH2/bin/fm-sovereign-ledger-redundancy.sh snapshot /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume/replica
+ /Users/admin/.no-mistakes/worktrees/aa652f3359ba/01M05B5RXBKXCJJXD4XYTA1YH2/bin/fm-sovereign-ledger-redundancy.sh verify /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/primary /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume/replica
+ printf '2 passed, 0 failed (strict cross-volume snapshot and verify; st_dev %s!=%s)\n' 16777231 16777240
2 passed, 0 failed (strict cross-volume snapshot and verify; st_dev 16777231!=16777240)
+ finish
+ local status=0
+ cleanup_fixture /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume yes hdiutil
+ local scratch=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN volume_root=/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume attached=yes hdiutil_command=hdiutil
+ '[' yes = yes ']'
+ hdiutil detach /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume
+ attached=no
+ rm -rf -- /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN
+ '[' -n /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume ']'
+ '[' no = no ']'
+ [[ /var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T/tmp.hEuBHkMzYN/ledger-volume != \/\v\a\r\/\f\o\l\d\e\r\s\/\c\q\/\x\f\4\q\c\b\9\j\0\q\z\c\2\d\b\h\1\7\3\m\f\l\b\m\0\0\0\0\g\n\/\T\/\t\m\p\.\h\E\u\B\H\k\M\z\Y\N/* ]]
+ trap - EXIT HUP INT TERM
+ exit 0
Evidence: 53-mutant evidence verification

killed=36 survived=17 void=0 harness_broken=0 denominator=53

M001 SURVIVED substitutions=1 status=0
M002 KILLED substitutions=1 status=1
M003 KILLED substitutions=1 status=1
M004 KILLED substitutions=1 status=1
M005 KILLED substitutions=1 status=1
M006 KILLED substitutions=1 status=1
M007 KILLED substitutions=1 status=1
M008 KILLED substitutions=1 status=1
M009 KILLED substitutions=1 status=1
M010 KILLED substitutions=1 status=1
M011 KILLED substitutions=1 status=1
M012 KILLED substitutions=1 status=1
M013 KILLED substitutions=1 status=1
M014 KILLED substitutions=1 status=1
M015 KILLED substitutions=1 status=1
M016 KILLED substitutions=1 status=1
M017 KILLED substitutions=1 status=1
M018 KILLED substitutions=1 status=1
M019 KILLED substitutions=1 status=1
M020 KILLED substitutions=1 status=1
M021 KILLED substitutions=1 status=1
M022 KILLED substitutions=1 status=1
M023 KILLED substitutions=1 status=1
M024 KILLED substitutions=1 status=1
M025 KILLED substitutions=1 status=1
M026 KILLED substitutions=1 status=1
M027 SURVIVED substitutions=1 status=0
M028 SURVIVED substitutions=1 status=0
M029 SURVIVED substitutions=1 status=0
M030 SURVIVED substitutions=1 status=0
M031 KILLED substitutions=1 status=1
M032 SURVIVED substitutions=1 status=0
M033 SURVIVED substitutions=1 status=0
M034 SURVIVED substitutions=1 status=0
M035 SURVIVED substitutions=1 status=0
M036 SURVIVED substitutions=1 status=0
M037 KILLED substitutions=1 status=1
M038 SURVIVED substitutions=1 status=0
M039 KILLED substitutions=1 status=1
M040 KILLED substitutions=1 status=1
M041 SURVIVED substitutions=1 status=0
M042 KILLED substitutions=1 status=1
M043 SURVIVED substitutions=1 status=0
M044 KILLED substitutions=1 status=1
M045 KILLED substitutions=1 status=1
M046 KILLED substitutions=1 status=1
M047 KILLED substitutions=1 status=1
M048 KILLED substitutions=1 status=1
M049 KILLED substitutions=1 status=1
M050 SURVIVED substitutions=1 status=0
M051 SURVIVED substitutions=1 status=0
M052 SURVIVED substitutions=1 status=0
M053 SURVIVED substitutions=1 status=0
CONTROL SURVIVED substitutions=1 status=0
MUTATION SUMMARY killed=36 survived=17 void=0 harness_broken=0 denominator=53

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • 🚨 tests/fm-sovereign-ledger-redundancy.test.sh:486 - The constructible directory-hard-link path expects primary and replica directories must differ, but that guard compares canonical path strings; two hard-link names remain distinct, so the verifier instead reaches the later member-identity refusal. This violates the required real-refusal record on hosts that permit the attack. Decide whether to compare directory device:inode identities during shared pair admission or authorize the member-identity refusal as the expected invariant.
  • ⚠️ tests/fm-sovereign-ledger-cross-volume.test.sh:14 - If hdiutil detach fails, cleanup ignores the error and immediately runs rm -rf through the still-mounted APFS fixture, deleting its replica contents and potentially returning success with the volume attached. Retain the scratch directory and fail cleanup when detachment fails.

🔧 Fix: Harden APFS cleanup and correct hard-link refusal
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Baseline: pwd -P, git rev-parse HEAD, git status --short --branch, and target/base diff inspection
  • bash tests/fm-sovereign-ledger-redundancy.test.sh
  • bash tests/fm-sovereign-ledger-cross-volume.test.sh
  • bash tests/fm-sovereign-ledger-redundancy.mutation.sh --verify-evidence
  • PS4='+ ' bash -x tests/fm-sovereign-ledger-cross-volume.test.sh
  • Final git status --porcelain=v1 and target-HEAD identity check
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coreldh coreldh changed the title feat(bin): add independent sovereign ledger replicas feat(bin): add verified sovereign ledger replicas Aug 16, 2026
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