Repository navigation
Make room before 0.9.0: five types non-exhaustive, the labels, Verdict::new (no behaviour moves) - #49
Merged
Merged
Conversation
Ten fixed states that between them hold the nine words, a checked proof (mined, suspect after a fork, and kept after a stale), every HintStatus kind without a verdict and with one read from an ARC body (the presence hint carrying a verdict by Hint's public fields), and the seven Reask kinds, each reached through the public API. Each state's to_compact is compared with bytes written out in the test, and a state whose word is not mined restores equal to itself. Why: the make-room pull request before 0.9.0 (bsv-stack-lean docs/DECISIONS-2026-10-19.md 28.8.1 (c), ruled 2026-11-17 16:1xZ) must move no byte the crate writes. This commit lands alone on the base, so the later commits are measured against it. No test of the base changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#[non_exhaustive] on the enums HostAction, Reask, HintStatus and VerdictError and on the struct Verdict; the type alone, no variant marked, Verdict's four fields still pub. Verdict::new(status) builds a verdict holding the word as given (not trimmed, not checked) with no height, no reason and no competitors; from_arc_body stays the checked reader. Why: the rulings of 2026-11-17 16:1xZ (bsv-stack-lean docs/RULINGS-2026-10-12.md; docs/DECISIONS-2026-10-19.md 28.8.1 (c), VerdictError by the keeper's reading of 17:1xZ) land bsv-tracker #45, #46 and #47 after the 0.9.0 cut as minors; with the marks their new kinds, the status-code field and a refusal reader's error are additive. A host's exhaustive match on the four enums, and a Verdict literal, stop compiling now instead. The proof: a compile_fail doctest per type, each quoting its code (E0004 for the four enums, E0639 for the literal); on nightly, where rustdoc checks the code, all five hold, and with the marks removed all five compile. tests/verdicts.rs builds its three verdicts with Verdict::new and field assignments, the same values and answers. No match in src/ gains a wildcard arm, and no test under tests/ matches one of the five enums without one, so none gains an arm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HintStatus::label and Reask::label (#[must_use]) give each kind its
stable word, the payload not in it, the snake_case of the variant's
name; each is a match with no wildcard arm, so a kind added without its
word does not compile. HintStatus::LABELS and Reask::LABELS are every
word in declaration order, which is the compact form's tag order, as a
&'static [&'static str] so a later kind does not change the type.
HintStatus derives Serialize and Deserialize, internally tagged by its
word ({"status":"mined","height":900}); MempoolPresent's source is
written as courier and DoubleSpend's competitors are left out when
empty, so the form equals the JSON bsv-wallet-cli already stores. No
#[serde(other)] and no default kind: an unknown word and a missing
payload are refused. Reask gets the words alone (no serde, no Display,
no bytes); Hint, Verdict and HostAction no serde.
Why: the ruling's labels (bsv-stack-lean docs/DECISIONS-2026-10-19.md
28.8.1 (c), 2026-11-17 16:1xZ): a host that stores hints and shows
re-asks takes the words from the crate instead of a hand map, so a kind
a later minor adds is kept and surfaced, never mapped to Unknown.
Tests: tests/labels.rs (the sixteen pairs, both lists, every status's
text round-tripped, the serde tag equal to label, the refusals, and the
host's shape: a struct with the status flattened between source and
observed reads every text the CLI's StoredHint::of writes, a copy of it
at bsv-wallet-cli 108f80e, and writes it back identical); two unit
tests in src/compact.rs that LABELS[i] is the word of the kind the
compact writer tags i. The compact goldens are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README.md gains "Kinds a later release adds" between "Broadcaster hints" and "Events and records", and the rustdoc of Reask and of HintStatus carries the same sentence: a re-ask of a kind the host does not name is kept and surfaced by Reask::label, never dropped by a wildcard arm; a hint status is stored by its serde form and read back by it, never mapped by hand, and a status the reader refuses is surfaced, never read as HintStatus::Unknown. The words never change, are never reused, and a later minor only appends. Why: the sentence is the second of the ruling's three additions (bsv-stack-lean docs/DECISIONS-2026-10-19.md 28.8.1 (c), 2026-11-17 16:1xZ): without it the marks trade a compile error at a host's pin for a wrong answer at run time. Docs only; no code moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lead paragraph (the rows of the rulings of 2026-11-17, bsv-stack-lean
docs/DECISIONS-2026-10-19.md 28.8.1 (c); the five types non-exhaustive,
so a host's exhaustive match on the four enums and a Verdict literal
stop compiling; no behaviour moves and the compact bytes are unchanged,
pinned by tests/compact_golden.rs), then Changed (the five marks), Added
(Verdict::new, label and LABELS, the serde form of HintStatus, the
tests) and Hosts (the wildcard arm that keeps and surfaces, Verdict::new
for a literal, the stored form, and that bsv-wallet-cli's stored rows
read as they are).
Also one word of a test comment in src/compact.rs ("leading byte"), for
the wording rule; no code moves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The room made before 0.9.0, and nothing more. Ruled 2026-11-17 16:1xZ: bsv-stack-lean
docs/RULINGS-2026-10-12.md(the section of that hour) anddocs/DECISIONS-2026-10-19.md28.8.1, option (c) with its three additions (the labels, the sentence, the CLI's maps);VerdictErroris the fifth type by the keeper's reading of 17:1xZ, recorded in the same 28.8.1 (c). The three rows of those rulings (#45 finality, #46 the status code, #47conflictedkeeping its proof) land after the cut as minors. None of them is built here. No behaviour moves: every test of the base keeps its name and its answer, and the compact bytes are unchanged, pinned by a golden that landed on the base before any other change. No version bump, no tag, no release.The surface
The type alone is marked, no variant. Each
labelis a match with no wildcard arm.LABELSis in declaration order, which is the compact form's tag order (a unit test inside the crate checksLABELS[i]against the tag the writer gives).Reaskhas the words alone: no serde, noDisplay, no bytes.Hint,VerdictandHostActionhave no serde. No other type is marked.Part F's table, after this pull request
From the keeper's design (
docs/p0/tracker-rulings-2026-11-17-design.md, part F), by my own read of the crate at this head:Lock { lock_time, sequences_final },Lock::from_transactionHostAction::Lock(Lock);Reask::WaitFinal { lock },Reask::AnnounceFinal;HintStatus::NonFinal#[non_exhaustive]; the words append toLABELS(non_final,wait_final,announce_final) and the compact tags append after version 1's.State::finality(&self, &H) -> Finality; theTracker's pending-lock indexHeaders::time_at(a provided method answeringOk(None));median_time_past(&H)State::rivals(),Rival;Reask::CompetitorGone { competitors };on_chain/recheckselectConflictedby its rivals; theTrackerindexes rivalsCOMPACT_VERSIONchanges value (no compile break), and a 0.9.0 reader refuses a version-2 state withUnknownVersion, so hosts on two minors that share one store read each other's rows only from the newer one.Verdict::status_code: Option<u16>;into_hint466 and 476;Verdict::from_arc_refusalVerdict::newsets it toNone), a variant ofVerdictErrorif the refusal reader needs one, a new function. The 466 and 476 arms change behaviour.No type outside the five is broken by a row as part F states it. Two depend on the design holding:
Word(not marked) stays unbroken only while #47 keeps the rivals beside the word (State::rivals) and not insideWord::Conflicted.CompactError(not marked) stays unbroken only while version 2's refusals fitMalformed. Neither is marked here.The tests
(a)
tests/compact_golden.rs, alone on the base: ten states built through the public API. Between them they hold the nine words, a checked proof (mined, suspect after a fork, kept after a stale), everyHintStatuskind without a verdict and with one read from an ARC body, and the sevenReaskkinds. Eachto_compactis asserted against hex written out in the test. Green at that commit (75 passed) and unchanged since.(b) A
compile_faildoctest on each of the five, each quoting its code: E0004 for an exhaustive match outside the crate onHostAction,Reask,HintStatusandVerdictError, E0639 for aVerdictliteral. Stable rustdoc does not check the code, so I ran them under nightly too: all five hold. With the marks removed, all five compile (5 FAILED), so each fails for its mark alone.tests/verdicts.rs's three literals now useVerdict::newand field assignments, with the same values and the same answers. No match insrc/gains a wildcard arm, and no test undertests/matched one of the five enums without one.(c)
tests/labels.rs:LABELSin order;{"status":"double_spend"}for none,{"status":"mempool_present","courier":"c"}, ...);label();{"status":"non_final"},{"status":"mined"},{"status":"mempool_present"}(andrejectedwith no reason, a capitalised word, a missing tag) are eachErr;{ source, #[serde(flatten)] status: HintStatus, observed }reads every text bsv-wallet-cli'sStoredHint::ofwrites and writes it back identical. A copy ofStoredHintandoffrom the CLI's beta at 108f80e (src/tracker_host.rs:408-452) proves those texts are the CLI's, its match gaining an arm that panics aloud on a kind it does not name.flattenround-trips every text.There are also two unit tests in
src/compact.rsthatLABELS[i]is the word of the kind the writer tagsi.The hosts
HostAction,Reask,HintStatusorVerdictErrorgains a wildcard arm that keeps and surfaces what the host does not name (a re-ask byReask::label). Never an arm that maps toHintStatus::Unknownor drops the value.Verdictbuilt by literal becomesVerdict::new(status)with the other fields assigned after it. AVerdict { .. }pattern outside the crate also needs its..now (E0638).HintStatus's serde form and reads it back by it, and surfaces a status the reader refuses.Verdictand matches noHostAction(git grepon its beta).The proof (this head, 1d6141b; base 3adda34)
cargo test --locked:Every test of the base has the same name and answer at the tip.
cargo test --locked -- --listat both, compared by binary: none missing. 23 new: 5 doctests, 11 compact_golden, 5 labels and 2 unit tests.RUSTDOCFLAGS=-Dwarnings cargo doc --locked --no-deps:cargo fmt --all -- --check: clean (exit 0).cargo clippy --locked --all-targets -- -D warnings:The two
vectorssteps, as ci.yml runs them:cargo build --locked --target wasm32-unknown-unknown --features wasm:Finished. MSRV: declared1.88,cargo +1.88 check --locked --all-targets:Finished.cargo semver-checks --baseline-rev origin/beta --release-type patch(0.51.0; without--release-typeit skips all 260 checks, both sides being one prerelease version):The five marks and nothing else.
cargo deny --locked check bans licenses sources:bans ok, licenses ok, sources ok.git diff origin/beta --stat:Landing
The landing is the captain's. No release is cut for this alone: it rides the crate's next prerelease. bsv-wallet-cli's pin of that prerelease replaces its two hand maps (
StoredHint::of/hintandreask_label) with these words under a test that plants a kind the host does not name. That is a row there, not here.🤖 Generated with Claude Code