Skip to content

test(ports): oversized keys hash exactly like the legacy Key::of - #10

Merged
M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:test/key-of-golden-hash
Oct 23, 2026
Merged

M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:test/key-of-golden-hash

Conversation

@M3gA-Mind

Copy link
Copy Markdown
Collaborator

Summary

Adds a golden-value test for key_of's hashed path (escaped keys longer than 512 bytes). The value must match what the legacy tinystoragedrivers-core Key::of produced, 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 --check on the changed file is clean
  • cargo clippy --all-targets --all-features -- -D warnings: left to CI
  • cargo build --all-targets --all-features: left to CI
  • cargo test --all-features: left to CI. Ran cargo test -p tinyeventqueues --lib -- ports: 4 passed. With key_of's encoding deliberately broken (to_ascii_uppercase in place of to_ascii_lowercase), the new test fails and the existing two still pass.

Tests

  • ports::tests::oversized_keys_hash_exactly_like_the_legacy_key_of pins two literals:
    • a single 600-byte part;
    • a composite with an escaped / (["a/b", "y" × 600]).
  • The expected values follow the legacy algorithm at tinystoragedrivers-core 0c6dcfce (key/mod.rs Key::of): ~ + lowercase unpadded RFC 4648 base32 of SHA-256 of the escaped key, with MAX_ID_LEN = 512. They were computed independently from the Rust code, and the current key_of reproduces them.
  • The existing oversized_composite_keys_are_bounded_and_deterministic only checked determinism and length, so a changed encoding would have passed it.

Documentation

Not needed: no behaviour or API change.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

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.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c69a081c-8cc5-4574-b087-fb212284995d
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@tinysweeper

tinysweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: 0d965cafff208c26a06802dc122e01c64a89d1cb

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 1 of 1 files.
Pull request purpose (title): test(ports): oversiz…

Diagnostics and supporting details

Full summary

Pull request purpose (title): test(ports): oversized keys hash exactly like the legacy Key::of. Tiny Sweeper completed its review; deterministic results follow.

Review snapshot

Change surface Files Review signal Count
Production 0 Active findings 0
Tests 1 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

Adds 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

  • Added — Golden-value test pinning oversized-key hash encoding: Locks the encoded form of keys exceeding the size limit to fixed expected literals, so a drift in the hash encoding would be caught by a failing test rather than silently orphaning pre-migration dedupe and buffer rows. Test-only; no runtime behavior change. (crates/tinyeventqueues/src/ports_tests.rs fn oversized_composite_keys_are_bounded_and_deterministic() {)

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

None.

Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Critique lane answered with no findings, noting the test pins the legacy key-hash layout with golden values and that the `key_of` escaping rules look consistent with the inputs used.
  • Lane summary: The new test pins the legacy key-hash layout with golden values; I could not independently verify the two base32 digests without running the helper, and the escaping rules in `key_of` (including `%7E` for a leading `~` in part 0 and `%2F` in the second part) look consistent with the inputs used. No concrete defect identified in this test-only diff. _The code index is behind this pull request (indexed at `a719a6e00927`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Security lane answered with no findings: a pure unit test with no production code path, no external input, and no behavior change; a wrong constant would fail the test rather than ship a defect.
  • Lane summary: This adds two golden-value assertions pinning `key_of`'s oversized-key hashing to the legacy `Key::of` encoding. It is a pure unit test with no production code path, no external input, and no change to behaviour; nothing reportable. I did not independently recompute the base32 digests, but a wrong constant would fail the test it adds rather than ship a defect. _The code index is behind this pull request (indexed at `a719a6e00927`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Tests lane answered with no findings, observing the new test exercises the changed hashing path and would fail if the hash encoding drifted.
  • Lane summary: The change adds a golden-value characterization test for `key_of`'s oversized-key hashing path, pinning two exact encoded strings. It exercises the changed behaviour and would fail if the hash encoding drifted. I could not independently recompute the base32 SHA-256 goldens from the evidence here, but they are exact literals rather than a truthiness assertion, so the test can genuinely fail. No reportable defect found. _The code index is behind this pull request (indexed at `a719a6e00927`), so retrieved context may be out of date._

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Commits lane answered with no findings: no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files. _The code index is behind this pull request (indexed at `a719a6e00927`), so retrieved context may be out of date._

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Description lane answered with no findings, noting the diff matches the PR description (test-only, no behavior change) and documents why the golden values must match the legacy encoding.
  • Lane summary: Adds a golden-value test pinning `key_of`'s oversized-key hash output against two literals, matching the PR description exactly (test-only, no behaviour change). One detail in the description's escape example is loose, but the description still matches and explains what the diff does; I found no reportable defect in the change itself. I could not independently verify the two base32 literals against the legacy `Key::of`, since that algorithm lives in the parent repository, not here. _The code index is behind this pull request (indexed at `a719a6e00927`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.000242
  • Tokens: 79792 input · 2248 output · 12288 cached · 167 embedding
  • Updated: 2026-10-23T00:33:37Z
Head State Pass summary
0d965cafff20 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-23T00:33:37Z)

tinysweeper 0.1.2

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0002

@M3gA-Mind
M3gA-Mind merged commit 249b2e9 into tinyhumansai:main Oct 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant