Skip to content

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) - #3802

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope
Aug 8, 2026
Merged

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491)#3802
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3491
Part of objectstack-ai/cloud#944 —— 消费端先行;本单落地后 cloud#1168(生产者按 ADR-0112 收敛)才可动。⛔ 本 PR 不改任何生产者、不动 cloud 仓。

为什么消费端必须先行

两个 AI 配额 429 生产者用相反的方式填同一个 error 键(guardrail 塞 code,service-ai 塞 message、code 放在 code 兄弟键),而 ADR-0112 声明的是第三种:{ success:false, error:{ code, message } }parseAiQuotaError 今天只认「平铺 error 就是 code」这一种,生产者一旦按声明收敛,配额拒绝会静默失配、退回通用的「Response failed」红条 —— 与 objectui#2992(useAgents 先学信封、服务端再转)同一套路。

改动(packages/plugin-chatbot/src/tool-display.ts)

  • parseAiQuotaError 现在在三个位置找 code:嵌套声明形 error.code、平铺 error、兄弟键 code
  • 只拓宽 code 的位置,不拓宽 code 的值域 —— 固定集合(ai_design_quota_exhausted / ai_data_chat_trial_exhausted / ai_allowance_exhausted)一字未动,任何未知形状仍降级为现状行为(null),因此不会有非配额错误被新捕进配额 CTA。
  • message 主干:嵌套 error.message → 平铺 message → (仅当 error 不是 code 槽时)error 里的散文。service-ai 方言的 message 就在 error 里,而平铺方言的 error 是 code —— 后者绝不能当 message 显示给用户,这个 gate 由测试钉住。
  • 伴随字段(upgrade / topUp / messageEn)保持既有的顶层读取,嵌套位置不预设(是 error.details.upgrade?还是 error.code 的兄弟?)—— 那是 cloud#1168 决定的形状,现在编一个嵌套键出来等于把没人同意过的契约固化下来(AGENTS.md #0.1)。
  • 新增两个小 helper:asAiQuotaCode(值域判定)、asText(空串算 message,因为 { error:'', code:… } 方言正好发空串)。

三方言 × 命中/不命中矩阵(实跑)

pnpm vitest run packages/plugin-chatbot/src/tool-display.test.tsTest Files 1 passed / Tests 30 passed;整包 pnpm vitest run packages/plugin-chatbot17 files / 272 tests passed;pnpm --filter @object-ui/plugin-chatbot type-check 干净通过。

方言命中不命中
平铺 guardrail(error 是 code)三个 code 各一例error:'ai_quota_exhausted' → null
service-ai(code 兄弟键)三个 code 各一例 + error 散文当 messagecode:'ai_quota_exhausted' → null
嵌套声明形(ADR-0112)三个 code 各一例code:'QUOTA_EXCEEDED' → null;error 无 code → null

另有:未知形状降级(error:null / error:[] / code:42 / 非 JSON)、伴随字段向后兼容(嵌套 code + 顶层 upgrade/topUp/messageEn 双发)、嵌套-only 时 CTA flag 落 false、以及嵌套在外层文本/数组里的 body 仍能被定位(既有 substring 抽取行为,顺手钉住)。

解析优先级依据

嵌套声明形 > 平铺 code > 兄弟 code,是一条全序,不是「先试哪个都行」:过渡期生产者新信封与旧顶层键双发是很现实的一步,同时命中两形态时必须只有一个确定结果,所以最「声明」的位置优先;而嵌套 code 缺失或不在值域时,旧 limb 仍然可达(测试里 QUOTA_EXCEEDED 嵌套 + 顶层旧 code 就落到旧 limb)。

反向验证(方向先判后跑,两次都对上)

  • 砍掉嵌套 limb → 预判 7 红:嵌套三 code 命中、嵌套优先级、两条伴随字段、嵌套 body 定位;实跑 7 failed | 23 passed,逐条对上。三条嵌套「不命中」用例照旧绿 —— 它们钉的是 miss 侧,本来区分不了,如实记下而不是假装它们证明了什么。
  • 砍掉兄弟键 limb → 预判 5 红:service-ai 三 code 命中、散文当 message、旧 limb 兜底;实跑 5 failed | 25 passed。「平铺优先于兄弟键」那条两种情况下都绿 —— 它是优先级钉子,不是可达性钉子;兄弟键的可达性由上面 4 条钉住。

一个必须记下的剩余缺口(本单不动手,交 PM/维护者定)

ADR-0112 的 error.code 值域是封闭z.enum(ErrorCode = StandardErrorCodeERROR_CODE_LEDGER,SCREAMING_SNAKE,由 error-code-ledger.test.ts 机械强制),而这三个配额 code 在 ledger 里零登记(git grep over origin/mainpackages/spec/src 零命中)。也就是说:一个真正合规的嵌套信封今天装不下ai_allowance_exhausted —— ApiErrorSchema.parse 会拒。所以本 PR 的嵌套分支只对「嵌套形 + 旧小写词汇」的生产者生效;cloud#1168 若把词汇一并收敛(登记 AI_*,或按 ledger 自己的建议直接用标准的 QUOTA_EXCEEDED 把三态与 CTA flag 挪进 details),objectui 这边还需要一次词汇对齐的后续小 PR。那是契约决策,不该由我猜 —— 已写进 JSDoc 与 dev 报告的 open_questions。

顺带更正 issue 描述里的一处:parseAiQuotaError 并非「今天无仓内生产调用方」—— ChatbotEnhanced.tsx 有两处活调用(:2781 的红条抑制、:3790 的配额 CTA)。核心前提(只认平铺 error-as-code)经 origin/main 实读成立,tool-display.ts:197 一带确如描述。


Generated by Claude Code

…r envelope (#3491)
The two cloud AI 429 producers fill the same `error` key in opposite ways (the
token guardrail puts the code there, service-ai puts the message there and the
code in a `code` sibling), while ADR-0112 declares a third shape both converge
on: `{ success: false, error: { code, message } }`. The consumer has to learn
the declared shape first, or the producers' convergence silently turns every
quota refusal back into a generic "Response failed" banner (cloud#944; same
consumer-first sequencing as objectui#2992).
Code lookup is a total order — declared envelope, flat guardrail code, `code`
sibling — so a transitional producer double-emitting the new envelope next to
the legacy top-level keys has one defined outcome. Only the code's location
widens: the recognized code set is unchanged and any unrecognized shape still
degrades to null. Companion fields keep their top-level read; their position in
the declared envelope is not presumed (cloud#1168 fixes the real shape).
Tests: three dialects x hit/miss, unknown-shape degradation, companion-field
backward compatibility, and the parse-priority order.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
@vercel

vercelBot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 8, 2026 4:58pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.1 KB350 KB
Entry fileindex-Rq8io3A8.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)481.69KB106.04KB
core (index.js)2.96KB1.13KB
create-plugin (index.js)9.85KB3.18KB
data-objectstack (index.js)139.51KB35.97KB
fields (index.js)230.82KB56.70KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.53KB10.71KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.98KB12.37KB
plugin-charts (index.js)61.04KB17.31KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)117.21KB30.27KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)232.99KB57.58KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)112.10KB27.10KB
plugin-gantt (index.js)162.55KB39.57KB
plugin-grid (index.js)187.71KB49.68KB
plugin-kanban (index.js)48.30KB13.28KB
plugin-list (index.js)105.12KB25.48KB
plugin-map (index.js)16.81KB5.24KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)25.76KB7.33KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

✅ 验收通过(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)—— undraft + auto-merge。

git 实物核验(2b2ec58d6):净 diff 3 文件;code 三处查找一条全序(嵌套声明形 > 平铺 > 兄弟键,asAiQuotaCode(nested?.code) ?? flatCode ?? asAiQuotaCode(body.code)),JSDoc「Parse priority (a total order, deliberately)」写明双发过渡期的确定性依据;固定集合与未知形状降级行为一字未动;⛔ 未触碰 #3783 在飞文件、未改生产者、未动 cloud 仓 —— 边界全守。三方言 × 命中/不命中矩阵 30 测;两轮反向验证(7 红/5 红)逐条吻合,且对「优先级钉子 vs 可达性钉子」的区分、以及一处自己预期写错后按真实行为改钉(数组 body 的 substring 抽取系改前既有行为)的处置都合规 —— 不改实现迁就错误预期。

验收要害采纳并转录:#3804(finding)记录的词汇缺口 —— 三个 AI 配额 code 在 ADR-0112 封闭值域外,合规嵌套信封今天装不下它们;本单只接住「新形态+旧词汇」的过渡期生产者。⚠️ cloud#1168 动手前必须先看 #3804(词汇拍板属 spec owner,A 案+护栏为 dev 推荐)—— 本 PR 落地不等于消费端已能接住任意收敛形态。19 项 CI 全部完成 0 失败(PM 独立复核);changeset patch 三门绿。


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 17:07
@yinlianghui
yinlianghui added this pull request to the merge queueAug 8, 2026
Merged via the queue into main with commit 2a54e86Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3491-quota-error-envelope branch August 8, 2026 17:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseAiQuotaError 先学会嵌套信封形态(消费端先行)—— cloud 两个 429 生产者随后按 ADR-0112 收敛(cloud#944 移交)

2 participants

@yinlianghui@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) by yinlianghui · Pull Request #3802 · objectstack-ai/objectui · GitHub
Skip to content

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) - #3802

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope
Aug 8, 2026
Merged

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491)#3802
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3491
Part of objectstack-ai/cloud#944 —— 消费端先行;本单落地后 cloud#1168(生产者按 ADR-0112 收敛)才可动。⛔ 本 PR 不改任何生产者、不动 cloud 仓。

为什么消费端必须先行

两个 AI 配额 429 生产者用相反的方式填同一个 error 键(guardrail 塞 code,service-ai 塞 message、code 放在 code 兄弟键),而 ADR-0112 声明的是第三种:{ success:false, error:{ code, message } }parseAiQuotaError 今天只认「平铺 error 就是 code」这一种,生产者一旦按声明收敛,配额拒绝会静默失配、退回通用的「Response failed」红条 —— 与 objectui#2992(useAgents 先学信封、服务端再转)同一套路。

改动(packages/plugin-chatbot/src/tool-display.ts)

  • parseAiQuotaError 现在在三个位置找 code:嵌套声明形 error.code、平铺 error、兄弟键 code
  • 只拓宽 code 的位置,不拓宽 code 的值域 —— 固定集合(ai_design_quota_exhausted / ai_data_chat_trial_exhausted / ai_allowance_exhausted)一字未动,任何未知形状仍降级为现状行为(null),因此不会有非配额错误被新捕进配额 CTA。
  • message 主干:嵌套 error.message → 平铺 message → (仅当 error 不是 code 槽时)error 里的散文。service-ai 方言的 message 就在 error 里,而平铺方言的 error 是 code —— 后者绝不能当 message 显示给用户,这个 gate 由测试钉住。
  • 伴随字段(upgrade / topUp / messageEn)保持既有的顶层读取,嵌套位置不预设(是 error.details.upgrade?还是 error.code 的兄弟?)—— 那是 cloud#1168 决定的形状,现在编一个嵌套键出来等于把没人同意过的契约固化下来(AGENTS.md #0.1)。
  • 新增两个小 helper:asAiQuotaCode(值域判定)、asText(空串算 message,因为 { error:'', code:… } 方言正好发空串)。

三方言 × 命中/不命中矩阵(实跑)

pnpm vitest run packages/plugin-chatbot/src/tool-display.test.tsTest Files 1 passed / Tests 30 passed;整包 pnpm vitest run packages/plugin-chatbot17 files / 272 tests passed;pnpm --filter @object-ui/plugin-chatbot type-check 干净通过。

方言命中不命中
平铺 guardrail(error 是 code)三个 code 各一例error:'ai_quota_exhausted' → null
service-ai(code 兄弟键)三个 code 各一例 + error 散文当 messagecode:'ai_quota_exhausted' → null
嵌套声明形(ADR-0112)三个 code 各一例code:'QUOTA_EXCEEDED' → null;error 无 code → null

另有:未知形状降级(error:null / error:[] / code:42 / 非 JSON)、伴随字段向后兼容(嵌套 code + 顶层 upgrade/topUp/messageEn 双发)、嵌套-only 时 CTA flag 落 false、以及嵌套在外层文本/数组里的 body 仍能被定位(既有 substring 抽取行为,顺手钉住)。

解析优先级依据

嵌套声明形 > 平铺 code > 兄弟 code,是一条全序,不是「先试哪个都行」:过渡期生产者新信封与旧顶层键双发是很现实的一步,同时命中两形态时必须只有一个确定结果,所以最「声明」的位置优先;而嵌套 code 缺失或不在值域时,旧 limb 仍然可达(测试里 QUOTA_EXCEEDED 嵌套 + 顶层旧 code 就落到旧 limb)。

反向验证(方向先判后跑,两次都对上)

  • 砍掉嵌套 limb → 预判 7 红:嵌套三 code 命中、嵌套优先级、两条伴随字段、嵌套 body 定位;实跑 7 failed | 23 passed,逐条对上。三条嵌套「不命中」用例照旧绿 —— 它们钉的是 miss 侧,本来区分不了,如实记下而不是假装它们证明了什么。
  • 砍掉兄弟键 limb → 预判 5 红:service-ai 三 code 命中、散文当 message、旧 limb 兜底;实跑 5 failed | 25 passed。「平铺优先于兄弟键」那条两种情况下都绿 —— 它是优先级钉子,不是可达性钉子;兄弟键的可达性由上面 4 条钉住。

一个必须记下的剩余缺口(本单不动手,交 PM/维护者定)

ADR-0112 的 error.code 值域是封闭z.enum(ErrorCode = StandardErrorCodeERROR_CODE_LEDGER,SCREAMING_SNAKE,由 error-code-ledger.test.ts 机械强制),而这三个配额 code 在 ledger 里零登记(git grep over origin/mainpackages/spec/src 零命中)。也就是说:一个真正合规的嵌套信封今天装不下ai_allowance_exhausted —— ApiErrorSchema.parse 会拒。所以本 PR 的嵌套分支只对「嵌套形 + 旧小写词汇」的生产者生效;cloud#1168 若把词汇一并收敛(登记 AI_*,或按 ledger 自己的建议直接用标准的 QUOTA_EXCEEDED 把三态与 CTA flag 挪进 details),objectui 这边还需要一次词汇对齐的后续小 PR。那是契约决策,不该由我猜 —— 已写进 JSDoc 与 dev 报告的 open_questions。

顺带更正 issue 描述里的一处:parseAiQuotaError 并非「今天无仓内生产调用方」—— ChatbotEnhanced.tsx 有两处活调用(:2781 的红条抑制、:3790 的配额 CTA)。核心前提(只认平铺 error-as-code)经 origin/main 实读成立,tool-display.ts:197 一带确如描述。


Generated by Claude Code

…r envelope (#3491)
The two cloud AI 429 producers fill the same `error` key in opposite ways (the
token guardrail puts the code there, service-ai puts the message there and the
code in a `code` sibling), while ADR-0112 declares a third shape both converge
on: `{ success: false, error: { code, message } }`. The consumer has to learn
the declared shape first, or the producers' convergence silently turns every
quota refusal back into a generic "Response failed" banner (cloud#944; same
consumer-first sequencing as objectui#2992).
Code lookup is a total order — declared envelope, flat guardrail code, `code`
sibling — so a transitional producer double-emitting the new envelope next to
the legacy top-level keys has one defined outcome. Only the code's location
widens: the recognized code set is unchanged and any unrecognized shape still
degrades to null. Companion fields keep their top-level read; their position in
the declared envelope is not presumed (cloud#1168 fixes the real shape).
Tests: three dialects x hit/miss, unknown-shape degradation, companion-field
backward compatibility, and the parse-priority order.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
@vercel

vercelBot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 8, 2026 4:58pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.1 KB350 KB
Entry fileindex-Rq8io3A8.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)481.69KB106.04KB
core (index.js)2.96KB1.13KB
create-plugin (index.js)9.85KB3.18KB
data-objectstack (index.js)139.51KB35.97KB
fields (index.js)230.82KB56.70KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.53KB10.71KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.98KB12.37KB
plugin-charts (index.js)61.04KB17.31KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)117.21KB30.27KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)232.99KB57.58KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)112.10KB27.10KB
plugin-gantt (index.js)162.55KB39.57KB
plugin-grid (index.js)187.71KB49.68KB
plugin-kanban (index.js)48.30KB13.28KB
plugin-list (index.js)105.12KB25.48KB
plugin-map (index.js)16.81KB5.24KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)25.76KB7.33KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

✅ 验收通过(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)—— undraft + auto-merge。

git 实物核验(2b2ec58d6):净 diff 3 文件;code 三处查找一条全序(嵌套声明形 > 平铺 > 兄弟键,asAiQuotaCode(nested?.code) ?? flatCode ?? asAiQuotaCode(body.code)),JSDoc「Parse priority (a total order, deliberately)」写明双发过渡期的确定性依据;固定集合与未知形状降级行为一字未动;⛔ 未触碰 #3783 在飞文件、未改生产者、未动 cloud 仓 —— 边界全守。三方言 × 命中/不命中矩阵 30 测;两轮反向验证(7 红/5 红)逐条吻合,且对「优先级钉子 vs 可达性钉子」的区分、以及一处自己预期写错后按真实行为改钉(数组 body 的 substring 抽取系改前既有行为)的处置都合规 —— 不改实现迁就错误预期。

验收要害采纳并转录:#3804(finding)记录的词汇缺口 —— 三个 AI 配额 code 在 ADR-0112 封闭值域外,合规嵌套信封今天装不下它们;本单只接住「新形态+旧词汇」的过渡期生产者。⚠️ cloud#1168 动手前必须先看 #3804(词汇拍板属 spec owner,A 案+护栏为 dev 推荐)—— 本 PR 落地不等于消费端已能接住任意收敛形态。19 项 CI 全部完成 0 失败(PM 独立复核);changeset patch 三门绿。


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 17:07
@yinlianghui
yinlianghui added this pull request to the merge queueAug 8, 2026
Merged via the queue into main with commit 2a54e86Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3491-quota-error-envelope branch August 8, 2026 17:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseAiQuotaError 先学会嵌套信封形态(消费端先行)—— cloud 两个 429 生产者随后按 ADR-0112 收敛(cloud#944 移交)

2 participants

@yinlianghui@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) by yinlianghui · Pull Request #3802 · objectstack-ai/objectui · GitHub
Skip to content

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) - #3802

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope
Aug 8, 2026
Merged

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491)#3802
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3491
Part of objectstack-ai/cloud#944 —— 消费端先行;本单落地后 cloud#1168(生产者按 ADR-0112 收敛)才可动。⛔ 本 PR 不改任何生产者、不动 cloud 仓。

为什么消费端必须先行

两个 AI 配额 429 生产者用相反的方式填同一个 error 键(guardrail 塞 code,service-ai 塞 message、code 放在 code 兄弟键),而 ADR-0112 声明的是第三种:{ success:false, error:{ code, message } }parseAiQuotaError 今天只认「平铺 error 就是 code」这一种,生产者一旦按声明收敛,配额拒绝会静默失配、退回通用的「Response failed」红条 —— 与 objectui#2992(useAgents 先学信封、服务端再转)同一套路。

改动(packages/plugin-chatbot/src/tool-display.ts)

  • parseAiQuotaError 现在在三个位置找 code:嵌套声明形 error.code、平铺 error、兄弟键 code
  • 只拓宽 code 的位置,不拓宽 code 的值域 —— 固定集合(ai_design_quota_exhausted / ai_data_chat_trial_exhausted / ai_allowance_exhausted)一字未动,任何未知形状仍降级为现状行为(null),因此不会有非配额错误被新捕进配额 CTA。
  • message 主干:嵌套 error.message → 平铺 message → (仅当 error 不是 code 槽时)error 里的散文。service-ai 方言的 message 就在 error 里,而平铺方言的 error 是 code —— 后者绝不能当 message 显示给用户,这个 gate 由测试钉住。
  • 伴随字段(upgrade / topUp / messageEn)保持既有的顶层读取,嵌套位置不预设(是 error.details.upgrade?还是 error.code 的兄弟?)—— 那是 cloud#1168 决定的形状,现在编一个嵌套键出来等于把没人同意过的契约固化下来(AGENTS.md #0.1)。
  • 新增两个小 helper:asAiQuotaCode(值域判定)、asText(空串算 message,因为 { error:'', code:… } 方言正好发空串)。

三方言 × 命中/不命中矩阵(实跑)

pnpm vitest run packages/plugin-chatbot/src/tool-display.test.tsTest Files 1 passed / Tests 30 passed;整包 pnpm vitest run packages/plugin-chatbot17 files / 272 tests passed;pnpm --filter @object-ui/plugin-chatbot type-check 干净通过。

方言命中不命中
平铺 guardrail(error 是 code)三个 code 各一例error:'ai_quota_exhausted' → null
service-ai(code 兄弟键)三个 code 各一例 + error 散文当 messagecode:'ai_quota_exhausted' → null
嵌套声明形(ADR-0112)三个 code 各一例code:'QUOTA_EXCEEDED' → null;error 无 code → null

另有:未知形状降级(error:null / error:[] / code:42 / 非 JSON)、伴随字段向后兼容(嵌套 code + 顶层 upgrade/topUp/messageEn 双发)、嵌套-only 时 CTA flag 落 false、以及嵌套在外层文本/数组里的 body 仍能被定位(既有 substring 抽取行为,顺手钉住)。

解析优先级依据

嵌套声明形 > 平铺 code > 兄弟 code,是一条全序,不是「先试哪个都行」:过渡期生产者新信封与旧顶层键双发是很现实的一步,同时命中两形态时必须只有一个确定结果,所以最「声明」的位置优先;而嵌套 code 缺失或不在值域时,旧 limb 仍然可达(测试里 QUOTA_EXCEEDED 嵌套 + 顶层旧 code 就落到旧 limb)。

反向验证(方向先判后跑,两次都对上)

  • 砍掉嵌套 limb → 预判 7 红:嵌套三 code 命中、嵌套优先级、两条伴随字段、嵌套 body 定位;实跑 7 failed | 23 passed,逐条对上。三条嵌套「不命中」用例照旧绿 —— 它们钉的是 miss 侧,本来区分不了,如实记下而不是假装它们证明了什么。
  • 砍掉兄弟键 limb → 预判 5 红:service-ai 三 code 命中、散文当 message、旧 limb 兜底;实跑 5 failed | 25 passed。「平铺优先于兄弟键」那条两种情况下都绿 —— 它是优先级钉子,不是可达性钉子;兄弟键的可达性由上面 4 条钉住。

一个必须记下的剩余缺口(本单不动手,交 PM/维护者定)

ADR-0112 的 error.code 值域是封闭z.enum(ErrorCode = StandardErrorCodeERROR_CODE_LEDGER,SCREAMING_SNAKE,由 error-code-ledger.test.ts 机械强制),而这三个配额 code 在 ledger 里零登记(git grep over origin/mainpackages/spec/src 零命中)。也就是说:一个真正合规的嵌套信封今天装不下ai_allowance_exhausted —— ApiErrorSchema.parse 会拒。所以本 PR 的嵌套分支只对「嵌套形 + 旧小写词汇」的生产者生效;cloud#1168 若把词汇一并收敛(登记 AI_*,或按 ledger 自己的建议直接用标准的 QUOTA_EXCEEDED 把三态与 CTA flag 挪进 details),objectui 这边还需要一次词汇对齐的后续小 PR。那是契约决策,不该由我猜 —— 已写进 JSDoc 与 dev 报告的 open_questions。

顺带更正 issue 描述里的一处:parseAiQuotaError 并非「今天无仓内生产调用方」—— ChatbotEnhanced.tsx 有两处活调用(:2781 的红条抑制、:3790 的配额 CTA)。核心前提(只认平铺 error-as-code)经 origin/main 实读成立,tool-display.ts:197 一带确如描述。


Generated by Claude Code

…r envelope (#3491)
The two cloud AI 429 producers fill the same `error` key in opposite ways (the
token guardrail puts the code there, service-ai puts the message there and the
code in a `code` sibling), while ADR-0112 declares a third shape both converge
on: `{ success: false, error: { code, message } }`. The consumer has to learn
the declared shape first, or the producers' convergence silently turns every
quota refusal back into a generic "Response failed" banner (cloud#944; same
consumer-first sequencing as objectui#2992).
Code lookup is a total order — declared envelope, flat guardrail code, `code`
sibling — so a transitional producer double-emitting the new envelope next to
the legacy top-level keys has one defined outcome. Only the code's location
widens: the recognized code set is unchanged and any unrecognized shape still
degrades to null. Companion fields keep their top-level read; their position in
the declared envelope is not presumed (cloud#1168 fixes the real shape).
Tests: three dialects x hit/miss, unknown-shape degradation, companion-field
backward compatibility, and the parse-priority order.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
@vercel

vercelBot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 8, 2026 4:58pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.1 KB350 KB
Entry fileindex-Rq8io3A8.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)481.69KB106.04KB
core (index.js)2.96KB1.13KB
create-plugin (index.js)9.85KB3.18KB
data-objectstack (index.js)139.51KB35.97KB
fields (index.js)230.82KB56.70KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.53KB10.71KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.98KB12.37KB
plugin-charts (index.js)61.04KB17.31KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)117.21KB30.27KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)232.99KB57.58KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)112.10KB27.10KB
plugin-gantt (index.js)162.55KB39.57KB
plugin-grid (index.js)187.71KB49.68KB
plugin-kanban (index.js)48.30KB13.28KB
plugin-list (index.js)105.12KB25.48KB
plugin-map (index.js)16.81KB5.24KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)25.76KB7.33KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

✅ 验收通过(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)—— undraft + auto-merge。

git 实物核验(2b2ec58d6):净 diff 3 文件;code 三处查找一条全序(嵌套声明形 > 平铺 > 兄弟键,asAiQuotaCode(nested?.code) ?? flatCode ?? asAiQuotaCode(body.code)),JSDoc「Parse priority (a total order, deliberately)」写明双发过渡期的确定性依据;固定集合与未知形状降级行为一字未动;⛔ 未触碰 #3783 在飞文件、未改生产者、未动 cloud 仓 —— 边界全守。三方言 × 命中/不命中矩阵 30 测;两轮反向验证(7 红/5 红)逐条吻合,且对「优先级钉子 vs 可达性钉子」的区分、以及一处自己预期写错后按真实行为改钉(数组 body 的 substring 抽取系改前既有行为)的处置都合规 —— 不改实现迁就错误预期。

验收要害采纳并转录:#3804(finding)记录的词汇缺口 —— 三个 AI 配额 code 在 ADR-0112 封闭值域外,合规嵌套信封今天装不下它们;本单只接住「新形态+旧词汇」的过渡期生产者。⚠️ cloud#1168 动手前必须先看 #3804(词汇拍板属 spec owner,A 案+护栏为 dev 推荐)—— 本 PR 落地不等于消费端已能接住任意收敛形态。19 项 CI 全部完成 0 失败(PM 独立复核);changeset patch 三门绿。


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 17:07
@yinlianghui
yinlianghui added this pull request to the merge queueAug 8, 2026
Merged via the queue into main with commit 2a54e86Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3491-quota-error-envelope branch August 8, 2026 17:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseAiQuotaError 先学会嵌套信封形态(消费端先行)—— cloud 两个 429 生产者随后按 ADR-0112 收敛(cloud#944 移交)

2 participants

@yinlianghui@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) by yinlianghui · Pull Request #3802 · objectstack-ai/objectui · GitHub
Skip to content

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) - #3802

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope
Aug 8, 2026
Merged

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491)#3802
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3491
Part of objectstack-ai/cloud#944 —— 消费端先行;本单落地后 cloud#1168(生产者按 ADR-0112 收敛)才可动。⛔ 本 PR 不改任何生产者、不动 cloud 仓。

为什么消费端必须先行

两个 AI 配额 429 生产者用相反的方式填同一个 error 键(guardrail 塞 code,service-ai 塞 message、code 放在 code 兄弟键),而 ADR-0112 声明的是第三种:{ success:false, error:{ code, message } }parseAiQuotaError 今天只认「平铺 error 就是 code」这一种,生产者一旦按声明收敛,配额拒绝会静默失配、退回通用的「Response failed」红条 —— 与 objectui#2992(useAgents 先学信封、服务端再转)同一套路。

改动(packages/plugin-chatbot/src/tool-display.ts)

  • parseAiQuotaError 现在在三个位置找 code:嵌套声明形 error.code、平铺 error、兄弟键 code
  • 只拓宽 code 的位置,不拓宽 code 的值域 —— 固定集合(ai_design_quota_exhausted / ai_data_chat_trial_exhausted / ai_allowance_exhausted)一字未动,任何未知形状仍降级为现状行为(null),因此不会有非配额错误被新捕进配额 CTA。
  • message 主干:嵌套 error.message → 平铺 message → (仅当 error 不是 code 槽时)error 里的散文。service-ai 方言的 message 就在 error 里,而平铺方言的 error 是 code —— 后者绝不能当 message 显示给用户,这个 gate 由测试钉住。
  • 伴随字段(upgrade / topUp / messageEn)保持既有的顶层读取,嵌套位置不预设(是 error.details.upgrade?还是 error.code 的兄弟?)—— 那是 cloud#1168 决定的形状,现在编一个嵌套键出来等于把没人同意过的契约固化下来(AGENTS.md #0.1)。
  • 新增两个小 helper:asAiQuotaCode(值域判定)、asText(空串算 message,因为 { error:'', code:… } 方言正好发空串)。

三方言 × 命中/不命中矩阵(实跑)

pnpm vitest run packages/plugin-chatbot/src/tool-display.test.tsTest Files 1 passed / Tests 30 passed;整包 pnpm vitest run packages/plugin-chatbot17 files / 272 tests passed;pnpm --filter @object-ui/plugin-chatbot type-check 干净通过。

方言命中不命中
平铺 guardrail(error 是 code)三个 code 各一例error:'ai_quota_exhausted' → null
service-ai(code 兄弟键)三个 code 各一例 + error 散文当 messagecode:'ai_quota_exhausted' → null
嵌套声明形(ADR-0112)三个 code 各一例code:'QUOTA_EXCEEDED' → null;error 无 code → null

另有:未知形状降级(error:null / error:[] / code:42 / 非 JSON)、伴随字段向后兼容(嵌套 code + 顶层 upgrade/topUp/messageEn 双发)、嵌套-only 时 CTA flag 落 false、以及嵌套在外层文本/数组里的 body 仍能被定位(既有 substring 抽取行为,顺手钉住)。

解析优先级依据

嵌套声明形 > 平铺 code > 兄弟 code,是一条全序,不是「先试哪个都行」:过渡期生产者新信封与旧顶层键双发是很现实的一步,同时命中两形态时必须只有一个确定结果,所以最「声明」的位置优先;而嵌套 code 缺失或不在值域时,旧 limb 仍然可达(测试里 QUOTA_EXCEEDED 嵌套 + 顶层旧 code 就落到旧 limb)。

反向验证(方向先判后跑,两次都对上)

  • 砍掉嵌套 limb → 预判 7 红:嵌套三 code 命中、嵌套优先级、两条伴随字段、嵌套 body 定位;实跑 7 failed | 23 passed,逐条对上。三条嵌套「不命中」用例照旧绿 —— 它们钉的是 miss 侧,本来区分不了,如实记下而不是假装它们证明了什么。
  • 砍掉兄弟键 limb → 预判 5 红:service-ai 三 code 命中、散文当 message、旧 limb 兜底;实跑 5 failed | 25 passed。「平铺优先于兄弟键」那条两种情况下都绿 —— 它是优先级钉子,不是可达性钉子;兄弟键的可达性由上面 4 条钉住。

一个必须记下的剩余缺口(本单不动手,交 PM/维护者定)

ADR-0112 的 error.code 值域是封闭z.enum(ErrorCode = StandardErrorCodeERROR_CODE_LEDGER,SCREAMING_SNAKE,由 error-code-ledger.test.ts 机械强制),而这三个配额 code 在 ledger 里零登记(git grep over origin/mainpackages/spec/src 零命中)。也就是说:一个真正合规的嵌套信封今天装不下ai_allowance_exhausted —— ApiErrorSchema.parse 会拒。所以本 PR 的嵌套分支只对「嵌套形 + 旧小写词汇」的生产者生效;cloud#1168 若把词汇一并收敛(登记 AI_*,或按 ledger 自己的建议直接用标准的 QUOTA_EXCEEDED 把三态与 CTA flag 挪进 details),objectui 这边还需要一次词汇对齐的后续小 PR。那是契约决策,不该由我猜 —— 已写进 JSDoc 与 dev 报告的 open_questions。

顺带更正 issue 描述里的一处:parseAiQuotaError 并非「今天无仓内生产调用方」—— ChatbotEnhanced.tsx 有两处活调用(:2781 的红条抑制、:3790 的配额 CTA)。核心前提(只认平铺 error-as-code)经 origin/main 实读成立,tool-display.ts:197 一带确如描述。


Generated by Claude Code

…r envelope (#3491)
The two cloud AI 429 producers fill the same `error` key in opposite ways (the
token guardrail puts the code there, service-ai puts the message there and the
code in a `code` sibling), while ADR-0112 declares a third shape both converge
on: `{ success: false, error: { code, message } }`. The consumer has to learn
the declared shape first, or the producers' convergence silently turns every
quota refusal back into a generic "Response failed" banner (cloud#944; same
consumer-first sequencing as objectui#2992).
Code lookup is a total order — declared envelope, flat guardrail code, `code`
sibling — so a transitional producer double-emitting the new envelope next to
the legacy top-level keys has one defined outcome. Only the code's location
widens: the recognized code set is unchanged and any unrecognized shape still
degrades to null. Companion fields keep their top-level read; their position in
the declared envelope is not presumed (cloud#1168 fixes the real shape).
Tests: three dialects x hit/miss, unknown-shape degradation, companion-field
backward compatibility, and the parse-priority order.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
@vercel

vercelBot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 8, 2026 4:58pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.1 KB350 KB
Entry fileindex-Rq8io3A8.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)481.69KB106.04KB
core (index.js)2.96KB1.13KB
create-plugin (index.js)9.85KB3.18KB
data-objectstack (index.js)139.51KB35.97KB
fields (index.js)230.82KB56.70KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.53KB10.71KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.98KB12.37KB
plugin-charts (index.js)61.04KB17.31KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)117.21KB30.27KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)232.99KB57.58KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)112.10KB27.10KB
plugin-gantt (index.js)162.55KB39.57KB
plugin-grid (index.js)187.71KB49.68KB
plugin-kanban (index.js)48.30KB13.28KB
plugin-list (index.js)105.12KB25.48KB
plugin-map (index.js)16.81KB5.24KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)25.76KB7.33KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

✅ 验收通过(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)—— undraft + auto-merge。

git 实物核验(2b2ec58d6):净 diff 3 文件;code 三处查找一条全序(嵌套声明形 > 平铺 > 兄弟键,asAiQuotaCode(nested?.code) ?? flatCode ?? asAiQuotaCode(body.code)),JSDoc「Parse priority (a total order, deliberately)」写明双发过渡期的确定性依据;固定集合与未知形状降级行为一字未动;⛔ 未触碰 #3783 在飞文件、未改生产者、未动 cloud 仓 —— 边界全守。三方言 × 命中/不命中矩阵 30 测;两轮反向验证(7 红/5 红)逐条吻合,且对「优先级钉子 vs 可达性钉子」的区分、以及一处自己预期写错后按真实行为改钉(数组 body 的 substring 抽取系改前既有行为)的处置都合规 —— 不改实现迁就错误预期。

验收要害采纳并转录:#3804(finding)记录的词汇缺口 —— 三个 AI 配额 code 在 ADR-0112 封闭值域外,合规嵌套信封今天装不下它们;本单只接住「新形态+旧词汇」的过渡期生产者。⚠️ cloud#1168 动手前必须先看 #3804(词汇拍板属 spec owner,A 案+护栏为 dev 推荐)—— 本 PR 落地不等于消费端已能接住任意收敛形态。19 项 CI 全部完成 0 失败(PM 独立复核);changeset patch 三门绿。


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 17:07
@yinlianghui
yinlianghui added this pull request to the merge queueAug 8, 2026
Merged via the queue into main with commit 2a54e86Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3491-quota-error-envelope branch August 8, 2026 17:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseAiQuotaError 先学会嵌套信封形态(消费端先行)—— cloud 两个 429 生产者随后按 ADR-0112 收敛(cloud#944 移交)

2 participants

@yinlianghui@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) by yinlianghui · Pull Request #3802 · objectstack-ai/objectui · GitHub
Skip to content

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) - #3802

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope
Aug 8, 2026
Merged

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491)#3802
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3491
Part of objectstack-ai/cloud#944 —— 消费端先行;本单落地后 cloud#1168(生产者按 ADR-0112 收敛)才可动。⛔ 本 PR 不改任何生产者、不动 cloud 仓。

为什么消费端必须先行

两个 AI 配额 429 生产者用相反的方式填同一个 error 键(guardrail 塞 code,service-ai 塞 message、code 放在 code 兄弟键),而 ADR-0112 声明的是第三种:{ success:false, error:{ code, message } }parseAiQuotaError 今天只认「平铺 error 就是 code」这一种,生产者一旦按声明收敛,配额拒绝会静默失配、退回通用的「Response failed」红条 —— 与 objectui#2992(useAgents 先学信封、服务端再转)同一套路。

改动(packages/plugin-chatbot/src/tool-display.ts)

  • parseAiQuotaError 现在在三个位置找 code:嵌套声明形 error.code、平铺 error、兄弟键 code
  • 只拓宽 code 的位置,不拓宽 code 的值域 —— 固定集合(ai_design_quota_exhausted / ai_data_chat_trial_exhausted / ai_allowance_exhausted)一字未动,任何未知形状仍降级为现状行为(null),因此不会有非配额错误被新捕进配额 CTA。
  • message 主干:嵌套 error.message → 平铺 message → (仅当 error 不是 code 槽时)error 里的散文。service-ai 方言的 message 就在 error 里,而平铺方言的 error 是 code —— 后者绝不能当 message 显示给用户,这个 gate 由测试钉住。
  • 伴随字段(upgrade / topUp / messageEn)保持既有的顶层读取,嵌套位置不预设(是 error.details.upgrade?还是 error.code 的兄弟?)—— 那是 cloud#1168 决定的形状,现在编一个嵌套键出来等于把没人同意过的契约固化下来(AGENTS.md #0.1)。
  • 新增两个小 helper:asAiQuotaCode(值域判定)、asText(空串算 message,因为 { error:'', code:… } 方言正好发空串)。

三方言 × 命中/不命中矩阵(实跑)

pnpm vitest run packages/plugin-chatbot/src/tool-display.test.tsTest Files 1 passed / Tests 30 passed;整包 pnpm vitest run packages/plugin-chatbot17 files / 272 tests passed;pnpm --filter @object-ui/plugin-chatbot type-check 干净通过。

方言命中不命中
平铺 guardrail(error 是 code)三个 code 各一例error:'ai_quota_exhausted' → null
service-ai(code 兄弟键)三个 code 各一例 + error 散文当 messagecode:'ai_quota_exhausted' → null
嵌套声明形(ADR-0112)三个 code 各一例code:'QUOTA_EXCEEDED' → null;error 无 code → null

另有:未知形状降级(error:null / error:[] / code:42 / 非 JSON)、伴随字段向后兼容(嵌套 code + 顶层 upgrade/topUp/messageEn 双发)、嵌套-only 时 CTA flag 落 false、以及嵌套在外层文本/数组里的 body 仍能被定位(既有 substring 抽取行为,顺手钉住)。

解析优先级依据

嵌套声明形 > 平铺 code > 兄弟 code,是一条全序,不是「先试哪个都行」:过渡期生产者新信封与旧顶层键双发是很现实的一步,同时命中两形态时必须只有一个确定结果,所以最「声明」的位置优先;而嵌套 code 缺失或不在值域时,旧 limb 仍然可达(测试里 QUOTA_EXCEEDED 嵌套 + 顶层旧 code 就落到旧 limb)。

反向验证(方向先判后跑,两次都对上)

  • 砍掉嵌套 limb → 预判 7 红:嵌套三 code 命中、嵌套优先级、两条伴随字段、嵌套 body 定位;实跑 7 failed | 23 passed,逐条对上。三条嵌套「不命中」用例照旧绿 —— 它们钉的是 miss 侧,本来区分不了,如实记下而不是假装它们证明了什么。
  • 砍掉兄弟键 limb → 预判 5 红:service-ai 三 code 命中、散文当 message、旧 limb 兜底;实跑 5 failed | 25 passed。「平铺优先于兄弟键」那条两种情况下都绿 —— 它是优先级钉子,不是可达性钉子;兄弟键的可达性由上面 4 条钉住。

一个必须记下的剩余缺口(本单不动手,交 PM/维护者定)

ADR-0112 的 error.code 值域是封闭z.enum(ErrorCode = StandardErrorCodeERROR_CODE_LEDGER,SCREAMING_SNAKE,由 error-code-ledger.test.ts 机械强制),而这三个配额 code 在 ledger 里零登记(git grep over origin/mainpackages/spec/src 零命中)。也就是说:一个真正合规的嵌套信封今天装不下ai_allowance_exhausted —— ApiErrorSchema.parse 会拒。所以本 PR 的嵌套分支只对「嵌套形 + 旧小写词汇」的生产者生效;cloud#1168 若把词汇一并收敛(登记 AI_*,或按 ledger 自己的建议直接用标准的 QUOTA_EXCEEDED 把三态与 CTA flag 挪进 details),objectui 这边还需要一次词汇对齐的后续小 PR。那是契约决策,不该由我猜 —— 已写进 JSDoc 与 dev 报告的 open_questions。

顺带更正 issue 描述里的一处:parseAiQuotaError 并非「今天无仓内生产调用方」—— ChatbotEnhanced.tsx 有两处活调用(:2781 的红条抑制、:3790 的配额 CTA)。核心前提(只认平铺 error-as-code)经 origin/main 实读成立,tool-display.ts:197 一带确如描述。


Generated by Claude Code

…r envelope (#3491)
The two cloud AI 429 producers fill the same `error` key in opposite ways (the
token guardrail puts the code there, service-ai puts the message there and the
code in a `code` sibling), while ADR-0112 declares a third shape both converge
on: `{ success: false, error: { code, message } }`. The consumer has to learn
the declared shape first, or the producers' convergence silently turns every
quota refusal back into a generic "Response failed" banner (cloud#944; same
consumer-first sequencing as objectui#2992).
Code lookup is a total order — declared envelope, flat guardrail code, `code`
sibling — so a transitional producer double-emitting the new envelope next to
the legacy top-level keys has one defined outcome. Only the code's location
widens: the recognized code set is unchanged and any unrecognized shape still
degrades to null. Companion fields keep their top-level read; their position in
the declared envelope is not presumed (cloud#1168 fixes the real shape).
Tests: three dialects x hit/miss, unknown-shape degradation, companion-field
backward compatibility, and the parse-priority order.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
@vercel

vercelBot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 8, 2026 4:58pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.1 KB350 KB
Entry fileindex-Rq8io3A8.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)481.69KB106.04KB
core (index.js)2.96KB1.13KB
create-plugin (index.js)9.85KB3.18KB
data-objectstack (index.js)139.51KB35.97KB
fields (index.js)230.82KB56.70KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.53KB10.71KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.98KB12.37KB
plugin-charts (index.js)61.04KB17.31KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)117.21KB30.27KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)232.99KB57.58KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)112.10KB27.10KB
plugin-gantt (index.js)162.55KB39.57KB
plugin-grid (index.js)187.71KB49.68KB
plugin-kanban (index.js)48.30KB13.28KB
plugin-list (index.js)105.12KB25.48KB
plugin-map (index.js)16.81KB5.24KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)25.76KB7.33KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

✅ 验收通过(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)—— undraft + auto-merge。

git 实物核验(2b2ec58d6):净 diff 3 文件;code 三处查找一条全序(嵌套声明形 > 平铺 > 兄弟键,asAiQuotaCode(nested?.code) ?? flatCode ?? asAiQuotaCode(body.code)),JSDoc「Parse priority (a total order, deliberately)」写明双发过渡期的确定性依据;固定集合与未知形状降级行为一字未动;⛔ 未触碰 #3783 在飞文件、未改生产者、未动 cloud 仓 —— 边界全守。三方言 × 命中/不命中矩阵 30 测;两轮反向验证(7 红/5 红)逐条吻合,且对「优先级钉子 vs 可达性钉子」的区分、以及一处自己预期写错后按真实行为改钉(数组 body 的 substring 抽取系改前既有行为)的处置都合规 —— 不改实现迁就错误预期。

验收要害采纳并转录:#3804(finding)记录的词汇缺口 —— 三个 AI 配额 code 在 ADR-0112 封闭值域外,合规嵌套信封今天装不下它们;本单只接住「新形态+旧词汇」的过渡期生产者。⚠️ cloud#1168 动手前必须先看 #3804(词汇拍板属 spec owner,A 案+护栏为 dev 推荐)—— 本 PR 落地不等于消费端已能接住任意收敛形态。19 项 CI 全部完成 0 失败(PM 独立复核);changeset patch 三门绿。


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 17:07
@yinlianghui
yinlianghui added this pull request to the merge queueAug 8, 2026
Merged via the queue into main with commit 2a54e86Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3491-quota-error-envelope branch August 8, 2026 17:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseAiQuotaError 先学会嵌套信封形态(消费端先行)—— cloud 两个 429 生产者随后按 ADR-0112 收敛(cloud#944 移交)

2 participants

@yinlianghui@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) by yinlianghui · Pull Request #3802 · objectstack-ai/objectui · GitHub
Skip to content

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) - #3802

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope
Aug 8, 2026
Merged

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491)#3802
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3491
Part of objectstack-ai/cloud#944 —— 消费端先行;本单落地后 cloud#1168(生产者按 ADR-0112 收敛)才可动。⛔ 本 PR 不改任何生产者、不动 cloud 仓。

