Skip to content

fix(scaffold): a scaffolded namespace fits the customization-pair cap, so a fresh project from a long name validates with no warning - #29103

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-g0aewi
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-g0aewi

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #28992

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:npx create-objectstack 和 os init 由项目名生成命名空间时,上限从 20 个字符改为 13 个(即 MAX_CUSTOMIZATION_BASE_NAMESPACE_LENGTH)。qa-console-first-paint 现在得到 qa_console_fi,脚手架里的对象名和文件名都跟着它走;截断后不留结尾的 _。13 个字符以内的项目名,生成结果与以前逐字节相同。
  • 为什么改:超过 13 个字符的命名空间没有配对的定制命名空间(ADR-0146 D3),所以新人刚生成的项目第一次 os validate 就弹出 namespace-no-customization-pair 警告,让他去改不是他写的对象名。
  • 风险与回滚:只影响新生成的项目,已有项目不变。create-objectstack 运行时不依赖 spec,所以保留一份本地常量,由测试钉死等于 spec 的常量;os init 直接读 spec 常量。回滚即 revert。
  • 先看:packages/create-objectstack/src/rewrite-identity.ts 的 SCAFFOLD_NAMESPACE_MAX_LENGTH 与 sanitizeNamespace()(从 index.ts 原样搬来,只改上限);packages/cli/src/commands/init.ts 的 sanitizeNamespace();packages/create-objectstack/src/scaffold-namespace-cap.test.ts 的常量相等钉。
  • 两分钟验证:pnpm --filter create-objectstack exec vitest run src/scaffold-namespace-cap.test.ts src/scaffold-namespace-customization-pair.test.ts,预期 Tests 44 passed (44)。
  • 需要你做的:无,席位落地。

What changes

  • packages/create-objectstack/src/rewrite-identity.ts: sanitizeNamespace() moves here from index.ts, beside its sibling deriveManifestId(), so it can be unit tested (index.ts calls program.parse() on import). The only behaviour change is the cap: SCAFFOLD_NAMESPACE_MAX_LENGTH = 13 replaces the three 20s. The existing trailing-_ strip after truncation is kept, so a namespace whose 13th character is _ ends one character earlier.
  • Why a local constant in create-objectstack (measured). The order asked to read MAX_CUSTOMIZATION_BASE_NAMESPACE_LENGTH from one place if the scaffolder can depend on it cheaply. @objectstack/spec is only a devDependency of create-objectstack. A value import from src/ would be bundled into the published scaffolder, and check:undeclared-dep-imports refuses exactly that (a devDependency inlined into published source). Making the spec a runtime dependency would add zod and pg-connection-string to a two-dependency npx entry point. Bundle size was not the obstacle: an esbuild probe from spec source gives 3,121 bytes and no zod. So the order's fallback applies: a local constant, pinned equal to the spec constant by scaffold-namespace-cap.test.ts, which resolves @objectstack/spec/kernel to source through the package's existing vitest alias.
  • packages/create-objectstack/src/index.ts: imports sanitizeNamespace from ./rewrite-identity.js. The namespace is still computed once (const namespace = sanitizeNamespace(projectName)) and handed to the manifest, the config and the object-prefix rewrite, so every derived name uses the truncated value.
  • packages/cli/src/commands/init.ts (os init): the same function had the same 20 cap. It now reads MAX_CUSTOMIZATION_BASE_NAMESPACE_LENGTH from @objectstack/spec/kernel, a runtime dependency of the CLI already. The seat widened the claim to cover it, so the two scaffolders keep agreeing.
  • .changeset/28992-scaffold-namespace-pair-cap.md: create-objectstack patch and @objectstack/cli patch, with both declaration lines. Nothing newly exported from @objectstack/spec. The create-objectstack index.ts export of sanitizeNamespace is not in its exports map (only ./created-summary is), so no published surface moved.

Tests

  • Red first, unit (real scaffold). New scaffold-namespace-customization-pair.test.ts drives the real CLI through tsx for qa-console-first-paint. On the unchanged code it failed with Expected: "qa_console_fi", Received: "qa_console_first_pai". Green, it asserts that the namespace is qa_console_fi, that customizationNamespace() (the helper the lint rule and the ensure door use) answers { ok: true, value: 'qa_console_fi_custom' }, that the config literal matches, and that every scaffolded object name passes validateObjectNamespacePrefix.
  • New scaffold-namespace-cap.test.ts (43 cases):
    • the constant equals MAX_CUSTOMIZATION_BASE_NAMESPACE_LENGTH;
    • for 27 names (empty, single character, reserved, scoped, digit-leading, Unicode, exactly 13, 14, 26 characters), the result passes ManifestSchema.shape.namespace, is not reserved, and has a customization pair;
    • truncation cases, including the 13th character being _ (abcdefghijkl-mnop → abcdefghijkl) and a digit-leading name (1234567890123456 → a123456789012);
    • controls: names that already fit (my-app, crm, abcdefghijklm, thirteen-char, '', x, 9-lives, sys, system, @acme/my-app) keep their previous value.
  • cli test/init.test.ts: five truncation cases and one customization-pair sweep added to its sanitizeNamespace block.
  • Real os validate (red and green), on scaffolds under packages/cli/node_modules/.probe-28992/, run with the built packages/cli/bin/run.js:
    • main's index.ts (from 0be247ce): namespace qa_console_first_pai, os validate exit 0 with 1 namespace-no-customization-pair warning ("namespace "qa_console_first_pai" is 20 characters …").
    • this branch: namespace qa_console_fi, os validate exit 0, 0 occurrences of the rule and 0 ⚠ lines.
    • os init qa-console-first-paint --no-install on this branch: Namespace: qa_console_fi, object file qa_console_fi_item.object.ts, os validate exit 0 with no namespace-no-customization-pair. (It prints the pre-existing ⚠ No apps or plugins defined for the app template, which does not depend on the namespace.)
  • Ablation (scripts/ablation-replace.mjs, anchor hit once each; restore proved by blob == HEAD and an empty git diff HEAD):
    • create-objectstack, SCAFFOLD_NAMESPACE_MAX_LENGTH = 13 → 20 (blob 8fb4bd56 → 3a388a6f): pnpm --filter create-objectstack test reds 15 failed / 330 passed, in the 2 new files only, while the 19 existing files stay green. The red cases are the constant pin, the 8 long names in the pair sweep, the 5 truncation cases, and the real-scaffold case.
    • cli, const max = MAX_CUSTOMIZATION_BASE_NAMESPACE_LENGTH → const max = 20 (blob ef45f599 → a44b2c1f): the five init suites red 5 failed / 118 passed, exactly the 4 new truncation cases and the pair sweep. The exact-fit control stays green.
    • No build was on either path: both suites import the changed file as relative source.
  • Package suites at c422fbc2 (the follow-up 51ac52ae changes one comment line in a test): pnpm --filter create-objectstack test 21 files / 345 tests passed, and its typecheck (which includes src/**/*.test.ts) passed. pnpm --filter @objectstack/cli typecheck passed, and vitest run --project unit passed 368 files / 5,202 tests. The cli integration layer is left to CI: no integration-layer file or spawn entry is touched.

Acceptance notes

  • No "namespace was shortened" line was added. create-objectstack and os init already print Namespace: VALUE before writing, and the value is now the truncated one. A separate notice would need the untruncated value threaded out of sanitizeNamespace(), which is more than the order's "only if trivial".
  • docs/audits/2026-09-os-create-os-init-convergence-measurement.md mentions sanitizeNamespace() in a dated audit table. Its claim (one call site, the config namespace) still holds, so it was left as is.

Verification

Head 51ac52ae.

  • Derived gate families (node scripts/pm/dispatch-gates.mjs --commands, change set vs merge base 0be247ce8): 62 derived. 60 ran green (exit 0). 2 NOT MEASURED, reason: prerequisite, because they read every package's built output and only the CLI closure was built here: check:dual-build-cjs-loads and check:i18n-coverage (exit 3, PREREQUISITE NOT MET). CI runs both. Reconciliation: dispatch-gates --ran → 62 derived famil(ies) accounted for — 60 run, 2 NOT-MEASURED.
  • One real red, fixed on this branch: check:cross-package-test-inputs read a repo path spelled in a test comment (packages/lint/src/…) as an undeclared input of the new real-scaffold test. The comment now names the rule by its export (51ac52ae), and the gate passes: OK: 31 package(s) read outside themselves, all declared.
  • check-plugin-teardown-shape.mjs --self-test first exited 3 because the shallow clone could not reach its pinned fixture commit. After git fetch --depth=1 of that commit it passed (48 cases).
  • test:repo was not run locally (no file of that project is touched). CI's Test Core covers it.
Gate record (60 + 2)
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-adoption.mjs :: exit 0
node scripts/check-comment-mask-adoption.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-dts-emitted.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-issue-citations.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs --self-test :: exit 0
node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
node scripts/docs-audit/check-affected-docs.mjs :: exit 0
node scripts/docs-audit/check-drift-comment.mjs :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:cli-test-child-env :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:dts-closure :: exit 0
pnpm check:dual-build-cjs-loads :: exit 3
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:i18n :: exit 0
pnpm check:i18n-coverage :: exit 3
pnpm check:i18n-walk-parity :: exit 0
pnpm check:issue-citations :: exit 0
pnpm check:keyed-text-bounds :: exit 0
pnpm check:lean-entry-closure :: exit 0
pnpm check:logger-receiver-detach :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:objectql-double-limit :: exit 0
pnpm check:org-identifier :: exit 0
pnpm check:page-declaration-shape :: exit 0
pnpm check:platform-object-tenancy-census :: exit 0
pnpm check:pm-changeset-deadline-census :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:scaffold-emission-policy :: exit 0
pnpm check:slot-lookup :: exit 0
pnpm check:sourcemap-no-sources-content :: exit 0
pnpm check:system-context-census :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0

Generated by Claude Code

…imit

create-objectstack and `os init` truncated the namespace derived from the
project name at 20 characters (the manifest grammar), while a namespace over
MAX_CUSTOMIZATION_BASE_NAMESPACE_LENGTH (13) has no paired customization
namespace, so a fresh project from a long name warned
namespace-no-customization-pair on its first `os validate`.

`os init` reads the spec constant; create-objectstack keeps a local copy
(the spec is only a devDependency there) pinned equal by a test, and its
sanitizeNamespace() moves beside deriveManifestId() so it can be unit tested.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5oqaD6uoTrtmva9fde
…epo path

check:cross-package-test-inputs reads a repo path spelled in a test as an
input of that test; the comment only meant to name the rule.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5oqaD6uoTrtmva9fde
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/cli, create-objectstack, touching 3 documentable anchor(s).

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

  • content/docs/deployment/cli.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/deployment/troubleshooting.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/getting-started/examples.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/getting-started/your-first-project.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/plugins/index.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/protocol/kernel/index.mdx (via os init (command, read off packages/cli/src/commands/init.ts))

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

  • content/docs/releases/v17/17-1.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/releases/v17/17-4.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/releases/v17/17-5.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/releases/v17/17-7.mdx (via os init (command, read off packages/cli/src/commands/init.ts))
  • content/docs/releases/v18/18-1.mdx (via os init (command, read off packages/cli/src/commands/init.ts))

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
  • 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 — 40 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 5d3667e292c67642a99c2ce1b02950af9469a82f → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 5d3667e292c67642a99c2ce1b02950af9469a82f

⚠️ 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 5d3667e292c67642a99c2ce1b02950af9469a82f → 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#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt

席位核对

ACCEPT · domain:server seat 2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt · 2026-11-02T08:18Z · head 51ac52ae · claimed by seat 2 on #28992 (comment 6572365415, taking over the released claim 6570629406)

The maintainer's words for this seat, verbatim: 「接手所有开发,包括跟进之前未完成的开发落地。」

  1. Shape: a draft against main, first line Fixes #28992, Clause-②: no and Metadata-protocol: none at line start in the body and the changeset. check-governed-merges --pr 29103: NOT governed (0 of 7 paths), +225 / -24. Non-governed landing.
  2. Premise and diff, read by the seat: both scaffolders carried the grammar's 20 as the cap; the diff replaces it with 13 in os init (reads MAX_CUSTOMIZATION_BASE_NAMESPACE_LENGTH from @objectstack/spec/kernel, already a runtime dependency of the cli) and in create-objectstack (a local SCAFFOLD_NAMESPACE_MAX_LENGTH = 13, pinned equal to the spec constant by scaffold-namespace-cap.test.ts). The function body is otherwise byte-identical to the one it replaces. sanitizeNamespace leaves create-objectstack/src/index.ts; its exports map names only ./created-summary, so no published surface moves, and every other caller found by git grep imports the cli's copy. Clause-②: no holds: the scaffold output narrows for long names only, no accept set or public surface changes.
  3. Evidence: red first on the real scaffold (qa_console_first_pai → qa_console_fi); ablation in both packages reds exactly the new cases (15 and 5) and restores to HEAD; real os validate on both scaffolders shows 0 namespace-no-customization-pair after, 1 before.
  4. Gates: check-runs on 51ac52ae: 37 success, 14 skipped, 0 red, none pending. The dev's local gate union: 60 run green, 2 NOT MEASURED (prerequisite, CI runs both), reconciled with --ran.
  5. Accepted deviations: no "namespace was shortened" notice (the order made it optional); the dated audit table in docs/audits/ left as is, its claim still holds.
  6. Out of scope: none filed. Serial: none; no other open claim names these files. Landing: pr_ready + automerge_enable through the relay.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 08:19
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit a1ae469 Nov 2, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-g0aewi branch November 2, 2026 09:37
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt

Landing record · PR #29103

domain:server seat 2 · session_01ADHkmQxwoGb5fSnrFkpxmt · 2026-11-02T09:37Z · card #28992

Reading Probe Result
Merged PR #29103 state merged, merge commit a1ae4697be
On main git merge-base --is-ancestor a1ae4697be origin/main yes
Queue refs git ls-remote origin refs/heads/gh-readonly-queue/* matching 29103 0
Content git grep -c SCAFFOLD_NAMESPACE_MAX_LENGTH origin/main -- packages/create-objectstack/src present (2 files)

Release: ships patch for cli and create-objectstack at the next release.


Generated by Claude Code

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

Projects

None yet

1 participant