Skip to content

test(settings): pin the coverage snapshot on failed saves and drop a dead ternary - #635

Merged
cristim merged 1 commit into
mainfrom
test/settings-coverage-snapshot-mutants-551
Oct 6, 2026
Merged

cristim merged 1 commit into
mainfrom
test/settings-coverage-snapshot-mutants-551

Conversation

@cristim

@cristim cristim commented Oct 6, 2026

Copy link
Copy Markdown
Member

Closes #551

State on main (3413591), saveGlobalSettings in frontend/src/settings.ts:

  • Dead ternary still present: the per-service let coverage = defaultCoverageChanged ? settings.default_coverage : (base?.coverage ?? settings.default_coverage). After the global PUT, loadedServiceConfigs is remapped to settings.default_coverage when defaultCoverageChanged, so base?.coverage already equals it (and the fallback covers a missing row). Removed; behavior-neutral.
  • The snapshot ordering is now: global snapshot advances only after await api.updateConfig, and the card snapshot advances only inside the service .then, with failures restoring previousSnapshot. The two mutants from the review had no test.

Tests (settings.test.ts, 'global coverage propagation' block): (1) a rejected global PUT leaves the coverage dirty and sends no service PUTs (kills 'global snapshot refreshed before the PUT resolves'); (2) a card coverage whose service PUT failed stays dirty and is resent next Save, then clears (kills 'card snapshot updated after a failed PUT').

These pin existing behavior, so they pass on main by design; the mutants were not re-run (jest cannot run offline here, CI is the authority). The ternary removal is verified by reading: the two branches are equal on every reachable path.

Scope: #539, #617 and the Save scope untouched.

@cristim cristim added impact/internal Team-internal only type/chore Maintenance / non-user-visible triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline effort/s Hours labels Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 5 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 68 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: a298e012-c3c5-4018-bdad-8efb21755dc0
📥 Commits

Reviewing files that changed from the base of the PR and between 3413591 and c3d4707.

📒 Files selected for processing (2)
  • frontend/src/__tests__/settings.test.ts
  • frontend/src/settings.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@cristim
cristim merged commit bacc142 into main Oct 6, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/internal Team-internal only priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/chore Maintenance / non-user-visible urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(settings): coverage-save snapshot tests miss two mutants

1 participant