You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 78a8388
Browse filesBrowse the repository at this point in the historyBrowse files
fix(scenarios): judge the bare-name Build check only where ADR-0150 keeps the literal prefix (#31749)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCPAmC6XoinFYKSk7wgQt4T)_Fixes#31729
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:场景评分器的 `bare-name`
构建检查只再判视图、文档、岗位(`NS_SHORT`)和能力(`NS.SHORT`);流程、动作、作业、工具、仪表盘、权限集等行为元数据裸名不再判失败;构建与迭代提示词的命名规则同步收窄。
- **为什么改**:ADR-0150 已把 bucket 2–4 类型改为按(软件包,
名称)寻址,忠实按新规则命名的应用不应在评分和画廊导出时被判构建失败;须与 #31669(child P,撤销 lint
与技能文案)同时或更早落地,避免评分器、技能、模板教出两套规则。
- **风险与回滚**:只影响评分规则与提示词文本,不动任何平台解析或 spec;回滚即 revert 本 PR。能力名写成
`NS_SHORT` 现在会判失败(此前通过),与 ADR-0150 D1 的 `NS.SHORT` 拼写一致。
-
**先看**:`packages/qa/scenarios/src/score/scenario-naming.ts`(判哪些类型、能力的点号前缀);`packages/qa/scenarios/test/score/entry.test.ts`
末段(读取 ADR-0150 D1 表格的钉子测试);`packages/qa/scenarios/src/runner/prompts.ts`
的 `namingRule`。
- **两分钟验证**:`pnpm --filter @objectstack/scenarios exec vitest run
test/score/entry.test.ts`,预期 14 个用例全绿,其中裸流程/动作/工具/作业通过、裸岗位/视图失败、无
`NS.SHORT` 的能力失败。
- **需要你做的**:无,席位落地。
## What changes
- `gradeItemNames` (`src/score/scenario-naming.ts`) judges only the
manifest collections that hold a type ADR-0150 keeps on the global
literal prefix: D1's bucket 1 (`object`, `field`, `object_extension`,
`view`, `capability`, `doc`) and the position (D7, one environment-wide
slot per name). Of the collections the scorer walks that is views, docs
and positions, named `NS_SHORT`, and capabilities, named `NS.SHORT`.
Objects stay out (`defineStack` judges them); an api item's `name` is
bucket 2 and passes. Every other bare name (flow, action, job, tool,
skill, agent, app, page, dashboard, permission set, …) is no finding.
- **Where the bucket list comes from.** Child P (#31669) has no PR open
and its branch (`b7acc113`) exports no per-type bucket from the
platform; its list is cli-local. So the list is restated from ADR-0150
D1's table in a comment and a module-private constant, and
`test/score/entry.test.ts` reads the ADR's bucket-1 and position rows
and fails when either row changes, or when the types the check judges
stop being exactly the rows' types the manifest walks. Once P (or R)
exports the bucket of each type, the constant moves to read it, tracked
on #31669. Nothing new is exported from `./score`.
- `namingRule` (`src/runner/prompts.ts`), used by the build, iterate and
template-iterate prompts, asks for `NS_` on objects, views, docs and
positions and `NS.` on capabilities, says every other item needs no
prefix, and keeps "where this prompt names an item, use that exact name"
so the stated names (persona permission sets, dashboards, agent actions)
still match the Build half's exact-name checks.
- Prose this makes false is corrected (claim amendment 6730010093): the
`namespace.ts` and `scenarioNamespace` docblocks, the `naming` field
docblock in `scenario-tags.ts`, and README's Namespaces bullet.
`namespace.ts` still prefixes the card's own names, so the prompt and
the Build half keep one spelling.
- The ADR file the pin reads is declared as a scenarios test input
(claim amendments 6730243476 and 6730537694):
`scripts/cross-package-test-inputs.mjs` (the `@objectstack/scenarios`
globs), root `turbo.json` (`@objectstack/scenarios#test` inputs), and
`scripts/check-ci-filter-parity.mjs`, whose rollback pin counts declared
globs under the `docs/**` root (22 → 23, recorded by name).
- Changeset `31729-scenario-naming-literal-prefix.md`, `patch` on
`@objectstack/scenarios` (published).
## Tests
- `test/score/entry.test.ts`: a bare flow, action, tool, job, dashboard,
permission set and api name pass; a bare position, view and doc fail,
and a capability spelled `export_data` or `democrm_export_data` fails
while `democrm.refund` passes, each one counted check; the ADR-0150 D1
pin; the multi-package case now finds a bare view under `packages[]`.
- `test/runner/orchestrate.test.ts`: the bare-items build now yields
only the view finding (build and iterate build); the bare dashboard is
no finding.
- `test/runner/units.test.ts`: every authoring prompt states the
narrowed rule and no longer says "EVERY metadata item".
## Acceptance notes
- Serial with #31669: P has no PR yet. `git merge-tree --write-tree` of
head `edb1f41b` against P's branch head `b7acc113` is clean, and the two
diffs share no file.
- ADR-0150 D9's hand-off line is executed as written: view, doc and
capability keep the check, plus positions.
## Verification
<details><summary>Local runs (code at head 805f90e; 947b040 adds only
the changeset)</summary>
- `pnpm --filter @objectstack/scenarios build && … test && … typecheck`
under the verify lock: build ok, Test Files 31 passed (31), Tests 618
passed (618), typecheck exit 0 (`tsc --listFiles` includes the three
edited test files).
- Ablations, each through `scripts/ablation-replace.mjs`, restored to
the HEAD blob after: (1) judging every collection again: 4 tests red
(bucket 2-4 pass, ADR pin, multi-package, orchestrate); (2) capability
prefix `NS_` instead of `NS.`: the position/view/doc/capability test
red; (3) adding `` `dashboard` `` to the ADR-0150 D1 bucket-1 row: the
ADR pin red.
- Derived gates (`dispatch-gates --commands`, 82 families on the final
tree, code at `8b3f7e4e`/`edb1f41b`): 81 exit 0, reconciled with `--ran`
(0 unrun). `check:dual-build-cjs-loads` is NOT MEASURED locally (exit 3,
needs a full workspace build), left to CI. `check-plugin-teardown-shape
--self-test` exit 0 after fetching its pinned fixture.
`check:pm-dispatch-gates` exit 0 (2205 cases).
`check:cross-package-test-inputs` and `check:ci-filter-parity` were red
before the input declarations and exit 0 after.
- `origin/main` (`0105a687` and three more) merged at `edb1f41b`; it
touches none of this PR's files, so nothing above was re-run.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jSUNgKkrn9jFYL5BWj)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(scenarios): the scorer's bare-name Build check judges only the names ADR-0150 keeps on the literal prefix, and the build prompt asks for the prefix only there
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
The scorer (`gradeItemNames`, `./score`) used to fail every non-object item a build named without the app's namespace, and the build and iterate prompts told the agent to prefix every item. ADR-0150 identifies flows, actions, jobs, tools, skills, agents, apps, pages, dashboards, permission sets and every other behavioural type by (package, name), so a build that names them plainly is correct.
11
+
12
+
-**Judged now:** views, docs and positions named `<namespace>_<short>`, and capabilities named `<namespace>.<short>`. A bare one is still a failing Build check `bare-name:<type>:<name>`, and a capability spelled `<namespace>_<short>` now fails too. Objects stay judged by `defineStack`.
13
+
-**No longer judged:** every other collection. A build whose only finding was a bare flow, action, dashboard or permission set name now passes its Build half.
14
+
-**Prompts:** the naming rule names the prefixed types and says every other item needs no prefix, while the names the prompt states (persona permission sets, dashboards, agent actions) are still used exactly.
out.push({check: `bare-name:${type}:${name}`,pass: false,detail: `a gallery app names every item \`${prefix}<short>\`; this ${type} is \`${name}\``});
70
+
out.push({check: `bare-name:${type}:${name}`,pass: false,detail: `a gallery app names each ${type} \`${prefix}<short>\`; this ${type} is \`${name}\``});
expect(p).toContain("Naming: this app's namespace is `democrm`. Name each object, view, doc and position you declare `democrm_<name>`, and each capability `democrm.<name>`");
0 commit comments