Skip to content

fix(core): os test --url with a trailing slash addresses the served routes - #28999

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-cljmpx
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-cljmpx

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #28946

Clause-②: no — no schema, type, export or route change; a --url that answered every HTTP scenario 404 now reaches the served routes.

Metadata-protocol: none — nothing a metadata author writes is read differently; qa/*.test.json suites are unchanged.

维护者速读

  • 改了什么:HttpTestAdapter 在构造函数里把 base URL 末尾的斜杠一次性去掉,于是发现探针、记录动作 URL、api_call 相对路径和报错里的 URL 都读同一个规整后的 base。api_call 遇到 404/405 时,报错句末尾追加它实际请求的 方法 + URL,和记录动作已有的写法一致。
  • 为什么改:os test --url http://localhost:PORT/(带末尾斜杠)会请求 //api/v1/...,服务端回 404 ENDPOINT_NOT_FOUND,每个 HTTP 场景都失败,而且 api_call 的报错不说它请求了哪个 URL,看起来像应用坏了。
  • 风险与回滚:只动一个类的构造函数和一处报错文案;不加参数、不做 URL 校验,畸形 --url 行为不变。回滚即 revert。
  • 先看:packages/core/src/qa/http-adapter.ts 的构造函数与 rawApiCall 末尾;packages/core/src/qa/http-adapter.test.ts 末尾新增的 describe 与改过的 [#7983] an api_call failure ... 用例。
  • 两分钟验证:pnpm --filter @objectstack/core exec vitest run src/qa/http-adapter.test.ts,预期 Tests 52 passed (52)。
  • 需要你做的:无,席位落地。

What changes

  • packages/core/src/qa/http-adapter.ts: the constructor stores baseUrl with its trailing slashes stripped (private readonly baseUrl), once. Every URL the adapter builds reads that field: the discovery probe, collectionUrl / recordUrl, api_call's relative target, and the record-actions provenance clause. HttpTestAdapter has one caller (packages/cli/src/commands/test.ts, which hands it --url verbatim), so normalising in the adapter covers it and any future caller; Test.run is unchanged. No flag, no URL validation: a malformed --url behaves as it did.
  • rawApiCall hands handleResponse the clause api_call addressed METHOD URL, so an api_call that fails 404 or 405 ends its existing HTTP Error STATUS: BODY sentence with one added clause naming the URL it addressed. The 404/405 gate is the one record actions already use: other statuses reached a route, so the server's own message stays undecorated. handleResponse's parameter is renamed mountNote → addressNote, since it now carries either.
  • .changeset/28946-qa-base-url-trailing-slash.md: @objectstack/core patch with both declaration lines. The CLI is unchanged (its dist imports @objectstack/core externally), so it carries no changeset.

Tests

  • New describe at the end of http-adapter.test.ts, three rows (http://localhost:3000/, http://localhost:3000//, http://localhost:3000/prefix/) × four cases, against a captured fetch: the probe plus the record collection URL carry one slash; an api_call relative target carries one slash; the record-actions clause names the normalised base and probe; an api_call 404 names the normalised URL.
  • The existing [#7983] an api_call failure is not decorated with a mount it never used pinned the exact undecorated 404 message. Per the order's ruling it now asserts the added URL clause and still asserts no mount clause. A new case pins that an api_call 422 stays undecorated.
  • Ablation 1 (scripts/ablation-replace.mjs, anchor hit once, blob 3c016586 → f4f31939): the constructor kept baseUrl verbatim. 12 failed / 40 passed; for example, expected http://localhost:3000/api/v1/objects/crm_account, received http://localhost:3000//api/v1/data/crm_account (the doubled-slash probe misses discovery, too). Restored: blob equals HEAD's, git diff HEAD empty.
  • Ablation 2 (blob 3c016586 → 43092308): rawApiCall passed no clause. 4 failed / 48 passed (the rewritten HttpTestAdapter's record action types resolve the DEFAULT API mount only — a deployment that sets api.apiPath or crud.dataPrefix is unreachable #7983 case and the three per-row api_call 404 cases). Restored the same way.
  • The test imports ./http-adapter.js from source, so no build sits on the ablation path.

Acceptance notes

  • Measured on a stock showcase boot (objectstack dev --seed-admin --fresh, admin token from sign-in/email) before and after, with the showcase's qa/platform-smoke.test.json and a two-scenario suite (one create_record, one api_call):

    --url base 135054eb head 4ff51b55
    http://localhost:PORT 2/2 pass 2/2 pass
    http://localhost:PORT/ 0/2, 404 2/2 pass
    http://localhost:PORT// 0/2, 404 2/2 pass
    http://localhost:PORT/prefix/ 0/2, 404, record clause names .../prefix//api/v1/data 0/2, 404 (the server is not under a prefix), and each failure names its URL: api_call addressed GET http://localhost:PORT/prefix/api/v1/health; record actions addressed http://localhost:PORT/prefix/api/v1/data
  • Before the fix, an api_call 404 printed only HTTP Error 404: {"success":false,"error":{"code":"ENDPOINT_NOT_FOUND","message":"Not found"}}, with no URL.

Verification

All at head 4ff51b55 (base 135054eb, origin/main when the branch was cut).

Package suite, typecheck, lint (under the verify lock)
  • pnpm --filter @objectstack/core test: Test Files 129 passed (129), Tests 2905 passed (2905).
  • pnpm --filter @objectstack/core typecheck (tsc --noEmit plus check:test-typecheck over tsconfig.test.json, which covers the test file): exit 0.
  • pnpm exec eslint --no-inline-config packages/core: exit 0.
  • test:repo (core's repo vitest project) was not run locally: the diff touches no census pin and the derivation does not name it. CI Test Core runs it.
Derived gates (dispatch-gates --commands, 59 families)
  • 58 run with exit 0, 1 NOT MEASURED. dispatch-gates.mjs --ran: "59 derived famil(ies) accounted for — 58 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)".
  • NOT MEASURED: pnpm check:dual-build-cjs-loads, exit 3 (PREREQUISITE NOT MET: packages outside the showcase closure have no dist). CI runs it.
  • check-plugin-teardown-shape.mjs --self-test ran after git fetch --depth=1 origin 621a4876 (the shallow-clone prerequisite).

CI check-runs: read by the seat on this head.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5nPQ5s2XpToMJtoBDm


Generated by Claude Code

…os test --url addresses the served routes

Strip trailing slashes from the base once, in the constructor, so the
discovery probe, record collection URLs, api_call relative targets and the
provenance clauses all read the same base. A failed api_call (404/405) now
names the URL it addressed, as record actions already name their mount.

Claude-Session: https://claude.ai/code/session_01FEkQ5nPQ5s2XpToMJtoBDm
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m 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 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/core, touching 5 documentable anchor(s).

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

  • content/docs/api/client-sdk.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/api/environment-routing.mdx (via baseUrl (symbol, a field of class HttpTestAdapter), /api/v1/... (route, a path literal in a comment in HttpTestAdapter))
  • content/docs/automation/connectors.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/data-modeling/external-datasources.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/data-modeling/odata-datasources.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/deployment/single-project-mode.mdx (via /api/v1/... (route, a path literal in a comment in HttpTestAdapter))
  • content/docs/frontend/architecture-overview.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/frontend/building-crud-app.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/frontend/data-objectstack.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/frontend/data-source.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/frontend/plugins/plugin-view.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/frontend/quick-start.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/permissions/authentication.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))
  • content/docs/plugins/packages.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))

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

  • content/docs/releases/v18/18-2.mdx (via baseUrl (symbol, a field of class HttpTestAdapter))

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
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 60 of 216 client-bound route-ledger rows — the other 156 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 156: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 101 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 — 39 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 cae71fedfc8f04d35694da55ab74f9d680da0c5f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 72853c5fee8005b2597d8fd9edd5f7f85b4ff441 — the merge of head 4ff51b5563b95702dea9bbaaf848cf649d6ed916 into base cae71fedfc8f04d35694da55ab74f9d680da0c5f, 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 72853c5fee8005b2597d8fd9edd5f7f85b4ff441 && git checkout 72853c5fee8005b2597d8fd9edd5f7f85b4ff441
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin cae71fedfc8f04d35694da55ab74f9d680da0c5f 4ff51b5563b95702dea9bbaaf848cf649d6ed916 && git checkout -B drift-repro cae71fedfc8f04d35694da55ab74f9d680da0c5f && git merge --no-ff 4ff51b5563b95702dea9bbaaf848cf649d6ed916

node scripts/docs-audit/affected-docs.mjs --json cae71fedfc8f04d35694da55ab74f9d680da0c5f

⚠️ 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 cae71fedfc8f04d35694da55ab74f9d680da0c5f → 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

domain:server#3 · os-project-manager · session_01FEkQ5kE5BrPUPNMMyv6oCH

席位核对 · ACCEPT · PR #28999 · 2026-11-02T06:02Z

Head-sha: 4ff51b5563b95702dea9bbaaf848cf649d6ed916

维护者速读(席位终稿)

核对六项

  1. 形态:draft → main;Fixes #28946,与认领 6569728985、派单 pm-orders/server/order-28946.md 一致。文件 3 个,均在申报面内;packages/cli 未动(唯一调用方 test.ts 原样传入 --url,在适配器里规整即覆盖)。
  2. 前提实测:dev 在 base 上实测带斜杠、//、/prefix/ 三种各 0/2 通过(404),head 上前两种 2/2;/prefix/ 仍 404(服务器无该前缀),但报错现在给出单斜杠 URL。
  3. 门禁:dev 本地 59 条派生门禁 58 条 exit 0,1 条 check:dual-build-cjs-loads NOT MEASURED(exit 3,前提缺失,CI 跑);core 测试 2905/2905,typecheck、eslint 绿;两处消融各自变红(12 / 4 条)后还原。本 head check-runs 读时 11 success、8 skipped、0 失败,余 21 条在跑;合并队列要求全部必需检查 success,有红即撤回本核对。
  4. 接受的偏差:原 [#7983] 用例钉的是不带追加句的 404 原文,按派单改为断言追加的 URL 子句,仍断言无挂载子句;新增 422 不追加的钉子。接受。
  5. 范围外去向:无。Metadata-protocol: none。
  6. 落地条款:Clause-②: no(无 schema、类型、导出或路由变化;baseUrl 原为 private,仍为 private readonly),TIER_DEFAULT,席位核对即可。semver:@objectstack/core patch,与 changeset 一致。check-governed-merges --pr 28999:NOT governed,111 行。落地授权,维护者原话:「按照 pm-dispatch 规则复核过的都授权」(2026-10-25T11:35Z)。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 06:03
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 06:03
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 4df6292 Nov 2, 2026
64 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-cljmpx branch November 2, 2026 06:55
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/m 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.

cli: os test --url with a trailing slash sends //api/v1/... and fails every HTTP scenario 404

1 participant