feat(schemas): add discriminated union to QualityMetricsSchema#51
Conversation
…alsQualityMetricsSchema Add `type: 'run'` to QualityMetricsSchema and `type: 'trial'` to TrialsQualityMetricsSchema, aligning with the existing discriminated union pattern in ReliabilityMetricsSchema. This enables TypeScript narrowing without custom type guards. Closes #50 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate rules from separate .agents/rules/*.md files to inline content in AGENTS.md between PLAITED-RULES markers, matching the new approach in @plaited/development-skills 0.8.0. Remove now-unused .claude/rules and .cursor/rules symlinks. Dependency updates: - @plaited/development-skills 0.7.0 → 0.8.0 - @biomejs/biome 2.3.12 → 2.3.14 - @types/bun 1.3.6 → 1.3.9 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review Summary✅ Approved - This is a clean, well-tested enhancement that improves type safety and consistency. Code QualityStrengths:
Implementation correctness:
Test Coverage✅ Excellent coverage
Best Practices ComplianceChecked against
Potential Improvements (Optional)Consider for future (not blocking):
Security & Performance
Final VerdictThis PR is ready to merge. It successfully addresses issue #50 by adding type discriminators to quality metrics schemas, making them consistent with reliability metrics and improving TypeScript developer experience. The implementation is minimal, well-tested, and follows all repository conventions. Files reviewed:
🤖 Review performed by Claude Sonnet 4.5 |
PR Review: Add discriminated union to QualityMetricsSchemaSummaryThis PR adds type discriminators ( ✅ Code QualityStrengths:
Implementation:
✅ Test CoverageExcellent coverage:
Pattern validation: ✅ Architecture & DesignWhy separate schemas (not
This matches the reliability metrics pattern exactly - schemas are structurally similar but serve different comparison types. Type narrowing: 🔍 Additional Changes ReviewRules consolidation (AGENTS.md):
Rationale: Rules are now inline in AGENTS.md for better discoverability and single-source-of-truth maintenance. Dependency updates:
These are minor version bumps (patch/minor) - safe to include. 🛡️ Security & Performance
📋 Best Practices ComplianceChecked against
💡 Optional Future Enhancements (Not blocking)
✅ Final VerdictLGTM - Ready to merge This PR successfully addresses issue #50 by:
The implementation is minimal, well-tested, and production-ready. Files reviewed:
🤖 Review performed by Claude Sonnet 4.5 |
Summary
type: z.literal('run')discriminator toQualityMetricsSchemaandtype: z.literal('trial')toTrialsQualityMetricsSchemaReliabilityMetricsSchema/TrialsReliabilityMetricsSchemametrics.type === 'run'ormetrics.type === 'trial'Closes #50
Test plan
bun run checkpasses (type-check, lint, format)bun testpasses (563 tests, 0 failures)type: 'run'incompare-statistical.spec.tstype: 'trial'incompare-trials.spec.tsReliabilityMetricsSchema🤖 Generated with Claude Code