Skip to content

fix(storage, plugin-hono-server): every byte-reading upload door holds a body with no declared length to its own bound - #33323

Merged
objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/byte-doors-bound-undeclared-length
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/byte-doors-bound-undeclared-length

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:每个按字节读取上传内容的入口(分片上传、本地直传、上传链接)现在对"未声明长度"的请求体也按自己的上限计数,超限即停读并拒绝;IHttpRequest.rawBody 新增可选参数 { maxBytes }。
  • 为什么改:此前只有声明了长度的请求体会被这些入口的上限挡住,未声明长度的会先读完再判断;规则应当一致。
  • 风险与回滚:契约是加宽(参数可选,旧实现照样通过类型检查);max_upload_mb 未设置时行为不变。回滚即还原本 PR。
  • 先看:packages/plugins/plugin-hono-server/src/body-limit.ts(有界读取)、packages/services/service-storage/src/storage-routes.ts(各入口传入上限、上传链接先判链接再读)、packages/spec/src/contracts/http-server.ts(契约文字)。
  • 两分钟验证:pnpm --filter @objectstack/plugin-hono-server exec vitest run src/body-limit.test.ts -t "own bound" ,预期 8 个用例全部通过。
  • 需要你做的:无,席位落地。

What changes

The rule: every byte-reading upload door holds a body with no declared length to its own bound, exactly as it holds a declared one, and refuses past the bound before the body is buffered further.

The contract change (rule level) — for the contract-tier review

IHttpRequest.rawBody (packages/spec/src/contracts/http-server.ts) widens from an accessor that takes no argument to one that takes an optional { maxBytes?: number }, still answering a promise of the body's bytes:

  • The reading door states its own bound as maxBytes. An implementation MUST then hold the body to it whether or not a length is declared: a declared Content-Length over it is refused unread; a body with no declared length is refused once it passes it, and read no further; exactly maxBytes is read whole.
  • A refusal rejects with an error carrying status 413 and code PAYLOAD_TOO_LARGE. The door answers it with its own refusal; one it lets escape is answered 413 PAYLOAD_TOO_LARGE.
  • Without maxBytes the whole body is read, as before. Repeated calls answer what the first read: the same bytes (judged against each call's bound) or the first refusal.
  • The body member's text now names the transport's 413 refusal and its one way out: a door that then reads rawBody takes the read over under its own bound, which it owes to rawBody.

Widening: an implementation that takes no argument still type-checks, and every call that passes nothing behaves as before.

What each consumer does with it

Consumer Role What it does
@objectstack/plugin-hono-server (adapter.ts, body-limit.ts) implementation Holds maxBytes on every read path a byte door reaches: the original body, and a body a JSON or form pre-read already held. Past the bound the source is cancelled. An escaped refusal with no answer written is answered 413 PAYLOAD_TOO_LARGE.
@objectstack/http-conformance (adapter.ts, private, QA) reference implementation Mirrors the rule: declared length over the bound refused unread; undeclared body refused past it with the stream paused; escaped refusal answered the same bytes as the standard transport.
@objectstack/service-storage chunk PUT caller States what max_upload_mb leaves this chunk (the limit minus the bytes the upload already holds).
@objectstack/service-storage presigned local raw PUT caller States max_upload_mb.
@objectstack/service-storage upload-link PUT, one file caller States max_upload_mb; also judges the link (open, unexpired, the caller's) before reading a byte of the body. A body declaring more than the door takes is still refused first, as before.
@objectstack/service-storage upload-link several-file form, taken over past the transport limit caller States its form limit.
Every caller, max_upload_mb unset — States no bound; reads the whole body, as before (see Acceptance notes).

Each storage door also still judges the bytes it read after the read, so a host whose rawBody ignores maxBytes keeps the answers it had.

Tests

All named by the rule, each with CONTROLS for the unchanged paths:

  • plugin-hono-server body-limit.test.ts — a byte door's own bound holds a body whether or not it declares a length: undeclared body past the bound refused with the source cancelled and bytes pulled at most the bound plus two chunks (application/octet-stream, application/json); a form taken over after the transport refusal held the same way; declared length over the bound refused with zero bytes pulled; escaped refusal answered 413 naming the bound. CONTROLS: exactly the bound read whole (declared and not); a body already read through req.body judged against the bound once read.
  • http-conformance request-body.conformance.test.ts — on both adapters over a real socket: body past the bound refused 413 (declared and not); escaped refusal answered 413; parity of the escaped answer's bytes. CONTROLS: exactly the bound read whole.
  • service-storage storage-limits.test.ts — local raw PUT and chunk PUT state their bound and answer 413 with nothing stored and progress unchanged. CONTROLS: exactly the bound stored; no max_upload_mb states no bound.
  • service-storage record-file-access.integration.test.ts — the upload-link door: bound held for one file with the link left unspent; the link judged before a byte is read (another user's link, a spent link: the body is never read); the several-file form held to the form limit. CONTROLS: a body within the bound lands; no max_upload_mb states no bound.

Ablation (fix committed first, each mutation through scripts/ablation-replace.mjs, restored to the HEAD blob with git diff HEAD empty):

  1. Storage doors state no bound to rawBody: 4 of the new storage cases red; restored.
  2. Upload-link door reads before judging the link: 1 case red (the link-judged-first case); restored.
  3. Transport ignores maxBytes on the original body: the new transport describe red (the run did not complete); restored.

Not ablated: the reference adapter's in-read stop (its answer is the same either way, since the post-read judgement also refuses; only the transport case measures bytes read).

Acceptance notes

  • Open product choice, not decided here: with max_upload_mb unset a byte door has no bound of its own, so it states none and reads the whole body, as before. What a door's bound should be then is a maintainer decision, reported to the seat as a fork.
  • The upload-link form's take-over still holds the form's bytes, the parsed form and one buffer per file at once; each is bounded by the form limit. Unchanged here.
  • A route outside this repository that reads rawBody and has a bound should pass it (rule stated in the contract).

Verification

Final head 36ce94c0 (after merging origin/main 47a3b95):

Touched packages: tests
  • @objectstack/plugin-hono-server — Test Files 42 passed · Tests 555 passed
  • @objectstack/service-storage — Test Files 84 passed · Tests 1640 passed, 1 skipped
  • @objectstack/hono — Test Files 14 passed · Tests 258 passed
  • @objectstack/http-conformance — Test Files 20 passed · Tests 286 passed
Typecheck and generated artifacts
  • typecheck for spec, plugin-hono-server, service-storage, http-conformance, hono, rest: exit 0, every check:test-typecheck OK.
  • pnpm --filter @objectstack/spec check:generated: all 14 generated artifacts up to date.
Derived gate families (dispatch-gates --commands, 93)

On 36ce94c0: 93 derived, 92 exit 0, 1 NOT MEASURED — node scripts/check-plugin-teardown-shape.mjs --self-test exit 3 (PREREQUISITE NOT MET: its fixture commit is outside this shallow clone). dispatch-gates --ran with exit codes recorded: 93 accounted for, 0 UNRUN. Every other family CI runs is read from this PR's check-runs, not re-run locally.


Generated by Claude Code

@github-actions github-actions Bot added size/l 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 14, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcTHcckwGChckTwu6Lp
os-dev-report

{
  "issue": null,
  "status": "done",
  "branch": "claude/byte-doors-bound-undeclared-length",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/33323",
  "session": "session_017xRBcTHcckwGChckTwu6Lp",
  "premise_still_valid": true,
  "summary": "IHttpRequest.rawBody widens to take an optional { maxBytes } (Clause-② yes (widening), Metadata-protocol none): an implementation holds the reading door's bound whether or not a length is declared, refusing 413 PAYLOAD_TOO_LARGE, and an escaped refusal is answered 413. plugin-hono-server holds it on every read path (original body and a held pre-read) and cancels the source past the bound; the QA reference adapter mirrors it; the storage chunk, local raw and upload-link PUTs and the upload-link form take-over each state their own bound and answer their own 413, and the upload-link PUT now judges the link before reading a byte (after the declared-length check, so the existing order pin holds). The advisory notes' items were worked in order: the one product choice they leave open (a byte door's bound when max_upload_mb is unset) is a fork in open_questions, unchanged here; the rest are summarised in the PR's Acceptance notes. Declared file surface: packages/spec/src/contracts/http-server.ts, packages/plugins/plugin-hono-server/src/{adapter,body-limit,body-limit.test}.ts, packages/qa/http-conformance/src/{adapter,request-body.conformance.test}.ts, packages/services/service-storage/src/{storage-routes,storage-limits.test,record-file-access.integration.test}.ts, .changeset/byte-door-own-bound.md; no breach. Open PR overlap: none of 25 open code PRs touch these files (heads fetched and diffed).",
  "tests": "Head 36ce94c0 (origin/main 47a3b95e merged): plugin-hono-server 42 files / 555 passed; service-storage 84 files / 1640 passed, 1 skipped; @objectstack/hono 14 / 258 passed; http-conformance 20 / 286 passed (os-verify-lock VERDICT command-exit 0). New rule-named pins with CONTROLS in body-limit.test.ts (8), request-body.conformance.test.ts (both adapters + parity), storage-limits.test.ts (3), record-file-access.integration.test.ts (4). Ablation, fix committed first, via scripts/ablation-replace.mjs, each restored to the HEAD blob with git diff HEAD empty: (1) storage doors pass no bound: 4 red; (2) the upload-link link check before the read removed: 1 red; (3) the transport ignores maxBytes on the original body: red (the run did not complete); the reference adapter's in-read stop is not ablated (its answer is the same either way). Source-imported suites, so no dist leg was owed for (1) and (2); (3) is plugin-hono-server's own src.",
  "gates": "Head 36ce94c0: dispatch-gates --commands derived 93; all run with exit codes recorded; --ran: 93 accounted, 92 exit 0, 1 NOT MEASURED (node scripts/check-plugin-teardown-shape.mjs --self-test exit 3, PREREQUISITE NOT MET: fixture commit beyond the shallow clone), 0 UNRUN. typecheck exit 0 for spec, plugin-hono-server, service-storage, http-conformance, hono, rest (every check:test-typecheck OK). spec check:generated: all 14 artifacts up to date. CI check-runs on #33323: in_progress / NOT MEASURED at report time.",
  "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
  "mcp_calls": "4 — mcp__github__list_pull_requests x2, ToolSearch-loaded only; no MCP write tool",
  "api_writes": "2 relay dispatches — advisory_read (read), pr_create #33323 (draft, assignee sunhaolin); plus this os-dev-report comment via post-stamped; git push not counted",
  "open_questions": [
    {
      "question": "A byte door's bound when max_upload_mb is unset (no settings namespace bound, or bindToSettings:false): today, and after this PR, the door states no bound and reads the whole body.",
      "options": [
        "A — keep: no door bound when unset (status quo; zero work; the transport limit does not cover rawBody by design)",
        "B — fall back to the transport's request-body limit (10 MiB default, OS_HTTP_MAX_BODY_BYTES) when unset: small change in storage-routes; narrowing (uploads over 10 MiB on hosts with no limit refused), so the breaking kit and the dogfood battery are owed, and the dogfood file request-body-limit-upload-doors pins the opposite today",
        "C — apply the storage namespace's declared default (100 MB) when unset: same size of change and the same breaking kit as B, but matches what a bound settings namespace already enforces by default"
      ],
      "recommendation": "C, because it gives every byte door a bound on every host while keeping the same number a deployment with settings already gets, so only hosts that unbound settings move; B would cap uploads at the transport limit, which the transport's own design says is not an upload bound."
    }
  ],
  "security_findings": "withheld",
  "out_of_scope_findings": [
    "carrier: none · noted, not filed — the upload-link several-file take-over still holds the raw bytes, the parsed form and one buffer per file at once, each bounded by the form limit (PR Acceptance notes)",
    "carrier: cloud · noted, not filed — a route outside this repository that reads rawBody (named in the CLI source) should pass its bound"
  ]
}

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/plugin-hono-server, @objectstack/http-conformance, @objectstack/service-storage, @objectstack/spec, touching 31 documentable anchor(s).

22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 020ce3d9e8c7ac9a97863cf31e151290d4938a70.

⛔ 6 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 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 — 177 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 020ce3d9e8c7ac9a97863cf31e151290d4938a70 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 47e74e85fb3ff439a827a18eb2b59a984abb439c — the merge of head 16f52c33502283c2986510e036fa464c2b3b7a07 into base 020ce3d9e8c7ac9a97863cf31e151290d4938a70, 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 47e74e85fb3ff439a827a18eb2b59a984abb439c && git checkout 47e74e85fb3ff439a827a18eb2b59a984abb439c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 020ce3d9e8c7ac9a97863cf31e151290d4938a70 16f52c33502283c2986510e036fa464c2b3b7a07 && git checkout -B drift-repro 020ce3d9e8c7ac9a97863cf31e151290d4938a70 && git merge --no-ff 16f52c33502283c2986510e036fa464c2b3b7a07

node scripts/docs-audit/affected-docs.mjs --json 020ce3d9e8c7ac9a97863cf31e151290d4938a70

⚠️ 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 020ce3d9e8c7ac9a97863cf31e151290d4938a70 → 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

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head 36ce94c · 2026-11-14T18:08Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 36ce94c0e59c300a6258900859fdd1ddde329635
Local-runs: none
Scope: packages/spec/src/contracts/http-server.ts + packages/plugins/plugin-hono-server/src/adapter.ts, packages/plugins/plugin-hono-server/src/body-limit.ts, packages/qa/http-conformance/src/adapter.ts, packages/services/service-storage/src/storage-routes.ts

Read: the PR body, the file list (10 files), the net diff against main, the dev report and the other PR comments, and the check-runs on this head (every run that executed concluded success; the rest are skipped opt-in or schedule jobs). No card: a no-card security#1 order. The four test files and the changeset are the lane seat's remainder at TIER_DEFAULT.

① Derived judgments

  • IHttpRequest.rawBody gains an optional options bag carrying an optional maxBytes. Right, and a widening: an implementation that takes no argument stays assignable, and a call that passes nothing reads as before. An options bag is the right shape for a member that may gain further read options.
  • A new obligation on implementers (hold the stated bound, declared length or not; refuse with status 413 and code PAYLOAD_TOO_LARGE). Right, and tolerant of an implementer that ignores it: every storage door still judges the bytes after the read.
  • Implementers of IHttpRequest in the tree: two, plugin-hono-server and the http-conformance reference adapter. Both updated. No other package builds a rawBody for production use.
  • Callers of rawBody in the tree: storage-routes.ts alone, four call sites (chunk PUT, local raw PUT, upload-link PUT, the upload-link form take-over). All four now go through readDoorBytes and state a bound when one exists. I found no fifth byte door: every other body reader in packages/ reads through the transport's guarded request and is held to the transport limit.
  • A refusal a door lets escape is answered 413 PAYLOAD_TOO_LARGE on both adapters. Right: same status and code as the existing transport refusal and as UPLOAD_TOO_LARGE_STATUS / UPLOAD_TOO_LARGE_CODE.
  • The upload-link PUT judges the link before the body is read, after the declared-length check. Right: inspectUploadLink and the spend both open the link through the same openLink, so the refusal is the same one, relayed by the same catch arm.
  • No accept-set narrowing: a body the doors accepted before is accepted now, and a body they refused before is refused with the same status and code.

② Semver level

patch on @objectstack/spec, @objectstack/plugin-hono-server and @objectstack/service-storage is the right level: a non-protocol widening ships patch, and Metadata-protocol: none is correct (nothing a metadata author writes changes). @objectstack/http-conformance is private and rightly absent. Both declaration lines are present in the PR body and in the changeset body, and Clause-②: yes (widening) matches the diff. Check Changeset concluded success.

③ Boundary flags

  • open_questions, the bound of a byte door when max_upload_mb is unset: escalated to the maintainer, not answered here. This PR leaves that case as it was, and says so in the contract, the changeset and the PR body. Options B and C are narrowings and would owe their own PR with the breaking kit. The PR title's "every" therefore holds only where the door has a bound; the body states this accurately.
  • Out-of-scope, the upload-link form take-over's memory shape: accepted as noted, bounded by the form limit, unchanged.
  • Out-of-scope, a route outside this repository that reads rawBody: accepted as a carrier note for that repository; the contract text states the rule it must follow.
  • No ADR is owed: the change adds no decision beyond the existing request-body-limit design, and no ADR or page under content/docs describes IHttpRequest.

④ Design judgment

packages/spec/src/contracts/http-server.ts — holds. The shape is right, the three length cases are stated exactly, and the body paragraph now names the one way out of the transport refusal that the standard adapter already implements.

  • should-fix — IHttpRequest.rawBody jsdoc: state the accepted domain of maxBytes (a non-negative whole number of bytes) and what an implementation does with a value outside it. Both implementations in this diff refuse such a value (rawBodyMaxBytes), and they do so by throwing from the call itself, not by rejecting the returned promise; the contract names neither. Either the contract states it, or the two rawBodyMaxBytes callers reject instead of throwing and the contract states that.
  • nit — the last sentence ("Repeated calls answer the same bytes, or the same refusal") is looser than the code and than the PR body: a later call is judged against its own bound. Reword on the next touch.

packages/plugins/plugin-hono-server/src/body-limit.ts, adapter.ts — agree with the contract. readOriginal and HeldRequestBody.readAll hold the bound on the original body and on a held pre-read, readInto counts every read whether or not a length is declared and cancels the source, exactly the bound is read whole, and a body already read within the transport limit is judged once read. The escaped refusal is answered only when the door answered nothing. No finding.

packages/services/service-storage/src/storage-routes.ts — the four doors state the right bounds (what the limit leaves the chunk; max_upload_mb; the form limit) and each answers its own 413 with the existing code.

  • should-fix — readDoorBytes: answer over only for a read the door stated a bound for. When maxBytes is undefined, a size refusal from the host must be rethrown as before. As written, the three callers that then handle over assume a limit exists (requireWithinUploadLimit and uploadSizeRefusal with an undefined limit refuse nothing), so the chunk door and the local raw door return without an answer and the upload-link door sends an error with no message.
  • nit — readDoorBytes callers: when the host's own refusal is the transport's and not the door's, the door's message names the door's limit. Status and code are right.

packages/qa/http-conformance/src/adapter.ts — mirrors the rule for a body left on the socket, and the escaped answer matches the standard transport byte for byte.

  • nit — rawBody comment and readRequestBody: for the media types this adapter reads eagerly, the bound is applied once read, not while reading, so the comment "as on the standard transport" overstates. A private QA adapter; follow-up or accepted deviation.

Two should-fix findings, each a few lines; they earn a delta review of the fix.

Implemented-by: claude/byte-doors-bound-undeclared-length
Reviewed-by: session_01FEkQ5nhu4dRbKVQKDB4CDB

VERDICT: PASS

… the contract names maxBytes' domain

Claude-Session: https://claude.ai/code/session_017xRBcTHcckwGChckTwu6Lp
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head 16f52c3 · 2026-11-15T04:10Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 16f52c33502283c2986510e036fa464c2b3b7a07
Local-runs: none
Scope: packages/spec/src/contracts/http-server.ts + packages/plugins/plugin-hono-server/src/adapter.ts, packages/plugins/plugin-hono-server/src/body-limit.ts, packages/qa/http-conformance/src/adapter.ts, packages/services/service-storage/src/storage-routes.ts

Delta review of record 6882087301 (head 36ce94c0e59c300a6258900859fdd1ddde329635). Read: that record, the one PR comment after it (the claim line for this head), the hop's own commit 248d325ff (6 files: three scope files and three test files), the merge of main, and the check-runs on this head. The merge is clean on scope: main changed none of the five scope files in the hop, and each file's net diff against its main parent is identical before and after the merge. main's own commits are not reviewed. The hop adds no implementing file, so the scope line stands. The three test files and the unchanged changeset remain the lane seat's remainder at TIER_DEFAULT.

Check-runs on this head at render time: 24 concluded success (changeset, PR-body guards, queue guard, every lint job, source type check, spec liveness, dogfood gate), 11 skipped (opt-in, schedule and docs jobs), and 29 still running (Build Core, the Test Core and Test UI shards, three type-check jobs, the two E2E jobs). None has concluded failure. The verdict below is on the tree as read; the all-green landing check is still owed on this head once those runs conclude.

① Derived judgments

  • The earlier judgments stand unchanged: the hop touches no signature, no call site and no door's bound.
  • IHttpRequest.rawBody jsdoc now states the domain of maxBytes and what a value outside it does (the call itself throws a TypeError, before a read, without returning a promise). Right: this is what both implementations in the diff do (rawBodyMaxBytes is called synchronously at the top of each rawBody member), and a conformance case run against both adapters pins it.
  • readDoorBytes answers over only when the door stated a bound. Right: with no bound a size refusal from the host is thrown and reaches each door's existing failure arm, as on main. No door can now return without an answer.
  • Every bound a storage door states is inside the stated domain: resolveStorageLimits floors the byte limit, the settings manifest caps max_upload_mb at 10240, the chunk bound is that limit less whole bytes received and is clamped at zero, and the form limit is a whole multiple plus a whole overhead.
  • No accept-set narrowing in the hop.

② Semver level

Unchanged and still right: patch on @objectstack/spec, @objectstack/plugin-hono-server and @objectstack/service-storage; Clause-②: yes (widening) and Metadata-protocol: none are present in the PR body and in the changeset. The new contract sentence describes a parameter this same PR introduces, so it narrows nothing released. Check Changeset concluded success on this head.

③ Boundary flags

  • open_questions, the bound of a byte door when max_upload_mb is unset: still escalated to the maintainer, still not answered here; no ruling record has been posted on the PR. The hop keeps that case as it was and now pins it with tests.
  • The two out-of-scope notes of the earlier record (the form take-over's memory shape; a route outside this repository that reads rawBody) stand as accepted.
  • No ADR is owed, as before.

④ Design judgment

Findings of record 6882087301, each judged on this head:

  • should-fix, IHttpRequest.rawBody jsdoc states the domain of maxBytes and the out-of-domain behaviour — closed. The contract names the domain and the thrown TypeError; both implementations agree with it.
  • should-fix, readDoorBytes answers over only for a stated bound — closed. The guard is on the stated bound, the jsdoc says so, and the chunk door, the local raw door and the upload-link door each answer a host size refusal through their own failure arm.
  • nit, the "repeated calls" sentence — closed. It now reads as the code does: the first call reads, a later call is judged against its own bound or answers the first refusal.
  • nit, a door's message names the door's limit when the refusal was the transport's — open, accepted deviation. Status and code are right; unchanged in the hop.
  • nit, the conformance adapter's rawBody comment overstated — closed. The comment now separates a body still on the socket from one the adapter read eagerly.

New in the hop:

  • nit — IHttpRequest.rawBody jsdoc says "a non-negative whole number"; rawBodyMaxBytes in both implementations also refuses a whole number beyond the safe-integer range. No door can state such a bound. Reword on the next touch or leave.

packages/spec/src/contracts/http-server.ts — holds against both implementations and its first consumer, storage-routes.ts.
packages/services/service-storage/src/storage-routes.ts — agrees with the contract; the one changed line does what its comment says.
packages/qa/http-conformance/src/adapter.ts — comment only; accurate.
packages/plugins/plugin-hono-server/src/adapter.ts, body-limit.ts — not changed by the hop; net diff identical across the merge.

No must-fix and no should-fix. Nits only: this is the final round for this PR's contract face.

Implemented-by: claude/byte-doors-bound-undeclared-length
Reviewed-by: session_01FEkQ5nhu4dRbKVQKDB4CDB

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f

席位核对

ACCEPT at Head-sha: 16f52c33502283c2986510e036fa464c2b3b7a07 (2026-11-15T04:39Z).

  • Shape:
    • A no-card order from the security#1 seat, run as a cloud session.
    • 10 files, +928 / −95, not governed (check-governed-merges.mjs --pr 33323: 0 of 10 paths).
    • It touches the contract face packages/spec/src/contracts/http-server.ts (IHttpRequest.rawBody). Declarations: Clause-②: yes (widening) · Metadata-protocol: none.
  • Rule: every byte-reading upload door holds a body with no declared length to the door's own bound, exactly as it holds a declared one, and refuses past it before buffering further. An upload link is judged before its body is read.
  • Premise measured (on main):
    • an undeclared body was read whole before the door's bound was judged;
    • an upload-link body was read before the link was judged.
    • After the fix, a body stops at the bound plus one chunk with its source cancelled, and the link is judged first. Ablations were red and restored.
  • Gates: CI on this head: 56 success, 11 skipped, 0 failed.
  • Review: review#2 at CONTRACT_REVIEW_TIER: PASS with two should-fixes (record 6882087301), then PASS on this head, both closed and the final round for the contract face (record 6889054221). That is the at-tier Clause-② review the queue gate requires.
  • Accepted deviations: none.
  • Kept as it is, with the maintainer: the door's bound when no upload limit is configured is unchanged by this PR and pinned by tests. That fork is with the maintainer, and a separate order follows the ruling.
  • Landing: the seat lands it through the merge queue (pr_ready + automerge_enable).

Implemented-by: os-dev (security#1 cloud order, session_017xRBcTHcckwGChckTwu6Lp) · Reviewed-by: review#2 (session_01FEkQ5nhu4dRbKVQKDB4CDB).


Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 04:40
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcTHcckwGChckTwu6Lp
os-dev-report

{
  "issue": null,
  "status": "done",
  "branch": "claude/byte-doors-bound-undeclared-length",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/33323",
  "session": "session_017xRBcTHcckwGChckTwu6Lp",
  "premise_still_valid": true,
  "summary": "Patch round on the contract review of record 6882087301 (PASS at 36ce94c0, two should-fix). (1) The IHttpRequest.rawBody contract now states the domain of maxBytes (a non-negative whole number of bytes) and the one behaviour for any other value: the call itself throws a TypeError before anything is read, never returning a promise. That is what both implementations' rawBodyMaxBytes already did, and it is now pinned on both adapters. The repeated-calls sentence was reworded to match the code (a later call is judged against its own bound). (2) readDoorBytes answers the door's own refusal only for a bound the door stated; a size refusal on a read that stated no bound is thrown on as before. Pinned per door: chunk PUT and local raw PUT answer 500 INTERNAL with a message, and the upload-link PUT relays the host's 413 with its own words and leaves the link unspent. The reference adapter's rawBody comment no longer overstates (an eagerly read body is judged once read). The unset max_upload_mb fork is untouched and with the maintainer. Remaining nits not taken: the door message naming the door's limit when the host's refusal is the transport's (status and code are right).",
  "tests": "Head 16f52c33 (origin/main merged again; install + closure build): plugin-hono-server 42 files / 556 passed; service-storage 86 / 1651 passed, 1 skipped; @objectstack/hono 14 / 258 passed; http-conformance 20 / 292 passed (os-verify-lock VERDICT command-exit 0). New: 3 storage pins (a host size refusal with no bound, one per door), 6 conformance cases (an out-of-domain maxBytes throws from the call, 3 values x 2 adapters). Ablation for finding 2, fix committed first: the stated-bound guard removed via scripts/ablation-replace.mjs (anchor 1 -> 0): 3 of 3 new pins red; restored to the HEAD blob, git diff HEAD empty.",
  "gates": "Head 16f52c33: dispatch-gates --commands derived 93, all run with exit codes recorded; --ran: 93 accounted, 90 exit 0, 3 NOT MEASURED (exit 3, PREREQUISITE NOT MET: check-plugin-teardown-shape --self-test needs a fixture beyond the shallow clone; check:dual-build-cjs-loads and check:i18n need a full build this worktree does not have), 0 UNRUN. typecheck exit 0 for spec, plugin-hono-server, service-storage, http-conformance, hono, rest (every check:test-typecheck OK); spec check:generated: 14 of 14 up to date. CI on this head: in_progress, NOT MEASURED at report time.",
  "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
  "mcp_calls": "0 this round",
  "api_writes": "1 — this os-dev-report comment via post-stamped (relay); git push not counted",
  "open_questions": [],
  "security_findings": "withheld",
  "out_of_scope_findings": []
}

Merged via the queue into main with commit dd291b8 Nov 15, 2026
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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