Skip to content

fix(service-storage)!: every upload bound resolves by one precedence, and unset never means unlimited - #33883

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/storage-upload-bound-built-in-default
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/storage-upload-bound-built-in-default

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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

维护者速读

  • 改了什么:存储的上传上限改为三个 Limits 键共用的同一条优先级(已保存的设置 > 宿主选项 > 清单默认值 > 内置默认 100 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.

  • Built-in default. DEFAULT_MAX_UPLOAD_MB = 100 (storage-limits.ts), held equal to the settings manifest's declared max_upload_mb default by a drift pin.
  • Host option. maxUploadMb on the StorageServicePlugin constructor, on MountStorageRoutesOptions and on StorageRoutesOptions: the host layer, through the same pickLayer the TTLs use. It takes a positive number of MB, or 'unlimited'. Anything else throws InvalidMaxUploadMbError at construction or mount (parseHostMaxUploadMb).
  • Failure paths. A settings read that fails, and a saved value that is present but invalid (dropped by readStorageLimits), fall to the host option or else the built-in default.
  • Coverage. The bound applies wherever maxUploadBytes is read: the byte doors (chunk PUT, presigned local raw PUT, upload-link PUT and 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 as hostMaxUploadMb.
  • Boot line. Each host door says once the bound in force and the layer it came from: the plugin (a kernel:ready hook registered after the settings binding, through its logger), mountStorageRoutes and registerStorageRoutes (through the logger they are given, announceUploadBound). It is a warn when there is no bound, which only an explicit host 'unlimited' reaches, and that warn is said on console.warn when the door was given no logger.
  • Host bound edges. A host number must floor to a finite bound of at least one byte: a number too small to bound one byte, or too large to be a finite byte bound, is refused like any other malformed value. The file verbs (FieldFileService, FileAttachmentService, RecordFileAccess) judge a host bound handed to them at construction too.
  • Entry exports. HostMaxUploadMb (type) and InvalidMaxUploadMbError are exported from the package entry, so a host can type the option and recognise the refusal by class.
  • The upload refusal's message also names the host option, for hosts with no storage settings.
  • Docs: the service-storage README Limits section and the error catalog's PAYLOAD_TOO_LARGE entry state the rule. The stale comment in request-body-limit-upload-doors.dogfood.test.ts now names the built-in bound.
  • Test wiring: @objectstack/service-settings joins 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 minimal with storage; mountStorageRoutes hosts over a bare adapter or an unbound plugin; bindToSettings: false embedders; settings-bound hosts during a settings fault; a host whose saved or env-sourced max_upload_mb is present but not a positive number. Each moves from no bound to 100 MB. Remedies: a host that constructs the plugin passes maxUploadMb: 500 or maxUploadMb: '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's plugins); 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 and record-file-access.integration.test.ts:

  • Rule pins. Each unset path resolves to 100 MB: resolution with no snapshot; a plugin with no settings service; a settings read that fails; a dropped saved value; mountStorageRoutes over a bare adapter and over an unbound plugin's service; bindToSettings: false. The host option overrides the manifest default, on the plugin and on mountStorageRoutes. An explicit 'unlimited' is honoured and announced at warn: by the plugin, by the mount with a logger and with none (on console.warn), and by registerStorageRoutes with a logger and with none; a bounded mount or registration with no logger writes nothing to console.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.
  • Door pins (no settings bound). A declared 101 MB body is refused unread, and an undeclared one is read under the built-in bound and refused, at the local raw PUT, the chunk PUT, the upload-link PUT and 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-files and file-attachments refuse a 101 MB file before the engine is reached.
  • Controls. Exactly 100 MB is accepted. A settings-bound plugin with nothing saved holds the declared 100 MB, 3600 s and 86400 s, as before (the default os serve composition). 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.
  • Flipped controls. The no-settings, bindToSettings: false and "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' maxUploadMb bounds that mount's doors. The server-side verbs on the kernel take the storage plugin's own maxUploadMb. 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.
  • The released 18.5.0 changelog note "with max_upload_mb unset a byte door states no bound" no longer holds. The new changeset says so; the released entry is not edited.
  • Importer packages' suites (cli, runtime, mailbox, organizations, plugin-dev and others) were not re-run locally. No test outside this package sends more than 100 MB through a storage door (grep of the test tree), and CI runs them.

Verification

Package test and typecheck, head 667098e
pnpm --filter @objectstack/service-storage exec vitest run --maxWorkers=2
 Test Files  86 passed (86)
      Tests  1672 passed | 1 skipped (1673)
pnpm --filter @objectstack/service-storage typecheck
check:test-typecheck: OK — 0 file(s) / 0 error(s)
os-verify-lock: VERDICT command-exit 0
Ablation 1: the built-in layer resolved to no bound, then restored

node scripts/ablation-replace.mjs on storage-limits.ts, anchor hit 1 -> 0, replacement 0 -> 1, run of storage-limits.test.ts and record-file-access.integration.test.ts (head 92e01a9):

Tests  18 failed | 113 passed (131)
ablation-replace: ok restored: blob == HEAD (c44e64497413) and `git diff HEAD` is empty
Ablation 2: the no-logger announcement removed, then restored

node scripts/ablation-replace.mjs on storage-limits.ts (announceUploadBound says nothing without a logger), anchor hit 1 -> 0, run of storage-limits.test.ts (head 667098e):

× mountStorageRoutes with no logger still announces 'unlimited' at warn, on console
× registerStorageRoutes announces the bound in force: 'unlimited' at warn, with a logger or, without one, on console
Tests  2 failed | 41 passed (43)
ablation-replace: ok restored: blob == HEAD (9ffe93f27164) and `git diff HEAD` is empty
Derived gate families, head 667098e

node scripts/pm/dispatch-gates.mjs --commands: 121 derived, 121 run (--ran: 121 accounted for). 118 exit 0, including check-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:i18n and check:nul-bytes. The derivation warned that the tree is 21 commits behind origin/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-examples and check:dual-build-cjs-loads (exit 3, PREREQUISITE NOT MET: a whole-workspace build), and check: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
pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test
os-verify-lock: VERDICT command-exit 0 · held the lock 2163s
 Test Files  467 passed | 3 skipped (470)
      Tests  3959 passed | 42 skipped (4001)

The first head (14805de) gave the same counts: 467 passed | 3 skipped files, 3959 passed | 42 skipped tests.


Generated by Claude Code

…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>
@github-actions github-actions Bot added size/l dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-storage, touching 38 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/services/service-storage/README.md, packages/services/service-storage/src/index.ts, packages/services/service-storage/vitest.config.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/error-catalog.mdx (via maxUploadMb (symbol, a field of interface MountStorageRoutesOptions; a field of interface StorageLimitHostOptions; a field of interface StorageRoutesComposition; a field of interface StorageRoutesOptions; a field of interface StorageServicePluginOptions))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-4.mdx (via mountStorageRoutes (symbol, a top-level function), mountStorageRoutes (literal, a string literal in mountStorageRoutes))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/services/service-storage/README.md, packages/services/service-storage/src/index.ts, packages/services/service-storage/vitest.config.ts) — pages documenting those are invisible to this run
  • 2 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 895783a1e864e0fe629c56b3c6315771ca87bf87 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 66105c838e91ee6685b63ccb11ac15fe6e74583a — the merge of head 667098ef47ac71cd5f4e24aaabebf0255f8c1538 into base 895783a1e864e0fe629c56b3c6315771ca87bf87, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 895783a1e864e0fe629c56b3c6315771ca87bf87 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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:

  • Declared surface beyond the order's list, each with its reason in the dev report, accepted by the seat: storage-routes.ts, a third flipped integration control, a devDependency alias for the drift pin, and error-catalog.mdx.
  • 18.5.0 released the earlier byte-door changeset during this work. The new changeset says its "unset states no bound" sentence no longer holds. The released entry is not edited.

