Skip to content

test(usage): make the shared account order between the usage checks deterministic - #2345

Merged
devswha merged 1 commit into
mainfrom
fix/usage-signin-check-order
Oct 29, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/usage-signin-check-order

Conversation

@devswha

@devswha devswha commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Change

Test-only, scripts/usage-regression.ts:

  • checkUsageMeters waits for its shared account order to reach the server before its page closes. It watches for the PUT /api/preferences response that carries usageOrder (set up before the Settings edits, 10 s bound) and asserts it is 200.
  • checkUsageSignInAgain first clears the shared account order on its server (PUT /api/preferences with usageOrder: [], checked for 200), so it no longer depends on what an earlier check saved.

Why

scripts/ui-contexts-regression.ts runs checkUsageMeters and then checkUsageSignInAgain against one server. The first check moves an account, and the app saves the shared usageOrder to the server once the settings rest (600 ms debounce). Whether that save landed before the check closed its page was a race. When it did, the second check's expired report sorted claude:u1 and antigravity@keychain first, because they are the ranked keys, and the notes assertion at usage-regression.ts:229 failed:

+   'Sign-in expired. Open Antigravity to renew it.',
    'Sign-in expired.',
    'Sign-in expired. Open Codex to renew it.',
-   'Sign-in expired. Open Antigravity to renew it.'

The release PR #2337 fails Browser regression (ui-regression) on it, and so does #2328 (run 40835368558). The flaky check is on main itself, not something either PR changed.

Can the earlier save land after the reset?

No. checkUsageMeters waits for the response to the save that carries usageOrder, so by the time its page closes, the server has stored that order and answered. Nothing pending can carry it later: the sync sends a setting only while it differs from what the server last confirmed, and both contexts are closed before checkUsageSignInAgain starts. The reset therefore always comes after the save, and nothing in checkUsageSignInAgain writes the order. No fixed sleep: the wait is for that exact response.

Validation

  • Deterministic now:
    • With the wait and the reset removed, bun scripts/usage-regression.ts failed 3 of 3 runs with exactly the CI diff.
    • With both, it passed 3 of 3 runs.
    • Before this change, a server seeded with the moved order failed origin/main the same way.
  • bun scripts/ui-contexts-regression.ts passes (both usage checks PASS).
  • bun run check fast is green, including scripts/conventions.test.ts (no fixed sleeps).
  • An omo code review of the reset approved it with no blockers.

