-
Notifications
You must be signed in to change notification settings - Fork 56
release: v2.2.0 stable + post-audit hardening #504
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 all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,3 +32,6 @@ test-results.md | |
| # local env files | ||
| .env | ||
| .env.local | ||
|
|
||
| # OMC session scratch (never publish) | ||
| .omc/ | ||
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import { afterEach, beforeEach, describe, expect, it } from "vitest"; | ||
| import { styleAccountDetailText } from "../lib/codex-manager.js"; | ||
| import { ANSI } from "../lib/ui/ansi.js"; | ||
| import { resetUiRuntimeOptions, setUiRuntimeOptions } from "../lib/ui/runtime.js"; | ||
|
|
||
| // styleAccountDetailText colors a one-line account detail by tone. The | ||
| // security/UX-relevant invariant is precedence: a real failure whose text also | ||
| // contains "unavailable"/"not available" (e.g. a 5xx "service not available") | ||
| // MUST render danger (red), never be downgraded to a warning (yellow). These | ||
| // tests pin that the /failed|error/i check wins over the unavailable regex on | ||
| // both the compact path and the quota-suffix path. | ||
| // | ||
| // To make tone assertions deterministic we force the legacy ANSI renderer | ||
| // (v2 off) and an interactive stdout, so danger => ANSI.red and | ||
| // warning => ANSI.yellow exactly. | ||
|
|
||
| describe("styleAccountDetailText tone precedence", () => { | ||
| const stdoutIsTTYDescriptor = Object.getOwnPropertyDescriptor( | ||
| process.stdout, | ||
| "isTTY", | ||
| ); | ||
|
|
||
| beforeEach(() => { | ||
| Object.defineProperty(process.stdout, "isTTY", { | ||
| value: true, | ||
| configurable: true, | ||
| }); | ||
| setUiRuntimeOptions({ v2Enabled: false }); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| resetUiRuntimeOptions(); | ||
| if (stdoutIsTTYDescriptor) { | ||
| Object.defineProperty(process.stdout, "isTTY", stdoutIsTTYDescriptor); | ||
| } else { | ||
| delete (process.stdout as unknown as { isTTY?: boolean }).isTTY; | ||
| } | ||
| }); | ||
|
|
||
| it("renders danger (red), not warning (yellow), when a failure detail also says 'unavailable'", () => { | ||
| const styled = styleAccountDetailText("refresh failed: service unavailable"); | ||
| expect(styled).toContain(ANSI.red); | ||
| expect(styled).not.toContain(ANSI.yellow); | ||
| }); | ||
|
|
||
| it("treats 'not available' the same — danger wins over the warning keyword", () => { | ||
| const styled = styleAccountDetailText("token error (not available)"); | ||
| // "(not available)" has no percent sign, so this stays on the compact path. | ||
| expect(styled).toContain(ANSI.red); | ||
| expect(styled).not.toContain(ANSI.yellow); | ||
| }); | ||
|
|
||
| it("normalizes whitespace/newlines before matching tone keywords", () => { | ||
| const styled = styleAccountDetailText(" probe failed\n — endpoint unavailable "); | ||
| expect(styled).toContain(ANSI.red); | ||
| expect(styled).not.toContain(ANSI.yellow); | ||
| }); | ||
|
|
||
| it("still renders warning (yellow) when only an unavailable keyword is present", () => { | ||
| const styled = styleAccountDetailText("Codex not available for this account"); | ||
| expect(styled).toContain(ANSI.yellow); | ||
| expect(styled).not.toContain(ANSI.red); | ||
| }); | ||
|
|
||
| it("applies danger precedence to the quota suffix when it contains both keywords", () => { | ||
| // Quota-bearing prefix routes through the (NN%) branch; the suffix carries | ||
| // the failure text and must render red despite containing "unavailable". | ||
| const styled = styleAccountDetailText("acct (12%) — refresh failed, now unavailable"); | ||
| expect(styled).toContain(ANSI.red); | ||
| expect(styled).not.toContain(ANSI.yellow); | ||
| }); | ||
| }); |
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
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.
Uh oh!
There was an error while loading. Please reload this page.