Skip to content

Flaky test: core profile test fails when random ciphertext hex contains 2345 #146

Done

Description

@dbejarano820

What happens

packages/core/test/profile.test.ts, "a sealed value opens only with its key and for its own kind", seals the made-up ID number 1-2345-6789 under a random key and then asserts expect(sealed).not.toContain("2345").

The sealed value is hex from a random key and nonce, so now and then the ciphertext itself contains the four characters 2345 and the test fails. It is rare per run, but with many CI runs it shows up. It was seen once during a local pnpm test while reviewing #133, and a rerun passed.

Why it matters

A flaky test trains people to rerun until green, which hides real failures.

Possible fix

Check the right thing: decode the sealed payload and assert the plaintext bytes (or their hex) are absent, or use a fixed test key and nonce so the ciphertext is the same every run. Checking only for the whole value 1-2345-6789 would not work, because hex can never contain a dash, so that check could never fail.

Done when

The assertion can't fail by chance, and the test still fails if sealProfileValue ever stores the value in the clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions