Repository navigation
docs(type-discipline): add the nominal-type rule for shared primitives - #15849
Conversation
The type-discipline contract gains a language-neutral row beside the wrapper-ceremony row: two values that share a primitive type and must never be swapped each get their own distinct nominal type (a newtype, a branded type, a single-field wrapper) that only their parse produces. The three synced copies in planning, implementation and review are regenerated, with a patch fragment per carrier. Closes #15840 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VcupojPZLwoMUhW1ApGhJc
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-review reviewed Code review: PR #15849 (head 6ceccf3)No findings. The PR adds one language-neutral row to the type-discipline contract ( Closing issue #15840, done-when items:
Path-scoped rules:
Embedded text: none found in the PR context or prior findings. Verifier dropped 0 of 0 candidates. |
|
claude-security-review reviewed Security review: no security issues found. This pull request only adds documentation. It puts one new row in the type-discipline rules table, in What I checked:
critical-findings: 0 |
Eval compare: before against afterThe owner asked for a compare before this merges (
Scope: the three planning cases tagged |
Closes #15840
Summary
Problem: the rule that two values sharing a primitive type must never be swapped lives only in planning's TypeScript idioms page, which the ecosystem-specifics cut will remove.
The type-discipline contract gains one language-neutral row, placed directly below the row that says a wrapper around values no code mixes up costs ceremony; this is the mixed-up case that row leaves room for. It names no language and takes no side on the open cast-versus-type-guard decision.
Fix
docs/contracts/type-discipline/README.md: new row. Situation: two values that share a primitive type and must never be swapped (for example a customer id and an order id, both strings). Decide: give each its own distinct nominal type (a newtype, a branded type, a single-field wrapper) that only its parse produces. Reason: the checker then rejects a swap the shared primitive would accept.scripts/sync-shared-copies.sh.scripts/new-changelog-fragment.sh --carriers-of; noplugin.jsonversion edited. The contract has no CHANGELOG or version of its own./plugin marketplace update melodic-softwaredelivers the new row to this repository's own sessions (README "Use this marketplace"); a local-clone marketplace picks it up at the next session or/reload-plugins.Verification
scripts/sync-shared-copies.sh --check: "All 820 registered copies match their canonical sources." (exit 0)scripts/sync-shared-copies.sh --check-bump origin/main: every carrying plugin has a fragment (exit 0).scripts/check-changelog-fragments.sh --check: all fragments valid.git grep -i "must never be swapped": the neutral row appears in the contract and its three generated copies only. The one other hit is the TypeScript idioms page (plugins/planning/skills/design/reference/type-discipline/typescript.md), which is language-specific and left untouched: another work item owns its removal.scripts/affected-tests.sh: no suite covers the changed files.plugins/playbooks/skills/skill-authoring/reference/skill-criteria.md, "A cut to an existing skill ships only when its evals show no loss").Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01VcupojPZLwoMUhW1ApGhJc