Skip to content

(CODUX-125) Gate title-bar Update button on real availability - #2771

Merged
numnx merged 2 commits into
feature/CODUX-199-fix-update-buttonfrom
task/feature-codux-199-fix-update-button-t02-codex-mrczfplp
Jul 9, 2026
Merged

(CODUX-125) Gate title-bar Update button on real availability#2771
numnx merged 2 commits into
feature/CODUX-199-fix-update-buttonfrom
task/feature-codux-199-fix-update-button-t02-codex-mrczfplp

Conversation

@numnx

@numnx numnx commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Gate title-bar Update button on real availability

Automated task PR opened by Code UX for T02.

📋 Summary

Sprint: Sprint 199 · Fix Update Button · Task: T02

Fix the Electron title-bar Update button so it reflects real update availability: surface the update affordance only when a newer version exists (driven by the existing /api/system/update-status pipeline) instead of being hardcoded to always show, and communicate the available version.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.5

⏱️ Timing

Started 2026-07-09 04:04:05 UTC
Finished 2026-07-09 04:07:46 UTC
Duration 3m 41s

📊 Token Usage

Metric Value
Input tokens 76,238
Cached input tokens 453,376
Output tokens 6,308
Total tokens 535,922
Invocations 1
Tool calls 25
Active time 3m 10s

Included usage estimate (subscription/local login): $0.80

✅ QA Review

⏳ QA review runs after this PR is opened. Check the task card in the dashboard for the outcome once it lands.

📝 Full Task Prompt
## Objective
Wire `dashboard/src/v2/components/TitleBar.tsx` to the update-status hook so the amber "Update" button renders only when an update is actually available, instead of always showing. When shown, it should communicate the available version; the click behavior (open updates) stays the same.

## Scope
- Edit `dashboard/src/v2/components/TitleBar.tsx`
- Update `dashboard/src/v2/components/__tests__/TitleBar.test.tsx`
- Consumes the `useUpdateStatus` hook contract created in T01 (`dashboard/src/v2/hooks/use-update-status.ts`), specifically `updateAvailable` and `latestVersion`

## Implementation Requirements
1. Import and call `useUpdateStatus()` in `TitleBar`. Preserve the existing early return `if (!windowApi) return null;` (the title bar is Electron-only) — call the hook before that return so hook order stays stable.
2. Render the existing Update `<button>` (the block with `aria-label="Open updates"`, `handleUpdateClick`, `Download` icon) only when `updateAvailable` is true; when false, render nothing in its place and keep the surrounding version label/layout stable (no empty gap or placeholder).
3. When shown, make the affordance version-aware: set an accessible label/title that includes the latest version when available (e.g. `aria-label={latestVersion ? \`Update available: v${latestVersion}\` : "Open updates"}`), keeping the visible "Update" text and existing Tailwind classes/styling unchanged.
4. Keep `handleUpdateClick` calling `desktop?.openUpdates?.()` exactly as today; do not change the Electron IPC or `openCodeUxUpdatesPage` target.
5. Update `TitleBar.test.tsx`: mock the `use-update-status` hook. Add a case where `updateAvailable` is true asserting the update button renders and clicking it invokes `window.codeUxDesktop.openUpdates` once; add a case where `updateAvailable` is false asserting no button with the update affordance is present while the version label (`v...`) and window controls still render.

## Constraints
- Do not remove or alter the window min/maximize/close controls, the mac traffic-light spacer, drag/double-click behavior, or `__APP_VERSION__` version label.
- Do not show the Update button when `updateAvailable` is false (this is the core bug being fixed) and do not block title-bar render on the fetch (button simply stays hidden until/unless an update is confirmed).
- Reuse the existing button markup and Tailwind classes; do not introduce new UI frameworks or restyle unrelated title-bar elements.

## Verification
- `pnpm test tests/dashboard/v2` (or the focused command `pnpm test dashboard/src/v2/components/__tests__/TitleBar.test.tsx`) passes, including the new available/unavailable cases.
- `pnpm run typecheck:dashboard` and `pnpm run build` pass.
- Manually confirm: with a mocked up-to-date status no Update button appears; with an available update the button appears, is labeled with the version, and clicking it calls `openUpdates`.
🌿 Branch Info

Base: feature/CODUX-199-fix-update-button
Head: task/feature-codux-199-fix-update-button-t02-codex-mrczfplp


🤖 Generated by Code UX

@numnx
numnx merged commit dcee944 into feature/CODUX-199-fix-update-button Jul 9, 2026
6 checks passed
@numnx
numnx deleted the task/feature-codux-199-fix-update-button-t02-codex-mrczfplp branch July 9, 2026 04:16
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