Skip to content

refactor(tests): collapse repeated buildAndValidateSignature setup - #217

Merged
jackchuma merged 1 commit into
mainfrom
jackchuma/chain-6345-task-signing-tool-collapse-repeated
Oct 28, 2026
Merged

jackchuma merged 1 commit into
mainfrom
jackchuma/chain-6345-task-signing-tool-collapse-repeated

Conversation

@jackchuma

Copy link
Copy Markdown
Collaborator

What changed? Why?

In __tests__/task-origin-validate.test.ts, the ten buildAndValidateSignature tests each repeated the same 8–10 line options literal, differing in only 1–3 fields, and each cast role with a redundant as TaskOriginRole.

  • Add a file-local validate(overrides: Partial<TaskOriginVerifyOptions>) helper with defaults VALID_TASK_FOLDER, creator-signature.json, TASK_CREATOR_EMAIL, and 'taskCreator'.
  • Each test passes only the fields that differ from those defaults.
  • Remove the ten as TaskOriginRole casts and the TaskOriginRole import. TaskOriginVerifyOptions.role is already typed TaskOriginRole, so the literals get contextual typing.

Test-only. No production code changes.

Notes to reviewers

  • Every test keeps its name, effective inputs, assertion (including exact error strings), and in-test comments.
  • createDeterministicTarball tests, fixtures, and the cache/out comment near the top of the file are untouched.

How has it been tested?

  • npx jest __tests__/task-origin-validate.test.ts: 14/14 before and after.
  • npm test: 172/172.
  • npm run lint, npx tsc --noEmit, npm run format:check: pass.
  • grep -c "as TaskOriginRole" __tests__/task-origin-validate.test.ts: 0.

No new tests: behavior-preserving refactor of existing tests.

J-Engine-Session: toshi:6d9fdb9a-c736-4278-8ea8-de2f491a1a2a
@jackchuma

Copy link
Copy Markdown
Collaborator Author

Review round 1

Reviewers: cbhq-openai/gpt-6.1-sol
No findings. Spec check (anthropic/claude-opus-5-5): all criteria met.
Synced with main: 424c9a7 (already current)
Validation: jest task-origin-validate 14/14; npm test 172/172; lint, tsc, format:check pass

🤖 Reply generated with Toshi

@jackchuma
jackchuma marked this pull request as ready for review October 28, 2026 13:00
@jackchuma
jackchuma requested review from 0xth4nh and xenoliss October 28, 2026 13:00

@0xth4nh 0xth4nh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks Good to Thanh's Toshi

@cb-heimdall

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews ✅ 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@jackchuma
jackchuma merged commit 128d546 into main Oct 28, 2026
6 checks passed
@jackchuma
jackchuma deleted the jackchuma/chain-6345-task-signing-tool-collapse-repeated branch October 28, 2026 13:23
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.

4 participants