Skip to content

feat(deepseek): Safari web-auth import, balance consumption & per-model cost - #2938

Open
jky1314 wants to merge 2 commits into
steipete:mainfrom
jky1314:feat/deepseek-safari-cost
Open

feat(deepseek): Safari web-auth import, balance consumption & per-model cost#2938
jky1314 wants to merge 2 commits into
steipete:mainfrom
jky1314:feat/deepseek-safari-cost

Conversation

@jky1314

@jky1314 jky1314 commented Aug 14, 2026

Copy link
Copy Markdown

Summary

Three DeepSeek improvements in one PR:

1. Safari web-auth token import

DeepSeekPlatformTokenImporter only scanned Chromium leveldb (browsers: [.chrome]). This ports Factory's WebKit SQLite3 reader so platform.deepseek.com's userToken can be imported from Safari local storage (macOS only). The Chromium path is kept; candidates from both sources are merged.

  • Safari data: ~/Library/Containers/com.apple.Safari/.../WebsiteData/Default/<origin>/LocalStorage/localstorage.sqlite3 (requires Full Disk Access)
  • Iterates origin files (newer Safari uses hashed dirs, not domain-named dirs)
  • Safari container is only read when the user explicitly selects a safari: profile; routine refreshes stay Chrome-only (privacy opt-in)

2. API-key balance consumption tracking

DeepSeek's API has no usage endpoint, so API-key mode can only see the balance. New DeepSeekBalanceHistoryStore persists daily first/last balance snapshots (90-day rolling window, per-account isolated):

  • Consumption = adjacent snapshot delta
  • Balance increases are treated as recharges (reset baseline, no negative spend)
  • Cross-day recharge handled
  • DeepSeekUsageSnapshot rows append Today −¥x · Total −¥x
  • Consumption is derived BEFORE the fresh sample is recorded, so a recharge baseline is never overwritten by the following refresh
  • History is partitioned by currency (USD/CNY never mix) and scoped to the selected profile in web-only mode (no shared "default" key)
  • Account keys are namespaced SHA-256 digests (com.steipete.codexbar.deepseek-balance-history.v1 / .profile.v1), never raw key fragments — mirrors the existing DeepSeekSettingsReader.profileScope pattern

3. Per-model cost breakdown (web mode)

The platform usage/cost endpoint returns per-model totals, but DeepSeekUsageSummary discarded them. Added modelCosts: [DeepSeekModelCost] aggregated in buildBreakdowns and rendered in the Detailed usage section. Also added app-layer localization for DeepSeek detail rows and chart title/unit (zh-Hans) and Safari-aware setup copy (docs/deepseek.md, menu hints).

Real behavior proof

Credential-boundary proof (digest contains no API-key fragments):

API key (input): sk-9f8e7d6c5b4a39281706f5e4d3c2b1a0
Account key (digest): v1:92ca2c913382291c91804cf0ce24172ee0613afcd79a2ebe61b8b78609d39249
digest 包含 'sk-9f8e7d6c...'? false
digest 包含 'c2b1a0'? false
digest 包含 '9f8e7d6c'? false

Consumption-order proof (fresh test run, recharge baseline survives the next refresh):

Test Case '-[DeepSeekBalanceHistoryStoreTests testRechargeResetsBaseline]' passed
Test Case '-[DeepSeekBalanceHistoryStoreTests testRechargeTodayStillReportsPostRechargeSpend]' passed
Test Case '-[DeepSeekBalanceHistoryStoreTests testCurrenciesArePartitionedPerAccountKey]' passed
Test Case '-[DeepSeekBalanceHistoryStoreTests testCurrencySwitchWithoutHistoryStartsFresh]' passed

Profile-scope proof (web-only history no longer collapses to "default"):

Test Case 'web-only balance history is scoped to the selected profile' passed
Test Case 'profile scoped balance keys differ from api keys and default' passed

Safari opt-in proof:

Test Case 'safari storage is only read after explicit opt-in' passed

Chart localization proof (zh-Hans catalog now covers chart title/unit):

Test Case 'deepseek chart metadata is localized with the detail rows' passed
✔ Suite LocalizationLanguageCatalogTests passed (30 tests, all 21 language catalogs synced)

Full suite: 152 related tests pass (DeepSeek + localization + menu-card suites), release build verified locally.

Notes

  • Per-model costs require web-auth mode; API-key mode remains balance-delta only (API limitation)
  • Safari import requires Full Disk Access for the app (macOS TCC); docs and menu copy now state this

@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 16, 2026, 2:36 AM ET / 06:36 UTC.

ClawSweeper review

What this changes

The PR adds opt-in Safari DeepSeek session import, local balance-spend estimates, per-model web cost details, and related menu localization and documentation.

Merge readiness

Blocked until real behavior proof from a real setup is added - 8 items remain

Keep open: the Safari reader is gated correctly, but a Safari-only user cannot reach that gate because no Safari profile is discoverable before one is already selected. The branch also retains unrelated Traditional Chinese translation removals and needs real after-fix runtime proof. Likely related people: Peter Steinberger (medium confidence).

Priority: P2
Reviewed head: f952d8c635002469a9796544407607e5c2dce076

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The PR has substantial implementation and test work, but blocking correctness findings and test-only proof leave it below merge readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body provides test and assertion output only; add redacted after-fix proof from a real Safari-enabled setup showing the explicit selection and resulting menu data, without exposing tokens or private paths. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 3 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body provides test and assertion output only; add redacted after-fix proof from a real Safari-enabled setup showing the explicit selection and resulting menu data, without exposing tokens or private paths. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Safari discovery is circular: The PR only enables Safari import when the saved selected profile already begins with safari:, but the existing picker builds its options solely from previously resolved profiles; a Safari-only user therefore has no in-product way to create that first selection.
Picker contract: Current main exposes only resolved profiles and labels the selector as a Chrome profile, confirming that it cannot bootstrap the proposed Safari-only path.
Unrelated localization regression: The PR patch removes 49 unrelated zh-Hant translations; current main contains those dynamic Codex/OpenAI error and status strings, so merging would regress them to fallback English.
Findings 3 actionable findings [P1] Expose a reachable Safari discovery choice
[P2] Keep Safari testing off host browser storage
[P2] Restore unrelated zh-Hant catalog entries
Security None None.

How this fits together

CodexBar resolves DeepSeek API keys and browser sessions into usage snapshots, then renders balance and detailed usage in its menu-bar card. This PR extends the browser-session input and adds locally derived and per-model usage outputs.

flowchart LR
A[API key or web session] --> B[DeepSeek data fetch]
C[Chrome or Safari storage] --> B
B --> D[Usage normalization]
D --> E[Balance history]
D --> F[Model cost details]
E --> G[Menu-bar usage card]
F --> G
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body provides test and assertion output only; add redacted after-fix proof from a real Safari-enabled setup showing the explicit selection and resulting menu data, without exposing tokens or private paths. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Expose a reachable Safari discovery choice (P1) - This condition enables Safari only after a safari: profile has already been saved. Since the picker receives only profiles resolved by this same call, a Safari-only user gets no Safari option and cannot ever create that selection. Add an explicit user-initiated Safari discovery/opt-in path before relying on the saved profile prefix.
  • Keep Safari testing off host browser storage (P2) - The opted-in half of this test invokes the live Safari reader against the test machine’s Safari container and accepts either a Safari result or no Safari result, so it is host-dependent and does not verify parsing. Inject the Safari storage reader or filesystem dependency and assert the explicit opt-in behavior using fixtures.
  • Restore unrelated zh-Hant catalog entries (P2) - This catalog change removes unrelated Traditional Chinese dynamic status and error translations while adding DeepSeek strings. Current main still provides those translations, so landing this deletion regresses existing UI to fallback English; retain the unrelated entries and make the catalog update additive.
  • Resolve merge risk (P1) - Merging as written advertises Safari support while leaving Safari-only users without an in-product opt-in or discovery path.
  • Resolve merge risk (P2) - The branch removes unrelated zh-Hant translations, regressing existing localized status and error text.
  • Resolve merge risk (P1) - Safari storage is a sensitive local-session boundary; unit output does not prove the explicit opt-in flow works in a real signed-in setup.
  • Complete next step (P2) - The contributor must address the three concrete findings and provide real behavior proof before the PR can be merged.

