fix(adr-016): pre-compute groupMembers display counts in question payload#579
Draft
let-sunny wants to merge 3 commits into
Draft
fix(adr-016): pre-compute groupMembers display counts in question payload#579let-sunny wants to merge 3 commits into
let-sunny wants to merge 3 commits into
Conversation
…ayload Add `othersCount` (= groupMembers.length - 1) and `totalCount` (= groupMembers.length) as optional pre-computed fields on the `missing-component:structure-repetition` question payload. Per ADR-016, deterministic transformations must live in TypeScript, not SKILL.md prose. - Extend `GotchaSurveyQuestionSchema` with `.min(1)/.min(2)` constraints mirroring the existing `groupMembers .min(2)` invariant - Co-emit both fields with `groupMembers` in `mapToQuestion` - Add vitest coverage confirming values and absence on non-group questions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pins the Zod .min(1)/.min(2) floor — a 2-member groupMembers array must yield othersCount===1, totalCount===2, and pass schema validation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…unt fields Replace arithmetic prose (groupMembers.length - 1, others + 1) with direct field references (question.othersCount, question.totalCount) so the LLM reads pre-computed values instead of computing them inline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
othersCountandtotalCountpre-computed fields toGotchaSurveyQuestionZod schema and TypeScript typegroupMembersin the survey generator (single conditional spread), satisfyingexactOptionalPropertyTypesvia.optional()with.min()constraints{others}→question.othersCountand{total}→question.totalCount, removing the arithmetic prose (groupMembers.length - 1,others + 1) that ADR-016 prohibitsothersCount===1,totalCount===2) alongside the existing 3-member testCloses #577
Test plan
tsc --noEmit) — no errorsvitest run) — 82 files, 1291 tests, all passed🤖 Generated with Claude Code