Skip to content

fix(types): align TS UserPreferences with Rust update_channel#386

Merged
H-Chris233 merged 1 commit intobetafrom
fix/audit-ts-update-channel
May 9, 2026
Merged

fix(types): align TS UserPreferences with Rust update_channel#386
H-Chris233 merged 1 commit intobetafrom
fix/audit-ts-update-channel

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 9, 2026

User description

Summary

Rust types.rs declares pub update_channel: UpdateChannel on UserPreferences, but the TS interface in src/lib/types.ts and mockSettings in src/lib/ipc.ts both omitted it. setSettings() round-trips were lossless only because Rust's serde(default) refilled the field, so today's behavior is unaffected — but TS consumers that destructure UserPreferences silently miss the field, and the type was lying about what the backend serializes.

Changes

  • Move UpdateChannel type from ipc.ts to types.ts (avoids ipc <-> types circular import).
  • ipc.ts re-exports UpdateChannel for backward compat — SettingsModal.tsx and any other module still imports from ipc.ts unchanged.
  • Add updateChannel: UpdateChannel to UserPreferences interface.
  • Add updateChannel: 'stable' to mockSettings and to the stylePrefs.test.ts fixture (otherwise tsc fails).

Audit linkage

Audit ID 2.2.1 of the 2026-05-10 audit set (CONFIRMED). See docs/audit-2026-05-10-validated.md (local, not in repo) for the full validation context.

Test plan

  • npx tsc --noEmit clean (was failing on stylePrefs.test.ts for missing field — now fixed)
  • npm run build — to be verified in CI
  • Settings → About → Beta channel toggle still reads/writes via getUpdateChannel/setUpdateChannel IPC (unchanged)

Awaiting manual verification: this is a TS-only change; Rust round-trip behavior is identical.


PR Type

Bug fix, Tests


Description

  • Add updateChannel field to TS UserPreferences to match Rust backend

  • Move UpdateChannel type from ipc.ts to types.ts to avoid circular imports

  • Update mockSettings and test fixture with new required field

  • Re-export UpdateChannel from ipc.ts for backward compatibility


Diagram Walkthrough

flowchart LR
  A["Rust UserPreferences includes update_channel: UpdateChannel"] -- "missing in TypeScript" --> B["TS types.ts now defines UpdateChannel and adds updateChannel to UserPreferences"]
  B --> C["ipc.ts imports and re-exports UpdateChannel, adds field to mockSettings"]
  B --> D["stylePrefs.test.ts adds field to test fixture"]
  C --> E["SettingsModal and other imports remain unchanged"]
Loading

File Walkthrough

Relevant files
Bug fix
types.ts
Define UpdateChannel type and add updateChannel to UserPreferences

openless-all/app/src/lib/types.ts

  • Added UpdateChannel type definition (moved from ipc.ts)
  • Added updateChannel: UpdateChannel property to UserPreferences
    interface
+7/-0     
ipc.ts
Refactor UpdateChannel import and update mockSettings       

openless-all/app/src/lib/ipc.ts

  • Imported UpdateChannel from ./types instead of defining inline
  • Re-exported UpdateChannel for backward compatibility
  • Added updateChannel: 'stable' to mockSettings fixture
  • Removed old inline type definition and updated comments
+5/-1     
Tests
stylePrefs.test.ts
Add updateChannel to test fixture                                               

openless-all/app/src/lib/stylePrefs.test.ts

  • Added updateChannel: 'stable' to previousPrefs test fixture to match
    new interface requirement
+1/-0     

Rust types.rs declares pub update_channel: UpdateChannel, but the TS
UserPreferences interface in src/lib/types.ts and the mockSettings
fixture in src/lib/ipc.ts both omitted the field. setSettings()
round-trips were lossless only because Rust's serde(default) refilled
the field, but consumers that destructured UserPreferences would
silently miss it.

- Move UpdateChannel type from ipc.ts to types.ts (avoids ipc <-> types
  circular import); ipc.ts re-exports for backward compat with
  SettingsModal etc.
- Add updateChannel: UpdateChannel to UserPreferences interface.
- Add updateChannel: 'stable' to mockSettings fixture.
- Update stylePrefs.test.ts fixture for new required field.

Audit ID 2.2.1 (docs/audit-2026-05-10-validated.md, kept local).
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@H-Chris233 H-Chris233 merged commit a6f62e1 into beta May 9, 2026
4 checks passed
pull Bot pushed a commit to yimmy23/openless that referenced this pull request May 10, 2026
10 PRs landed on beta this cycle:
- Open-Less#377 paste shortcut configurable (issue Open-Less#360)
- Open-Less#386 TS UserPreferences updateChannel alignment
- Open-Less#387 focus_target leak on Processing-phase cancel
- Open-Less#388 [严重] MacHotkeyAdapter::shutdown stops CFRunLoop + tap
- Open-Less#389 emit_capsule window.show/hide off audio thread
- Open-Less#390 QA / dictation hotkey routing race
- Open-Less#391 audio-mute spawn_blocking (async hygiene)
- Open-Less#392 hotkey supervisor + global dispatcher exit signal
- Open-Less#393 post-audit logic-review hotfixes (QA mute .await + focus_target Processing branch)
- Open-Less#394 in-process credentials cache (kills repeated Keychain prompts)

Bump 4 files: package.json, tauri.conf.json, Cargo.toml, Cargo.lock.
@appergb appergb deleted the fix/audit-ts-update-channel branch May 10, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants