Capsule blocks step 2: mkcapsule makes no claims -- a later write overwrites
Captain Bob ruled "Overwrite. That's it. Deterministic and final", within a capsule and across capsules, "consistent with VOCABULARY FORGET & FENCE philosophy, not implementation". Of what only prevented collisions: "All of it goes". - The cross-capsule collision gate is gone. - tools/capsule-reserved.txt and its check are gone. - The interactive resolver and its claim registry are gone. - BLOCK_MAP.md says "Blocks used", and marks a shared number "the later write overwrites". It is a convenience, not a gate. - An unknown option is refused with the usage. A removed mode was otherwise taken for the capsules directory, with its next argument as the output file. Test first: scripts/test_mkcapsule_overwrite.sh, 9 checks. - The before-run failed 7. A repeat within one capsule already built, since there was never a check for it. - After: all 9 pass. step 1's test still passes, the amd64 build is clean, all 40 capsules lint, and the mesh boot passes 109 checks with POST 990/990. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LicenseRef-Starship-1.0
|
||||
# Copyright (c) 2023-2026 Robert A. James
|
||||
# test_mkcapsule_overwrite.sh -- the tests of capsule blocks step 2
|
||||
# (docs/v4.0.0/plans/2026-11-18-capsule-blocks.md). Captain Bob: "Overwrite. That's it.
|
||||
# Deterministic and final." -- within a capsule and across capsules, "consistent with VOCABULARY
|
||||
# FORGET & FENCE philosophy, not implementation"; and of what only prevents collisions: "All of it
|
||||
# goes".
|
||||
#
|
||||
# What is checked, mkcapsule run from the repository root (where it reads tools/):
|
||||
# - two capsules sharing a block number build;
|
||||
# - one capsule repeating a block number builds;
|
||||
# - a page in a range capsule-reserved.txt held builds, and that file is gone;
|
||||
# - --resolve is no longer a mode;
|
||||
# - the map says "Blocks used", and calls no number a conflict.
|
||||
#
|
||||
# No QEMU. Prints PASS:/FAIL: per check and RESULT:; exits 0 only if every check passes.
|
||||
set -uo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
T=$(mktemp -d)
|
||||
trap 'rm -rf "$T"' EXIT
|
||||
ok=1
|
||||
check() { if eval "$2"; then echo "PASS: $1"; else echo "FAIL: $1"; ok=0; fi; }
|
||||
|
||||
MK="$T/mkcapsule"
|
||||
cc -std=c99 -O2 -I"$ROOT/v3/include" -I"$ROOT/kernel/include" -I"$ROOT/tools" -o "$MK" \
|
||||
"$ROOT/tools/mkcapsule.c" "$ROOT/tools/pkcs8_ed25519.c" "$ROOT/kernel/src/crypto/ed25519.c" \
|
||||
"$ROOT/kernel/src/crypto/fe25519.c" "$ROOT/kernel/src/crypto/scalar25519.c" \
|
||||
"$ROOT/kernel/src/crypto/sha512.c" "$ROOT/kernel/src/crypto/x509_ed25519.c" 2> "$T/cc.log"
|
||||
build() { (cd "$ROOT" && "$MK" "$1" "$T/out.c" > "$T/build.log" 2>&1); } # build <capsules dir>
|
||||
|
||||
mkdir -p "$T/shared"
|
||||
printf 'Block 3000\n( first capsule )\n' > "$T/shared/a.4th"
|
||||
printf 'Block 3000\n( second capsule, the same number )\n' > "$T/shared/b.4th"
|
||||
check "two capsules sharing a block number build" 'build "$T/shared"'
|
||||
|
||||
mkdir -p "$T/repeat"
|
||||
printf 'Block 3000\n( once )\nBlock 3000\n( again )\n' > "$T/repeat/r.4th"
|
||||
check "one capsule repeating a block number builds" 'build "$T/repeat"'
|
||||
|
||||
mkdir -p "$T/reserved"
|
||||
printf 'Block 4300\n( where process.4th was )\n' > "$T/reserved/p.4th"
|
||||
check "a page in a once-reserved range builds" 'build "$T/reserved"'
|
||||
check " and tools/capsule-reserved.txt is gone" '[ ! -e "$ROOT/tools/capsule-reserved.txt" ]'
|
||||
|
||||
(cd "$ROOT" && "$MK" --resolve "$T/shared" < /dev/null > "$T/resolve.log" 2>&1)
|
||||
check "--resolve is no longer a mode: it is answered with the usage" 'grep -q "^Usage" "$T/resolve.log" && ! grep -q -i "conflict\|renumber" "$T/resolve.log"'
|
||||
check " and the tool has no such mode" '! grep -q -- "--resolve" "$ROOT/tools/mkcapsule.c"'
|
||||
|
||||
(cd "$ROOT" && "$MK" --manifest "$T/shared" "$T/map.md" > /dev/null 2>&1)
|
||||
check "the map says Blocks used" 'grep -q "Blocks used" "$T/map.md" 2>/dev/null'
|
||||
check " and calls no number a conflict" '! grep -q -i "conflict\|claimed" "$T/map.md" 2>/dev/null'
|
||||
|
||||
if [ $ok = 1 ]; then echo "RESULT: PASS"; else echo "RESULT: FAIL"; fi
|
||||
[ $ok = 1 ]
|
||||
Reference in New Issue
Block a user