fix: resolve outside_scope design links inside the explicit --root #6

Merged
cflmy merged 1 commits from feature/web01-root-scope into main 2026-11-27 08:52:30 +08:00
Owner

范围(WEB-01 显式 root 内 outside_scope 链接)

WEB-00/Preview 实测发现:当 entry 的最近 CLI 项目根是子目录时,组件链接 ../shared/x.mq.md 被 Analysis 标 outside_scope 且无 candidate_path,即使目标在设计命令显式 --root 内。

本次修复(不调用私有 loader/不搜索文件):

  • 仅对 state == outside_scope 且 URL 为无 scheme、非 / 开头的相对路径,用公开 reference URL 的路径部分相对来源模块目录解析;
  • canonical target 必须在显式 --root 内,否则 web.link.outside_root;
  • anchor 仍由目标模块 Analysis 的 anchors 精确验证;
  • 其他状态保持确定性拒绝。

新增真实 CLI 契约测试并通过;证据记录该解释规则与局限(若未来 CLI Analysis 提供显式 root-relative candidate 可简化)。

验证

MARQDO_BIN=<root-fixed CLI> scripts/ci.sh:fmt/clippy PASS,19/19 契约测试 PASS。

Refs cflmy/marqdo-web-design#1, cflmy/marqdo#6

## 范围(WEB-01 显式 root 内 outside_scope 链接) WEB-00/Preview 实测发现:当 entry 的最近 CLI 项目根是子目录时,组件链接 `../shared/x.mq.md` 被 Analysis 标 `outside_scope` 且无 `candidate_path`,即使目标在设计命令显式 `--root` 内。 本次修复(不调用私有 loader/不搜索文件): - 仅对 `state == outside_scope` 且 URL 为无 scheme、非 `/` 开头的相对路径,用公开 reference URL 的路径部分相对来源模块目录解析; - canonical target 必须在显式 `--root` 内,否则 `web.link.outside_root`; - anchor 仍由目标模块 Analysis 的 anchors 精确验证; - 其他状态保持确定性拒绝。 新增真实 CLI 契约测试并通过;证据记录该解释规则与局限(若未来 CLI Analysis 提供显式 root-relative candidate 可简化)。 ## 验证 `MARQDO_BIN=<root-fixed CLI> scripts/ci.sh`:fmt/clippy PASS,19/19 契约测试 PASS。 Refs cflmy/marqdo-web-design#1, cflmy/marqdo#6
cflmy added 1 commit 2026-11-27 08:52:25 +08:00
WEB-00's probe and the Preview fixture exposed a real boundary: when an entry's
nearest CLI project root is a subdirectory, a component link like
`../shared/x.mq.md` is reported as outside_scope without candidate_path even
though it is inside the design command's explicit --root.

Design now derives the physical candidate from the public reference URL only for
that state, resolves it relative to the source module, requires the canonical
target to stay inside --root, and still verifies the exact anchor through the
target module's Analysis. No private loader, file search or label guessing is
introduced; other states keep failing with the candidate diagnostic.

Adds a real-CLI contract test and records the rule/limitation in the evidence.

Refs cflmy/marqdo-web-design#1, cflmy/marqdo#6
cflmy merged commit 2f18dede85 into main 2026-11-27 08:52:30 +08:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cflmy/marqdo-web-design#6