为什么消费端必须先行

两个 AI 配额 429 生产者用相反的方式填同一个 error 键(guardrail 塞 code,service-ai 塞 message、code 放在 code 兄弟键),而 ADR-0112 声明的是第三种:{ success:false, error:{ code, message } }parseAiQuotaError 今天只认「平铺 error 就是 code」这一种,生产者一旦按声明收敛,配额拒绝会静默失配、退回通用的「Response failed」红条 —— 与 objectui#2992(useAgents 先学信封、服务端再转)同一套路。

改动(packages/plugin-chatbot/src/tool-display.ts)

  • parseAiQuotaError 现在在三个位置找 code:嵌套声明形 error.code、平铺 error、兄弟键 code
  • 只拓宽 code 的位置,不拓宽 code 的值域 —— 固定集合(ai_design_quota_exhausted / ai_data_chat_trial_exhausted / ai_allowance_exhausted)一字未动,任何未知形状仍降级为现状行为(null),因此不会有非配额错误被新捕进配额 CTA。
  • message 主干:嵌套 error.message → 平铺 message → (仅当 error 不是 code 槽时)error 里的散文。service-ai 方言的 message 就在 error 里,而平铺方言的 error 是 code —— 后者绝不能当 message 显示给用户,这个 gate 由测试钉住。
  • 伴随字段(upgrade / topUp / messageEn)保持既有的顶层读取,嵌套位置不预设(是 error.details.upgrade?还是 error.code 的兄弟?)—— 那是 cloud#1168 决定的形状,现在编一个嵌套键出来等于把没人同意过的契约固化下来(AGENTS.md #0.1)。
  • 新增两个小 helper:asAiQuotaCode(值域判定)、asText(空串算 message,因为 { error:'', code:… } 方言正好发空串)。

三方言 × 命中/不命中矩阵(实跑)

pnpm vitest run packages/plugin-chatbot/src/tool-display.test.tsTest Files 1 passed / Tests 30 passed;整包 pnpm vitest run packages/plugin-chatbot17 files / 272 tests passed;pnpm --filter @object-ui/plugin-chatbot type-check 干净通过。

方言命中不命中
平铺 guardrail(error 是 code)三个 code 各一例error:'ai_quota_exhausted' → null
service-ai(code 兄弟键)三个 code 各一例 + error 散文当 messagecode:'ai_quota_exhausted' → null
嵌套声明形(ADR-0112)三个 code 各一例code:'QUOTA_EXCEEDED' → null;error 无 code → null

另有:未知形状降级(error:null / error:[] / code:42 / 非 JSON)、伴随字段向后兼容(嵌套 code + 顶层 upgrade/topUp/messageEn 双发)、嵌套-only 时 CTA flag 落 false、以及嵌套在外层文本/数组里的 body 仍能被定位(既有 substring 抽取行为,顺手钉住)。

解析优先级依据

嵌套声明形 > 平铺 code > 兄弟 code,是一条全序,不是「先试哪个都行」:过渡期生产者新信封与旧顶层键双发是很现实的一步,同时命中两形态时必须只有一个确定结果,所以最「声明」的位置优先;而嵌套 code 缺失或不在值域时,旧 limb 仍然可达(测试里 QUOTA_EXCEEDED 嵌套 + 顶层旧 code 就落到旧 limb)。

反向验证(方向先判后跑,两次都对上)

  • 砍掉嵌套 limb → 预判 7 红:嵌套三 code 命中、嵌套优先级、两条伴随字段、嵌套 body 定位;实跑 7 failed | 23 passed,逐条对上。三条嵌套「不命中」用例照旧绿 —— 它们钉的是 miss 侧,本来区分不了,如实记下而不是假装它们证明了什么。
  • 砍掉兄弟键 limb → 预判 5 红:service-ai 三 code 命中、散文当 message、旧 limb 兜底;实跑 5 failed | 25 passed。「平铺优先于兄弟键」那条两种情况下都绿 —— 它是优先级钉子,不是可达性钉子;兄弟键的可达性由上面 4 条钉住。

一个必须记下的剩余缺口(本单不动手,交 PM/维护者定)

ADR-0112 的 error.code 值域是封闭z.enum(ErrorCode = StandardErrorCodeERROR_CODE_LEDGER,SCREAMING_SNAKE,由 error-code-ledger.test.ts 机械强制),而这三个配额 code 在 ledger 里零登记(git grep over origin/mainpackages/spec/src 零命中)。也就是说:一个真正合规的嵌套信封今天装不下ai_allowance_exhausted —— ApiErrorSchema.parse 会拒。所以本 PR 的嵌套分支只对「嵌套形 + 旧小写词汇」的生产者生效;cloud#1168 若把词汇一并收敛(登记 AI_*,或按 ledger 自己的建议直接用标准的 QUOTA_EXCEEDED 把三态与 CTA flag 挪进 details),objectui 这边还需要一次词汇对齐的后续小 PR。那是契约决策,不该由我猜 —— 已写进 JSDoc 与 dev 报告的 open_questions。

顺带更正 issue 描述里的一处:parseAiQuotaError 并非「今天无仓内生产调用方」—— ChatbotEnhanced.tsx 有两处活调用(:2781 的红条抑制、:3790 的配额 CTA)。核心前提(只认平铺 error-as-code)经 origin/main 实读成立,tool-display.ts:197 一带确如描述。


Generated by Claude Code

…r envelope (#3491)
The two cloud AI 429 producers fill the same `error` key in opposite ways (the
token guardrail puts the code there, service-ai puts the message there and the
code in a `code` sibling), while ADR-0112 declares a third shape both converge
on: `{ success: false, error: { code, message } }`. The consumer has to learn
the declared shape first, or the producers' convergence silently turns every
quota refusal back into a generic "Response failed" banner (cloud#944; same
consumer-first sequencing as objectui#2992).
Code lookup is a total order — declared envelope, flat guardrail code, `code`
sibling — so a transitional producer double-emitting the new envelope next to
the legacy top-level keys has one defined outcome. Only the code's location
widens: the recognized code set is unchanged and any unrecognized shape still
degrades to null. Companion fields keep their top-level read; their position in
the declared envelope is not presumed (cloud#1168 fixes the real shape).
Tests: three dialects x hit/miss, unknown-shape degradation, companion-field
backward compatibility, and the parse-priority order.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
@vercel

vercelBot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 8, 2026 4:58pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.1 KB350 KB
Entry fileindex-Rq8io3A8.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)481.69KB106.04KB
core (index.js)2.96KB1.13KB
create-plugin (index.js)9.85KB3.18KB
data-objectstack (index.js)139.51KB35.97KB
fields (index.js)230.82KB56.70KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.53KB10.71KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.98KB12.37KB
plugin-charts (index.js)61.04KB17.31KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)117.21KB30.27KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)232.99KB57.58KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)112.10KB27.10KB
plugin-gantt (index.js)162.55KB39.57KB
plugin-grid (index.js)187.71KB49.68KB
plugin-kanban (index.js)48.30KB13.28KB
plugin-list (index.js)105.12KB25.48KB
plugin-map (index.js)16.81KB5.24KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)25.76KB7.33KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

✅ 验收通过(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)—— undraft + auto-merge。

git 实物核验(2b2ec58d6):净 diff 3 文件;code 三处查找一条全序(嵌套声明形 > 平铺 > 兄弟键,asAiQuotaCode(nested?.code) ?? flatCode ?? asAiQuotaCode(body.code)),JSDoc「Parse priority (a total order, deliberately)」写明双发过渡期的确定性依据;固定集合与未知形状降级行为一字未动;⛔ 未触碰 #3783 在飞文件、未改生产者、未动 cloud 仓 —— 边界全守。三方言 × 命中/不命中矩阵 30 测;两轮反向验证(7 红/5 红)逐条吻合,且对「优先级钉子 vs 可达性钉子」的区分、以及一处自己预期写错后按真实行为改钉(数组 body 的 substring 抽取系改前既有行为)的处置都合规 —— 不改实现迁就错误预期。

验收要害采纳并转录:#3804(finding)记录的词汇缺口 —— 三个 AI 配额 code 在 ADR-0112 封闭值域外,合规嵌套信封今天装不下它们;本单只接住「新形态+旧词汇」的过渡期生产者。⚠️ cloud#1168 动手前必须先看 #3804(词汇拍板属 spec owner,A 案+护栏为 dev 推荐)—— 本 PR 落地不等于消费端已能接住任意收敛形态。19 项 CI 全部完成 0 失败(PM 独立复核);changeset patch 三门绿。


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 17:07
@yinlianghui
yinlianghui added this pull request to the merge queueAug 8, 2026
Merged via the queue into main with commit 2a54e86Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3491-quota-error-envelope branch August 8, 2026 17:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseAiQuotaError 先学会嵌套信封形态(消费端先行)—— cloud 两个 429 生产者随后按 ADR-0112 收敛(cloud#944 移交)

2 participants

@yinlianghui@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) by yinlianghui · Pull Request #3802 · objectstack-ai/objectui · GitHub
Skip to content

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) - #3802

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope
Aug 8, 2026
Merged

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491)#3802
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3491
Part of objectstack-ai/cloud#944 —— 消费端先行;本单落地后 cloud#1168(生产者按 ADR-0112 收敛)才可动。⛔ 本 PR 不改任何生产者、不动 cloud 仓。

为什么消费端必须先行

两个 AI 配额 429 生产者用相反的方式填同一个 error 键(guardrail 塞 code,service-ai 塞 message、code 放在 code 兄弟键),而 ADR-0112 声明的是第三种:{ success:false, error:{ code, message } }parseAiQuotaError 今天只认「平铺 error 就是 code」这一种,生产者一旦按声明收敛,配额拒绝会静默失配、退回通用的「Response failed」红条 —— 与 objectui#2992(useAgents 先学信封、服务端再转)同一套路。

改动(packages/plugin-chatbot/src/tool-display.ts)

  • parseAiQuotaError 现在在三个位置找 code:嵌套声明形 error.code、平铺 error、兄弟键 code
  • 只拓宽 code 的位置,不拓宽 code 的值域 —— 固定集合(ai_design_quota_exhausted / ai_data_chat_trial_exhausted / ai_allowance_exhausted)一字未动,任何未知形状仍降级为现状行为(null),因此不会有非配额错误被新捕进配额 CTA。
  • message 主干:嵌套 error.message → 平铺 message → (仅当 error 不是 code 槽时)error 里的散文。service-ai 方言的 message 就在 error 里,而平铺方言的 error 是 code —— 后者绝不能当 message 显示给用户,这个 gate 由测试钉住。
  • 伴随字段(upgrade / topUp / messageEn)保持既有的顶层读取,嵌套位置不预设(是 error.details.upgrade?还是 error.code 的兄弟?)—— 那是 cloud#1168 决定的形状,现在编一个嵌套键出来等于把没人同意过的契约固化下来(AGENTS.md #0.1)。
  • 新增两个小 helper:asAiQuotaCode(值域判定)、asText(空串算 message,因为 { error:'', code:… } 方言正好发空串)。

三方言 × 命中/不命中矩阵(实跑)

pnpm vitest run packages/plugin-chatbot/src/tool-display.test.tsTest Files 1 passed / Tests 30 passed;整包 pnpm vitest run packages/plugin-chatbot17 files / 272 tests passed;pnpm --filter @object-ui/plugin-chatbot type-check 干净通过。

方言命中不命中
平铺 guardrail(error 是 code)三个 code 各一例error:'ai_quota_exhausted' → null
service-ai(code 兄弟键)三个 code 各一例 + error 散文当 messagecode:'ai_quota_exhausted' → null
嵌套声明形(ADR-0112)三个 code 各一例code:'QUOTA_EXCEEDED' → null;error 无 code → null

另有:未知形状降级(error:null / error:[] / code:42 / 非 JSON)、伴随字段向后兼容(嵌套 code + 顶层 upgrade/topUp/messageEn 双发)、嵌套-only 时 CTA flag 落 false、以及嵌套在外层文本/数组里的 body 仍能被定位(既有 substring 抽取行为,顺手钉住)。

解析优先级依据

嵌套声明形 > 平铺 code > 兄弟 code,是一条全序,不是「先试哪个都行」:过渡期生产者新信封与旧顶层键双发是很现实的一步,同时命中两形态时必须只有一个确定结果,所以最「声明」的位置优先;而嵌套 code 缺失或不在值域时,旧 limb 仍然可达(测试里 QUOTA_EXCEEDED 嵌套 + 顶层旧 code 就落到旧 limb)。

反向验证(方向先判后跑,两次都对上)

  • 砍掉嵌套 limb → 预判 7 红:嵌套三 code 命中、嵌套优先级、两条伴随字段、嵌套 body 定位;实跑 7 failed | 23 passed,逐条对上。三条嵌套「不命中」用例照旧绿 —— 它们钉的是 miss 侧,本来区分不了,如实记下而不是假装它们证明了什么。
  • 砍掉兄弟键 limb → 预判 5 红:service-ai 三 code 命中、散文当 message、旧 limb 兜底;实跑 5 failed | 25 passed。「平铺优先于兄弟键」那条两种情况下都绿 —— 它是优先级钉子,不是可达性钉子;兄弟键的可达性由上面 4 条钉住。

一个必须记下的剩余缺口(本单不动手,交 PM/维护者定)

ADR-0112 的 error.code 值域是封闭z.enum(ErrorCode = StandardErrorCodeERROR_CODE_LEDGER,SCREAMING_SNAKE,由 error-code-ledger.test.ts 机械强制),而这三个配额 code 在 ledger 里零登记(git grep over origin/mainpackages/spec/src 零命中)。也就是说:一个真正合规的嵌套信封今天装不下ai_allowance_exhausted —— ApiErrorSchema.parse 会拒。所以本 PR 的嵌套分支只对「嵌套形 + 旧小写词汇」的生产者生效;cloud#1168 若把词汇一并收敛(登记 AI_*,或按 ledger 自己的建议直接用标准的 QUOTA_EXCEEDED 把三态与 CTA flag 挪进 details),objectui 这边还需要一次词汇对齐的后续小 PR。那是契约决策,不该由我猜 —— 已写进 JSDoc 与 dev 报告的 open_questions。

顺带更正 issue 描述里的一处:parseAiQuotaError 并非「今天无仓内生产调用方」—— ChatbotEnhanced.tsx 有两处活调用(:2781 的红条抑制、:3790 的配额 CTA)。核心前提(只认平铺 error-as-code)经 origin/main 实读成立,tool-display.ts:197 一带确如描述。


Generated by Claude Code

…r envelope (#3491)
The two cloud AI 429 producers fill the same `error` key in opposite ways (the
token guardrail puts the code there, service-ai puts the message there and the
code in a `code` sibling), while ADR-0112 declares a third shape both converge
on: `{ success: false, error: { code, message } }`. The consumer has to learn
the declared shape first, or the producers' convergence silently turns every
quota refusal back into a generic "Response failed" banner (cloud#944; same
consumer-first sequencing as objectui#2992).
Code lookup is a total order — declared envelope, flat guardrail code, `code`
sibling — so a transitional producer double-emitting the new envelope next to
the legacy top-level keys has one defined outcome. Only the code's location
widens: the recognized code set is unchanged and any unrecognized shape still
degrades to null. Companion fields keep their top-level read; their position in
the declared envelope is not presumed (cloud#1168 fixes the real shape).
Tests: three dialects x hit/miss, unknown-shape degradation, companion-field
backward compatibility, and the parse-priority order.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
@vercel

vercelBot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 8, 2026 4:58pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.1 KB350 KB
Entry fileindex-Rq8io3A8.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)481.69KB106.04KB
core (index.js)2.96KB1.13KB
create-plugin (index.js)9.85KB3.18KB
data-objectstack (index.js)139.51KB35.97KB
fields (index.js)230.82KB56.70KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.53KB10.71KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.98KB12.37KB
plugin-charts (index.js)61.04KB17.31KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)117.21KB30.27KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)232.99KB57.58KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)112.10KB27.10KB
plugin-gantt (index.js)162.55KB39.57KB
plugin-grid (index.js)187.71KB49.68KB
plugin-kanban (index.js)48.30KB13.28KB
plugin-list (index.js)105.12KB25.48KB
plugin-map (index.js)16.81KB5.24KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)25.76KB7.33KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

✅ 验收通过(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)—— undraft + auto-merge。

git 实物核验(2b2ec58d6):净 diff 3 文件;code 三处查找一条全序(嵌套声明形 > 平铺 > 兄弟键,asAiQuotaCode(nested?.code) ?? flatCode ?? asAiQuotaCode(body.code)),JSDoc「Parse priority (a total order, deliberately)」写明双发过渡期的确定性依据;固定集合与未知形状降级行为一字未动;⛔ 未触碰 #3783 在飞文件、未改生产者、未动 cloud 仓 —— 边界全守。三方言 × 命中/不命中矩阵 30 测;两轮反向验证(7 红/5 红)逐条吻合,且对「优先级钉子 vs 可达性钉子」的区分、以及一处自己预期写错后按真实行为改钉(数组 body 的 substring 抽取系改前既有行为)的处置都合规 —— 不改实现迁就错误预期。

验收要害采纳并转录:#3804(finding)记录的词汇缺口 —— 三个 AI 配额 code 在 ADR-0112 封闭值域外,合规嵌套信封今天装不下它们;本单只接住「新形态+旧词汇」的过渡期生产者。⚠️ cloud#1168 动手前必须先看 #3804(词汇拍板属 spec owner,A 案+护栏为 dev 推荐)—— 本 PR 落地不等于消费端已能接住任意收敛形态。19 项 CI 全部完成 0 失败(PM 独立复核);changeset patch 三门绿。


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 17:07
@yinlianghui
yinlianghui added this pull request to the merge queueAug 8, 2026
Merged via the queue into main with commit 2a54e86Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3491-quota-error-envelope branch August 8, 2026 17:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseAiQuotaError 先学会嵌套信封形态(消费端先行)—— cloud 两个 429 生产者随后按 ADR-0112 收敛(cloud#944 移交)

2 participants

@yinlianghui@claude
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) by yinlianghui · Pull Request #3802 · objectstack-ai/objectui · GitHub
Skip to content

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491) - #3802

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope
Aug 8, 2026
Merged

