diff --git a/macos-bar/Sources/CCSBarApp/BarMenuView.swift b/macos-bar/Sources/CCSBarApp/BarMenuView.swift index 6bbddcb3..4c6b9df2 100644 --- a/macos-bar/Sources/CCSBarApp/BarMenuView.swift +++ b/macos-bar/Sources/CCSBarApp/BarMenuView.swift @@ -401,7 +401,7 @@ struct BarRowView: View { /// A native first-party subscription (Claude Code / Codex) — drives the /// distinct "subscription" badge + indigo provider chip. private var isNativeSubscription: Bool { - BarFormatting.isNativeSubscription(provider: row.provider) + BarFormatting.isNativeSubscription(row) } var body: some View { diff --git a/macos-bar/Sources/CCSBarCheck/main.swift b/macos-bar/Sources/CCSBarCheck/main.swift index f4379124..f11e823c 100644 --- a/macos-bar/Sources/CCSBarCheck/main.swift +++ b/macos-bar/Sources/CCSBarCheck/main.swift @@ -906,13 +906,19 @@ check( BarFormatting.providerLabel("codex") == "Codex", "native: providerLabel maps codex -> 'Codex'") check(BarFormatting.providerLabel("agy") == "agy", "native: providerLabel passes CLIProxy keys through") check( - BarFormatting.isNativeSubscription(provider: "claude-code"), + BarFormatting.isNativeSubscription( + BarSummaryRow(accountId: "claude-code", provider: "claude-code")), "native: claude-code is a native subscription") check( - BarFormatting.isNativeSubscription(provider: "codex"), "native: codex is a native subscription") + BarFormatting.isNativeSubscription(BarSummaryRow(accountId: "codex", provider: "codex")), + "native: codex is a native subscription") check( - !BarFormatting.isNativeSubscription(provider: "agy"), + !BarFormatting.isNativeSubscription(BarSummaryRow(accountId: "agy-a", provider: "agy")), "native: agy (CLIProxy pool) is NOT a native subscription") +check( + !BarFormatting.isNativeSubscription( + BarSummaryRow(accountId: "pool-codex-oauth-1", provider: "codex")), + "native: codex CLIProxy pool row is NOT a native subscription") // (N6) Grouping: a mixed list splits into native subscriptions (top) and pool // accounts, preserving backend order within each group. @@ -922,17 +928,19 @@ do { BarSummaryRow( accountId: "claude-code", provider: "claude-code", quotaPercentage: 40, quotaStatus: "ok"), BarSummaryRow(accountId: "pool-b", provider: "ghcp", quotaStatus: "unsupported"), + BarSummaryRow( + accountId: "pool-codex-oauth-1", provider: "codex", quotaPercentage: 65, quotaStatus: "ok"), BarSummaryRow(accountId: "codex", provider: "codex", quotaPercentage: 52, quotaStatus: "ok"), ] let parts = BarFormatting.partitionSubscriptions(mixed) check(parts.subscriptions.count == 2, "native: partition pulls 2 subscriptions") - check(parts.pool.count == 2, "native: partition leaves 2 pool accounts") + check(parts.pool.count == 3, "native: partition leaves 3 pool accounts") check( parts.subscriptions.map { $0.provider } == ["claude-code", "codex"], "native: subscriptions keep backend order (claude-code, codex)") check( - parts.pool.map { $0.provider } == ["agy", "ghcp"], - "native: pool keeps backend order (agy, ghcp)") + parts.pool.map { $0.id } == ["agy:pool-a", "ghcp:pool-b", "codex:pool-codex-oauth-1"], + "native: pool keeps backend order and retains CLIProxy codex row") } // (N7) Pool-only list does NOT get split (single "Accounts" header path): both diff --git a/macos-bar/Sources/CCSBarCore/BarFormatting.swift b/macos-bar/Sources/CCSBarCore/BarFormatting.swift index 57ecd896..e996c9bf 100644 --- a/macos-bar/Sources/CCSBarCore/BarFormatting.swift +++ b/macos-bar/Sources/CCSBarCore/BarFormatting.swift @@ -165,8 +165,9 @@ public enum BarFormatting { /// Code or Codex plan) rather than a CLIProxy-managed OAuth pool account. Drives /// the "Subscriptions" grouping + badge so a user reads "this is MY plan quota", /// not one of the rotating pool credentials. - public static func isNativeSubscription(provider: String) -> Bool { - provider == "claude-code" || provider == "codex" + public static func isNativeSubscription(_ row: BarSummaryRow) -> Bool { + (row.provider == "claude-code" && row.accountId == "claude-code") + || (row.provider == "codex" && row.accountId == "codex") } /// Friendly product label for a provider key. Native subscription keys read as @@ -189,7 +190,7 @@ public enum BarFormatting { var subs: [BarSummaryRow] = [] var pool: [BarSummaryRow] = [] for row in rows { - if isNativeSubscription(provider: row.provider) { + if isNativeSubscription(row) { subs.append(row) } else { pool.append(row)