Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Complete quota validation and harden fixture locale coverage

Barack Sokullua8aa1e981d5d
diff --git a/docs/compass-quota-validation.md b/docs/compass-quota-validation.md
index 81c35f731..e48dd28cb 100644
--- a/docs/compass-quota-validation.md
+++ b/docs/compass-quota-validation.md
@@ -11,7 +11,7 @@ Both repositories were clean before implementation. No applicable `AGENTS.md` wa
| Cloud Plus, portal subscription recovery, renewal notices | Passed |
| Cloud PHP syntax | Passed for service, promotion trait, routes, and both new CLI scripts |
| Extension `npm run test:compass-quota` | 19 tests passed across Chrome and Firefox |
-| Extension `npm run test:compass-quota:ui` | 400 assertions passed in Chromium and Firefox, all 23 supported locales |
+| Extension `npm run test:compass-quota:ui` | 404 assertions passed in Chromium and Firefox, all 23 supported locales |
| Extension billing/payment notice | Passed in both builds |
| Extension runtime lifecycle suite | 218 tests and 14 UI/content lifecycle checks passed |
| Extension provider limits | Passed |
@@ -21,7 +21,7 @@ Both repositories were clean before implementation. No applicable `AGENTS.md` wa
| Extension `npm run build:all` | Chrome and Firefox unpacked builds succeeded |
| `git diff --check` | Passed in both repos |
-The cloud suite uses independent concurrent PHP processes against the same file lock. It covers repeated submissions, competing device/post/profile claims, approval retries mixed with consumption, no second grant across platforms, corrected rejection revisions, partial spending, weekly carryover, permanent ineligibility after award, redemption, corruption handling, paid usage, and real metered-session reporting. Reset checks cover Sunday 23:59:59 UTC, Monday 00:00 UTC, and a local Monday before the UTC boundary. The HTTP test launches an isolated local PHP server with external billing/model credentials disabled, exercises the public routes, and runs the actual reviewer CLI against that same usage store.
+The cloud suite uses independent concurrent PHP processes against the same file lock. It covers repeated submissions, competing device/post/profile claims, approval retries mixed with consumption, no second grant across platforms, corrected rejection revisions, partial spending, weekly carryover, permanent ineligibility after award, redemption, corruption handling, paid usage, and real metered-session reporting. Reset checks cover Sunday 23:59:59 UTC, Monday 00:00 UTC, and a local Monday before the UTC boundary. The HTTP test launches an isolated local PHP server with external billing/model credentials disabled, exercises the public routes and configured promotion body-size limit, and runs the actual reviewer CLI against that same usage store.
The extension tests use actual provider errors, agent chat/stream entry points, persisted/evicted run journals, reconnect responses, and structured card routing without a trailing Subscribe URL. The browser fixtures render the shipped quota controller and browser-specific styles, test all three choices, edited copy and composers, pending/rejected/corrected/approved/redeemed claims, restored card/form state, a simulated checkout return, provider selection, and explicit continuation. Keyboard tests exercise Tab through the choices and Enter into the claim form. All locales were checked for unresolved translation placeholders and horizontal overflow at **280 px**; awarded cards were also captured at **420 px**. English and Arabic screenshots were visually inspected.
@@ -33,23 +33,20 @@ All three review findings were addressed. Store writes now sync a temporary file
Metered usage now requires the billing tier resolved at admission, including streamed usage and visual sidecars. The paid-admission regression drops the billing table mid-request and verifies neither model nor visual usage debits promotional credit. UI submissions invalidate older refresh results/errors, including across a locale remount. Browser regressions verify pending state survives delayed draft responses, stale network errors, and a remount during submission; a failed submission after remount re-enables the form. Refreshes also retain keyboard focus and deliberately empty edited copy.
-After these fixes, the promotion suites, PHP syntax, weekly usage, Plus, portal recovery, renewal notices, stats endpoint, 15 extension quota tests, 392 rendered UI assertions, billing notice checks, and both extension builds were rerun and passed. `git diff --check` passed in both repos. The standard tool-request-shape check still fails at its existing local-model assertion before reaching the changed accounting calls; the complete check passes when its service instances use an isolated root without the local `.env` (the actual `.env` was untouched). The earlier full-suite failures below remain recorded; the aggregate suites were not rerun after these focused fixes.
+## PR review and complete validation
-## Existing failures
+Ordinary quota reads now use a shared read lock without creating lifetime claims or rewriting the store; metering and expiring client telemetry also avoid allocating claims. Sharing explicitly creates the opaque identifier. Regressions rotate device headers across 50 direct usage reads and 20 real HTTP usage/malformed-chat requests and verify unchanged store bytes. Paid and Plus no-op reads, repeated conversion observations, and expired checkout activity are checked using store bytes and modification times. Both promotion POST handlers use the existing bounded JSON parser; oversized bodies with and without Content-Length are rejected before claim allocation. No-op exclusive transactions do not replace the ledger.
-The first GitHub review findings were addressed in both PRs. Ordinary quota reads now use a shared read lock without creating lifetime claims or rewriting the store; metering and expiring client telemetry also avoid allocating claims. Sharing explicitly creates the opaque identifier. Regressions rotate device headers across 50 direct usage reads and 20 real HTTP usage/malformed-chat requests, check unchanged store bytes, and retain conversion counting without a claim. Both browsers now emit one recovery signal on response-only quota failure, and provider switching checks connection results, exceptions, and stale tests before reporting readiness. The rendered test server selects locale identifiers from a fixed allowlist. The PDF browser test captures its Chrome tab ID at creation instead of rediscovering it by URL.
+Both browsers emit one recovery signal on response-only quota failure. Provider switching checks connection results, exceptions, and stale tests before reporting readiness. The rendered fixture server selects locales from a fixed allowlist, with malicious locale query regressions. The PDF browser test captures its Chrome tab ID at creation instead of rediscovering it by URL. GitHub CodeQL confirmed the fixture injection alert was fixed, and PDF/WebMCP CI passed after the first review fixes.
-After these changes, the cloud promotion suite, syntax, weekly usage, Plus, payment recovery, renewal notices, 19 quota tests, 400 browser assertions, payment notice checks, both builds, and real Chrome PDF/WebMCP tests passed. Screenshots were regenerated at 280 and 420 px. GitHub checks and fresh Codex reviews are tracked on the PRs.
+The full **npm test** passed, including **2,426 legacy tests** and **60 security checks**. Focused quota tests passed 19 cases, and the browser fixture passed 404 assertions across both engines and 23 locales. Both extension builds, payment notices, and real Chrome PDF/WebMCP tests passed; English and Arabic narrow-panel screenshots were inspected again.
-- **Extension `npm test`:** the final run reached the legacy `test/run.js` suite: **2,425 passed, 1 failed** out of 2,426. The failing test is `extended provider catalog is complete, mirrored, safe, and excluded-provider clean`; its expected catalog omits existing `freebuff2api`. The unchanged HEAD test reproduces that failure. Earlier chained suites passed; checks chained after this failing legacy suite were not executed by `npm test`. Two source-extraction assertions affected by the expanded quota renderer were updated and now pass.
-- **Cloud `composer check`:** the native Windows checkout gives `tests/apache-health-guard.sh` CRLF line endings, and Bash rejects its `set -u` / function syntax. The aggregate check stops there with exit 2. This shell script was not changed.
-- **Cloud PHP checks run separately:** `tool-request-shape.php` fails its default-upstream-model assertion because the existing local `.env` sets `UPSTREAM_MODEL_ID=stepfun/step-3.7-flash`, while the test expects the constructor's GPT-5.6 Luna Pro default. The unchanged HEAD service/test reproduces this failure.
-- **Cloud PHP checks run separately:** `pii-scrubber-cli.php` fails its overlapping-run assertion. The unchanged HEAD service, CLI, and test reproduce the same failure on this host. The cause was not changed or resolved by this implementation.
+The full cloud **composer check** and the real HTTP/review-CLI suite passed after the latest cloud fixes. Earlier validation blockers were resolved: shell fixtures use LF line endings, the default-model test uses an isolated root without a developer .env, the PII CLI recognizes absolute Windows lock paths, and stale provider/structured-error source assertions match the current behavior. The actual .env was untouched. Expected fault-case diagnostics remain in passing test logs.
-All other PHP checks in the Composer check list passed when run individually. Test cases that intentionally exercise missing billing configuration, invalid test credentials, or corrupt improvement payloads emit expected diagnostic lines while passing.
+Fresh Codex reviews and GitHub checks are recorded on each PR.
## Local artifacts and rollout
-Browser screenshots are generated in `%TEMP%/webbrain-compass-review` (override with `QUOTA_UI_OUTPUT`). The complete aggregate extension logs are `%TEMP%/webbrain-compass-npm-test-final.log`; the cloud aggregate log is `%TEMP%/webbrain-cloud-compass-check.log`. Unpacked artifacts are `build/chrome` and `build/firefox`.
+Browser screenshots are generated in `%TEMP%/webbrain-compass-review` (override with `QUOTA_UI_OUTPUT`). The latest complete extension log is `%TEMP%/webbrain-compass-review-npm-test.log`; the cloud aggregate log is `%TEMP%/webbrain-cloud-compass-review-check.log`. Unpacked artifacts are `build/chrome` and `build/firefox`.
Local cloud configuration has no `WEEKLY_FREE_USD` process or `.env` override, so the inspected effective value is `0.375`. Production was not inspected or activated. Follow [the rollout checklist](compass-quota-rollout.md): backend compatibility pinned at `0.75`, both extensions, then live-worker override verification and activation at `0.375`. Reassess the actual consumption report after two complete UTC weeks.
diff --git a/test/compass-quota-ui.mjs b/test/compass-quota-ui.mjs
index a828d794a..caea9c778 100644
--- a/test/compass-quota-ui.mjs
+++ b/test/compass-quota-ui.mjs
@@ -60,6 +60,12 @@ await new Promise(r => server.listen(0, '127.0.0.1', r));
const origin = `http://127.0.0.1:${server.address().port}`;
let checks = 0;
try {
+ const injectedLocale = '</script><script>window.localeInjection=true</script>';
+ for (const build of ['chrome', 'firefox']) {
+ const html = await (await fetch(`${origin}/quota?build=${build}&locale=${encodeURIComponent(injectedLocale)}`)).text();
+ assert.doesNotMatch(html, /localeInjection/);
+ assert.match(html, /const code="en"/); checks += 2;
+ }
for (const [build, engine] of [['chrome', chromium], ['firefox', firefox]]) {
if (process.env.QUOTA_UI_BROWSER && process.env.QUOTA_UI_BROWSER !== build) continue;
const browser = await engine.launch();
diff --git a/test/run.js b/test/run.js
index ec22226ab..d61380805 100644
--- a/test/run.js
+++ b/test/run.js
@@ -70379,7 +70379,7 @@ test('extended provider catalog is complete, mirrored, safe, and excluded-provid
302ai abacus aihubmix alibaba-coding-plan alibaba-coding-plan-cn
azure-cognitive-services bailing baseten berget cerebras chutes clarifai
cloudferro-sherlock cohere cortecs deepinfra demonroute digitalocean dinference drun
- evroc fastrouter friendli google-vertex google-vertex-anthropic helicone
+ evroc fastrouter freebuff2api friendli google-vertex google-vertex-anthropic helicone
iflowcn inception inference io-net jiekou kilo kimi-for-coding
kuae-cloud-coding-plan llama lucidquery meganova minimax-cn-coding-plan
minimax-coding-plan moark modelscope morph nano-gpt nearai nebius nova novita-ai
@@ -70391,7 +70391,7 @@ test('extended provider catalog is complete, mirrored, safe, and excluded-provid
`.trim().split(/\s+/);
const excluded = ['github-models', 'github-copilot', 'gitlab', 'sap-ai-core'];
- assert.equal(expectedIds.length, 80);
+ assert.equal(expectedIds.length, 81);
assert.deepEqual(ProviderCatalogCh.ADDITIONAL_PROVIDER_IDS, expectedIds);
assert.deepEqual(ProviderCatalogFx.ADDITIONAL_PROVIDER_IDS, expectedIds);
assert.deepEqual(
@@ -70405,7 +70405,7 @@ test('extended provider catalog is complete, mirrored, safe, and excluded-provid
['firefox', ProviderManagerFx, 'src/firefox'],
]) {
const defaults = new PM()._defaultConfigs();
- const expectedDefaultCount = label === 'chrome' ? 113 : 112;
+ const expectedDefaultCount = label === 'chrome' ? 114 : 113;
assert.equal(
Object.keys(defaults).length,
expectedDefaultCount,
@@ -70422,7 +70422,7 @@ test('extended provider catalog is complete, mirrored, safe, and excluded-provid
expectedAskStreaming,
`${label}: ${id} Ask streaming capability mismatch`,
);
- assert.ok(config.model || id === 'azure-cognitive-services', `${label}: ${id} missing model`);
+ assert.ok(config.model || config.requiresModel, `${label}: ${id} missing model`);
const icon = path.join(ROOT, prefix, 'icons/providers', `${id}.svg`);
assert.equal(fs.existsSync(icon), true, `${label}: missing icon for ${id}`);
@@ -117638,7 +117638,7 @@ test('sidepanel routes every run-error path through request-scoped deduplication
assert.match(panel, /import \{ claimRunError \} from '\.\/run-error-dedupe\.js';/, `${label}: sidepanel should use the shared deduper`);
assert.match(panel, /createActiveChatPayloadState\(retryPayload, requestId\)/, `${label}: active error state should retain request identity`);
assert.match(panel, /renderAgentErrorUpdate\(returnedErrorUpdate\.data, tabId, requestId(?:, \{[\s\S]*?submittedTurnDurable: res\.submittedTurnDurable,[\s\S]*?\})?\)/, `${label}: returned errors should use request-scoped rendering`);
- assert.match(panel, /renderAgentErrorUpdate\(\{ message: e\.message \}, tabId, requestId\)/, `${label}: caught errors should use request-scoped rendering`);
+ assert.match(panel, /renderAgentErrorUpdate\(\{ message: e\.message, quota: e\.quota \}, tabId, requestId\)/, `${label}: caught errors should preserve quota metadata and use request-scoped rendering`);
assert.match(panel, /renderAgentErrorUpdate\(data, currentTabId, msg\.requestId\)/, `${label}: streamed errors should use message request identity`);
assert.match(panel, /msgEl\.dataset\.tabId = active\.tabId;[\s\S]*?msgEl\.dataset\.runRequestId = active\.requestId;[\s\S]*?msgEl\.dataset\.errorMessageKey = active\.key;/, `${label}: persisted error cards should retain their dedupe identity`);
assert.match(panel, /if \(active\.duplicate\) return;[\s\S]*?retryPayload: isTabAbortRequested\(tabId\) \? null : active\.retryPayload/, `${label}: only the first copy should retain the Retry action`);