Add negative and boundary tests for blobgen and types (closes #170) #192

Merged
clawbot merged 1 commits from issue-170-blobgen-types-negative-tests into next 2026-09-22 14:28:35 +02:00
Collaborator

Test-only; no production code changes. internal/blobgen and internal/types had no negative or boundary coverage.

Added in blobgen_test: Writer-to-Reader round trips at the 64 KiB age-segment edges (sizes 0, 1, 65535, 65536, 65537, 4*65536+123) for random and compressible data, checking plaintext, BytesRead/BytesWritten, and both hashes by decrypting; a wrong-identity open (*age.NoIdentityMatchError); truncation and one-byte corruption of a multi-segment blob across every region; trailing bytes, empty input and garbage; rejected/accepted compression levels; nil, empty and invalid recipients; a failing destination. In types_test: Value/Scan round trips, NULL, wrong-type and malformed Scan, Parse and IsZero for FileID and BlobID.

Scope and disclosures:

  • Scoped to internal/blobgen and internal/types test files per the task brief; case 12 (a verify --deep hash-mismatch test in internal/vaultik) is therefore not included here.
  • The "cut right after the age header and nonce" truncation is excluded: it reads as valid and empty today and is the regression case for #152.
  • Multi-recipient read-back (case 5) is already covered by the existing TestMultipleRecipients.
  • internal/crypto and CompressStream/CompressData were removed by #151 and are skipped.
  • Reworded two writer_test.go messages that overstated what the double hash prevents; no assertion weakened.

make check green.

Model: opus-4-8

Test-only; no production code changes. `internal/blobgen` and `internal/types` had no negative or boundary coverage. Added in `blobgen_test`: Writer-to-Reader round trips at the 64 KiB age-segment edges (sizes 0, 1, 65535, 65536, 65537, 4*65536+123) for random and compressible data, checking plaintext, `BytesRead`/`BytesWritten`, and both hashes by decrypting; a wrong-identity open (`*age.NoIdentityMatchError`); truncation and one-byte corruption of a multi-segment blob across every region; trailing bytes, empty input and garbage; rejected/accepted compression levels; nil, empty and invalid recipients; a failing destination. In `types_test`: `Value`/`Scan` round trips, NULL, wrong-type and malformed `Scan`, `Parse` and `IsZero` for `FileID` and `BlobID`. Scope and disclosures: - Scoped to `internal/blobgen` and `internal/types` test files per the task brief; case 12 (a `verify --deep` hash-mismatch test in `internal/vaultik`) is therefore not included here. - The "cut right after the age header and nonce" truncation is excluded: it reads as valid and empty today and is the regression case for https://git.eeqj.de/sneak/vaultik/issues/152. - Multi-recipient read-back (case 5) is already covered by the existing `TestMultipleRecipients`. - `internal/crypto` and `CompressStream`/`CompressData` were removed by https://git.eeqj.de/sneak/vaultik/issues/151 and are skipped. - Reworded two `writer_test.go` messages that overstated what the double hash prevents; no assertion weakened. `make check` green. Model: opus-4-8
clawbot added the needs-review label 2026-09-22 14:04:15 +02:00
clawbot self-assigned this 2026-09-22 14:04:15 +02:00
clawbot added 1 commit 2026-09-22 14:04:15 +02:00
Test-only. internal/blobgen and internal/types had no negative or
boundary coverage. Adds, in package blobgen_test: Writer-to-Reader round
trips at the 64 KiB age-segment edges for random and compressible data,
checking plaintext, byte counts and the reader/writer hashes by
decrypting; a wrong-identity open; truncation and single-byte corruption
of a multi-segment blob at every region; trailing bytes, empty input and
garbage; rejected and accepted compression levels; nil, empty and invalid
recipients; and a failing destination. In package types_test: Value/Scan
round trips, NULL, wrong-type and malformed Scan, Parse and IsZero for
FileID and BlobID.

internal/crypto and CompressStream/CompressData no longer exist and are
skipped. The "cut right after the age header and nonce" truncation is
excluded: it reads as valid and empty today and belongs to #152. Reworded
two writer_test.go messages that overstated what the double hash prevents.

Model: opus-4-8
Author
Collaborator

PASS

Model: opus-4-8

PASS Model: opus-4-8
clawbot merged commit 4f27608560 into next 2026-09-22 14:28:35 +02:00
clawbot deleted branch issue-170-blobgen-types-negative-tests 2026-09-22 14:28:35 +02:00
Sign in to join this conversation.