Skip to content

fix: standardize updateApp to use undefined as no-change sentinel#75

Merged
kitsuyui merged 1 commit into
mainfrom
fix/audit-implicit-behavior-updateapp-null-url-clears-001
Jul 11, 2026
Merged

fix: standardize updateApp to use undefined as no-change sentinel#75
kitsuyui merged 1 commit into
mainfrom
fix/audit-implicit-behavior-updateapp-null-url-clears-001

Conversation

@kitsuyui

Copy link
Copy Markdown
Owner

Summary

updateApp had inconsistent sentinel semantics across its optional parameters:

param default check null behavior
_name null || (falsy) keeps existing
_url undefined !== undefined (strict) clears the URL
_icon null || (falsy) keeps existing

Callers reading only the signature could not tell whether passing null would clear a field or fall back to the existing value. The asymmetry meant updateApp(id, null, null, null) would silently clear the URL while leaving name and icon unchanged.

Change

Standardize all three parameters to undefined as the no-change sentinel, using strict !== undefined checks throughout:

  • undefined → keep the existing value (no change)
  • any other value including null → replace the field

Update the two test cases that passed null for name or icon intending no-change — those now correctly use undefined.

Behavior

No change to the URL semantics: null still explicitly clears the URL (the test 'keeps explicit null URLs when updating apps' continues to pass). The change makes name and icon consistent with that behavior.

Verification

  • bun run lint: clean
  • bun run typecheck: no errors
  • bun run test: 244/244 passed
  • tsc --noEmit: no errors

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

gh-counter

PR gate

Removed Added +/-
TODO/FIXME 0 0 0
Type escape 0 0 0
Lint suppression 0 0 0

Repo dashboard

main (f26c7d4) #75 (16afc11) +/-
TODO/FIXME 0 0 0
Type escape 1 1 0
Lint suppression 36 36 0

Reported by gh-counter

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

Code Metrics Report

main (f26c7d4) #75 (16afc11) +/-
Coverage 41.1% 41.1% 0.0%
Code to Test Ratio 1:0.3 1:0.3 +0.0
Test Execution Time 7s 5s -2s
Details
  |                     | main (f26c7d4) | #75 (16afc11) | +/-  |
  |---------------------|----------------|---------------|------|
  | Coverage            |          41.1% |         41.1% | 0.0% |
  |   Files             |            146 |           146 |    0 |
  |   Lines             |           2578 |          2578 |    0 |
  |   Covered           |           1061 |          1061 |    0 |
+ | Code to Test Ratio  |          1:0.3 |         1:0.3 | +0.0 |
  |   Code              |          13392 |         13389 |   -3 |
+ |   Test              |           4296 |          4299 |   +3 |
+ | Test Execution Time |             7s |            5s |  -2s |

Code coverage of files in pull request scope (100.0% → 100.0%)

Files Coverage +/- Status
src/state/app-management/actions/action-creators.ts 100.0% 0.0% modified

Reported by octocov

Previously _name and _icon defaulted to null and used falsy fallback (||),
while _url defaulted to undefined and used a strict check (!== undefined).
This asymmetry meant null behaved differently per parameter: it kept the
existing value for name/icon but silently cleared the URL.

Change all three to default to undefined and use !== undefined checks so
null is treated as an explicit value for every parameter. Update the two
test cases that relied on null as a no-change signal for name/icon.
@kitsuyui kitsuyui force-pushed the fix/audit-implicit-behavior-updateapp-null-url-clears-001 branch from 40e649f to 3e448d5 Compare July 11, 2026 06:17
@kitsuyui kitsuyui merged commit a03e5b6 into main Jul 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant