Summary
The messageValidator uses v.string() for the status field. Consider creating a messageStatusValidator union for stricter validation.
Context
Identified during PR #37 review (CodeRabbit comment #2652223400).
Current State
export const messageValidator = v.object({
// ...
status: v.string(), // Currently permissive
// ...
});
Proposed Change
Create a union validator with all valid message statuses:
export const messageStatusValidator = v.union(
v.literal('sent'),
v.literal('delivered'),
v.literal('read'),
v.literal('failed'),
// ... other statuses
);
Required Work
- Audit all message status values used across the codebase
- Identify all sources of message statuses (email providers, internal state, etc.)
- Create comprehensive
messageStatusValidator union
- Update
messageValidator to use the new validator
Additional Notes
Message statuses may come from different sources (email providers, internal state), so need to ensure all possible values are captured before implementing strict validation.
Summary
The
messageValidatorusesv.string()for thestatusfield. Consider creating amessageStatusValidatorunion for stricter validation.Context
Identified during PR #37 review (CodeRabbit comment #2652223400).
Current State
Proposed Change
Create a union validator with all valid message statuses:
Required Work
messageStatusValidatorunionmessageValidatorto use the new validatorAdditional Notes
Message statuses may come from different sources (email providers, internal state), so need to ensure all possible values are captured before implementing strict validation.