Skip to content

fix(shell): validate taos:activate-window event shape (#585 nit)#589

Merged
jaylfc merged 1 commit into
devfrom
fix/activate-window-event-typecheck
Jun 4, 2026
Merged

fix(shell): validate taos:activate-window event shape (#585 nit)#589
jaylfc merged 1 commit into
devfrom
fix/activate-window-event-typecheck

Conversation

@jaylfc
Copy link
Copy Markdown
Owner

@jaylfc jaylfc commented Jun 4, 2026

Tidy for the kilo review nits on #585. Replaces the blind CustomEvent<{windowId?}> cast in the taos:activate-window handler with a runtime check that detail.windowId is a string, and adds the (stable) setActiveWindowId to the effect deps. No behaviour change — the original cast was already guarded by optional chaining + an if. Build clean.

Summary by CodeRabbit

  • Bug Fixes
    • Improved robustness of window-activation functionality by adding runtime validation for event data to ensure stable window management.

…ting

Replace the blind CustomEvent cast with a runtime check that windowId is a
string, and add the stable setActiveWindowId to the effect deps. Addresses the
kilo nits on #585 (no behaviour change — the cast was already guarded).
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0de54f00-4bf1-4a12-8731-bcdb4d5ee8e7

📥 Commits

Reviewing files that changed from the base of the PR and between cbf4f46 and ba88f85.

📒 Files selected for processing (1)
  • desktop/src/App.tsx

📝 Walkthrough

Walkthrough

A single event listener in App.tsx is updated to add runtime type validation. The "taos:activate-window" handler now checks that the event detail contains a valid string windowId before updating state, replacing an unchecked cast with defensive validation.

Changes

Window Activation Event Validation

Layer / File(s) Summary
Runtime validation for activate-window event
desktop/src/App.tsx
The "taos:activate-window" event listener validates detail.windowId is a string at runtime before calling setActiveWindowId, and the useEffect dependency array is updated to include setActiveWindowId.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

A guardian shield now guards the gate,
Type-checking at the runtime state,
No blind trust in the window's call—
Safe validation conquers all! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the specific fix: validating the taos:activate-window event shape instead of relying on a type cast. It accurately describes the main change in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/activate-window-event-typecheck

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@jaylfc jaylfc merged commit 3937c16 into dev Jun 4, 2026
7 checks passed
@jaylfc jaylfc deleted the fix/activate-window-event-typecheck branch June 4, 2026 23:24
@github-project-automation github-project-automation Bot moved this from Todo to Done in TinyAgentOS Roadmap Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant