fix(isms): production-deploy review follow-ups (CS-701)
Why
The main→release production-deploy PR (#3364) got an automated review that flagged 4 ISMS issues in the CS-701 versioning work (already merged to main). This PR fixes the real ones. Base is main (stage); it flows to release (production) on the next deploy.
What (each maps to a flagged issue)
- P2 —
hasApprovedVersioncould reportfalsefor an approved doc. The migration intentionally drops legacy (pre-CS-701, snapshot-less) version rows but preserves theapprovedstatus, leavingcurrentVersionIdnull.hasApprovedVersionnow checkscurrentVersionId != null || status === 'approved', so those docs stay consistent (they capture a real versioned artifact on their next approval). Locked with a unit test. - P3 — Scope form showed stale text after "Generate from platform data" / reload.
ScopeFormreads its defaults at mount; its remount key tracked the publishedcurrentVersionId, which doesn't change when the draft does. The key now reflectsdraftNarrative, so the form re-seeds on draft changes. (LeadershipForm already handled this via a reset effect; ScopeForm's narrative is a fresh object each render, so keying is the clean equivalent.) - P3 — export DTO description was misleading. It said omitting
versionIdexports the working draft, but runtime serves the current published version when one exists. Description updated to match. - P3 — approval banner rendered
v 2instead ofv2(JSX split thevand the number). Now a single expression.
Not changed (by design)
The migration stays non-destructive (approvals preserved rather than reset to draft). The hasApprovedVersion fix makes that state self-consistent, so no destructive reset or heavy backfill is needed for pre-GA (flag-gated) data.
Testing
- 319 API + 123 app ISMS tests passing, typecheck clean on both.
Follows up on #3361 (CS-701). Flagged in #3364.
🤖 Generated with Claude Code
https://claude.ai/code/session_012CweXoSSEP89mX93u3Bdcp
Summary by cubic
Fixes ISMS follow-ups from CS-701 versioning to keep approval state accurate and refresh scope text, plus minor UI/DTO copy corrections for a cleaner publish/export experience.
- Bug Fixes
hasApprovedVersionnow true whencurrentVersionIdexists orstatus === 'approved'(covers pre-versioning approvals); adds unit test.- Scope form remounts when
draftNarrativechanges so generated/reloaded text appears immediately. - Export DTO description corrected: omitting
versionIdexports the current published version, or the draft if never published. - Approval banner now renders
(v2)instead ofv 2.