Repository navigation
fix(data-objectstack): uploadFile/uploadFiles upload through the storage service presigned flow - #38237
Conversation
…age service's presigned flow The two methods posted to /api/data/<resource>/upload, a route the standard server does not serve (404 ENDPOINT_NOT_FOUND). They now delegate to createObjectStackUploadAdapter: presigned request, byte PUT, completion, with recordId mapped to attachTo (scope attachments). fieldName and metadata, which neither presigned request carries, are refused before any request instead of dropped. Storage refusals reject UPLOAD_ERROR with the server's status and code. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
The dogfood package declares @object-ui/data-objectstack as a dev dependency so the pin resolves the adapter, the dogfood closure builds it, and the dogfood test hash follows adapter changes. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
📓 Docs Drift Check
What this run could not see
Coarse fallback — 2 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
…solated project check:test-source-alias asks for one anchored alias per new workspace import, so the upload-route pin is a verdict about the adapter source in the checkout, not about its last build. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a ACCEPT at Face. L1 only, no L2 owed. The 8 files touch no Claim against surface (claim 7236668269, surface additions 7236682186, 7237259964, 7237706727). The surface matches file for file.
Changeset, read sentence by sentence: every bullet matches the code. That covers the three-request flow, sequential Evidence (reports 7237242813, 7237679580, 7238096080).
Checks at this head: 11 skipped · 60 success · 0 pending; Lint & Repo Gates, TypeScript Type Check and Check Changeset green. Nit (not blocking). Out of scope, answered for the seat. |
… server The upload fetch counts a URL as this server only when it is a path with one leading slash or starts with the data source's own origin. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
…resolved origins A request counts as this server only when the URL parser resolves it to the server's origin (baseUrl, or the page's origin when baseUrl is empty), under baseUrl's path when it has one. An unreadable server or an unparsable URL is not this server. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a delta: ACCEPT at
Still L1 only: no face has moved. The PR body should stay neutral about the hardening: it states what the check does, with no claim of a prior exposure. |
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-28T12:57Z · zone
|
…objectstack-ai#38348) Part of objectstack-ai#38143 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:每次合入主干后,云端部署用的框架预构建镜像恢复自动发布,换版本时不用再手动触发构建。 - 属于“框架基础镜像随主干自动发布”这项工作:上一轮开启了逐次推送发布,但之后一次合入让每次推送的镜像构建都失败了。 - 出错时只影响这个镜像的构建任务变红、镜像不发布,主干代码和运行时不受影响,改动可以直接撤回。 - 无 ## What changes `docker/framework-build-base/Dockerfile` only. - The typeless build (`OS_SKIP_DTS=1`) now also excludes `@objectstack/dogfood`: `--filter='!@objectstack/docs' --filter='!./ui/**' --filter='!@objectstack/dogfood'`. - Before that build, the same filters are read with `turbo run build --dry=json`, and the step stops when any task in the closure sits under `ui/`, naming each `ui/` package and the package outside `ui/` that pulls it in. - Two comments are corrected: the header's "same arguments as the downstream stage" note names the one added argument, and the closing note no longer claims that no package outside `ui/` depends on an `@object-ui/*` one. Root cause, read from the failing push run 46153615363, job 141005357401: the step `pnpm exec turbo run build --filter='!@objectstack/docs' --filter='!./ui/**' --concurrency=1` prints "Running build in 93 packages" with no `@object-ui/*` package in scope, then runs `@object-ui/types:build`. That task fails with TS7016 "Could not find a declaration file for module '@objectstack/spec/ui'" (and `/shared`, `/data`, `/api`, `/kernel`, `/system`, `/ai`), because `OS_SKIP_DTS` leaves `packages/spec/dist` without `.d.ts`. The `!./ui/**` filter takes `ui/` packages out of scope only. turbo still builds every dependency of a package in scope (`build` dependsOn `^build`). objectstack-ai#38237 (333e6f3) added `"@object-ui/data-objectstack": "workspace:*"` to the devDependencies of `packages/qa/dogfood`, which pulls in four `ui/` packages. At b503291, the last green run, dogfood's manifest names no `@object-ui/*` package. Why excluding dogfood is safe: it is the only package outside `ui/` that depends on an `@object-ui/*` package (`git grep '"@object-ui/' -- '*package.json' ':!ui/**'` finds only its manifest). It has no `build` script (its task's command in the dry run is `NONEXISTENT`), and no workspace package depends on it. The image's consumer links `packages/*` by path to run the framework, and a private regression-test suite is no part of that. The exclusion takes out exactly five packages: dogfood and the four `ui/` ones it pulled in (see the closure diff below). Why a closure check and not just the filter: the next `ui/` dependency from outside `ui/` would otherwise fail the same way, minutes into tsc, with an error that names a `ui/` package and not the manifest that caused it. The check follows this Dockerfile's existing fail-fast pattern (the authorable-surface baseline assertion). It sits inline because this Dockerfile can package a commit whose tree predates any helper script. It shares one filter list (`set --`) with the build, so the two cannot drift apart. ## Tests <details><summary>turbo closure before / after, on this branch's base 5f741ed (contains 333e6f3)</summary> ``` turbo run build --filter='!@objectstack/docs' --filter='!./ui/**' --dry=json tasks 97, ui-packages 4: @object-ui/core @object-ui/data-objectstack @object-ui/test-support @object-ui/types @objectstack/dogfood#build dependencies under ui/: @object-ui/data-objectstack#build + --filter='!@objectstack/dogfood' before 97 after 92 dropped: @object-ui/core @object-ui/data-objectstack @object-ui/test-support @object-ui/types @objectstack/dogfood added: (none) ui in after: 0 ``` </details> <details><summary>the RUN step itself, joined the way the Dockerfile parser joins it and run under dash (the image's /bin/sh), install and real build stubbed</summary> As written (exit 0): ``` → typeless build closure: 92 tasks, none under ui/ BUILD-WOULD-RUN: turbo run build --filter=!@objectstack/docs --filter=!./ui/** --filter=!@objectstack/dogfood --concurrency=1 ``` With the dogfood exclusion removed (exit 1, the build never starts): ``` ✗ the typeless build closure reaches ui/: @object-ui/core, @object-ui/data-objectstack, @object-ui/test-support, @object-ui/types pulled in by: @objectstack/dogfood (packages/qa/dogfood) ``` </details> No local Docker daemon was available, so the full image build was not run locally. This PR touches `docker/framework-build-base/**`, so the workflow's `verify` job runs here as a dry run. It builds this PR's BASE commit (a `main` that contains 333e6f3) with this PR's Dockerfile, which is the end-to-end reading. ## Acceptance notes - `Part of`, not `Fixes`: the card's acceptance ("a cloud pin round to a fresh objectstack main commit finds its base image already published with no manual dispatch") is read after merge, on the first post-merge push run and a pin round. - The push commits between 333e6f3 and this merge have no image. Each can be backfilled by a `workflow_dispatch` with its `sha`, because the image definition always comes from main's checkout. - The pull_request trigger covers only this Dockerfile and the workflow, so a future manifest change that pulls `ui/` into the closure still surfaces first on a push run. It now fails in seconds, with the offending package named, and not in tsc. - The downstream stage this Dockerfile mirrors ("keep them in step") runs the same typeless build with the old filters. Wherever that stage still builds the framework itself rather than starting FROM this image, it hits the same failure on any commit at or after 333e6f3 (carrier: cloud). - Changeset: none. `docker/` is in no package's `files[]`, so nothing publishes (`skip-changeset`). ## Verification Read first: `docker/framework-build-base/Dockerfile`, the second `RUN` (the inline closure check and the shared `set --` filter list). Two-minute check: open this PR's `Build framework build base (dry run, no push)` job. Expect a log line `→ typeless build closure: 92 tasks, none under ui/`, no `@object-ui/types:build` task in the typeless step, and a green `Look inside the image` step. Local gates on 21835be (`dispatch-gates.mjs --commands`, 9 derived, all exit 0): `check-closing-keyword-parity` (+ `--self-test`), `check-comment-mask-corpus`, `check:adr-anchors`, `check:driver-memory-census`, `check:gitlink-declared`, `check:nul-bytes`, `check:refd-timer-probe`, `check:watch-hint-literal`. `overlap-check`: VERDICT clean exit 0. --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW)_ Co-authored-by: Claude <noreply@anthropic.com>
Requested by Tesla · project thread
Fixes #38163
Clause-②: no
Metadata-protocol: none
Route taken: (a).
uploadFileanduploadFilesnow upload through the package's own presigned storage adapter,createObjectStackUploadAdapter.recordIdmaps toattachTowith scopeattachments, and the adapter's result maps toFileUploadResult. The declaredDataSourcecontract promises an upload that returns a stored file, and the storage service is the one upload route the standard server serves, so (a) keeps that promise and (b) would not. Two options cannot be mapped:fieldNameandmetadata. Neither presigned request carries them. Those two are refused before any request, in the (b) manner, with an error that names the supported path, so nothing is dropped silently. Neither method sends a request to/api/data/RESOURCE/uploadany more.Why refusing
fieldName/metadatais not a narrowing (Clause-②: nostands): before this PR every call to either method failed. The standard server answers the old route 404ENDPOINT_NOT_FOUND(405 with the version segment), whatever options were passed, so no caller had a working upload that carried those options. This PR removes no working behaviour. A call that always failed now succeeds without the two options, and with them it fails at once with an error that names the supported path, instead of a 404. The public types (DataSource.uploadFile/uploadFiles,FileUploadResult) are unchanged, and no metadata an author writes is affected (Metadata-protocol: none).维护者速读
What changes
ui/packages/data-objectstack/src/index.ts:uploadFiledelegates tocreateObjectStackUploadAdapter, which sendsPOST /api/v1/storage/upload/presigned, the bytePUT, thenPOST /api/v1/storage/upload/complete. The adapter is built per call becauseattachTois one of its construction options. The fetch it uses is built once per data source (storageUploadFetch). That fetch is the injecteduploadTransport(data-objectstack:上传文件和 metadata-client 绕过注入的 fetch,纯令牌会话下被当匿名(接 #37225) #37506), plus the data source'stokenon every request to this server and never on a presigned URL on another origin. The same-origin check compares resolved origins: the URL is resolved againstbaseUrl, or the page's origin whenbaseUrlis empty, and it counts as this server only when the origins match (and, for abaseUrlwith a path, the resolved path lies under it). A server that cannot be read, or a URL that does not parse, is not this server.uploadFilesis N sequential presigned uploads. The first refused file stops the batch, and the rejection'sdetailscarryfailedIndexplus, asuploaded, the files already stored. The files after it are not sent.recordIdmaps toattachTo: { parentObject: resource, parentId: recordId }andscope: 'attachments'. Without it, no scope is sent, so the server default applies, andresourceis not sent.onProgressmaps the adapter's 0 to 1 ratio to 0 to 100, spread across the batch foruploadFiles.fieldNameandmetadatareject withUNSUPPORTED_OPERATIONbefore any request.ObjectStackErrorwithUPLOAD_ERROR, the server's status, anddetails.serverCode. A failure that got no HTTP answer reaches the caller unchanged, as before.ui/packages/data-objectstack/src/upload-adapter.ts: the presign refusal and the byte-PUT refusal now carrystatus(andcode), as the completion refusal already did, so the mapping above can read them. Messages are unchanged.DataSource.uploadFile/uploadFilesandFileUploadResultare untouched.packages/qa/dogfood/test/data-objectstack-upload-route-38163.dogfood.test.ts: the real-stack pin.packages/qa/dogfood/package.jsongains one devDependency,@object-ui/data-objectstack(workspace:*), andpnpm-lock.yamlgains only that importer entry, written bypnpm install. With that, the pin resolves the adapter, the dogfood closure builds it, and the dogfood test hash follows adapter changes.packages/qa/dogfood/vitest.config.tsgains the one anchored aliascheck:test-source-aliasprescribes, so the pin resolves the adapter's SOURCE in this checkout and not its last build. The dogfood package is private, so it needs no changeset.Tests
uploadTransport-37506.test.tsis updated, because its fake server now answers 404 on/api/data/RESOURCE/uploadas the real one does. The data-objectstack:上传文件和 metadata-client 绕过注入的 fetch,纯令牌会话下被当匿名(接 #37225) #37506 pins keep their meaning: injected fetch, bearer on every request, connection state unchanged. A new top-level describe for data-objectstack 的 uploadFile/uploadFiles 发往一条服务端不存在的路由,上传必然失败(404/405) #38163 checks that no request reaches the unserved route, the exact three-step sequence per file, therecordIdmapping and result, the default scope withoutrecordId, the refusal offieldNameandmetadatawith zero requests, token-only signing with no token on a foreign presigned URL,UPLOAD_ERRORcode, status and serverCode, the partial-batch report, progress, and presigned URLs spelled protocol-relative (//host), slash-backslash and double-backslash getting no token while the presign and complete requests keep it. Ablation, run after the commit: with the previous string check restored, the slash-backslash case fails (1 of 15). The double-backslash case already got no token under that check. With the origin comparison removed, all three spellings and the cross-origin case fail (4 of 15). After restoring, git status is clean.index.tsrestored on disk, the file reported 12 of 12 failed. With the fix restored, it reported 21 of 21 passed (this file plusobjectstack-upload-scope-12055.test.ts).type-checkexited 0, both on 95e3f9f.baseUrlis a bare origin, so no path rule applies), first measured on head 9725c42, resolving the adapter source through the alias (the dependency is declared, and no link was made by hand). The stack isbootStackwithStorageServicePlugin, the attachments fixture and a bearer-only session.uploadFilewith arecordId(token only) anduploadFiles(host bearer fetch) pass 2 of 2. They assert committedsys_filerows, thesys_attachmentrow with itsattachmentId, and that no request reached an unserved upload path. Ablation: with the baseindex.tsrestored on disk (the file shows the old route twice), both tests fail withUPLOAD_ERROR"Not found", the server's 404. Aftergit checkout HEAD, git status is clean and both pass again. The dogfoodtypecheckexits 0.Acceptance notes
README.md(File Uploads) does not describeuploadFile/uploadFiles, and it is outside the claimed surface. No sentence in it became false.Verification
Read first:
index.ts, atuploadThroughStorageandstorageUploadFetch(where the token goes, and which URLs get it), thenuploadFiles(what a partial batch reports).Two-minute check: run
pnpm --dir ui exec vitest run packages/data-objectstack/src/uploadTransport-37506.test.ts. Expected: 15 passed.Local gates on head 95e3f9f
node scripts/pm/dispatch-gates.mjs --commandsderived 87 families over the 8 changed paths, and all 87 exited 0,check:test-source-aliasincluded. The--ranreconciliation reported: 87 derived, 87 run, 0 NOT-MEASURED.overlap-checkreported clean: origin/main, #38192 (which shares the dogfoodpackage.json) and #38284 (which sharespnpm-lock.yaml) all merge cleanly. All other CI families are left to the PR's check-runs.Generated by Claude Code