chore(balance): post-merge cleanup of #182-#185 reviews (#187) #195
No reviewers
Labels
No labels
autopilot:pending-human
source:analyste
source:defenseur
source:human
source:medic
status:approved
status:blocked
status:in-progress
status:needs-clarification
status:needs-fix
status:ready
status:review
status:triage
type:bug
type:feature
type:infra
type:refactor
type:schema
type:security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: maximus/Simpl-Resultat#195
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-187-balance-cleanup-post-184-185"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #187
Summary
Bundles 6 atomic commits addressing 6 of the 9 suggestions raised during the adversarial reviews of PRs #182, #183, #184 and #185. The 3 remaining suggestions are out of scope for this PR:
collision_tooltip) — already done inStarterAccountsModal.tsx, no action needed.kindByAccountIddead comment) — function not found in the current codebase, likely cleaned up earlier.Commits
getStarterCollisionsfiltersarchived_at IS NULLso re-creating a voluntarily archived starter is no longer blocked.proposeStarterAccountsre-checks each(name, balance_category_id)collision in-transaction before INSERT (defense-in-depth). Skips silently on hit, no UNIQUE constraint added.consolidated_schema.sqlpre-seedsbalance_starter_proposedso brand-new profiles never see the briefly-empty StarterAccountsModal./balancehides period selector, evolution chart and accounts table while the empty-state onboarding card is shown — avoids three stacked empty messages under the card.BalanceOnboardingCard.StepusesuseTranslation()directly instead of receivingtas a prop — aligns with the project's majority pattern.return_calculator.rsModified Dietz formula doc block wrapped in atextfence socargo test --docno longer fails to compile pseudo-math as Rust.Tests
StarterAccountsModal.test.tsx(atomic insert + rollback) to mock the new in-txn collision SELECT call sequence (S3).StarterAccountsModal.test.tsx:getStarterCollisionsexcludes archived accounts via SQL filter (S4).StarterAccountsModal.test.tsx:proposeStarterAccountsskips silently when in-txn collision check finds an existing account (S3).cargo test --docitself is the test (now passes with 0 doctests instead of 9 compile errors).Verification
npm test(vitest) — 227 test files, 3722 tests passed (3720 + 2 new)npm run build(tsc + vite) —built in 6.60scargo check --manifest-path src-tauri/Cargo.toml --all-targets— cleancargo test --doc --manifest-path src-tauri/Cargo.toml—0 passed; 0 failed; 0 ignored(was 9 errors before)Decisions retained from /analyze
consolidated_schema.sql(data-level invariant). Existing profiles dismiss once on first /balance visit (current behaviour, no migration needed).UNIQUEconstraint). Cheaper, no rollback risk on existing prod databases.Test plan (manual smoke)
Review — APPROVE
Solid post-merge cleanup bundling 6 atomic, well-scoped fixes (S1-S5, S7) from the adversarial reviews of #182-#185. Each commit references its suggestion ID for traceability, the changelog entries are dual-language, the SQL change is additive (
consolidated_schema.sqlonly, no existing migration touched), and tests cover both new behaviours (S3 collision skip + S4 archived filter). The defense-in-depth design on S3 (callers pre-filter, in-txn re-check skips silently on hit) and the data-level S1 solution (no migration v12 needed because the bug is benign on existing profiles — once dismissed, never re-shows) are both well-justified.Checks pass:
consolidated_schema.sqlchange is additive only, no existing migration modified (compliant with the SQL migration rule)cargo test --docSuggestions (non-blocking)
BalanceOnboardingCard.tsx:124— callinguseTranslation()inside theStepsub-component is fine and aligns with the project pattern, but creates one extra hook subscription per step (2 today, marginal). If the file ever expands to manyStepinstances, hoistingtback to the parent could be revisited — current scale doesn't warrant action.consolidated_schema.sql:296— the seeded value uses the literal string"seed"forshown_atinstead of an ISO timestamp. If a future reader parsesshown_at(analytics, migration logic, anywherenew Date(...)), it will silently produceInvalid Date. Today nothing reads it; flagging for if/when it becomes consumed.Test count claim — PR body reports
3722 tests passed (3720 + 2 new)but the diff adds 2 tests on top of the 1 collision-check assertion that touches existing test scaffolding. Numbers look consistent; just flagging that the suite green can't be re-verified from the diff alone.Nothing here blocks merge. Good polish work.