Both callers of the check (ui-contexts-checks.ts and usage-regression.ts's own run) use servers without a token, so the reset needs no credential.

…eterministic

checkUsageMeters moves an account, and the app saves the shared account
order (usageOrder) to the server once the settings rest. Whether that
save landed before the check closed its page was a race. When it did,
checkUsageSignInAgain on the same server inherited the order: its
expired report then listed Antigravity first, and the notes assertion
failed. The release PR #2337 and #2328 hit it in CI.

checkUsageMeters now waits for that PUT /api/preferences response (the
one carrying usageOrder) before its page closes, so the save has always
landed, and checkUsageSignInAgain clears the shared order before it
opens a page. With the wait and without the reset, the sign-in check
fails every time; with both it passes every time.
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ef482f2 and 67fd6eb.

Files selected for processing: 1
  • scripts/usage-regression.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Improved the reliability of usage-meter checks by ensuring preference changes are saved and shared settings are reset successfully before checks proceed. This helps make test results more consistent.

The usage regression checks now wait for preference updates to succeed. The sign-in-again check clears the saved usage order before testing sign-in behavior.

Changes: Usage preference checks

Layer / File(s) Summary
Preference save and reset
scripts/usage-regression.ts
checkUsageMeters waits for the usageOrder preference save and asserts a 200 response. checkUsageSignInAgain clears usageOrder and asserts a 200 response before testing sign-in behavior.

Priority: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Possibly related PRs

  • devswha/ovis#2309: Adds the sign-in-again check that this change synchronizes with the usage-order preference.

Suggested reviewers: nahwan-kim

Merge Risk: Minimal · up to 67fd6

The synchronization changes are ready to merge with no established blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the main test change: making shared account order deterministic between usage checks.
Description check Passed The description includes the required Change and Validation sections. It explains the race condition, the resulting behavior, the affected checks, and the validation results with specific commands and…
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.
Full details: Description check

Explanation

The description includes the required Change and Validation sections. It explains the race condition, the resulting behavior, the affected checks, and the validation results with specific commands and outcomes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@devswha

devswha commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

Merging 67fd6eb (test-only). Ends the race in scripts/usage-regression.ts that failed the 0.4.20 release PR: checkUsageMeters moves an account and the app saves the shared usageOrder once the settings rest, so that save could land during checkUsageSignInAgain and put Antigravity first. Now checkUsageMeters waits for the exact PUT /api/preferences response carrying usageOrder (10 s bound, asserts 200) before its page closes, and checkUsageSignInAgain clears usageOrder first. No sleeps. The lane's evidence: 3/3 fail without, 3/3 pass with; full ui-contexts-regression 113 PASS; check fast green; omo APPROVE (test-only, so omo alone per policy). The merge pass read the diff.

@devswha
devswha merged commit 269e9ce into main Oct 29, 2026
11 checks passed
@devswha
devswha deleted the fix/usage-signin-check-order branch October 29, 2026 09:38
@devswha devswha mentioned this pull request Oct 29, 2026
5 tasks
devswha added a commit that referenced this pull request Oct 29, 2026
## Release 0.4.20

The release PR, prepared by step 1 of
[docs/development.md#releasing](https://github.com/devswha/ovis/blob/main/docs/development.md#releasing),
initially on main `bd676637a16471e8744d62c7311026ddb43a39eb` (#2335,
xterm 6), then merged with final-scope main
`ef482f2e66b3344658fb548fa1110744a92929c9` (#2338) and test-only
follow-up main `269e9ce19558b8d197959250075da56b25b9668f` (#2345):

- **Version:** `version` is 0.4.20 in `package.json` and
`herdr-plugin.toml`.
- **Changelog:** `bun scripts/changelog-fold.ts 0.4.20` initially folded
122 fragments into the 2026-10-29 section of `CHANGELOG.md`, linked
their PRs, and deleted the fragments. After merging main, the modified
`letta-native-chat.md` from #2338 was folded by hand with its current
wording and PR link. No other late fragment landed; `changelog.d` holds
only `README.md`. Four additional entries for external PRs without their
own fragments bring the section to 157 entries.
- Added 22 `by @login` credits across all 19 outside-contributor PRs in
the release range. Preserved the existing credit to @Yoonwoo-Ha for
#1634. See the complete ancestry-based audit below.
- **Release summaries:** en, ko, ja and zh each have 5 new, 5 improved
and 5 fixed lines, matching 0.4.19's shape. They include the xterm 6
improvement: terminal frames no longer mix old and new output. Every
English line is at most 80 characters.
- **Remote bundle:** `REMOTE_BUNDLE_VERSION` rises from 38 to 39 because
the bundle inputs changed since remote-v38.
- **Telemetry:** the guard confirms no Worker deploy or deployed
fingerprint update is needed.
- **iOS upload note:** CURRENT_PROJECT_VERSION raised to 3 for App and
OvisNotifications (last uploaded: 2, source: `docs/native-app.md:99`,
commit `54fdadc1c65da5d50a6afef411e3ed8f23b6c255`). Both targets inherit
project-level Debug and Release settings, and every
`CURRENT_PROJECT_VERSION` entry is 3. `app/store/ios.md` now records the
prepared build. This is the last documented upload, not a live App Store
Connect query; check for later uploads before uploading. The marketing
version remains 1.0.
- The changelog explicitly distinguishes delivery: removing WebKit's
form bar (#2109) requires the new iOS app build, while Korean
composition (#2307) comes with the PC update and needs no new iOS build.
The Korean-input summary says the same in all four languages, with no
change to list counts.

## Validation

- Final `dori heavy release-check -- bun run check fast`: passed, exit
0; workflow syntax, generated types/themes, typecheck, build and unit
suite (8,591 pass, 0 fail, 34 platform skips in 549 files). This is the
merged tree containing #2338, #2345, the contributor corrections and iOS
build 3.
- `bun test scripts/changelog-fold.test.ts
server/release-notes.test.ts`: 33 pass, 0 fail.
- `bun scripts/release-notes.ts 0.4.20`: passed, with all patch-note
lists and the full changelog.
- `bun scripts/release-guards.ts` and CI mode with `--base
ef482f2`: passed on the final merged
tree: "Release 0.4.20: remote bundle, telemetry Worker and release
metadata are in order."
- `bun scripts/release-guards.ts --release 0.4.20`: expected exit 1 only
because "remote-v39 is not published." The merge pass publishes it after
merging.

## Merge pass

**Do not merge before the owner's OK.**

- [ ] Merge only after the owner's OK and required checks pass.
- [ ] After merging, push `remote-v39` on the merged commit and wait for
the **Remote PC bundles** workflow to publish the manifest and all
archives.
- [ ] Then run **Release** on `main` with version `0.4.20`, without `v`.
The Release workflow creates the app tag; do not push it by hand.
- [ ] From this PR's merge until the Release run is done, merge nothing
touching `server/`, `shared/`, `bun.lock` or `patches/`.
- [ ] A changelog fragment merged after this PR must be moved into
0.4.20 by hand.

This lane stops at the open PR. No tag, workflow dispatch, merge or
telemetry deploy was performed.

**Completed release follow-up:** merged main `ef482f2e` including #2338
(`fix/letta-no-live-box`), folded its revised fragment into 0.4.20, and
retained the contributor-credit commit `184dc120` and iOS-build commit
`0ffa3d45`. The Letta summary already describes conversation support
without promising a live-terminal box, so it needs no change.

Merged test-only #2345 from main `269e9ce1`: the two usage browser
checks now wait for the earlier shared account-order save and start the
sign-in check from a cleared order. No product behavior or late fragment
was added; `changelog.d` still contains only `README.md`. The iOS
delivery clarification and resolved review thread are retained.

## Complete external-contributor audit

Checked every merged PR whose merge commit is in `git log
v0.4.19..origin/main`: 133 PRs through final-scope main `ef482f2e`, or
134 including test-only #2345 on `269e9ce1`, with 19 PRs by 12 external
non-bot authors. Both rescans found no additional external-author gaps;
#2345 is by the maintainer. Added the four missing entries: #2271 and
#2274 by @CharleoYang, #2290 by @DravenDou, and #2282 by @fivetaku. The
tab-reopening summary now includes the history-page improvement in all
four languages; list counts remain 5/5/5.

Full external PR list checked: #1911 @jjsteffen; #2068 @YuuuXie; #2072
@Noobear; #2087 @JJLiebig; #2145 @mattmarcin; #2176 @jpcarranza94; #2231
@philipprass-prog; #2235 @vuongnmhvn; #2270, #2271, #2274 @CharleoYang;
#2278 @jpcarranza94; #2282 @fivetaku; #2283, #2292, #2293 @YuuuXie;
#2301 @jpcarranza94; #2321 @kilhyeonjun. Every PR has a linked `by
@login` credit in 0.4.20.

---------

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
aNNdii added a commit to aNNdii/herdr-web-ui that referenced this pull request Oct 29, 2026
chore(sync): merge upstream/main (36 commits up to devswha#2345) into next
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