Repository navigation
fix(app-shell,console): the shell package list, AI chat lists and studio-design reads and writes send the stored bearer token - #37185
Conversation
…rites through the authenticated fetch (WIP) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
… fetch ratchet; changesets (WIP) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…ticated fetch; the ratchet reads 'include' as const (WIP) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
… fetch reads them (WIP, shard 1 of 6) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
… of 6) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…of 6) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…of 6) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…shard 5 of 6) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…shard 6 of 6) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…stub, clear of a sibling PR's lines Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…ers read off a Headers, the record-lock read) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…ouble gains headers in its one stub Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…gin-detail load at collection (check:test-source-alias) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…arer-only-shell-fetch
…alette's plugin-detail load at collection (check:test-source-alias) Claude-Session: https://claude.ai/code/session_01QSeKYnV6DdKeTL414FFGnp Co-authored-by: Claude <noreply@anthropic.com>
…converted authenticated read (headers) The package list now goes through createAuthenticatedFetch, which reads the response's set-auth-token header; the double carried none, so the read threw and the palette drew no Packages group. Claude-Session: https://claude.ai/code/session_01QSeKYnV6DdKeTL414FFGnp Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for L1 (fix round 1, cloud session
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
…arer-only-shell-fetch # Conflicts: # ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx # ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx
…r in user terms, and claim only the same-server console requests Claude-Session: https://claude.ai/code/session_01QSeKYnV6DdKeTL414FFGnp Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for the delta read (patch round 2, cloud session
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Landing · area a4-U · 2026-11-25T05:45Z · head
State change: ready for review + auto-merge armed; the queue lands it. On MERGED the card #37080 closes through |
…llscreen Two conflicts, both a collection-time comment beside an import both sides kept (entryReadsOnce-11797, itemDraftLine-12725): main's comment taken. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYoFqGdRM9Qmg7M2o2B
…h beside the flow's ⋯ menu) Claude-Session: https://claude.ai/code/session_01QSeKYnHH41MS5hWVGPia4F Co-authored-by: Claude <noreply@anthropic.com>
Fixes #37080
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Same-server
/api/reads and writes in app-shell and the console that called the bare globalfetchwithcredentials: 'include'(the session cookie and nothing else) now go throughcreateAuthenticatedFetchfrom@object-ui/auth, exactly as #37077 did for the Setup pages: built per call (createAuthenticatedFetch()(input, init), a localauthFetchin each module),credentials: 'include'kept on every call, so the cookie still rides along and a401now reaches the console's session-ended check. No second auth-fetch helper and no new export. Nothing changes in what the server accepts.The measured case: under a bearer-only session,
readPackagesPayload(GET /api/v1/packages, the session's held package list read by the sidebar, the app header, the command palette and the Studio entries) sends the bearer and the list loads (pinned below).The family, measured at
origin/main63ab47979 non-test files under
ui/packages/app-shell/srcandui/apps/console/srccontaincredentials: 'include'. Read call by call (AST scan of everycredentials: 'include'property and the call it is handed to):Converted here: 64 calls in 39 files.
app-shell/.../studio-design/packages-io.tsreadPackagesPayload(GET /api/v1/packages, the measured case),ensureCustomizationPackage,duplicatePackageapp-shell/.../studio-design/packageCustomizations-io.ts,PackageSwitcher.tsx,AutomationsPillar.tsx,FlowItemMoreMenu.tsxapp-shell/src/hooks/useConversationList.tsapp-shell/src/hooks/useChatConversation.tsapp-shell/src/console/ai/buildDebugApi.tsapp-shell/src/hooks/useAiUsage.tsapp-shell/src/services/suggestedBindingsApi.tsapp-shell/src/preview/commitHistory.tsapp-shell/src/preview/DraftChangesPanel.tsx,UnpublishedAppBar.tsx,usePendingDrafts.tsapp-shell/src/preview/flowDraftChecks.tsopts.fetchImpl ?? createAuthenticatedFetch())app-shell/src/views/changeOwner.tsapiFetch ?? createAuthenticatedFetch())app-shell/src/views/metadata-admin/PackageFormDialog.tsx,catalog-activation.ts,permission-set-clone.ts,sharing-rule-catalog.tsapp-shell/src/views/metadata-admin/inspectors/FlowReferenceField.tsx,connector-input-fields.tsapp-shell/src/views/metadata-admin/previews/FlowRunsPanel.tsx,useFlowNodePalette.ts,PagePreview.tsxapp-shell/src/views/setup/packagedActionLedger.ts,packagedFlowLedger.tsapp-shell/src/hooks/useRecordApprovals.ts,sharedUserFeeds.ts,useInboxBell.tsapp-shell/src/console/AppNoAccessEmptyState.tsx,connect/ConnectAgentWidget.tsx,deployment-notice/deploymentNoticeState.tsapp-shell/src/console/marketplace/marketplaceApi.tsserverFetch(/cloud-connection/install,install-namespace,installation, and on the control plane its owninstall_packageaction and installed-state route)app-shell/src/layout/designModeMenuSave.ts/api/v1/i18n/locales)app-shell/src/layout/ContextSelectors.tsx{ sameOriginOnly: true }: the endpoint is author-written (optionsSource.endpoint) and may name another hostconsole/src/pages/developer/AgentConnectSection.tsx,IntegrationsPage.tsxconsole/src/pages/auth/DeviceAuthPage.tsxOf the card's named ones:
packages-io.tsreadPackagesPayload,useConversationList,useChatConversation,suggestedBindingsApiand the studio-design writes (ensure-customization, duplicate, customizations, flow clone) are all converted.suggestedBindingsApi,useRecordApprovals,sharedUserFeeds,useInboxBell,ConnectAgentWidget,deploymentNoticeStateand threemarketplaceApicalls already set the bearer header by hand (authHeaders/bearerAuthHeaders/withEnvAuth), so those were not cookie-only; they are converted anyway for the session-ended check and the one mechanism, and their hand-rolled header is left in place (the wrapper sets the same value).Already authenticated or injected (not the family): 24 files.
settings/api.ts,AuditLogPage.tsx,approvalsApi.ts,studioEntry.ts,ExcelImportBar.tsx,CloudAiModelStatus.tsx,useEnvironmentEntitlements.ts,storageUsageEndpoint.ts,ImpersonationBanner.tsx,useImpersonationExit.ts,RecordAttachmentsPanel.tsx,RecordDetailView.tsx,useConsoleActionRuntime.tsx,AccessExplainPanel.tsx,MetadataTypeActions.tsx,PackagesPage.tsx,DatasourceResourcePage.tsx,personalViews.ts,connectorConnections.ts,connectorCredentials.ts, and the injected transports ofmyPreferences.ts,slackDoors.ts,orgEnvironments.ts,useLauncherApps.tsx.App.tsxnames the string in a comment only.Left, on the pin's shrink-only list: 21 calls in 15 files, each with its reason in the pin (
sameServerFetch.bearer.ratchet.test.ts,ALLOWED):console/src/LocalizationFetchProvider.tsx(1) andconsole/src/languageSeed.ts(not counted by the pin: it handssharedGetJsona transport argument that may beundefined): the boot read of/api/v1/auth/me/localization, shared in flight by a key built from the init with the early requestindex.htmlsends. A session it cannot see readsauthenticated: falseand falls back to the browser language rather than failing. Its transport is its own decision (Acceptance notes).console/src/components/FormPage.tsx(1): the bare channel is the public form route's on purpose.console/src/lib/auth-preflight.ts,console/src/lib/early-discovery.ts(1 each): set the bearer header themselves on purpose.console/src/pages/auth/OAuthConsentPage.tsx(3),followAuthorize.ts(1),handoffClientName.ts(1): the OAuth hand-off, whose authorize step is a top-level navigation that can only carry the cookie.console/src/pages/auth/SetupPage.tsx,app-shell/src/console/auth/bootstrapStatus.ts,console/src/pages/auth/VerifyEmailPage.tsx,app-shell/src/chrome/ConditionalAuthWrapper.tsx,app-shell/src/runtime-config.ts(1 each): read before or without a session.app-shell/src/console/ai/AiChatPage.tsx(1): an open PR (feat(console): conversation focus — a pinned record in the chat request, shown as a chip, kept across navigation #37123) edits this file; its call moves with that work.app-shell/src/console/marketplace/marketplaceApi.ts(5): each targetsgetCloudBase() || SERVER_URL, the cloud control plane's own origin whenever one is configured, which must never see this runtime's bearer.app-shell/src/views/metadata-admin/previews/ActionPreview.tsx(1): the test request of anapiaction preview, sent to the author-written target; its transport is not decided here.The other two fenced files hold no family call:
RecordDetailView.tsxanduseConsoleActionRuntime.tsxalready route everycredentials: 'include'call through theirauthFetch. Neither was edited.Tests
ui/packages/app-shell/src/sameServerFetch.bearer.ratchet.test.ts(new, the enumeration pin; runs in Test UI, app-shell'sunitproject): parses every non-test source file of both trees with the TypeScript parser and refuses a bare cookie-only call (the transport is the globalfetch,window.fetch,globalThis.fetch,self.fetch, one of those as a??/||fallback, orsharedGetJsonwithout its transport argument; the init carriescredentials: 'include', inline or as aconstof the file,as constincluded). The URL is not judged: a call that must stay bare is a counted row with its reason. Four cases: the scan reads both trees (more than 500 and 100 files); a 13-case detector battery (each bare spelling found, each authenticated one not); every bare call is a counted row; every row is still exact (a file that sheds a call must shrink its row).ui/packages/app-shell/src/views/studio-design/packages-io.bearerSession.test.ts(new): against a server that refuses any request without the bearer, with a token stored,fetchPackagesloads the list and its one request carriesAuthorization: Bearer TOKENandcredentials: 'include';fetchListedPackageIdslikewise; the duplicate write, the commit timeline and revert, suggested bindings and the build-debug report carry the bearer. Each with a cookie-only control (no token stored: noAuthorization,credentials: 'include').Test doubles that moved (118 files, no assertion weakened):
Responsedoubles ({ ok, status, json }) gainheaders: new Headers(), the headers a realResponsecarries and the authenticated fetch reads (set-auth-token), as fix(console): Settings, Packages, Audit Log and the connector pages send the stored bearer token #37077 did. The 102nd,StudioPaletteGroups.surfaceScope-36900(the command-palette suite that reachedmainafter round 0), doublesGET /api/v1/packages: without the headers the convertedreadPackagesPayloadthrew on the double and the palette drew no Packages group. ForfetchInstalledPackageRow-7881andStudioDesignSurface.readOnlyPosture-12453the headers are added at the one stub instead of each answer.@object-ui/authmock answeredcreateAuthenticatedFetch: () => vi.fn()(a transport that answers nothing) now hand the authenticated fetch's requests to the globalfetchthe file already stubs: the fourRecordApprovalsPanelsuites andRecordDetailVieweditLockedByState-32756,phoneFace-27058,userActionPredicates,harness.RecordDetailViewapproval suites whoseauthFetchSpystands for the action door: approvals reads (now through the authenticated fetch too) are handed to the file's wire double, as before (approvalRecallGate,accessEndedAfterDecision-26589,approvalDeclaredActions,approvalLock-12220,approvalLock-25934).StudioRoute.searchPalette-11863(console): its auth mock answers the Studio permissions read and hands every other request (the package list) to the wire double.useConversationListandBuildDebugDrawerassert{ credentials: 'include', headers: expect.any(Headers) }(exact keys, as before);DraftChangesPanel.flowChecks-34818readsAccept-Languageoff aHeaders.RecordDetailView.headerApiInterpolation: the flow-trigger case asserts exactly one call to the trigger door, filtered by its path, since the page's own reads now share that spy.Acceptance notes
plugin-*hooks out unless measured here):credentials: 'include'with the barefetchremains inui/packages/plugin-chatbot(useAgents,useAiModels,useHitlInChat,usePendingActions),plugin-detail(queueClaim,stageChangeStarts,useRecordEditable),plugin-grid(useRecordCrudVerdicts,useRowApprovalLocks),plugin-dashboard(DatasetWidget),plugin-charts(ObjectChart),fields(ShareableObjectRefField,preferenceOptions),components(ShareDialog) andpermissions(MePermissionsProvider). Not each read call by call.fetch('/api/…')with no init at all is cookie-only as well (the defaultsame-origincredentials) and is outside the pin's spelling:views/metadata-admin/widgets.tsxfetchFieldSelectorOptions(GET /api/v1/objects/:name/fields).LocalizationFetchProviderandlanguageSeedread/api/v1/auth/me/localizationcookie-only; under a bearer-only session that read answers anonymously and the console falls back to the browser language instead of the user's own locale. Not measured in a browser; left because the request key is shared with the early requestindex.htmlsends.authHeadersinsuggestedBindingsApi,bearerAuthHeaders,withEnvAuth) are now redundant there; not removed here.Verification
The measured case and the pins (green at the head)
packages-io.bearerSession.test.tsand the ratchet are in the rerun below (all green). The ratchet's detector battery first went red on a real detector issue: at a script's top levelawait (x)(…)parses as a call ofawait, so the(apiFetch ?? fetch)case read 0; the cases now run inside an async function.Ablation: one conversion reverted, both pins red
Through
scripts/ablation-replace.mjsonpackages-io.ts: anchorconst res = await authFetch('/api/v1/packages', {hit 1 → 0, blobd3c93d771344→42f8862ba05e; the ratchet and the bearer-session file run under the lock:The cookie-only control stayed green. Restored: blob
d3c93d771344equal toHEAD,git diff HEADempty.Suites
The whole
@object-ui/app-shelland@object-ui/consolesuites, under the shared verify lock, in six shards (cd ui && pnpm exec vitest run --maxWorkers=3 --shard=k/6 packages/app-shell apps/console) at32505939(the final source; only test files changed after it). These are the readings BEFORE the doubles moved, and they are how the moved doubles were found:The 117 failing files are exactly the 117 moved doubles. Each was re-run after its fix (the two new pin files with them):
Test Files 116 passed | 3 failed (119), then the three fixed againTest Files 3 passed (3). After the last two type fixesTest Files 2 passed (2), and after the collection-time imports the 34 files that gained oneTest Files 34 passed (34)/Tests 319 passed (319), at5dde589a8c. The 2,655 files that passed in the shards were not edited. A full re-run after the fixes was not done locally (NOT MEASURED, reason: about 90 minutes of shared lock); Test UI runs the full affected set on this PR.Type-check through turbo (dependency closure built):
@object-ui/app-shelland@object-ui/consoletype-checkTasks: 77 successful, 77 totalat3080a68173;@object-ui/app-shellagain at5dde589a8cafter the last test edits,Tasks: 69 successful, 69 total. The first run found two type errors in my test edits (a typed tuple, an object literal against a declared parameter type), fixed in3080a68173.pnpm --dir ui exec vitest run scripts/after building the seven@objectstackpackages as Test UI does:Test Files 172 passed | 2 skipped (174),Tests 5131 passed | 2 skipped (5133).Gates
node scripts/pm/dispatch-gates.mjs --commands(no paths, merge base63ab4794): 39 families. All 39 run locally, each exit captured before any pipe; 37 lock-free families re-run at5dde589a8c, all exit 0;pnpm check:type-check-debtexit 0 (0 raw tsc error(s) total, none above its recorded number); the uiscripts/suite above exit 0. Reconciled:dispatch-gates --ran:39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED (a DERIVED zero).check:test-source-aliasfirst went red on the edited suites (exit 1): 34 of them reach a dynamicimport('@objectstack/lint'),import('@objectstack/formula')orimport('@object-ui/plugin-detail')in the source under test with no collection-time load. Each gained the module-top side-effect import the gate prescribes (5dde589a8c), then exit 0.overlap-checkbefore every push: at4a990ef7it merges cleanly withorigin/main(93bd4595) and with #37204, #37188 and #37148, and exits 1 on textual conflicts with three open Studio PRs that edit the same test files: #37166, #37168, #37169 (inStudioDesignSurface.*,BuilderLanding.*,CommandPalette.studioScope-11863,StudioRoute.searchPalette-11863, and #37166/#37169 also inPackageSwitcher.tsx,FlowItemMoreMenu.tsx). Whichever lands second takes the merge.Round 1: main merged at 3b4f0b9, re-measured at e055596
CI at
5dde589awas red on two causes, both frommainmoving (the ⌘K palette work):check:test-source-aliasexit 1: four edited suites (StudioDesignSurfaceentryReadsOnce-11797,itemDraftLine-12725,notFound-26708,readOnlyPosture-12453) now reachimport('@object-ui/plugin-detail')through the surface's command palette and its record preview. Each gained the prescribed module-topimport '@object-ui/plugin-detail';(38 files carry a collection-time import in all). Then exit 0.StudioPaletteGroups.surfaceScope-36900: 3 failed, 8 passed; after its package-list double gainedheaders(above), 11 passed. No assertion changed.Readings at
e0555965, under the shared verify lock:The one failing file is
ReportNewPage-36692.test.tsx, which this branch does not touch (nor its page); it passed 3 of 3 runs alone (Tests 6 passed (6)each). Its second failure received the first case's save call, late: its cases flush bysetTimeout(0)rounds while the page loads its Han romanizer lazily, so on a loaded box the save can land after the case ends.@object-ui/app-shelltype-checkthrough turbo:Tasks: 69 successful, 69 total.pnpm --dir ui exec vitest run scripts/:Test Files 172 passed | 2 skipped (174),Tests 5131 passed | 2 skipped (5133).Gates:
dispatch-gates --commands(merge base3b4f0b98): 39 families, all run, each exit captured before any pipe, all exit 0.check:type-check-debtfirst answered exit 3 (its closure build queued behind the suite above and never got the lock: not measured), then exit 0 under the lock (0 raw tsc error(s) total, none above its recorded number).dispatch-gates --ran:39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED (a DERIVED zero …).Read first
ui/packages/app-shell/src/sameServerFetch.bearer.ratchet.test.ts: the detector and theALLOWEDrows (each reason is a claim about a call left bare).ui/packages/app-shell/src/layout/ContextSelectors.tsx: the one conversion withsameOriginOnly, because its URL is author-written.ui/packages/app-shell/src/console/marketplace/marketplaceApi.ts: which calls moved ontoserverFetchand which stay bare because they may target the cloud origin.Two-minute check:
cd ui && pnpm exec vitest run packages/app-shell/src/sameServerFetch.bearer.ratchet.test.ts packages/app-shell/src/views/studio-design/packages-io.bearerSession.test.ts, expectTest Files 2 passed (2).Round 2: main merged at 93bd459, re-measured at 4a990ef
mainafter round 1 and left this PR conflicting inStudioDesignSurface.notFound-26708andStudioDesignSurface.readOnlyPosture-12453: both sides add the sameimport '@object-ui/plugin-detail';with a different comment. The merge (48321c62) keeps one import withmain's comment, so againstmainthose two files differ only by round 0's doubles.credentials: 'include'line underui/packages/app-shell/srcorui/apps/console/src, and their one new hand-rolled Response double already carriesheaders: new Headers().4a990ef7) now name every converted door in user terms (flow clone, permission-set clone, page preview, the no-access state and the design-mode language list were missing) and claim only "the other same-server console requests", since the 21 listed calls stay cookie-only.Readings at
4a990ef7, under the shared verify lock (packages/specmoved onmain: the seven@objectstackpackages Test UI builds were rebuilt first, andpnpm --filter @objectstack/spec check:generatedreadsAll 14 generated artifacts are up to date):check:test-source-aliasexit 0.@object-ui/app-shelltype-checkthrough turbo:Tasks: 69 successful, 69 total.dispatch-gates --commands(merge base93bd4595): the same 39 families, all run, each exit captured before any pipe, all exit 0 (check:type-check-debt:0 raw tsc error(s) total, none above its recorded number; the uiscripts/suiteTest Files 172 passed | 2 skipped (174)).dispatch-gates --ran:39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED (a DERIVED zero …). The whole app-shell and console suites were not re-run this round (NOT MEASURED, reason: about 70 minutes of shared lock for a merge that changed no source line of this PR); Test UI runs the affected set on this PR.Generated by Claude Code