Generated by Claude Code

@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 14805de · 2026-11-15T14:00Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 14805de73571f1c52f575e821fbfcb72b5f1be0d
Local-runs: none
Scope: packages/services/service-storage/src/storage-limits.ts, packages/services/service-storage/src/storage-service-plugin.ts, packages/services/service-storage/src/mount-storage-routes.ts, packages/services/service-storage/src/storage-routes.ts, packages/services/service-storage/src/field-file-service.ts, packages/services/service-storage/src/file-attachment-service.ts, packages/services/service-storage/src/record-file-access.ts, packages/services/service-storage/src/storage-limits.test.ts, packages/services/service-storage/src/record-file-access.integration.test.ts, packages/services/service-storage/README.md, packages/services/service-storage/package.json, packages/services/service-storage/vitest.config.ts, packages/qa/dogfood/test/request-body-limit-upload-doors.dogfood.test.ts, pnpm-lock.yaml + packages/services/service-storage/src/swappable-storage-service.ts, packages/services/service-storage/src/index.ts, packages/services/service-settings/src/manifests/storage.manifest.ts, packages/services/service-settings/package.json, packages/core/src/capability-composition.ts, packages/plugins/plugin-dev/src/dev-plugin.ts, packages/cli/src/utils/data-migration-plugins.ts, packages/cli/src/commands/serve.ts (cited code, read at the head, not reviewed); the two prose-face files (.changeset/storage-upload-bound-built-in-default.md, content/docs/api/error-catalog.mdx) were read for what they declare.

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 packages/spec/src) and none is a governed surface (Prime Directive #14 register). The face is the declared narrowing alone.

① Derived judgments

Accept-set and public-surface changes, each read in the tree at the head:

  • Unset upload bound resolves to 100 MB, never to no bound (resolveStorageLimits, layer 4 is DEFAULT_MAX_UPLOAD_MB). Right. It is the declared narrowing. On main the same call with no snapshot answered no bound.
  • A saved value that is present but not a positive number now falls to the host option or the built-in bound. Right, and declared (changeset "Failure paths"). On main that dropped value resolved to no bound. See S1: the "Who moves" list omits this host.
  • A settings read that fails lands on a bound. Right, declared.
  • New optional host option maxUploadMb on StorageServicePluginOptions, MountStorageRoutesOptions, StorageRoutesOptions and StorageRoutesComposition: a positive finite number or the one spelling 'unlimited'. Right: additive, and it enters through the same layer function the two TTLs use.
  • Construction, mount and route registration now throw on any other maxUploadMb. Right, declared. The key was undeclared before, so a host that passed one was ignored and is now refused; that is the declared refusal, not a hidden one.
  • A saved setting still wins over every host choice, 'unlimited' included. Right, and pinned.
  • Server-side file verbs take the plugin's host option (hostMaxUploadMb on the three deps interfaces). Right: optional and additive; absent it resolves to the namespace default or the built-in bound, so a caller that constructs these services itself is bounded, never unbounded.
  • ResolvedStorageLimits gains maxUploadLayer. Right: the type is not exported from the package entry, so no consumer constructs it.
  • Refusal message and boot line. Additive text; right.
  • Unchanged, verified: a settings-bound host with nothing saved resolves to the manifest default 100 MB before and after; the manifest (storage.manifest.ts: default 100, scope global, platform-admin write) is untouched; both TTL resolutions are value-identical to main.

Is the declared narrowing the whole narrowing? In the code, yes: every read of the resolved bound in non-test source (storage-routes.ts, field-file-service.ts, file-attachment-service.ts, record-file-access.ts, the two boot lines) goes through resolveStorageLimits, and I found no configuration or request whose behaviour changes outside the classes above. In the declaration, one moved class is named in the rule text but left out of the "Who moves" list (S1).

Is "one precedence" one across every upload door? The order is one: a single pickLayer, called for all three keys, and every door and verb resolves through it per request. The host layer, though, is per composition: the plugin's own mount and the kernel verbs read the plugin's option, a mountStorageRoutes mount reads its own. Where the two differ the byte doors and the verbs resolve different bounds; on the upload-link spend the tighter one decides. The tree says so in the MountStorageRoutesOptions.maxUploadMb jsdoc and the changeset tells the host to pass both, and the TTLs already behave this way, so I name it and do not grade it.

② Semver level

  • Changeset: @objectstack/service-storage at patch, summary fix(service-storage)!:. AGENTS.md (Pre-push step 3) ships a non-protocol breaking change at patch with its BREAKING banner and ADR-0087 disposition. The banner is there, the body carries the from/to and a one-line remedy, and exactly one ADR-0087 marker is present: not-required (no-migration-prescription). That arm is right: no authorable key, no stored row and no manifest value changes, so there is nothing for a metadata migration to rewrite.
  • Clause-②: no (narrowing): present line-initial in the PR body and in the changeset body, and correct. No published schema moves; the accept set of a host composition narrows.
  • Metadata-protocol: none: correct. Nothing a metadata author can write is added, refused or re-meant; max_upload_mb keeps its key, type, bounds and declared default, and the new option is host code.
  • dependencies label: the one dependency change is @objectstack/service-settings as a workspace:* devDependency of service-storage (package.json, three lockfile lines, one vitest source alias). It is test-only, used by the drift pin that holds the built-in bound equal to the manifest default, and read from source for the reason the neighbouring aliases give. service-settings does not depend on service-storage, so no cycle. Justified; nothing new is published as a runtime dependency.
  • Check-runs on this head: 78 runs, all completed. 62 success, 15 skipped, 1 cancelled. The cancelled one is a Check Changeset run superseded by a later Check Changeset run on the same head that concluded success (an earlier one had also concluded success). No failure, nothing still running. Skipped by name include Dogfood Regression Gate, Dogfood Verify CLI, Temporal Conformance (live PG + MySQL), UI Published Artifacts, the two opt-in harnesses, Queue verdict and Borrowed queue verdict; none of them rendered a verdict on this head, so the dogfood reading in the PR body is the dev's local run, not a gate verdict.

③ Boundary flags

  • No packages/spec path, no governed surface, no content/docs/releases edit. The released 18.5.0 entry is left as released and the new changeset states which sentence of it no longer holds.
  • The package entry (src/index.ts) is untouched: HostMaxUploadMb, InvalidMaxUploadMbError, UNLIMITED_UPLOAD and DEFAULT_MAX_UPLOAD_MB are not exported, although three exported option interfaces name the type and a host boot can now throw the class (N1).
  • The diff changes no door's own logic: the routes and verbs keep their checks and take a different resolved value. The other writes to the store in this package (backfill-file-references.ts, file-reference-lifecycle.ts) are internal copies, not upload doors, and are outside the rule.

④ Design judgment

The 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):

  • storage-limits.ts: holds. One layer function, four layers, the layer named with the value. Unset, absent snapshot, empty snapshot, dropped value and failed read all land on a number. The host parse refuses zero, negatives, non-finite numbers, numeric strings, other strings, null, booleans and objects, and admits only a positive finite number or the exact spelling. The numeric arm has no upper or lower edge pinned (N2).
  • storage-service-plugin.ts: holds. The option is judged in the constructor, before any door exists, and the validated value is what the routes, the two verb services and the boot line read. The boot-line hook is registered after the settings hook and reads the snapshot the next upload will meet. bindToSettings: false, no settings service and a failed binding each leave the snapshot absent, which resolves to the host option or the built-in bound.
  • storage-routes.ts: holds. The option is judged once at registration, before a route is registered (pinned: no route on refusal), and currentLimits still resolves per request, so a save still reaches the next request.
  • mount-storage-routes.ts: holds for the bound; the option is judged before anything is composed. The announcement half of the rule is weaker here (S2).
  • field-file-service.ts, file-attachment-service.ts, record-file-access.ts: hold. Each verb judges every file against the resolved bound before the engine or the store is reached, the several-file spend before the link is spent, and the nested RecordFileAccess receives the same host option as its parent.
  • Tests: the rule pins, door pins, controls and flipped controls match the tree. Each unset path, each byte door declared and undeclared, both declared-size doors and both verbs are pinned at 101 MB refused and 100 MB accepted; the drift pin reads the manifest from source. The flipped controls are the ones whose old assertion was the behaviour being removed, and the two "host refusal is not the door's own" cases moved to the only remaining no-bound path rather than being dropped.
  • README.md, the dogfood test comment, vitest.config.ts, package.json, pnpm-lock.yaml: agree with the code.

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 'unlimited'; settings bound with nothing saved; a mount over a bare adapter and over an unbound plugin; global scope of the setting (there is no tenant-scoped reading of it to diverge).

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 max_upload_mb is present but invalid also moved from no bound to 100 MB; it is named under "Failure paths" but absent from "Who moves", and its remedy differs, because the saved layer cannot express no bound. (b) The remedy sentence "one host option" assumes the host writes the constructor call; a DevPlugin-composed server does not (dev-plugin.ts constructs the plugin with no options), so that row needs its actual steps (turn the DevPlugin storage toggle off and mount the plugin itself, as os serve already lets an explicit plugins instance win).

