Deduplicate test fixtures and prune subsumed tests - #1163
Merged
Conversation
Second simplification pass after #1143, covering the suites that pass did not touch: consolidates duplicated fixtures (Cursor JWT/SQLite fakes, OpenCode stub, BlockingParser, sequence runtimes), parameterizes near-identical test clusters, and removes tests whose behavior is verified elsewhere or that restated the implementation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
liaomingxin
added a commit
to liaomingxin/openusage
that referenced
this pull request
Aug 26, 2026
Brings in the 8 upstream commits behind v0.7.10-beta.3: multi-account Claude (robinebers#1164), sub-1% session countdown (robinebers#1167, WidgetData.isSessionWindow → sessionStartSignal), Codex Session on by default (robinebers#1165), GLM 5.3 pricing (robinebers#1171), test-fixture dedup (robinebers#1163), plus docs/policy chores. Conflicts and how they were resolved (both sides kept everywhere): - Sources/OpenUsage/Services/ProviderAccountAssembly.swift — kept both the fork's Codex extra cards (CodexExtraCard, extraCodexCards, the ~/.cli-proxy-api discovery, mergedObservations/mergedSources) and upstream's Claude Desktop organization discovery (ClaudeAccountCard, claudeCards, allowsUnattributedPiUsage, the bare "claude" identity key rewritten to the org record id). Restructured the core make() so it appends the extra-Codex observations, then runs the Claude desktop-org discovery, then reconciles exactly once per pass through mergedObservations, then builds BOTH card lists — upstream's two early returns are now conditions on the discovery block, so a skipped/legacy Claude path still emits the Codex extra cards. Kept the fork's cold-login-shell guard (!families.isEmpty || !extraCodex.isEmpty) and the extra-Codex read in make(defaults:waitsForLoginShell:). init takes both extraCodexCards and claudeCards with defaults so upstream and fork tests both compile. 361 LOC, no split needed. - Sources/OpenUsage/Providers/ProviderCatalog.swift — one make(defaults:extraCodexCards:claudeCards:claudeIdentityKeys:): upstream's Claude card list first, then CodexProvider() followed by the fork's extra Codex cards, then Cursor and the alphabetical tail with Kimi after Grok. Comment updated to mention both. - Sources/OpenUsage/App/AppContainer.swift — call site passes all three arguments (extraCodexCards, claudeCards, claudeIdentityKeys). - Sources/OpenUsage/Services/UsageReader.swift — same three arguments; kept upstream's placement of ProviderEnablementStore(defaults:) after the registry is built. - docs/menu-bar.md — default-star sentence lists both upstream's Codex Session/Weekly and the fork's Kimi Session/Weekly. Sanity-checked DefaultLayout.swift (auto-merged): kimi rows still in metricIDs/pinnedMetricIDs/expandedMetricIDs, codex.session now in metricIDs and pinnedMetricIDs. Verified: swift build and swift build --build-tests both succeed; ProviderAccountAssembly / CodexMultiAccount / ClaudeDesktopAuthStore / CodexExtraCardCatalog tests pass (24/24).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TL;DR — Second test-simplification pass after #1143, focused on the suites that pass didn't touch: consolidates duplicated test fixtures, parameterizes near-identical test clusters, and removes tests whose behavior is already verified elsewhere. Net −360 lines (724 deleted, 364 added) with the full suite still green.
What was happening
BlockingParserexisted twice (integer and Claude-entry variants); andTogglingProviderRuntime/ a privateSequenceProviderRuntimewere the same idea implemented twice.What this changes
makeCursorJWTandKeyValueSQLitetoTestSupport.swift; the four Cursor suites now use them.OpenCodeFakeSQLite) andopenCodeRowbuilder between the scanner and provider suites.TogglingProviderRuntimewith one sharedSequenceProviderRuntime(different snapshot per refresh, call-counting); makesBlockingParsergeneric over the item type.makeProvider/makeAuthStorehelpers in ClaudeDesktopAuthStoreTests and amakeCloudCodeProviderhelper in AntigravityProviderTests, collapsing repeated construction boilerplate.hasLocalCredentialspairs.$130rounding case moved intoMetricFormatterTestswhere the rule lives.Heads-up
Tests/.Tests
swift build --build-tests— clean (only pre-existing warnings).swift test— 1,173 tests passed, 0 failures, 3 skipped (pre-existing env-gated live/parity tests), plus the CLI and swift-testing bundles. Baseline run before the changes was also green.🤖 Generated with Claude Code
Note
Low Risk
Only test code under
Tests/OpenUsageTestsis modified; behavior is unchanged and risk is limited to possible loss of unique test coverage, which the PR explicitly addresses by consolidating rather than deleting scenarios.Overview
This PR is a test-only cleanup (~−360 lines): no production code changes.
Shared fixtures —
makeCursorJWT,KeyValueSQLite,SequenceProviderRuntime(replacingTogglingProviderRuntime), and a genericBlockingParserland inTestSupport.swift/JSONLScannerTestSupport.swift. Cursor suites drop four duplicate JWT/SQLite copies; OpenCode sharesopenCodeRowandOpenCodeFakeSQLitebetween scanner and provider tests.Less boilerplate —
makeCloudCodeProviderin Antigravity provider tests andmakeAuthStore/makeProvider/cliCredentialsin Claude desktop auth tests replace repeated ~25-line setups.Consolidated cases — Four Grok Bot optional-endpoint tests become one table-driven test; Grok credits absent-field tests, Devin HTTPS-vs-HTTP TOML tests, and OpenCode
hasLocalCredentialspositive/empty paths are merged. ShareCard condensing is asserted on a fixed hand-built fixture instead of re-implementing the production rule in the test.Removed redundancy — Tests dropped where coverage already exists (e.g. Antigravity pins exact-set, MenuBar compaction →
MetricFormatterTestsfor$130tray rounding, duplicate Claude revoked-CLI fallback, LocalUsageAPI limits 404, and others noted in the PR description).The full suite remains green (1,173 tests).
Reviewed by Cursor Bugbot for commit d0771a3. Bugbot is set up for automated code reviews on this repo. Configure here.