fix(plugin-chatbot): parseAiQuotaError 先学会嵌套声明信封(三方言全部可读)(#3491)#3802
yinlianghui merged 1 commit into
mainfrom
claude/issue-3491-quota-error-envelope

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3491
Part of objectstack-ai/cloud#944 —— 消费端先行;本单落地后 cloud#1168(生产者按 ADR-0112 收敛)才可动。⛔ 本 PR 不改任何生产者、不动 cloud 仓。

为什么消费端必须先行

两个 AI 配额 429 生产者用相反的方式填同一个 error 键(guardrail 塞 code,service-ai 塞 message、code 放在 code 兄弟键),而 ADR-0112 声明的是第三种:{ success:false, error:{ code, message } }parseAiQuotaError 今天只认「平铺 error 就是 code」这一种,生产者一旦按声明收敛,配额拒绝会静默失配、退回通用的「Response failed」红条 —— 与 objectui#2992(useAgents 先学信封、服务端再转)同一套路。

改动(packages/plugin-chatbot/src/tool-display.ts)

  • parseAiQuotaError 现在在三个位置找 code:嵌套声明形 error.code、平铺 error、兄弟键 code
  • 只拓宽 code 的位置,不拓宽 code 的值域 —— 固定集合(ai_design_quota_exhausted / ai_data_chat_trial_exhausted / ai_allowance_exhausted)一字未动,任何未知形状仍降级为现状行为(null),因此不会有非配额错误被新捕进配额 CTA。
  • message 主干:嵌套 error.message → 平铺 message → (仅当 error 不是 code 槽时)error 里的散文。service-ai 方言的 message 就在 error 里,而平铺方言的 error 是 code —— 后者绝不能当 message 显示给用户,这个 gate 由测试钉住。
  • 伴随字段(upgrade / topUp / messageEn)保持既有的顶层读取,嵌套位置不预设(是 error.details.upgrade?还是 error.code 的兄弟?)—— 那是 cloud#1168 决定的形状,现在编一个嵌套键出来等于把没人同意过的契约固化下来(AGENTS.md #0.1)。
  • 新增两个小 helper:asAiQuotaCode(值域判定)、asText(空串算 message,因为 { error:'', code:… } 方言正好发空串)。

三方言 × 命中/不命中矩阵(实跑)

pnpm vitest run packages/plugin-chatbot/src/tool-display.test.tsTest Files 1 passed / Tests 30 passed;整包 pnpm vitest run packages/plugin-chatbot17 files / 272 tests passed;pnpm --filter @object-ui/plugin-chatbot type-check 干净通过。

方言命中不命中
平铺 guardrail(error 是 code)三个 code 各一例error:'ai_quota_exhausted' → null
service-ai(code 兄弟键)三个 code 各一例 + error 散文当 messagecode:'ai_quota_exhausted' → null
嵌套声明形(ADR-0112)三个 code 各一例code:'QUOTA_EXCEEDED' → null;error 无 code → null

另有:未知形状降级(error:null / error:[] / code:42 / 非 JSON)、伴随字段向后兼容(嵌套 code + 顶层 upgrade/topUp/messageEn 双发)、嵌套-only 时 CTA flag 落 false、以及嵌套在外层文本/数组里的 body 仍能被定位(既有 substring 抽取行为,顺手钉住)。

解析优先级依据

嵌套声明形 > 平铺 code > 兄弟 code,是一条全序,不是「先试哪个都行」:过渡期生产者新信封与旧顶层键双发是很现实的一步,同时命中两形态时必须只有一个确定结果,所以最「声明」的位置优先;而嵌套 code 缺失或不在值域时,旧 limb 仍然可达(测试里 QUOTA_EXCEEDED 嵌套 + 顶层旧 code 就落到旧 limb)。

反向验证(方向先判后跑,两次都对上)

  • 砍掉嵌套 limb → 预判 7 红:嵌套三 code 命中、嵌套优先级、两条伴随字段、嵌套 body 定位;实跑 7 failed | 23 passed,逐条对上。三条嵌套「不命中」用例照旧绿 —— 它们钉的是 miss 侧,本来区分不了,如实记下而不是假装它们证明了什么。
  • 砍掉兄弟键 limb → 预判 5 红:service-ai 三 code 命中、散文当 message、旧 limb 兜底;实跑 5 failed | 25 passed。「平铺优先于兄弟键」那条两种情况下都绿 —— 它是优先级钉子,不是可达性钉子;兄弟键的可达性由上面 4 条钉住。

一个必须记下的剩余缺口(本单不动手,交 PM/维护者定)

ADR-0112 的 error.code 值域是封闭z.enum(ErrorCode = StandardErrorCodeERROR_CODE_LEDGER,SCREAMING_SNAKE,由 error-code-ledger.test.ts 机械强制),而这三个配额 code 在 ledger 里零登记(git grep over origin/mainpackages/spec/src 零命中)。也就是说:一个真正合规的嵌套信封今天装不下ai_allowance_exhausted —— ApiErrorSchema.parse 会拒。所以本 PR 的嵌套分支只对「嵌套形 + 旧小写词汇」的生产者生效;cloud#1168 若把词汇一并收敛(登记 AI_*,或按 ledger 自己的建议直接用标准的 QUOTA_EXCEEDED 把三态与 CTA flag 挪进 details),objectui 这边还需要一次词汇对齐的后续小 PR。那是契约决策,不该由我猜 —— 已写进 JSDoc 与 dev 报告的 open_questions。

顺带更正 issue 描述里的一处:parseAiQuotaError 并非「今天无仓内生产调用方」—— ChatbotEnhanced.tsx 有两处活调用(:2781 的红条抑制、:3790 的配额 CTA)。核心前提(只认平铺 error-as-code)经 origin/main 实读成立,tool-display.ts:197 一带确如描述。


Generated by Claude Code

…r envelope (#3491)
The two cloud AI 429 producers fill the same `error` key in opposite ways (the
token guardrail puts the code there, service-ai puts the message there and the
code in a `code` sibling), while ADR-0112 declares a third shape both converge
on: `{ success: false, error: { code, message } }`. The consumer has to learn
the declared shape first, or the producers' convergence silently turns every
quota refusal back into a generic "Response failed" banner (cloud#944; same
consumer-first sequencing as objectui#2992).
Code lookup is a total order — declared envelope, flat guardrail code, `code`
sibling — so a transitional producer double-emitting the new envelope next to
the legacy top-level keys has one defined outcome. Only the code's location
widens: the recognized code set is unchanged and any unrecognized shape still
degrades to null. Companion fields keep their top-level read; their position in
the declared envelope is not presumed (cloud#1168 fixes the real shape).
Tests: three dialects x hit/miss, unknown-shape degradation, companion-field
backward compatibility, and the parse-priority order.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
@vercel

vercelBot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 8, 2026 4:58pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.1 KB350 KB
Entry fileindex-Rq8io3A8.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)481.69KB106.04KB
core (index.js)2.96KB1.13KB
create-plugin (index.js)9.85KB3.18KB
data-objectstack (index.js)139.51KB35.97KB
fields (index.js)230.82KB56.70KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.53KB10.71KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.98KB12.37KB
plugin-charts (index.js)61.04KB17.31KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)117.21KB30.27KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)232.99KB57.58KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)112.10KB27.10KB
plugin-gantt (index.js)162.55KB39.57KB
plugin-grid (index.js)187.71KB49.68KB
plugin-kanban (index.js)48.30KB13.28KB
plugin-list (index.js)105.12KB25.48KB
plugin-map (index.js)16.81KB5.24KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)25.76KB7.33KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghuiClaude

Copy link
Copy Markdown
CollaboratorAuthor

✅ 验收通过(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)—— undraft + auto-merge。

git 实物核验(2b2ec58d6):净 diff 3 文件;code 三处查找一条全序(嵌套声明形 > 平铺 > 兄弟键,asAiQuotaCode(nested?.code) ?? flatCode ?? asAiQuotaCode(body.code)),JSDoc「Parse priority (a total order, deliberately)」写明双发过渡期的确定性依据;固定集合与未知形状降级行为一字未动;⛔ 未触碰 #3783 在飞文件、未改生产者、未动 cloud 仓 —— 边界全守。三方言 × 命中/不命中矩阵 30 测;两轮反向验证(7 红/5 红)逐条吻合,且对「优先级钉子 vs 可达性钉子」的区分、以及一处自己预期写错后按真实行为改钉(数组 body 的 substring 抽取系改前既有行为)的处置都合规 —— 不改实现迁就错误预期。

验收要害采纳并转录:#3804(finding)记录的词汇缺口 —— 三个 AI 配额 code 在 ADR-0112 封闭值域外,合规嵌套信封今天装不下它们;本单只接住「新形态+旧词汇」的过渡期生产者。⚠️ cloud#1168 动手前必须先看 #3804(词汇拍板属 spec owner,A 案+护栏为 dev 推荐)—— 本 PR 落地不等于消费端已能接住任意收敛形态。19 项 CI 全部完成 0 失败(PM 独立复核);changeset patch 三门绿。


Generated by Claude Code

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 17:07
@yinlianghui
yinlianghui added this pull request to the merge queueAug 8, 2026
Merged via the queue into main with commit 2a54e86Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3491-quota-error-envelope branch August 8, 2026 17:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseAiQuotaError 先学会嵌套信封形态(消费端先行)—— cloud 两个 429 生产者随后按 ADR-0112 收敛(cloud#944 移交)

2 participants

@yinlianghui@claude