S2 (should-fix) — the rule "no bound is announced at warn at boot" is kept by the plugin and not at every host door that accepts 'unlimited': mountStorageRoutes announces only when the host passes a logger, and registerStorageRoutes, which the changeset lists as taking the option, announces nothing. Either announce on a channel that does not depend on an optional argument, or narrow the changeset and README "Boot line" sentence to what the tree does.

N1 (nit) — export HostMaxUploadMb and InvalidMaxUploadMbError from the package entry, as the package's other option types and refusal classes are, so a host can type the option and recognise the refusal by class.

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 resolveStorageLimits trusts a host value it is handed directly. Trusted host code only; details are with the seat, not here.

N3 (nit) — content/docs/api/error-catalog.mdx says the host option applies "with no storage settings bound"; in the tree it also wins over the manifest default on a settings-bound host with nothing saved.

No must-fix. Two should-fix, three nits.

Implemented-by: claude/storage-upload-bound-built-in-default
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

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>
@github-actions github-actions Bot added size/xl and removed size/l labels Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 667098e · 2026-11-15T15:00Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f

Delta review requested from review#2 (the original reviewer, record 6895664766): range 14805de735..667098ef47, one commit.

  • S1 (Who moves): the changeset and README name the host with a present-but-invalid saved value. The DevPlugin remedy now gives the real steps.
  • S2 (loud no-limit): announceUploadBound warns to the logger, or else to console.warn. registerStorageRoutes announces once at registration.
  • N1–N3 applied: entry exports; host numbers must floor to a finite bound of at least 1 byte, checked in each server verb too; precedence wording.
  • On 667098e: package 1672 passed, ablation red and restored, and the dogfood battery Tests 3959 passed | 42 skipped (4001) with no failures. The body is updated to this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 667098ef47ac71cd5f4e24aaabebf0255f8c1538
Local-runs: none
Scope: packages/services/service-storage/src/storage-limits.ts, packages/services/service-storage/src/storage-service-plugin.ts, packages/services/service-storage/src/mount-storage-routes.ts, packages/services/service-storage/src/storage-routes.ts, packages/services/service-storage/src/field-file-service.ts, packages/services/service-storage/src/file-attachment-service.ts, packages/services/service-storage/src/record-file-access.ts, packages/services/service-storage/src/index.ts, packages/services/service-storage/src/storage-limits.test.ts, packages/services/service-storage/src/record-file-access.integration.test.ts, packages/services/service-storage/README.md, packages/services/service-storage/package.json, packages/services/service-storage/vitest.config.ts, packages/qa/dogfood/test/request-body-limit-upload-doors.dogfood.test.ts, pnpm-lock.yaml + packages/services/service-storage/src/swappable-storage-service.ts, packages/services/service-settings/src/manifests/storage.manifest.ts, packages/core/src/capability-composition.ts, packages/core/src/kernel.ts, packages/plugins/plugin-dev/src/dev-plugin.ts, packages/cli/src/commands/serve.ts (cited code, read at the head, not reviewed); the two prose-face files (.changeset/storage-upload-bound-built-in-default.md, content/docs/api/error-catalog.mdx) were read for what they declare.

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 14805de73571f1c52f575e821fbfcb72b5f1be0d (PASS, S1 and S2 open, N1 to N3). One commit on top, 667098ef, whose parent is that head; main was not merged, so the delta is the dev's change alone. Claim: comment 6896511540. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla.

No path of the diff is a published schema and none is a governed surface. The face is the declared narrowing alone.

① Derived judgments

The 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:

  • A host number must floor to a finite byte bound of at least one byte (parseHostMaxUploadMb, isByteBound). Right. It narrows the option this PR introduces, not anything on main: a number too small to bound one byte and a number too large to be a finite bound are refused where they were admitted at the previous head. The parse and the resolver floor the same product, so what is admitted is what is enforced. Declared in the PR body and the README; see N6 for the changeset.
  • The three file verbs refuse a malformed host bound at construction. Right. Their classes are not exported from the package entry, so the plugin is their only constructor and it hands them the value it already judged; this is a second line, not a new public refusal.
  • registerStorageRoutes now says the bound in force once at registration, and it and mountStorageRoutes say an explicit 'unlimited' on console.warn when no logger was passed. Right, additive, declared. A bounded door with no logger writes nothing to the console (pinned).
  • HostMaxUploadMb (type) and InvalidMaxUploadMbError are exported from the package entry. Right, additive.
  • The refusal message now says "with nothing saved" where it said "where no storage settings are bound". Right: that is what the precedence does.

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

  • Unchanged from record 6895664766 and still right: @objectstack/service-storage at patch with the BREAKING banner, one ADR-0087 marker not-required (no-migration-prescription), Clause-②: no (narrowing) line-initial in the PR body and the changeset, Metadata-protocol: none. The new entry exports are additive and need no level of their own.
  • Check-runs on this head: 73 runs, all completed. 62 success, 11 skipped, none failed, none cancelled, none still running. Skipped by name: Dogfood Regression Gate, Dogfood Verify CLI, UI Published Artifacts, Temporal Conformance (live PG + MySQL), the two opt-in harnesses, Queue verdict, Borrowed queue verdict, the schedule gate, Auto Label, Check PR Size. None of those rendered a verdict on this head, so the dogfood reading in the PR body is the dev's local run, not a gate verdict. This PASS does not wait on any running check.

③ Boundary flags

  • No packages/spec path, no governed surface, no content/docs/releases edit.
  • src/index.ts is now in the diff: two additive exports and nothing else. The resolver, the parse and the announcer stay inside the package, so the precedence keeps one definition.
  • The commit changes no door's size check. The direct registrar gains one call after its routes are registered; the plugin and the host mount go through the route family and the composed mount, so no door announces twice.

④ Design judgment

The 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):

  • storage-limits.ts: holds. Edges tried on the numeric arm: zero, negative zero, negatives, not-a-number, both infinities, the largest finite number, a number just under one byte, exactly one byte, a fraction over one byte, a fractional MB. Each is refused or resolves to a whole byte count of at least one, and the refusal happens before any door exists. The upper edge is "finite" (N7).
  • announceUploadBound: holds. The warn no longer depends on the optional logger; a logger of null from an untyped host falls to the console for the warn; the bounded line stays with the logger. The sink is called as a method, so a class-based logger keeps its receiver.
  • mount-storage-routes.ts, storage-routes.ts: hold. The announcement is said at each of the three host doors that accept the option: the plugin (its own logger, always present), the mount, the direct registrar. The registrar reads the limits snapshot once at registration as well as per request, and announces after its routes exist; a refusal still registers no route (pinned).
  • field-file-service.ts, file-attachment-service.ts, record-file-access.ts: hold. Each judges the host bound where it is built and reads the same field per request.
  • index.ts: holds; the two names a host needs, no more.
  • Tests: the new pins match the tree (the announcement with and without a logger at the mount and the registrar, the bounded controls, the two numeric edges at all three host doors, one byte accepted). The dev's second ablation shows the two no-logger pins fail when the fallback is removed. RecordFileAccess is the one verb whose own construction refusal has no direct pin (folded into N7).
  • README.md: the rule text agrees with the code; the new remedy table is malformed at its last row (N4).
  • Changeset and error catalog: agree with the code, bar N5 and N6.

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 dev-plugin.ts (the storage toggle and extraPlugins exist and behave as written).

