Skip to content

test: kill generator/param-metadata mutation survivors; reframe mutation guidance#122

Merged
rodrigobnogueira merged 1 commit into
mainfrom
test/trpc-survivors
Jul 6, 2026
Merged

test: kill generator/param-metadata mutation survivors; reframe mutation guidance#122
rodrigobnogueira merged 1 commit into
mainfrom
test/trpc-survivors

Conversation

@rodrigobnogueira

Copy link
Copy Markdown
Collaborator

Completes the survivor-killing pass on the tRPC generators + param metadata.

Tests (kill coverage-blind survivors). A param-metadata test pins the propertyKey guard — an undefined key must not coerce to the string "undefined" and attach metadata to a property of that name. Plus constants, decorators, schema-generator (a full 140-line spec), zod-serializer, and module specs closing survivors the coverage bar didn't catch.

Simplifications (equivalent mutants → delete the dead branch). Dropped a redundant 'utf-8' write encoding (Node's default) and an unused indent variable in the schema generator; folded the any / lazy / nativeEnum cases into the shared z.any() fallback in the zod serializer (all three returned z.any(), so the per-case branches were equivalent mutants). Behavior-neutral.

213 passing, 100% coverage on the touched files, complexity gate green locally (the Angular showcase ng build step needs Node ≥22.22.3 and is validated by GitHub CI, per the repo's known toolchain note).

Docs. Reframed the mutation-testing guidance (guidelines §11 + CLAUDE.md) as an occasional, targeted audit — not a per-PR gate (scope to one file, --concurrency 2, verify kills by hand-applying the mutant + running the fast mocha suite). No behavior or API change; no release.

…ion guidance

Recovers and completes the interrupted survivor-killing pass on the tRPC
generators and param metadata:

- param-metadata: a test proving an undefined propertyKey does not attach
  metadata to a property literally named "undefined" (the guard the mutant
  removed). Plus constants / decorators / schema-generator / zod-serializer /
  module specs closing coverage-blind survivors.
- Behavior-neutral simplifications of three equivalent-mutant branches: a
  redundant 'utf-8' write encoding and an unused indent var in the schema
  generator, and folding the any/lazy/nativeEnum cases into the shared z.any()
  fallback in the zod serializer.

213 passing, 100% coverage on the touched files, complexity gate green. Also
reframes the mutation-testing guidance (guidelines + CLAUDE.md) as an occasional,
scoped audit rather than a per-PR gate.
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

📊 Coverage Coverage Report

Metric PR Base Diff
Statements ████████████████████ 660/660 (100%) 664/664 (100%) ⚪ 0%
Branches ████████████████████ 280/280 (100%) 283/283 (100%) ⚪ 0%
Functions ████████████████████ 122/122 (100%) 122/122 (100%) ⚪ 0%
Lines ████████████████████ 635/635 (100%) 639/639 (100%) ⚪ 0%

Updated for 49930bd | Compared against base branch

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

⏱️ Performance Report

✅ Tests 213 passed, 0 failed, 0 skipped
🧪 Suites 42
⏱️ Total step time 11.00s (install + tests) ⚪ ~0
⚙️ Test execution 3.11s 🟢 -161ms
🐢 Slowest test suites
# Suite Tests Duration vs Base
1 test/generators/schema-generator.spec.ts 23 2.27s 🟢 -100ms
2 test/adapter/trpc-client-adapter-e2e.spec.ts 16 201ms ⚪ ~0
3 test/adapter/trpc-http-adapter.spec.ts 19 65ms ⚪ ~0
4 test/router/trpc-router.spec.ts 29 37ms ⚪ ~0
5 test/context/trpc-context-creator.spec.ts 26 30ms ⚪ ~0
6 test/adapter/trpc-http-adapter-unit.spec.ts 22 19ms ⚪ ~0
7 test/generators/zod-serializer.spec.ts 38 14ms ⚪ ~0
8 test/router/trpc-router-lifecycle.spec.ts 11 8ms ⚪ ~0
9 test/module/trpc-module.spec.ts 9 7ms ⚪ ~0
10 test/decorators/decorators.spec.ts 11 3ms ⚪ ~0
🐌 Slowest individual tests
# Suite Test Duration vs Base
1 schema-generator generateSchemaContent (type-level AppRouter contract) should require a link transformer on typed clients when generated with hasTransformer 1.46s ⚪ ~0
2 schema-generator generateSchemaContent (type-level AppRouter contract) should typecheck generated AppRouter with a typed tRPC client 806ms 🟢 -57ms
3 trpc-client-adapter-e2e real @trpc/client adapter E2E express handles typed queries, mutations, and context extraction 62ms ⚪ ~0
4 trpc-client-adapter-e2e real @trpc/client adapter E2E express streams subscriptions through the real client 30ms ⚪ ~0
5 trpc-client-adapter-e2e real @trpc/client adapter E2E express runs class-validator DTO validation through ValidationPipe 24ms ⚪ ~0
6 trpc-client-adapter-e2e real @trpc/client adapter E2E fastify handles typed queries, mutations, and context extraction 12ms ⚪ ~0
7 trpc-client-adapter-e2e real @trpc/client adapter E2E fastify runs class-validator DTO validation through ValidationPipe 12ms ⚪ ~0
8 trpc-client-adapter-e2e real @trpc/client adapter E2E express reports Zod input errors through the real client 9ms ⚪ ~0
9 trpc-client-adapter-e2e real @trpc/client adapter E2E fastify streams subscriptions through the real client 7ms ⚪ ~0
10 trpc-http-adapter TrpcHttpAdapter edge cases should handle Fastify GET with createContext 7ms ⚪ ~0
11 trpc-http-adapter TrpcHttpAdapter (server config passthrough) Express should apply responseMeta headers before streaming SSE responses 7ms ⚪ ~0
12 trpc-client-adapter-e2e real @trpc/client adapter E2E fastify reports Zod input errors through the real client 6ms ⚪ ~0
13 trpc-client-adapter-e2e real @trpc/client with superjson transformer E2E express round-trips Date instances through SSE subscriptions 6ms ⚪ ~0
14 trpc-client-adapter-e2e real @trpc/client with superjson transformer E2E express round-trips Date instances through queries 5ms ⚪ ~0
15 trpc-client-adapter-e2e real @trpc/client with superjson transformer E2E express round-trips Date instances through mutation inputs and outputs 5ms ⚪ ~0

Updated for 49930bd | Compared against base branch

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

🧠 Cognitive Complexity Report

Metric PR Base Diff
Total complexity 159 159 ⚪ 0
Max function complexity 12 12 ⚪ 0
Functions measured 53 53 ⚪ 0
🧩 Most complex functions
Function Location Complexity Status
serializeZodSchema packages/trpc/generators/zod-serializer.ts:9 12 🟢 OK
generateSchemaContent packages/trpc/generators/schema-generator.ts:59 9 🟢 OK
TrpcContextCreator.extractHttpExceptionMessage packages/trpc/context/trpc-context-creator.ts:467 7 🟢 OK
TrpcHttpAdapter.resolveBody packages/trpc/trpc-http-adapter.ts:124 7 🟢 OK
TrpcRouter.validateSubscriptionOutput packages/trpc/trpc-router.ts:551 7 🟢 OK
(anonymous callback) packages/trpc/context/trpc-context-creator.ts:243 6 🟢 OK
TrpcRouter.assertUniqueAliasPath packages/trpc/trpc-router.ts:436 6 🟢 OK
TrpcRouter.resolveContextId packages/trpc/trpc-router.ts:504 6 🟢 OK
TrpcRouter.createRouterProviderContext packages/trpc/trpc-router.ts:148 5 🟢 OK
(anonymous callback) packages/trpc/trpc-router.ts:320 5 🟢 OK

🧭 Cognitive complexity is reported as a review signal, not a merge gate. Prefer small, intention-revealing refactors when complexity rises.


Updated for 49930bd | Compared against base branch

@rodrigobnogueira rodrigobnogueira merged commit 6846693 into main Jul 6, 2026
10 checks passed
@rodrigobnogueira rodrigobnogueira deleted the test/trpc-survivors branch July 6, 2026 21:15
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