Findings

  • [P1] Expose a reachable Safari discovery choice — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekPlatformTokenImporter.swift:70-74
  • [P2] Keep Safari testing off host browser storage — Tests/CodexBarTests/DeepSeekPlatformTokenImporterTests.swift:84-88
  • [P2] Restore unrelated zh-Hant catalog entries — Sources/CodexBar/Resources/zh-Hant.lproj/Localizable.strings:1116-1117
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 37 files; +1,328 / -102 lines The PR combines browser credential discovery, persisted history, provider rendering, documentation, tests, and localization catalogs.

Merge-risk options

Maintainer options:

  1. Repair the reachable opt-in flow (recommended)
    Add a user-initiated Safari discovery action before Safari can be selected, restore the unrelated zh-Hant strings, and cover both paths without reading host browser storage in tests.
  2. Narrow the PR to non-Safari work
    Remove the Safari reader and Safari-facing copy if a safe discoverability flow is not ready, leaving the independent balance and model-cost work for separate review.

Technical review

Best possible solution:

Add a visible user-initiated Safari discovery choice that preserves Chrome-only background refreshes, restore unrelated zh-Hant entries, isolate the Safari reader behind a test seam, and provide redacted fresh-bundle proof.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: start with only a Safari DeepSeek session and no saved safari: profile; the resolver excludes Safari, returns no Safari profile, and the existing picker offers no way to select one.

Is this the best way to solve the issue?

No. The privacy gate is appropriate, but it must be preceded by a visible user-initiated Safari discovery path; otherwise the advertised capability is unreachable.

Full review comments:

  • [P1] Expose a reachable Safari discovery choice — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekPlatformTokenImporter.swift:70-74
    This condition enables Safari only after a safari: profile has already been saved. Since the picker receives only profiles resolved by this same call, a Safari-only user gets no Safari option and cannot ever create that selection. Add an explicit user-initiated Safari discovery/opt-in path before relying on the saved profile prefix.
    Confidence: 0.99
  • [P2] Keep Safari testing off host browser storage — Tests/CodexBarTests/DeepSeekPlatformTokenImporterTests.swift:84-88
    The opted-in half of this test invokes the live Safari reader against the test machine’s Safari container and accepts either a Safari result or no Safari result, so it is host-dependent and does not verify parsing. Inject the Safari storage reader or filesystem dependency and assert the explicit opt-in behavior using fixtures.
    Confidence: 0.96
  • [P2] Restore unrelated zh-Hant catalog entries — Sources/CodexBar/Resources/zh-Hant.lproj/Localizable.strings:1116-1117
    This catalog change removes unrelated Traditional Chinese dynamic status and error translations while adding DeepSeek strings. Current main still provides those translations, so landing this deletion regresses existing UI to fallback English; retain the unrelated entries and make the catalog update additive.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b9ccac302b28.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The patch removes unrelated existing zh-Hant translations and would alter localized behavior for current users.

Label justifications:

  • P2: This is a bounded provider enhancement with merge-blocking correctness gaps but no evidence of an urgent service outage.
  • merge-risk: 🚨 compatibility: The patch removes unrelated existing zh-Hant translations and would alter localized behavior for current users.
  • merge-risk: 🚨 security-boundary: The patch reads protected Safari web-session storage and must retain a reachable, explicit user opt-in boundary.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides test and assertion output only; add redacted after-fix proof from a real Safari-enabled setup showing the explicit selection and resulting menu data, without exposing tokens or private paths. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the DeepSeek automatic-session and profile-selection code to the baseline commit in the available history. (role: recent area contributor; confidence: medium; commits: 0e453c4a5b2a; files: Sources/CodexBarCore/Providers/DeepSeek/DeepSeekPlatformTokenImporter.swift, Sources/CodexBar/Providers/DeepSeek/DeepSeekProviderImplementation.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a user-reachable, explicit Safari discovery flow and regression coverage.
  • Restore unrelated zh-Hant translations and isolate Safari tests from host browser storage.
  • Post redacted real-setup proof in the PR body; if review does not refresh, ask a maintainer to comment @clawsweeper re-review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-08-14T19:23:55.444Z sha ce266b7 :: needs real behavior proof before merge. :: [P1] Hash the API key before persisting the balance account key | [P2] Document the Safari authorization path
  • reviewed 2026-08-14T19:43:20.990Z sha ae5acc3 :: needs real behavior proof before merge. :: [P1] Gate Safari storage reads behind an explicit opt-in | [P1] Preserve the recharge baseline across later refreshes | [P1] Scope web-only balance history to the selected session | [P2] Partition persisted history when the selected currency changes | [P2] Localize the chart metadata with the detail rows | [P2] Replace the scanner-triggering API-key-shaped fixture
  • reviewed 2026-08-14T19:55:10.576Z sha 8273bba :: needs real behavior proof before merge. :: [P1] Calculate consumption before recording the refresh | [P1] Gate Safari storage reads behind explicit opt-in | [P1] Scope browser-only history to the selected profile | [P1] Define the fallback digest input | [P2] Partition history when the selected currency changes | [P2] Localize the chart metadata with the detail rows
  • reviewed 2026-08-14T20:17:02.348Z sha 5458091 :: needs real behavior proof before merge. :: [P1] Calculate consumption before recording the refresh | [P1] Gate Safari storage reads behind explicit opt-in | [P1] Scope web-only balance history to the selected profile | [P2] Partition persisted history when the selected currency changes | [P2] Localize the chart metadata with the detail rows
  • reviewed 2026-08-16T05:27:54.646Z sha f952d8c :: needs real behavior proof before merge. :: [P1] Expose an explicit Safari discovery path | [P2] Keep unrelated zh-Hant translations
  • reviewed 2026-08-16T05:31:47.929Z sha f952d8c :: needs real behavior proof before merge. :: [P1] Expose a reachable Safari discovery choice | [P2] Restore unrelated zh-Hant translations | [P2] Keep the Safari unit test off host browser storage

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce266b70fe

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +189 to +193
Self.balanceHistoryStore.record(
balance: balance.totalBalance,
currency: balance.currency,
accountKey: accountKey,
at: now)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Compute consumption before replacing the stored balance

After a recharge, every production refresh records the current balance before calculating consumption. For example, after recording a recharge at 200, a later refresh at 195 overwrites that day's lastBalance with 195; consumptionSummary then uses 195 as both the recharge baseline and current balance, so both Today and Total report zero instead of 5. The tests bypass this ordering by calling consumptionSummary without first recording their final balance.

Useful? React with 👍 / 👎.

let log: @Sendable (String) -> Void = { message in logger?("[deepseek-storage] \(message)") }

// Safari stores localStorage in WebKit sqlite files; Chromium browsers use leveldb.
let safariTokens = Self.importSafariTokens(logger: log)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate Safari scanning behind an explicit browser override

Automatic DeepSeek session resolution now reads the protected Safari container before checking Chrome even when the user has not selected Safari. On macOS, an ordinary background refresh can therefore initiate Safari-data/Full Disk Access permission handling; keep Chrome as the default and invoke the Safari reader only through an explicit browser selection or opt-in.

AGENTS.md reference: AGENTS.md:L48-L48

Useful? React with 👍 / 👎.

Comment on lines +175 to +176
guard let apiKey else { return "default" }
return String(apiKey.prefix(8)) + ":" + String(apiKey.suffix(4))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Key browser-only histories by the selected profile

In web-only mode there is no API key, so every Safari or Chrome DeepSeek profile is assigned the same default history key. If a user switches between two platform profiles, the second account's balance is compared with the first account's snapshots and displayed as a recharge or spend; derive the key from the selected platform profile or token when the API key is absent.

Useful? React with 👍 / 👎.

/// 90-day window.
public func record(
balance: Double,
currency: String,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Partition balance history by currency

The currency argument is accepted but never persisted or included in the history key. When the existing balance parser changes its selected wallet—for example, funded USD reaches zero and it falls back to a funded CNY balance—the store subtracts the prior USD amount from the current CNY amount and formats that result with the current symbol. Reset or partition records when the selected currency changes.

Useful? React with 👍 / 👎.

return try? ProviderDetailSection(
title: title,
rows: rows,
chart: section.chart)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Localize the chart metadata too

The helper adds localized mappings for Daily tokens and tokens, but it passes section.chart through unchanged. Consequently, the newly localized DeepSeek details still render the chart heading and unit in English in zh-Hans; rebuild the chart with mapped title and unit values.

Useful? React with 👍 / 👎.

@jky1314

jky1314 commented Aug 14, 2026

Copy link
Copy Markdown
Author

@clawsweeper re-review — addressed P1 (API key now hashed via namespaced SHA-256 digest, with persistence regression tests) and P2 (Safari + Full Disk Access documented in docs/deepseek.md and menu copy). Real behavior proof added to the PR body (digest verification output + fresh test run).

@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@gitguardian

gitguardian Bot commented Aug 14, 2026

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 14, 2026
…el cost

Squashed from 3 commits: original feature, hashed account keys, credential-safe test fixtures (GitGuardian-clean).
@jky1314
jky1314 force-pushed the feat/deepseek-safari-cost branch from 8273bba to 5458091 Compare August 14, 2026 20:13
… opt-in, profile-scoped history, currency partitioning, chart localization

- Calculate consumption BEFORE recording the refresh so recharge baselines are
  never overwritten by the following refresh (both spend values stay correct)
- Gate Safari storage reads behind explicit opt-in: routine refreshes stay
  Chrome-only; Safari container is read only when a safari: profile is selected
- Scope web-only balance history to the selected profile: nil API key no longer
  collapses every browser account into the shared "default" history key
- Partition persisted balance history by currency so USD/CNY wallet switches
  never subtract unrelated balances or mix symbols
- Localize DeepSeek chart title/unit/point labels through the same label map
  as the detail rows (zh-Hans no longer shows English chart headers)
- Sync the 6 new catalog keys across all 21 language directories (en/zh-Hans
  were updated while the rest drifted, failing the catalog consistency tests)
- Regression tests: refresh-after-recharge spend, Safari opt-in flag, profile
  key isolation, USD/CNY partitioning, chart localization
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@jky1314

jky1314 commented Aug 16, 2026

Copy link
Copy Markdown
Author

@clawsweeper re-review — all 5 findings addressed:

P1-1 consumption order: consumption is now derived BEFORE recording the fresh sample, so a recharge baseline is never overwritten by the following refresh. Regression: testRechargeResetsBaseline + new currency tests.

P1-2 Safari opt-in: importTokens now takes includeSafari:; automatic resolution only reads Safari when a safari: profile is explicitly selected (routine refreshes stay Chrome-only). Regression: safari storage is only read after explicit opt-in.

P1-3 web-only history scope: balanceAccountKey(apiKey:profileID:) scopes web-only (no API key) history by the selected profile — no more shared "default" key across accounts. Regressions: web-only balance history is scoped to the selected profile + profile scoped balance keys differ from api keys and default.

P2-4 currency partitioning: DeepSeekBalanceHistoryStore keys history by accountKey|CURRENCY, so USD→CNY wallet switches never subtract unrelated balances. Regressions: testCurrenciesArePartitionedPerAccountKey + testCurrencySwitchWithoutHistoryStartsFresh.

P2-5 chart localization: deepSeekLocalizedDetails now rebuilds the chart through the same label map (title/unit/point labels). Regression: deepseek chart metadata is localized with the detail rows.

Also synced the 6 new catalog keys across all 21 language directories (en/zh-Hans had drifted, failing LocalizationLanguageCatalogTests).

Local verification: 152 related tests pass (DeepSeek + localization + menu-card suites). PR body updated with per-finding behavior proof.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. and removed merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant