Skip to content

Schema validation accepts optional string fields with null values, but downstream code may not #529

Description

@itsmiso-ai

Parent umbrella issue: #495
Source audit: Weekly tech debt audit: dispatch - 2026-07-01
Source audit date: 2026-07-01

Original recommendation

Schema validation accepts optional string fields with null values, but downstream code may not

Evidence: src/lib/groomer/schema.ts lines 230-241 — proposedTitle and proposedBody accept null as equivalent to "not provided". However, the downstream run.ts calls computeTitleBodyMutations() which explicitly checks undefined, not null:

const proposedTitle = typeof output.proposedTitle === "string" ? output.proposedTitle : undefined;

Because null is treated as "not a string", proposedTitle will correctly become undefined. But the proposedBody check in computeTitleBodyMutations has the same pattern, making null handling correct despite the type confusion. This is low risk but indicates schema-outbound type drift that could bite future refactoring.


Matched top finding

Evidence: src/lib/groomer/schema.ts lines 230-241 — proposedTitle and proposedBody accept null as equivalent to "not provided". However, the downstream run.ts calls computeTitleBodyMutations() which explicitly checks undefined, not null:

const proposedTitle = typeof output.proposedTitle === "string" ? output.proposedTitle : undefined;

Because null is treated as "not a string", proposedTitle will correctly become undefined. But the proposedBody check in computeTitleBodyMutations has the same pattern, making null handling correct despite the type confusion. This is low risk but indicates schema-outbound type drift that could bite future refactoring.


Metadata

Metadata

Assignees

No one assigned

    Labels

    auditAudit, review, or investigation work.priority/p1High priority.status/backlogNot ready for worker pickup yet.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions