Repository navigation
fix(service-storage)!: every upload bound resolves by one precedence, and unset never means unlimited - #33883
Conversation
…unset never means unlimited Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…the verb control reads its cause Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…-bound-built-in-default
Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 66105c838e91ee6685b63ccb11ac15fe6e74583a && git checkout 66105c838e91ee6685b63ccb11ac15fe6e74583a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 895783a1e864e0fe629c56b3c6315771ca87bf87 667098ef47ac71cd5f4e24aaabebf0255f8c1538 && git checkout -B drift-repro 895783a1e864e0fe629c56b3c6315771ca87bf87 && git merge --no-ff 667098ef47ac71cd5f4e24aaabebf0255f8c1538
node scripts/docs-audit/affected-docs.mjs --json 895783a1e864e0fe629c56b3c6315771ca87bf87
|
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Contract-review-handoff: review#1 — CONTRACT_REVIEW_TIER unavailable (the maintainer routes this account's contract reviews to review#1, 2026-11-15T13:52Z) · head 14805de A no-card security#1 order. The maintainer ruled option D in the seat's session (「同意」, after a contract-tier review of the analysis). Seat notes:
Generated by Claude Code |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 14805de · 2026-11-15T14:00Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-15T14:08Z. First review of this head; claim: comment 6895465109. The lane handed it to review#1 (6895325870), which signed off; review#2 took it as the seated review seat. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla. No path of the diff is a published schema (nothing under ① Derived judgmentsAccept-set and public-surface changes, each read in the tree at the head:
Is the declared narrowing the whole narrowing? In the code, yes: every read of the resolved bound in non-test source ( Is "one precedence" one across every upload door? The order is one: a single ② Semver level
③ Boundary flags
④ Design judgmentThe narrowing against the rule it implements (every upload door bounded in every composition; no bound only by an explicit host choice, announced at boot; a malformed host choice refuses the boot):
Tried and held: each config source (saved, env-sourced, host, manifest default, none); unset, zero, negative, non-number and wrong-case spelling at each of the three host doors; a saved value under a host Findings: S1 (should-fix) — the changeset's "Who moves" list and remedy are not the whole migration. (a) A host whose saved or env-sourced S2 (should-fix) — the rule "no bound is announced at N1 (nit) — export N2 (nit) — the rule "a host number always resolves to a finite, non-zero byte bound" is not pinned at the edges of the numeric arm, and N3 (nit) — No must-fix. Two should-fix, three nits. Implemented-by: VERDICT: PASS |
… upload bound; the host bound is a finite whole-byte bound Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 667098e · 2026-11-15T15:00Z |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Delta review requested from review#2 (the original reviewer, record 6895664766): range
|
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-15T15:05Z. Claim: comment 6896511540; lane request 6896562392 on mailbox #33873. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla. Delta round on record 6895664766, which judged head No path of the diff is a published schema and none is a governed surface. The face is the declared narrowing alone. ① Derived judgmentsThe judgments of record 6895664766 were re-read against this head and hold: unset resolves to 100 MB, a dropped saved value and a failed settings read land on a bound, a saved setting wins over every host choice, the manifest and both TTL resolutions are untouched. What this commit moves:
Is the declared narrowing still the whole narrowing? Yes. The "Who moves" list now carries the sixth class (a present but invalid saved or env-sourced value), and I found no configuration or request that moves outside the listed classes. ② Semver level
③ Boundary flags
④ Design judgmentThe delta against the rule (every upload door bounded in every composition; no bound only by an explicit host choice, announced at boot; a malformed host choice refuses the boot):
Earlier findings, by id: S1: closed. "Who moves" names the invalid saved value, and the remedies are split by host: the constructing host, the DevPlugin-composed server with its actual steps, the host with an invalid saved value. Verified against S2: closed. Every host door that accepts N1: closed. Both names are exported from the package entry. N2: closed. The two edges are refused and pinned, the file verbs judge a bound handed to them, and the resolver's trust is stated in its jsdoc. A narrower residue is N7. N3: closed. The catalog now states the order with nothing saved: host option, declared default, built-in bound. New in this round: N4 (nit) — N5 (nit) — the DevPlugin remedy's second form ("or list the instance in the stack's N6 (nit) — the changeset's "Host option" bullet still lists the refused values without the two numeric edges this commit adds, and the README names the lower edge only. The PR body states both. N7 (nit) — the upper edge of a host number is "finite", which admits byte counts too large to be counted exactly; and No must-fix, no should-fix. Four nits. Implemented-by: VERDICT: PASS |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f 席位核对ACCEPT at
Implemented-by: os-dev (security#1 order, |
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no published skill names the storage upload bound, the storage plugin's options or
max_upload_mb维护者速读
maxUploadMb(数字或显式的'unlimited'),「未设置」不再等于「不限」。maxUploadMb: 'unlimited'明确选择,并在启动时以 warn 宣告;宿主传错值则拒绝启动。max_upload_mb)的上传从不限变为 100 MB(BREAKING,changeset 与 README 里有「Who moves」与逐行修复,含 DevPlugin 的具体步骤);默认os serve(绑定设置、未保存)本来就是 100 MB,不变。回滚即还原本 PR。packages/services/service-storage/src/storage-limits.ts(pickLayer与resolveStorageLimits的上传层、parseHostMaxUploadMb),storage-service-plugin.ts(构造函数校验与启动行钩子),mount-storage-routes.ts。pnpm --filter @objectstack/service-storage exec vitest run --maxWorkers=2 src/storage-limits.test.ts,预期 43 个测试全绿。What changes
Every storage upload bound now resolves by one precedence, the same for all three storage Limits keys (
presigned_ttl,session_ttl,max_upload_mb): saved setting > host option > manifest default > built-in default. Unset never means unlimited.DEFAULT_MAX_UPLOAD_MB = 100(storage-limits.ts), held equal to the settings manifest's declaredmax_upload_mbdefault by a drift pin.maxUploadMbon theStorageServicePluginconstructor, onMountStorageRoutesOptionsand onStorageRoutesOptions: the host layer, through the samepickLayerthe TTLs use. It takes a positive number of MB, or'unlimited'. Anything else throwsInvalidMaxUploadMbErrorat construction or mount (parseHostMaxUploadMb).readStorageLimits), fall to the host option or else the built-in default.maxUploadBytesis read: the byte doors (chunkPUT, presigned local rawPUT, upload-linkPUTand its several-file form), the declared-size doors (presign, chunked start), and the server-side verbs (field-file-service.ts,file-attachment-service.ts,record-file-access.ts), which now take the plugin's host option ashostMaxUploadMb.kernel:readyhook registered after the settings binding, through its logger),mountStorageRoutesandregisterStorageRoutes(through theloggerthey are given,announceUploadBound). It is awarnwhen there is no bound, which only an explicit host'unlimited'reaches, and thatwarnis said onconsole.warnwhen the door was given no logger.FieldFileService,FileAttachmentService,RecordFileAccess) judge a host bound handed to them at construction too.HostMaxUploadMb(type) andInvalidMaxUploadMbErrorare exported from the package entry, so a host can type the option and recognise the refusal by class.PAYLOAD_TOO_LARGEentry state the rule. The stale comment inrequest-body-limit-upload-doors.dogfood.test.tsnow names the built-in bound.@objectstack/service-settingsjoins service-storage's devDependencies and its vitest source aliases, so the drift pin reads the manifest from source.BREAKING, who moves: a DevPlugin-composed server;
--preset minimalwith storage;mountStorageRouteshosts over a bare adapter or an unbound plugin;bindToSettings: falseembedders; settings-bound hosts during a settings fault; a host whose saved or env-sourcedmax_upload_mbis present but not a positive number. Each moves from no bound to 100 MB. Remedies: a host that constructs the plugin passesmaxUploadMb: 500ormaxUploadMb: 'unlimited'; a DevPlugin-composed server turns DevPlugin's storage toggle off and mounts the plugin itself (new DevPlugin({ services: { storage: false }, extraPlugins: [new StorageServicePlugin({ maxUploadMb: 500 })] }), or the instance in the stack'splugins); a host with an invalid saved value corrects it, because the saved layer cannot spell "no bound", and to accept any size removes it and passes the host's'unlimited'. The settings manifest's default value is unchanged.Tests
packages/services/service-storage/src/storage-limits.test.ts§5 andrecord-file-access.integration.test.ts:mountStorageRoutesover a bare adapter and over an unbound plugin's service;bindToSettings: false. The host option overrides the manifest default, on the plugin and onmountStorageRoutes. An explicit'unlimited'is honoured and announced atwarn: by the plugin, by the mount with a logger and with none (onconsole.warn), and byregisterStorageRouteswith a logger and with none; a bounded mount or registration with no logger writes nothing toconsole.warn, and a bounded registration names its bound and layer to its logger. A malformed host option (0,-1,NaN,Infinity,1e-9,Number.MAX_VALUE,'100','Unlimited','none',null,true,{}) refuses the plugin, the mount and the route registrar, with no route registered, and the file verbs refuse one handed to them; a bound of exactly one byte (1 / MiB) constructs and resolves to 1 byte. A saved setting still wins over a host'unlimited'. The drift pin.PUT, the chunkPUT, the upload-linkPUTand its several-file form. A presign and a chunked start for 101 MB are refused. A 101 MB file inside a several-file form within its form limit is refused by the link verb, with the link unspent.field-filesandfile-attachmentsrefuse a 101 MB file before the engine is reached.os servecomposition). The host's explicit'unlimited'states no bound and relays a host size refusal in its own words. Under'unlimited'the server verbs pass the size verdict.bindToSettings: falseand "states no bound" controls now assert the built-in bound. The two "a host size refusal is not the door's own" cases moved to the explicit'unlimited'mount, which is the only no-bound path left.Acceptance notes
mountStorageRoutes'maxUploadMbbounds that mount's doors. The server-side verbs on the kernel take the storage plugin's ownmaxUploadMb. A host that passes a larger bound to the mount than to the plugin gets the tighter of the two on the upload-link spend, which is judged again in the verb.max_upload_mbunset a byte door states no bound" no longer holds. The new changeset says so; the released entry is not edited.Verification
Package test and typecheck, head 667098e
Ablation 1: the built-in layer resolved to no bound, then restored
node scripts/ablation-replace.mjsonstorage-limits.ts, anchor hit 1 -> 0, replacement 0 -> 1, run ofstorage-limits.test.tsandrecord-file-access.integration.test.ts(head 92e01a9):Ablation 2: the no-logger announcement removed, then restored
node scripts/ablation-replace.mjsonstorage-limits.ts(announceUploadBoundsays nothing without a logger), anchor hit 1 -> 0, run ofstorage-limits.test.ts(head 667098e):Derived gate families, head 667098e
node scripts/pm/dispatch-gates.mjs --commands: 121 derived, 121 run (--ran: 121 accounted for). 118 exit 0, includingcheck-adr-0087-registration --base origin/main,check-changeset-no-major,check-empty-changeset,check:changeset-fixed,check:cross-package-test-inputs,check:test-source-alias,check:doc-authoring,check:i18nandcheck:nul-bytes. The derivation warned that the tree is 21 commits behindorigin/main, with 6 derivation inputs changed in that range; main was not merged, because there is no conflict and no main-caused red.NOT MEASURED, left to CI:
@objectstack/spec check:skill-examplesandcheck:dual-build-cjs-loads(exit 3, PREREQUISITE NOT MET: a whole-workspace build), andcheck:type-check-debt(exit 124: the local 600 s timeout expired while its closure build waited for the verify lock behind the dogfood battery). CI's Type Check lanes cover all three.Dogfood battery, final head 667098e
The first head (14805de) gave the same counts: 467 passed | 3 skipped files, 3959 passed | 42 skipped tests.
Generated by Claude Code