S2: closed. Every host door that accepts 'unlimited' announces it at warn on a channel that does not depend on an optional argument, and the changeset and README sentence now say what the tree does.

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) — packages/services/service-storage/README.md: the sentence that follows the new remedy table ("On the S3 adapter a presigned upload is judged by its declared size ...") was joined onto the table's last row. Its first half sits in a third cell the two-column table does not render and its second half becomes a stray row. Put a blank line after the table and restore the sentence as its own paragraph.

N5 (nit) — the DevPlugin remedy's second form ("or list the instance in the stack's plugins") holds only with the DevPlugin storage toggle off as well: DevPlugin builds its own storage plugin whenever the toggle is on, and the kernel refuses a second storage service. The changeset sentence can be read that way; the README table cell reads as if the second form stands alone. Say "with the toggle off" for both forms. Read in dev-plugin.ts and kernel.ts, not run.

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 RecordFileAccess has no direct pin for its construction refusal. Trusted host code only, not reachable by a request. Details are with the seat, not here.

No must-fix, no should-fix. Four nits.

Implemented-by: claude/storage-upload-bound-built-in-default
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f

席位核对

ACCEPT at Head-sha: 667098ef47ac71cd5f4e24aaabebf0255f8c1538 (2026-11-15T15:08Z).

  • Shape:
    • No-card order from the security#1 seat, maintainer option D.
    • 17 files, +976 / −90. Not governed (check-governed-merges: 0 of 17 paths).
    • Clause-②: no (narrowing), BREAKING, patch on @objectstack/service-storage, ADR-0087 marker not-required (no-migration-prescription). Metadata-protocol: none.
  • Rule: every storage upload door is bounded in every composition. The bound is the saved setting, then the host option, then the manifest default, then the built-in 100 MB. No bound comes only from an explicit host 'unlimited', announced at warn. A malformed host option refuses the boot.
  • Gates:
    • CI on this head: 62 success, 13 skipped, 0 failed when read. Auto-merge waits for the rest.
    • Locally: service-storage 1672 passed, typecheck clean, and 121 derived gate families accounted for. 3 are NOT MEASURED and left to CI's Type Check lanes.
    • Dogfood battery on this head: Tests 3959 passed | 42 skipped (4001), no failures.
  • Review: review#2 at CONTRACT_REVIEW_TIER.
    • First round on 14805de735: PASS (6895664766), with S1 and S2 should-fix.
    • Delta on this head: PASS (6896577168). S1, S2 and N1–N3 are closed, with no must-fix or should-fix.
  • Accepted deviations: these are the delta's nits, final round.
    • N4: a README sentence is joined onto the remedy table's last row.
    • N5: the DevPlugin remedy's second form needs "with the toggle off".
    • N6: the changeset's refused-values list omits the two numeric edges.
    • N4–N6 are prose only and go to a follow-up docs card.
    • N7 is trusted host code only and is kept with the seat.
  • Landing: through the merge queue, by the seat.

Implemented-by: os-dev (security#1 order, session_017xRBcT1w3zpekijraHJE4f) · Reviewed-by: review#2 (session_01L9qibxTeW8xHnxoHxWNHWW).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 15:09
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants