Repository navigation
test(ports): oversized keys hash exactly like the legacy Key::of - #10
Conversation
ports_tests checked that an oversized key is bounded and deterministic, but not its value. Pin two golden keys (one part, and a composite with an escaped /) computed the way tinystoragedrivers-core 0c6dcfce Key::of did: `~` plus the lowercase unpadded base32 SHA-256 of the escaped key. A changed encoding would orphan dedupe and buffer rows written before the port.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test(ports): oversized keys hash exactly like the legacy Key::of. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete What changedAdds a golden-value characterization test in `crates/tinyeventqueues/src/ports_tests.rs` (`fn oversized_keys_hash_exactly_like_the_legacy_key_of()`), asserting that `key_of` on oversized keys returns two exact `~`-prefixed encoded strings: one for a single 600-byte part and one for the composite `["a/b", "y" × 600]`. Per the description, no production behavior or API changes; the encoding is pinned to what the legacy `tinystoragedrivers-core` `Key::of` produced. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
Adds a golden-value test for
key_of's hashed path (escaped keys longer than 512 bytes). The value must match what the legacytinystoragedrivers-coreKey::ofproduced, so dedupe (teq.outcomes) and buffer rows written before the storage-port migration stay addressable after an upgrade.Related issue
None. Raised by the 2026-10-23 openhuman core-data audit (Q-L1), tracked from tinyhumansai/openhuman.
API or behavior changes
None. Test only.
Validation
Commands actually run, with their outcome:
cargo fmt --all -- --check: not run workspace-wide;rustfmt --edition 2021 --checkon the changed file is cleancargo clippy --all-targets --all-features -- -D warnings: left to CIcargo build --all-targets --all-features: left to CIcargo test --all-features: left to CI. Rancargo test -p tinyeventqueues --lib -- ports: 4 passed. Withkey_of's encoding deliberately broken (to_ascii_uppercasein place ofto_ascii_lowercase), the new test fails and the existing two still pass.Tests
ports::tests::oversized_keys_hash_exactly_like_the_legacy_key_ofpins two literals:/(["a/b", "y" × 600]).key/mod.rsKey::of):~+ lowercase unpadded RFC 4648 base32 of SHA-256 of the escaped key, withMAX_ID_LEN= 512. They were computed independently from the Rust code, and the currentkey_ofreproduces them.oversized_composite_keys_are_bounded_and_deterministiconly checked determinism and length, so a changed encoding would have passed it.Documentation
Not needed: no behaviour or API change.
Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description