Skip to content

fix(app): normalize record-shaped desktop list values#35553

Open
megamen32 wants to merge 1 commit into
anomalyco:devfrom
megamen32:fix/desktop-list-record-normalization
Open

fix(app): normalize record-shaped desktop list values#35553
megamen32 wants to merge 1 commit into
anomalyco:devfrom
megamen32:fix/desktop-list-record-normalization

Conversation

@megamen32

@megamen32 megamen32 commented Jul 6, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #35551

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The desktop app can receive some list-shaped values as object maps from persisted state or API responses. The renderer then calls array methods such as .filter(), .map(), or .find() and crashes on startup/navigation.

This change adds a small listValue() helper that accepts either an array or a record and returns an array. It applies that normalization to the desktop paths that handle sessions, commands, projects, permissions, and questions before array operations.

The reported macOS crash was:

TypeError: (store2.session ?? []).filter is not a function

After fixing that locally, the next same-shape issue was:

TypeError: sync2(...).data.command.map is not a function

Both are handled by normalizing the value before array operations.

How did you verify your code works?

From packages/app:

bun test --preload ./happydom.ts ./src/utils/list-value.test.ts ./src/pages/layout/helpers.test.ts ./src/context/server-sync.test.ts ./src/context/global-sync/bootstrap.test.ts ./src/components/prompt-input/submit.test.ts

Result:

45 pass
0 fail
92 expect() calls

Also passed:

bun run typecheck
bun run build

bun run build completed successfully with existing Vite chunk/dynamic import warnings.

A normal push ran the repository-wide pre-push hook and failed in unrelated packages with existing Buffer / URL type errors and then SIGSEGV / code 139. I pushed with --no-verify after the app tests, app typecheck, and app build above passed.

Screenshots / recordings

No UI change. The local patched desktop build reached server ready and stopped logging the renderer crashes above.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Normalize SDK and persisted list values before array operations so desktop startup can tolerate record-shaped session, command, project, permission, and question payloads.\n\nFixes anomalyco#35551
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Desktop renderer crashes when session/command lists are object maps

1 participant