You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Joob1n (via GitHub)" <gi...@apache.org> on 2026/09/18 13:17:17 UTC

[PR] feat(desktop): show Command Code GO account usage in the connection settings [maka]

Joob1n opened a new pull request, #5489:
URL: https://github.com/apache/maka/pull/5489

   ## What
   
   Adds a read-only **account-usage** section to a connection's settings page, and the plumbing that gets the numbers there. First (and only) provider wired: **Command Code GO**.
   
   The page shows the account/plan line, the stat tiles (requests / success rate / cost / tokens), then one bar per quota window — the 5-hour, weekly and plan-derived monthly allowances. Every block is optional: a provider that reports no stats, or two windows instead of three, simply yields fewer blocks, never a zero placeholder.
   
   ## Why it is Host-side
   
   The renderer never holds the API key — `queryCredential` returns only a `configured` status, and the key lives in the runtime host. So the read is a new Host query operation, `connection.usage.read`: read-only (nothing is committed, so the ticket is simply spent), addressed by connection id, resolving the credential the same way `connection.test.run` does.
   
   ## The generic model
   
   `@maka/core/connection-usage` is provider-agnostic: a **list** of `UsageWindow`s (`{ id, label?, used, cap, unit, resetsAt?, unlimited? }`) plus optional `UsageStats`. A window is the unit — the 5-hour, weekly and monthly allowances are all just windows, told apart by `id` (with a `label` fallback for one the card has no copy for). `fetchConnectionUsage` dispatches per provider; a new provider is one mapper function, and the card is unchanged.
   
   - `commandcode-go` maps four endpoints (`/alpha/whoami`, `/alpha/usage/summary`, `/alpha/billing/credits`, `/alpha/billing/subscriptions`), degrading per endpoint so one failure does not sink the report.
   - The **monthly** window's cap is the plan's allowance (the billing endpoint reports the monthly *remaining* balance, not the total): `used = cap − remaining`. It is omitted when the plan is unknown, rather than rendering `limit − 0` as a confident "100% used".
   - Only GO is wired; every other provider answers `unavailable: unsupported` and the section does not render. `providerReportsUsage` is the single source of truth for both the mapping and the section's visibility (deliberately **not** the Provider-API `commandcode` plan — no key here has exercised it, and inferring its windows could mis-report).
   
   ## Protocol
   
   The epoch moves **163 → 164**. A new operation is observable on the wire, so it is not eligible for a compatible-change declaration (per `packages/runtime-host/protocol-compatible-changes/README.md`).
   
   ## Files
   
   - `packages/core/src/connection-usage.ts` (model), `packages/core/src/provider-auth.ts` (`read_usage` action).
   - `packages/runtime/src/connection-usage.ts` (the GO mapper).
   - `packages/runtime-host/src/protocol/connection-effects.ts` (`connection.usage.read` + codecs), `.../protocol/index.ts` (epoch).
   - `packages/runtime-host/src/server/connection-effect-coordinator.ts` (handler).
   - `packages/storage/src/runtime-policy/{operations,coordinator}.ts`, `runtime-policy-stores.ts` (begin/complete ticket).
   - `apps/desktop/src/main/*` (client + `connections:usage` IPC), `src/preload/*` (bridge).
   - `apps/desktop/src/renderer/features/connection-settings/connection-usage-card.tsx` (section, feature-side, no legacy imports) + `settings-provider-copy.ts` (three locales).
   
   ## Tests
   
   - `packages/runtime/src/__tests__/connection-usage.test.ts` — the GO mapping against the real response shapes: window set, plan-derived monthly, missing window omitted (not zeroed), unknown plan omits monthly, per-endpoint degradation, no-credential, unsupported.
   - `packages/runtime-host/src/__tests__/connection-effects-protocol.test.ts` — the report codec round-trips and rejects negative amounts, unknown units and unknown reasons.
   
   ## Not in scope
   
   Other providers, a ring/percentage headline, purchased/free credit tiles (deliberately excluded), and the browser-login-adjacent UX.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] feat(desktop): show Command Code GO account usage in the connection settings [maka]

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #5489:
URL: https://github.com/apache/maka/pull/5489#discussion_r4047921654


##########
packages/runtime/src/connection-usage.ts:
##########
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Provider account usage, normalized into `@maka/core/connection-usage`.
+ *
+ * The dispatch is one `switch`: each provider that reports usage owns a mapper
+ * from its own endpoints to the shared window list, and every other provider
+ * answers `unavailable: unsupported`. The card that renders the result never
+ * learns the provider — only the windows and stats this produces.
+ */
+import type { ProviderType } from '@maka/core/llm-connections';
+import type {
+  ConnectionUsageReport,
+  ConnectionUsageResult,
+  UsageStats,
+  UsageWindow,
+} from '@maka/core/connection-usage';
+import { providerReportsUsage } from '@maka/core/connection-usage';
+import { commandCodeCliHeaders } from './commandcode-cli-language-model.js';
+import { fetchForConnectionEffect, type ConnectionEffectFetch } from './connection-effect-fetch.js';
+
+export interface ConnectionUsageInput {
+  readonly providerType: ProviderType;
+  readonly apiKey: string | undefined;
+  readonly baseUrl: string | undefined;
+  /** Injected for tests; production passes nothing and the global fetch is used. */
+  readonly fetch?: ConnectionEffectFetch;
+}
+
+export async function fetchConnectionUsage(
+  input: ConnectionUsageInput,
+): Promise<ConnectionUsageResult> {
+  if (!providerReportsUsage(input.providerType)) {
+    return { kind: 'unavailable', reason: 'unsupported' };
+  }
+  switch (input.providerType) {
+    case 'commandcode-go':
+      return fetchCommandCodeGoUsage(input);
+    // `commandcode` (the Provider-API plan) is deliberately NOT wired yet: its
+    // usage lives behind the same `/alpha/*` endpoints, but only a GO-tier key
+    // has been verified against them. Wiring it from inference alone could
+    // mis-report a plan's windows, which is worse than showing nothing.
+    default:
+      return { kind: 'unavailable', reason: 'unsupported' };
+  }
+}
+
+/**
+ * Command Code's account endpoints, fetched together with per-endpoint
+ * degradation: whichever endpoints answer, their facts land in the report, and
+ * only a total failure (no credential, or nothing answered) becomes
+ * `unavailable`.
+ */
+async function fetchCommandCodeGoUsage(
+  input: ConnectionUsageInput,
+): Promise<ConnectionUsageResult> {
+  if (!input.apiKey) return { kind: 'unavailable', reason: 'no-credential' };
+  const base = (input.baseUrl ?? 'https://api.commandcode.ai').replace(/\/+$/u, '');
+  const headers = commandCodeCliHeaders(input.apiKey, 'maka');
+  const get = async (path: string): Promise<Record<string, unknown> | undefined> => {
+    try {
+      const response = await fetchForConnectionEffect(input.fetch, `${base}${path}`, { headers });
+      if (!response.ok) return undefined;

Review Comment:
   [P2] A rejected credential is reported as a network problem, on the one screen whose job is managing that credential.
   
   Every non-2xx response becomes `undefined` here, and the `catch` below does the same for transport errors. When all four requests come back `undefined` the caller returns `{ kind: 'unavailable', reason: 'network' }`. So a `401` from an expired or revoked key, a `403` from a key without the right scope, and a genuinely unreachable host are the same value by the time anyone can act on it.
   
   It is flattened a second time downstream. `connection-usage-card.tsx:114` renders `result.reason === 'unsupported' ? copy.unsupported : copy.unavailable`, so `no-credential` and `network` both print "No usage data is available right now." (`connection-usage-card.tsx:72` also manufactures `reason: 'network'` in its own catch.) The three-value union computed carefully in `packages/runtime` reaches the user as two outcomes.
   
   The result for a user whose key expired: the connection settings page shows "No usage data is available right now" and nothing anywhere points at the credential — on the page they would use to fix it.
   
   The vocabulary for this already exists next door: the connection *test* path distinguishes `auth` from `network` from `timeout` (`settings-provider-copy.ts:238`), which is the same question asked of the same endpoint family. Adding an `unauthorized` reason and keeping `response.status` for 401/403 would close it; the copy block already has a natural place for the string.
   
   I am rating this P2 rather than P3 because the feature's purpose is telling the user the state of their account, and the most likely failure of that read is the one it cannot report.
   
   <details>
   <summary>简体中文</summary>
   
   **[P2] 凭据被拒会被报成网络问题,而这恰好发生在"管理该凭据"的那个页面上。**
   
   这里所有非 2xx 响应都变成 `undefined`,下面的 `catch` 对传输错误也一样。四个请求全 `undefined` 时,调用方返回 `{ kind:'unavailable', reason:'network' }`。于是**过期/被吊销的 key 的 401、权限不足的 403、和真正连不上的主机,到了能采取行动的那一层已经是同一个值。**
   
   下游还会再压一次:`connection-usage-card.tsx:114` 是 `result.reason === 'unsupported' ? copy.unsupported : copy.unavailable`,所以 `no-credential` 和 `network` 都打印"暂时取不到用量数据"(`:72` 的 catch 也自造了 `reason:'network'`)。**在 `packages/runtime` 里精心算出来的三值联合,到用户眼前只剩两种结果。**
   
   对一个 key 过期的用户:连接设置页显示"暂时取不到用量数据",**而在他本该用来修复它的页面上,没有任何地方指向凭据**。
   
   隔壁已有现成词汇:连接**测试**路径区分 `auth` / `network` / `timeout`(`settings-provider-copy.ts:238`),问的是同一组端点的同一个问题。增加一个 `unauthorized` reason 并对 401/403 保留 `response.status` 即可闭合,copy 里也有现成的位置。
   
   定 P2 而非 P3 的理由:这个功能的目的就是告诉用户账户状态,**而这次读取最可能的失败,恰恰是它无法报告的那一种**。
   
   </details>



##########
packages/runtime-host/src/protocol/connection-effects.ts:
##########
@@ -501,6 +558,132 @@ export function decodeConnectionTestRunResult(value: unknown): ConnectionTestRun
   return decodeNonEffectResult(result, 'connection test result');
 }
 
+export function decodeConnectionUsageReadInput(value: unknown): ConnectionUsageReadInput {
+  const input = requireExactRecord(value, 'connection usage input', ['connectionId']);
+  return { connectionId: requireEntityId(input.connectionId, 'connectionId') };
+}
+
+export function decodeConnectionUsageReadResult(value: unknown): ConnectionUsageReadResult {
+  const result = requireRecord(value, 'connection usage result');
+  if (result.kind === 'report') {
+    const report = requireExactRecord(result, 'connection usage report', ['kind', 'report']);
+    return { kind: 'report', report: decodeUsageReport(report.report) };
+  }
+  if (result.kind === 'unavailable') {
+    const unavailable = requireExactRecord(result, 'connection usage unavailable', [
+      'kind',
+      'reason',
+    ]);
+    if (
+      unavailable.reason !== 'unsupported' &&
+      unavailable.reason !== 'network' &&
+      unavailable.reason !== 'no-credential'
+    ) {
+      throw invalidProtocolFrame('Invalid connection usage unavailable reason');
+    }
+    return { kind: 'unavailable', reason: unavailable.reason };
+  }
+  if (result.kind === 'rejected') {
+    const rejected = requireExactRecord(result, 'connection usage result', ['kind', 'reason']);
+    return { kind: 'rejected', reason: rejectionReason(rejected.reason) };
+  }
+  throw invalidProtocolFrame('Invalid connection usage result');
+}
+
+function decodeUsageReport(value: unknown): ConnectionUsageReportProjection {
+  const report = requireExactRecord(value, 'connection usage report body', [
+    'accountLabel',
+    'planLabel',
+    'stats',
+    'windows',
+    'periodEnd',
+    'fetchedAt',
+  ]);
+  if (!Array.isArray(report.windows)) {

Review Comment:
   [P3] `windows` is the only array in this protocol package decoded without a length cap.
   
   Every other array decoder here bounds length before mapping: `agent-graph.ts:948` (`AGENT_GRAPH_MAX_WORK_INPUTS`) and `:1320` (`maxItems`), `access-authority.ts:403` (`ACCESS_CREDENTIAL_MAX_GRANTS`), `artifact.ts:454` (`ARTIFACT_PAGE_MAX_ITEMS`), `client-capability.ts:306/310/653`. This one checks `Array.isArray` and then maps.
   
   Today's producer emits at most three windows (`fiveHour`, `weekly`, `monthly` in `packages/runtime/src/connection-usage.ts`), so nothing is wrong at runtime. The point is that a decoder is the boundary that does not trust its producer — that is why the rest of this file uses `requireExactRecord` and caps every string at 64 or 256 bytes rather than relying on the producer being well behaved. The array is the one field that takes the producer's word for it.
   
   A `CONNECTION_USAGE_MAX_WINDOWS` alongside the existing constants, checked in the same `if`, would make this consistent with the rest of the package. Low severity precisely because the producer is in-tree and bounded — it is the convention that is broken, not the behaviour.
   
   <details>
   <summary>简体中文</summary>
   
   **[P3] `windows` 是本协议包里唯一一个解码时不限长的数组。**
   
   这里其他所有数组解码都会在 map 之前限长:`agent-graph.ts:948`、`:1320`、`access-authority.ts:403`、`artifact.ts:454`、`client-capability.ts:306/310/653`。这一处只做了 `Array.isArray` 就直接 map。
   
   当前生产者最多发三个窗口(`fiveHour`/`weekly`/`monthly`),所以运行时没有问题。**要点在于:解码器正是那个"不信任生产者"的边界** —— 本文件其余部分用 `requireExactRecord`、把每个字符串限在 64 或 256 字节,正是因为不依赖生产者守规矩;而这个数组是唯一一处采信了生产者的字段。
   
   按既有常量的写法加一个 `CONNECTION_USAGE_MAX_WINDOWS` 并在同一个 `if` 里检查即可与全包一致。**定级低正是因为生产者在树内且有界——坏的是约定,不是行为。**
   
   </details>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] feat(desktop): show Command Code GO account usage in the connection settings [maka]

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #5489:
URL: https://github.com/apache/maka/pull/5489#discussion_r4048755371


##########
packages/runtime/src/connection-usage.ts:
##########
@@ -0,0 +1,277 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Provider account usage, normalized into `@maka/core/connection-usage`.
+ *
+ * The dispatch is one `switch`: each provider that reports usage owns a mapper
+ * from its own endpoints to the shared window list, and every other provider
+ * answers `unavailable: unsupported`. The card that renders the result never
+ * learns the provider — only the windows and stats this produces.
+ */
+import type { ProviderType } from '@maka/core/llm-connections';
+import type {
+  ConnectionUsageReport,
+  ConnectionUsageResult,
+  UsageStats,
+  UsageWindow,
+} from '@maka/core/connection-usage';
+import { providerReportsUsage } from '@maka/core/connection-usage';
+import { commandCodeCliHeaders } from './commandcode-cli-language-model.js';
+import { fetchForConnectionEffect, type ConnectionEffectFetch } from './connection-effect-fetch.js';
+
+export interface ConnectionUsageInput {
+  readonly providerType: ProviderType;
+  readonly apiKey: string | undefined;
+  readonly baseUrl: string | undefined;
+  /** Injected for tests; production passes nothing and the global fetch is used. */
+  readonly fetch?: ConnectionEffectFetch;
+}
+
+export async function fetchConnectionUsage(
+  input: ConnectionUsageInput,
+): Promise<ConnectionUsageResult> {
+  if (!providerReportsUsage(input.providerType)) {
+    return { kind: 'unavailable', reason: 'unsupported' };
+  }
+  switch (input.providerType) {
+    case 'commandcode-go':
+      return fetchCommandCodeGoUsage(input);
+    // `commandcode` (the Provider-API plan) is deliberately NOT wired yet: its
+    // usage lives behind the same `/alpha/*` endpoints, but only a GO-tier key
+    // has been verified against them. Wiring it from inference alone could
+    // mis-report a plan's windows, which is worse than showing nothing.
+    default:
+      return { kind: 'unavailable', reason: 'unsupported' };
+  }
+}
+
+/**
+ * Command Code's account endpoints, fetched together with per-endpoint
+ * degradation: whichever endpoints answer, their facts land in the report, and
+ * only a total failure (no credential, or nothing answered) becomes
+ * `unavailable`.
+ */
+async function fetchCommandCodeGoUsage(
+  input: ConnectionUsageInput,
+): Promise<ConnectionUsageResult> {
+  if (!input.apiKey) return { kind: 'unavailable', reason: 'no-credential' };
+  const base = (input.baseUrl ?? 'https://api.commandcode.ai').replace(/\/+$/u, '');
+  const headers = commandCodeCliHeaders(input.apiKey, 'maka');
+  // One endpoint's outcome. A 401/403 is kept as `unauthorized` rather than
+  // flattened into "no data": the caller has to be able to tell a dead key from
+  // an unreachable host, because only one of the two is fixed on this page.
+  type Endpoint =
+    | { ok: true; body: Record<string, unknown> | undefined }
+    | { ok: false; unauthorized: boolean };
+  const get = async (path: string): Promise<Endpoint> => {
+    try {
+      const response = await fetchForConnectionEffect(input.fetch, `${base}${path}`, { headers });
+      if (!response.ok) {
+        return { ok: false, unauthorized: response.status === 401 || response.status === 403 };
+      }
+      return {
+        ok: true,
+        body: (await response.readJson<unknown>()) as Record<string, unknown> | undefined,
+      };
+    } catch {
+      return { ok: false, unauthorized: false };
+    }
+  };
+
+  const [whoami, summary, credits, subscriptions] = await Promise.all([
+    get('/alpha/whoami'),
+    get('/alpha/usage/summary'),
+    get('/alpha/billing/credits'),
+    get('/alpha/billing/subscriptions'),
+  ]);
+  const answered = [whoami, summary, credits, subscriptions].filter(
+    (endpoint) => endpoint.ok,
+  ) as Array<Extract<Endpoint, { ok: true }>>;
+  if (answered.length === 0) {

Review Comment:
   [P3] The all-or-nothing condition leaves the under-scoped key silently partial — and your own test name says that is a case you care about.
   
   The comment here is right about the case it covers: when every endpoint fails and any rejection was a 401/403, the credential is the problem. What it does not cover is a key that is *accepted* by some endpoints and refused by others.
   
   These four paths do not all need the same scope. `/alpha/whoami` is an identity read; `/alpha/billing/credits` and `/alpha/billing/subscriptions` are billing reads. A key that is valid but lacks billing scope answers the first and 403s the others. `answered.length` is then non-zero, so the function returns a report rather than `unauthorized`, and the card renders with no windows and no credits — and nothing tells the user their key is being refused.
   
   That is the same harm the [P2] was about, narrowed: the page for managing a key cannot say the key is the reason data is missing. It is just reached by a scope gap instead of an expiry.
   
   Your new test is named `reports an expired or under-scoped key as unauthorized, not as a network failure` — under-scoped is exactly the case above, and the test passes because it exercises the all-fail path. The name is broader than what the code does.
   
   This is a judgement call and I would not argue with declining it. If you keep the current behaviour, the honest fix is to the test name rather than the code, so it does not claim coverage of a case that falls through. If you want the behaviour, carrying the per-endpoint `unauthorized` into the report — say, a flag meaning "some of this account's data was refused" — would let the card show what it has *and* say why the rest is missing, which seems better than choosing between the two.
   
   Everything else I raised is resolved, and resolved where it mattered:
   
   - `unauthorized` is a real member of the reason union, the card renders it distinctly (`connection-usage-card.tsx:114-118`) instead of folding it into "no data", and the copy is actionable in all three locales — "Update the model key and try again" is the sentence that was missing.
   - `CONNECTION_USAGE_MAX_WINDOWS` is checked in the same `if` as the `Array.isArray`, which is what the rest of this protocol package does.
   
   <details>
   <summary>简体中文</summary>
   
   **[P3] "全都失败"这个条件把"权限不足的 key"漏成了静默残缺——而你自己的测试名恰好说明你在意这个情况。**
   
   这里的注释对它覆盖的情况是对的:所有端点都失败、且有 401/403 时,问题在凭据。**它没覆盖的是:一把 key 被一部分端点接受、被另一部分拒绝。**
   
   这四条路径需要的权限并不相同:`/alpha/whoami` 是身份读取,`/alpha/billing/*` 是账单读取。**一把有效但缺账单权限的 key 会答上第一个、对其余 403。** 此时 `answered.length` 非零,于是函数返回报告而不是 `unauthorized`,卡片渲染出来没有窗口、没有额度——**而没有任何地方告诉用户他的 key 正在被拒绝。**
   
   这和 [P2] 是同一种伤害,只是更窄:**管理密钥的页面说不出"数据缺失是因为这把密钥"**,只不过入口从"过期"换成了"权限不足"。
   
   你的新测试叫 `reports an expired or under-scoped key as unauthorized, not as a network failure` —— **under-scoped 正是上面这种情况**,而测试通过是因为它走的是"全失败"路径。**这个名字比代码实际做到的更宽。**
   
   这是个判断题,你要是不采纳我也不争。**若保留现有行为,诚实的修法是改测试名而不是改代码**,别让它声称覆盖了一个会漏过去的情况;若要这个行为,把各端点的 `unauthorized` 带进报告(例如一个"本账户部分数据被拒绝"的标志),可以让卡片既显示已有数据、又说明其余为何缺失,似乎比二选一更好。
   
   **我提过的其余问题都已解决,而且解决在了关键处**:`unauthorized` 成为 reason 联合的真正成员,卡片单独渲染它而不再折进"暂时取不到",三种语言的文案都是**可操作的**——"请更新模型密钥后重试"正是原先缺的那句;`CONNECTION_USAGE_MAX_WINDOWS` 与 `Array.isArray` 在同一个 `if` 里检查,与本包其余部分一致。
   
   </details>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] feat(desktop): show Command Code GO account usage in the connection settings [maka]

Posted by "Joob1n (via GitHub)" <gi...@apache.org>.
Joob1n commented on PR #5489:
URL: https://github.com/apache/maka/pull/5489#issuecomment-5733482837

   Thanks — both earlier findings are addressed, and I took your better option on the newest [P3].
   
   **New [P3] (under-scoped key) — fixed as behaviour, not as a test rename.** A key accepted by `/alpha/whoami` but refused by the billing reads is a real but *incomplete* report, so it is now returned **with** `partiallyUnauthorized` set. `ConnectionUsageReport` carries the flag, the protocol projection / decoder / coordinator project it, and the card shows what it could read plus a line saying the rest was refused and the key is why ("Some usage was refused — the key lacks the scope for it. Below is what could be read"). The all-endpoints-refused path is unchanged (`unavailable: unauthorized`). The mis-scoped test name is also corrected to `reports a wholly-refused key as unauthorized`.
   
   The runtime suite now has both cases: partial-scope → report + flag; fully-readable → no flag. `connection-usage` 11/11, `connection-effects-protocol` 5/5.
   
   **On the thing you flagged twice as not covered — I checked it.** You noted you have no GO credential, so I used mine:
   
   - **Invalid key → all four endpoints `401`** with a structured body (`{"error":{"code":"UNAUTHORIZED","status":401,...}}`). The [P2] fix is built on exactly this, so that path is now observed, not assumed.
   - **My valid key → all four `200`.** I could not construct the partial-scope state: this key holds full billing scope. So your [P3] premise — that the service answers one endpoint and refuses another for the same key — remains **unverified**. Different endpoints plausibly need different scopes, but I did not confirm it and cannot with one key.
   
   That does not change the fix: it is correct whether or not the case occurs, because a partial report is now labelled rather than silently presented as whole. Recording the limit so the thread does not overstate what was tested.
   
   Epoch note: this landed as **163 → 165**, not 164 — main took 164 (the plugins PR) while this branch was open, so the rebase re-pinned it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] feat(desktop): show Command Code GO account usage in the connection settings [maka]

Posted by "Joob1n (via GitHub)" <gi...@apache.org>.
Joob1n merged PR #5489:
URL: https://github.com/apache/maka/pull/5489


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org