Skip to content

test: pin claim code shape over 1000 iterations - #66

Merged
OBenner merged 1 commit into
mainfrom
test/claim-code-length-pin
Nov 15, 2026
Merged

OBenner merged 1 commit into
mainfrom
test/claim-code-length-pin

Conversation

@OBenner

@OBenner OBenner commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Per CTO's NOTICE (e7b53fd5): a 7-char claim code (synloq-claim-staff2-v7znph3) was observed once during staff2 onboarding; the relay correctly rejected it as malformed.

Investigation:

  • The only generator is ClaimCodeStore.issue → base32(randomBytes(5)); 5 bytes encode to exactly 8 base32 chars (40 bits / 5), and the JS 32-bit shift overflow inside the encoder only discards already-consumed bits — output length is invariant.
  • Standalone probe of the same algorithm, 100,000 iterations: 0 anomalies (all match ^[a-z2-7]{8}$).
  • Conclusion: the defect is not reproducible from the current implementation; the 7-char observation is most consistent with manual transcription when relaying the code. No issue filed.

This PR pins the invariant anyway (as requested): 1000-iteration test asserting every issued code matches ^synloq-claim-<role>-[a-z2-7]{8}$. Test-only change; pnpm verify green (86 files / 768 tests).

The generator encodes 5 random bytes to exactly 8 base32 chars; a 7-char
code observed once during staff2 onboarding is not reproducible from the
current implementation (100k-iteration standalone probe, 0 anomalies) and
is most consistent with manual transcription. Pin the invariant anyway.
@OBenner
OBenner merged commit cecabde into main Nov 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant