forked from steipete/CodexBar
-
Notifications
You must be signed in to change notification settings - Fork 127
Port upstream CodexBar 0.56.3 [review] #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
cbed5a5
Port 0.56.3 Codex catch-up pause state
Finesssee 5b34f23
Port 0.56.3 oversized JSONL discard
Finesssee 919abf9
Port 0.56.3 provider compatibility fixes
Finesssee 58fd46f
Verify 0.56.3 provider status layout parity
Finesssee 21a3844
Port 0.56.3 Codex workspace labels
Finesssee 38ebf49
Port 0.56.3 Claude scan pricing memoization
Finesssee 27837ce
Port 0.56.3 Grok billing truth table
Finesssee 8adde54
Decompose Codex catch-up reconciliation
Finesssee 9c4e709
Fix 0.56.3 native Rust compile regressions
Finesssee fe13a57
Finish 0.56.3 native Rust compile fixes
Finesssee bc8875c
Fix 0.56.3 Claude fallback pricing
Finesssee 701750b
Make 0.56.3 Rust port Clippy-clean
Finesssee 929716e
Merge repaired 0.56.2 base
Finesssee c59c2b7
Merge formatted repaired base for #437
Finesssee ea94669
Merge repaired 0.56.2 base
Finesssee 75ed3cc
Merge final repaired base for #437
Finesssee 6033cbb
Merge final format fix for #437
Finesssee d2f7e74
Merge remote-tracking branch 'origin/main' into HEAD
Finesssee 0ff7786
test: stabilize tray layout feedback assertion
Finesssee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
apps/desktop-tauri/src/components/codexAccountDisplay.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import type { CodexAccount } from "../types/bridge"; | ||
| import { buildCodexAccountDisplayNames } from "./codexAccountDisplay"; | ||
|
|
||
| function account(id: string, providerAccountId: string): CodexAccount { | ||
| return { | ||
| id, | ||
| nickname: null, | ||
| emailHint: "same@example.com", | ||
| authSubject: null, | ||
| providerAccountId, | ||
| codexHomePath: `C:/private/${providerAccountId}`, | ||
| source: "managedByApp", | ||
| createdAt: "2024-01-01T00:00:00Z", | ||
| updatedAt: "2024-01-01T00:00:00Z", | ||
| lastAuthenticatedAt: null, | ||
| }; | ||
| } | ||
|
|
||
| describe("Codex account display labels", () => { | ||
| it("keeps same-email workspace labels opaque and stable across ordering", () => { | ||
| const first = account( | ||
| "11111111-1111-1111-1111-111111111111", | ||
| "workspace-alpha", | ||
| ); | ||
| const second = account( | ||
| "22222222-2222-2222-2222-222222222222", | ||
| "workspace-beta", | ||
| ); | ||
|
|
||
| const labels = buildCodexAccountDisplayNames([first, second]); | ||
| const reversed = buildCodexAccountDisplayNames([second, first]); | ||
|
|
||
| expect(labels[first.id]).not.toBe(labels[second.id]); | ||
| expect(labels[first.id]).toMatch(/^same@example\.com · [0-9a-f]{8}$/); | ||
| expect(labels[second.id]).toMatch(/^same@example\.com · [0-9a-f]{8}$/); | ||
| expect(labels[first.id]).not.toContain("workspace-alpha"); | ||
| expect(labels[second.id]).not.toContain("workspace-beta"); | ||
| expect(reversed[first.id]).toBe(labels[first.id]); | ||
| expect(reversed[second.id]).toBe(labels[second.id]); | ||
| }); | ||
|
|
||
| it("binds canonical labels to account ids without exposing fallback fields", () => { | ||
| const first = account( | ||
| "33333333-3333-3333-3333-333333333333", | ||
| "internal-one", | ||
| ); | ||
| const second = account( | ||
| "44444444-4444-4444-4444-444444444444", | ||
| "internal-two", | ||
| ); | ||
| const canonical = { | ||
| [first.id]: "same@example.com · 1111aaaa", | ||
| [second.id]: "same@example.com · 2222bbbb", | ||
| }; | ||
|
|
||
| const labels = buildCodexAccountDisplayNames( | ||
| [second, first], | ||
| canonical, | ||
| ); | ||
|
|
||
| expect(labels[first.id]).toBe(canonical[first.id]); | ||
| expect(labels[second.id]).toBe(canonical[second.id]); | ||
| expect(Object.values(labels).join(" ")).not.toContain("internal-"); | ||
| }); | ||
|
|
||
| it("uses a generic privacy-safe fallback when identity fields are absent", () => { | ||
| const missingIdentity = { | ||
| ...account("55555555-5555-5555-5555-555555555555", "secret-workspace"), | ||
| nickname: null, | ||
| emailHint: null, | ||
| authSubject: "auth0|secret-subject", | ||
| codexHomePath: "C:/private/secret-workspace", | ||
| }; | ||
|
|
||
| const [label] = Object.values( | ||
| buildCodexAccountDisplayNames([missingIdentity]), | ||
| ); | ||
|
|
||
| expect(label).toBe("Workspace"); | ||
| expect(label).not.toContain("secret-workspace"); | ||
| expect(label).not.toContain("secret-subject"); | ||
| expect(label).not.toContain("C:/private"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import type { CodexAccount } from "../types/bridge"; | ||
|
|
||
| /** | ||
| * Return the same account labels in Settings and the tray menu. The backend | ||
| * normally supplies the canonical SHA-256-derived labels; the deterministic | ||
| * opaque-id fallback keeps older/test bridges collision-safe too. | ||
| */ | ||
| export function buildCodexAccountDisplayNames( | ||
| accounts: readonly CodexAccount[], | ||
| canonical: Readonly<Record<string, string>> = {}, | ||
| ): Record<string, string> { | ||
| const groups = new Map<string, CodexAccount[]>(); | ||
| for (const account of accounts) { | ||
| const base = codexAccountBaseName(account); | ||
| const key = base.trim().toLowerCase(); | ||
| const group = groups.get(key) ?? []; | ||
| group.push(account); | ||
| groups.set(key, group); | ||
| } | ||
|
|
||
| const result: Record<string, string> = {}; | ||
| for (const account of accounts) { | ||
| const supplied = canonical[account.id]?.trim(); | ||
| if (supplied) { | ||
| result[account.id] = supplied; | ||
| continue; | ||
| } | ||
|
|
||
| const base = codexAccountBaseName(account); | ||
| const group = groups.get(base.trim().toLowerCase()) ?? []; | ||
| result[account.id] = | ||
| group.length > 1 | ||
| ? `${base} · ${opaqueAccountSuffix(account.id)}` | ||
| : base; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| export function codexAccountBaseName(account: CodexAccount): string { | ||
| const nickname = account.nickname?.trim(); | ||
| const email = account.emailHint?.trim().toLowerCase(); | ||
| if (email && nickname) return `${email} — ${nickname}`; | ||
| return nickname || email || "Workspace"; | ||
| } | ||
|
|
||
| function opaqueAccountSuffix(id: string): string { | ||
| // Production account ids are app-owned UUIDs. FNV-1a is only a fallback | ||
| // when the Rust bridge did not provide its SHA-256 label; no provider id, | ||
| // email, or filesystem path is exposed by this path. | ||
| let hash = 0x811c9dc5; | ||
| for (let index = 0; index < id.length; index += 1) { | ||
| hash ^= id.charCodeAt(index); | ||
| hash = Math.imul(hash, 0x01000193); | ||
| } | ||
| return (hash >>> 0).toString(16).padStart(8, "0"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: nesszer/Win-CodexBar
Length of output: 50379
🏁 Script executed:
Repository: nesszer/Win-CodexBar
Length of output: 9455
🏁 Script executed:
Repository: nesszer/Win-CodexBar
Length of output: 9448
🏁 Script executed:
Repository: nesszer/Win-CodexBar
Length of output: 17038
Attach CUA evidence for both reset fallback paths
useFormattedResetTimefeedsMenuCardDetailsandCodexAccountsMenu, but this test renders only aProbe. It covers missingresetsAt, not an unparseable value. After a fresh Windows rebuild, attach CUA screenshots or equivalent manual proof for both fallback paths.🤖 Prompt for AI Agents