Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Unit tests for idempotency key parsing and request hashing in core

Open Beginner friendly
#425 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
docker, typescript
Domain
backend, testing

Research direction

Read the key pattern and parseIdempotencyKey at line 9 and lines 70-87 of app/packages/core/src/idempotency.ts, which cover canonical and requestHash. Use app/tests/app/typing-core.test.ts as the model for a pure unit test and safe-writes.test.ts for the expected behaviour. Create app/tests/app/idempotency-core.test.ts with no database or network. Done when every acceptance criterion has an assertion and the Docker command with --network none passes.

Written by the indexing model from the issue text.

Description

good first issue

A retried command is matched to its first run by requestHash, which hashes a canonical JSON form (object keys sorted, undefined fields dropped). If that canonical form changed, a retry would get a 409 instead of the stored answer. The rules are pure, but they are tested only through HTTP with a database.

Where to look

  • app/packages/core/src/idempotency.ts (lines 9 and 70–87): the key pattern, parseIdempotencyKey, canonical and requestHash.
  • app/tests/app/safe-writes.test.ts: the end-to-end idempotency tests, for context.
  • app/tests/app/typing-core.test.ts: an example of a core unit test.

Acceptance criteria

  • A new app/tests/app/idempotency-core.test.ts needs no database or network.
  • parseIdempotencyKey: undefined gives null; 1 and 255 visible ASCII characters are accepted; an empty string, 256 characters, a space, a non-ASCII character and a non-string are refused with INVALID_IDEMPOTENCY_KEY.
  • requestHash: the same object with keys in another order (also nested) hashes the same; a field set to undefined hashes like a missing field; array order matters; null and undefined input give the same hash.
  • No production code changes, unless a test finds a real bug (then describe it in the PR).

How to check
docker build --file docker/Dockerfile --target test --tag flux-idem-core app && docker run --rm --network none flux-idem-core node_modules/.bin/tsx --test tests/app/idempotency-core.test.ts, then docker image rm flux-idem-core.

New to Flux? Start with CONTRIBUTING. Comment here to say you are taking it.

Dominant language
TypeScript
Stars
3
Forks
0
Avg merge
18h 3m
Merged PRs (30d)
254

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ColdPhase/flux

All issues in ColdPhase/flux

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.