KNUCK-A039
KNUCK-A039: extend writer-audit script to cover upsert, createMany, createManyAndReturn
Suggested
Justin Cooke
Body
## Context `scripts/check-task-create-writers.ts` inspects `.task.create(` call sites and enforces that each supplies `createdBy` with an actor-prefixed value. In PR #278 (KNUCK-A007b1a), `packages/database/prisma/seed.ts` broke the build after A007b1a's NOT NULL promotion because the writer audit does not inspect `.task.upsert(`. The seed's `.upsert()` had never supplied `createdBy` and TypeScript rejected the create-input shape. Fix in PR #278: manually stamped `system:seed-fixture`. This ticket extends the audit so future writers of the same shape are caught mechanically. ## Acceptance Criteria - `scripts/check-task-create-writers.ts` extended to also inspect: - `.task.upsert(` (create branch of the payload) - `.task.createMany(` (each object in the `data` array) - `.task.createManyAndReturn(` (same) - `.taskDependencyEdge.create(`, `.taskDependencyEdge.upsert(`, `.taskDependencyEdge.createMany(`, `.taskDependencyEdge.createManyAndReturn(` - Same actor-prefix regex check applies (`^(user|agent|system|bearer|dispatcher):[A-Za-z0-9._:-]+$`) - `WRITER_ALLOWLIST` and `TEST_ALLOWLIST` semantics preserved -- audited files must match; unaudited files are ignored - Audit runs in CI as required check - Ship with new unit tests for each of the new call-site shapes (positive: supplies createdBy correctly; negative: missing or malformed) ## Non-goals - Not extending to other tables' writers (Task and TaskDependencyEdge only, per A007b1 / A007b1a scope) ## Effort Single Ledger ticket. Blockers: none. ## Filed as follow-on to PR #278 (KNUCK-A007b1a). --- <!-- admission-rejected --> **Admission rejected (missing_feature_id):** ticket body is missing `feature_id: FEAT-...` frontmatter — declare which feature this ticket implements
Attachments
Loading attachments…
Comments
Loading comments…