Skip to content

finding: check:duration-unit-keys scans packages/spec/src/** only — the same offender shape exists in workspace packages the gate never reads #15642

Description

@claude

Observation only — nothing is broken today. This deliberately does not touch the open population decision on #14478; it records a fact that decision may want.

What was measured

packages/spec/scripts/check-duration-unit-keys.ts declares its population in one place and holds it with its own self-test:

  • const SRC_ROOT = join(pkgRoot, 'src') (:108)
  • export const ROOT_DIR_WATCH_HINTS = ['packages/spec/src/**'] (:120)
  • the self-test asserts the declared hint IS the subtree the scan walks (:456 and following)

So the rule — a duration-shaped z.number() key carries its unit in the key NAME — is enforced over packages/spec/src/** and nowhere else. Every other workspace package that declares zod schemas of its own is invisible to it.

That boundary is not obviously wrong: packages/spec is the published authorable surface, and stopping there is defensible. What is worth recording is that the boundary is currently implicit — nothing states it as a decision — and that the offender shape does exist on the other side of it.

One measured example on the other side

The gate's own rule, pointed at a package outside its population:

cd packages/spec
npx tsx scripts/check-duration-unit-keys.ts --root ../drivers/driver-turso/src

✗ check:duration-unit-keys — 1 offender(s) among 2 duration-shaped numeric key(s) in 6 source file(s):
  [unit-in-prose-not-in-name] src/spec/turso.zod.ts:104 `timeout` — describe names ms but the key name carries no unit.

TursoDriverConfig is a published connection-config schema (@objectstack/driver-turso, reachable from that package's src/index.ts), and its timeout is the same shape the ruling converted inside packages/spec: z.number().int().min(0).optional().describe('Operation timeout in milliseconds').

⚠️ This is ONE package and NOT a census. A whole-repo count is deliberately not attempted here: --root walks whatever directory it is handed, and pointing it at a package ROOT rather than that package's src walks node_modules too — measured, that returns 7151 offender(s) ... in 150098 source file(s), which is a reading about this repo's dependencies, not about this repo. Whoever counts should iterate packages/*/src and packages/*/*/src instead.

Why this is filed rather than acted on

Which population the rule governs inside packages/spec is an open maintainer decision on #14478 — PR #15626 is held as a draft, red on this gate by design, for exactly that reason. Whether the rule should also reach zod schemas outside packages/spec is a second, wider axis of the same question, and answering it here would be the same pre-emption in the other direction.

Surfaced during the fix lap on PR #15626 while disambiguating the two different timeout spellings that live in @objectstack/driver-turso (the driver's own connection config, above, versus the DriverOptions argument the PR renames). #14478 is not addressed here.


Generated by Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions