Strengthen nullable type discipline with true-myth and safety tests#315
Draft
Strengthen nullable type discipline with true-myth and safety tests#315
Conversation
Install true-myth for Maybe<T> and Result<T, E> types. Update coding standards with concrete hierarchy: Maybe first, Result at async boundaries, custom discriminated unions only when neither fits.
…ards Step 0: 35 new tests locking down null/falsy-ID behavior before the nullable type migration. Covers SWR hook URL/key nullification, CoachingSessionApi.list early return, sanitizeCallbackUrl, and buildInitialOrder contracts. Step 1: Remove dangerous || "" ID fallbacks: - coaching-tabs-container: render guard on AgreementsList, non-null assertions in handlers (guaranteed by the guard) - page.tsx: render guard on EditorCacheProvider - coaching-session-list: delete unnecessary || "" (hook already accepts null)
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.
Description
Establishes stricter nullable type standards using
true-myth(Maybe<T>,Result<T, E>) and begins fixing the most dangerous|| ""ID fallback patterns. Adds 35 safety tests that lock down null/falsy-ID behavior as a prerequisite for the broader migration.Changes
true-mythv9.3.1 forMaybe<T>andResult<T, E>types.claude/coding-standards.mdwith nullable type hierarchy:Maybe<T>→Result<T, E>→ discriminated unions.claude/CLAUDE.mdwith top-level nullable type rule|| ""ID fallbacks with render guards incoaching-tabs-container.tsxandpage.tsx|| ""incoaching-session-list.tsx(hook already acceptsnull)CoachingSessionApi.list(null)early returnsanitizeCallbackUrlnull/undefined/empty handlingbuildInitialOrdernull-return contractTesting Strategy
npm run test— all 612 tests pass (35 new)npm run build— compiles cleanly with no TypeScript errorsConcerns
nullable-type-assessment.md, not committed) identifies ~65 domain-level violations across 6 tiers. This PR covers the standards + Tier 1 fixes only.AgreementsListrender guard changes the always-mounted CSS display pattern slightly — the component now mounts when the session ID becomes available rather than on initial render. Tab switch state preservation is unaffected since the session ID doesn't change during tab switches.