Skip to content
This repository was archived by the owner on Aug 24, 2026. It is now read-only.

fix: quote preset.yml descriptions (YAML metadata parse) + repair router.test.mjs import - #13

Open
baobaolaodie wants to merge 3 commits into
yjh051108:mainfrom
baobaolaodie:fix/preset-yml-metadata-parse
Open

fix: quote preset.yml descriptions (YAML metadata parse) + repair router.test.mjs import#13
baobaolaodie wants to merge 3 commits into
yjh051108:mainfrom
baobaolaodie:fix/preset-yml-metadata-parse

Conversation

@baobaolaodie

Copy link
Copy Markdown

问题

dsh 用 YAML 加载器读取每个预设的 preset.yml 显示元数据;未加引号的纯量值里出现 ": "(冒号+空格)会被解析为嵌套映射而报错,导致预设选择器回退为只显示 id(丢失名称/描述)。当前 main 上两个预设均存在此 bug:

  • preset/router-standard/preset.ymlrestoration: one-sentence
  • preset/router-spec/preset.yml(spec): classified

修复内容

  1. 两个 preset.ymldescription 值加双引号,YAML 合法化。
  2. router.test.mjs import 修复:v0.2.0 重构把 router-core.mjs 移入 preset/<preset>/ 子目录后,测试仍引用已不存在的 ./preset/router-core.mjs —— 在此之前 npm test 根本无法运行(无 CI 所以未被发现)。现指向 ./preset/router-standard/router-core.mjs
  3. 新增零依赖回归测试:校验每个预设的 preset.yml 元数据——name/description 行必须存在、引号必须闭合、未加引号的值不得包含 ": "
  4. README 同步(v0.2.0 重构同样遗留的过时引用):
    • Tests 计数 11 → 16(原计数早已与实际不符)
    • Files / License 章节的旧路径(preset/agent.cordis.yml 等根路径)改为实际目录 preset/router-standard/preset/router-spec/

验证

  • node router.test.mjs16/16 全部通过(15 原有 + 1 新增)
  • 变异测试:还原原 bug / 未闭合引号 / 删除 description 行 / name 引号未闭合 / name 含 ": " —— 5 组变异下回归测试均正确失败,证明其有效性
  • 两个 preset.yml 经 js-yaml 解析正常(与 dsh readPresetMetadata 使用同款加载器)
  • 仓库全部 YAML(含 agent.cordis.yml)经 dsh 官方 entryListSchema 解析通过,无其他同类隐患

…e) + regression test

dsh reads preset.yml with a YAML loader; plain-scalar description values
containing ": " (router-standard "restoration: one-sentence", router-spec
"(spec): classified") fail to parse, so the preset picker falls back to
showing only the preset id. Double-quote both descriptions.

Also repair router.test.mjs: the v0.2.0 preset reorg moved router-core.mjs
under preset/<preset>/, leaving the ./preset/router-core.mjs import dangling
and the suite unrunnable; point it at preset/router-standard/router-core.mjs
and add a zero-dependency regression test guarding the metadata files.
…e closure)

The previous guard only inspected the description value. Generalize it to
every metadata key (name, description, ...): require a name and a
description line, treat an opened quote that never closes as a failure, and
keep the unquoted ": " check. Still zero dependencies.
The v0.2.0 reorg moved the composition and router files under
preset/router-standard/ and preset/router-spec/, but README still listed the
pre-reorg root paths (preset/agent.cordis.yml, preset/router-core.mjs,
preset/router-bootstrap.mjs) and an outdated test count. Point the Files and
License sections at the real preset directories and note the actual 16-test
suite.
@baobaolaodie

Copy link
Copy Markdown
Author

补充说明:本 PR 提交之后才注意到 #12 已先行修复同一问题,未能更早发现,给审阅带来重复内容,敬请见谅。

#12 更早、更聚焦,对 preset.yml 的修复与本 PR 完全一致。本 PR 另包含 #12 未涉及的两处内容,供作者参考:

  1. router.test.mjs 的 import 断链修复——v0.2.0 重构后 ./preset/router-core.mjs 已不存在,npm test 目前无法运行;
  2. 零依赖回归测试(防止同类问题复发)与 README 三处过时引用的同步。

对应 bug 报告:#11。合并哪一个、如何合并,完全由作者决定;如需将上述修复拆分或并入 #12,随时告知即可配合调整。

lapp33669 added a commit to lapp33669/dsh-router-standard that referenced this pull request Aug 16, 2026
…claimed before assemble; sessionMode filters source.kind; import extractText

- yjh051108#11: extractText was used in the session/event guidance listener but never imported (bandOf was fixed in 0fbe572) -> ReferenceError on every real user message in v0.2.0. Both presets, both bootstrap copies.
- yjh051108#13: the session/event user/message firehose fires only AFTER the first assembly (agent loop appends the message at step start), so the v0.2.0 firstUserText capture still routed the FIRST request to weak. agent/inbox/claimed fires during inbox.claim, which preStep runs BEFORE systemPrompt.assemble — the first request now carries the real classification.
- sessionMode now only classifies source.kind === 'user' messages, so plugin steering (user-approval, ingest seeds) can no longer pin a session weak.
lapp33669 added a commit to lapp33669/dsh-router-standard that referenced this pull request Aug 16, 2026
…e — raw text clamped to 0 routed every task to spec

The claimed-event capture (previous commit) made the first assembly see the
real message, but the chain fed the RAW TEXT into bandOf(). clamp01() is
Number(v)||0, so a non-numeric task string became 0 → spec band for EVERY
task (measured: Mario build task got SPEC_PERSONA + read/edit/glob/grep).
Now firstMode() runs classifyTask() on the captured text; measured after
fix: react task → REACT_PERSONA + read/write/edit core on the first request.
yjh051108 added a commit that referenced this pull request Aug 21, 2026
…x/claimed (#13), near-field guidance at agent/pre-step (#34/#36, kills 2x API calls #55), extractText/bandOf imports (#11), sessionMode user-source filter, preset.yml quoting (#53), #5/#9/#44, integration tests
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant