feat(PR-06): one-command frozen-CLI acceptance, evidence and final docs
- tools/acceptance.sh: RFC §18.1 end-to-end acceptance against the frozen CLI release archive in an isolated tool home (build/test/bundle/archive-install/ view help/verify/export/browse/explicit CSRF run/export+security+browser suites/CLI SHA check) and generation of docs/evidence/<CLI-SHA>/manifest.json - tools/test-contract.sh + .woodpecker.yml CI lanes (remote CI unverified) - docs/ACCEPTANCE.md gate table (P0 all PASS; U-01/U-04 honestly PARTIAL), docs/audits/protocol-conformance.md, ADR-0006 documented RFC deviations - unicode/CRLF/duplicate-text examples + frozen goldens + tests (S-04) - presentation degradation matrix tests (S-05..S-07), hostile-stdout escaping test (X-05), keyboard accessibility browser checks (U-03) - final README/STATUS/COMPATIBILITY/CHANGELOG with honest limitations
This commit is contained in:
1 parent
1f34daffb0
commit
d641ca58ac
21 files changed
+1562
-70
No files matched your search
@@ -0,0 +1,68 @@
|
||||
# Woodpecker CI for marqdo-view.
|
||||
#
|
||||
# The contract/export/browser lanes need the frozen marqdo release archive.
|
||||
# Provide it through a secret and extract it before the lane runs; the pipeline
|
||||
# deliberately never builds the CLI from source.
|
||||
when:
|
||||
event: [push, pull_request, manual]
|
||||
|
||||
steps:
|
||||
code:
|
||||
image: rust:1.85-bookworm
|
||||
commands:
|
||||
- export PATH="$HOME/.cargo/bin:$PATH"
|
||||
- cargo fmt --all -- --check
|
||||
- cargo clippy --all-targets -- -D warnings
|
||||
- cargo test --locked
|
||||
- cargo build --release --locked
|
||||
|
||||
contract:
|
||||
image: rust:1.85-bookworm
|
||||
depends_on: [code]
|
||||
environment:
|
||||
MARQDO_ARCHIVE:
|
||||
from_secret: marqdo_beta_archive
|
||||
commands:
|
||||
# CI maintainers must provide the official archive at $MARQDO_ARCHIVE or
|
||||
# export MARQDO_BIN from a verified extracted release. Do not rebuild it.
|
||||
- |
|
||||
if [ -z "${MARQDO_ARCHIVE:-}" ]; then
|
||||
echo "MARQDO_ARCHIVE secret missing; contract lane requires the frozen official archive" >&2
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p /tmp/marqdo && tar -xzf "$MARQDO_ARCHIVE" -C /tmp/marqdo
|
||||
- export MARQDO_BIN="$(find /tmp/marqdo -maxdepth 2 -name marqdo -type f | head -1)"
|
||||
- sha256sum "$MARQDO_BIN"
|
||||
- MARQDO_BIN="$MARQDO_BIN" ./tools/test-contract.sh
|
||||
- sha256sum "$MARQDO_BIN"
|
||||
|
||||
export:
|
||||
image: rust:1.85-bookworm
|
||||
depends_on: [code]
|
||||
environment:
|
||||
MARQDO_ARCHIVE:
|
||||
from_secret: marqdo_beta_archive
|
||||
commands:
|
||||
- mkdir -p /tmp/marqdo && tar -xzf "$MARQDO_ARCHIVE" -C /tmp/marqdo
|
||||
- export MARQDO_BIN="$(find /tmp/marqdo -maxdepth 2 -name marqdo -type f | head -1)"
|
||||
- cargo build --release --locked
|
||||
- MARQDO_BIN="$MARQDO_BIN" ./tools/test-export.sh
|
||||
|
||||
browser:
|
||||
image: mcr.microsoft.com/playwright:v1.49.0-noble
|
||||
depends_on: [code]
|
||||
commands:
|
||||
- apt-get update && apt-get install -y --no-install-recommends cargo rustc || true
|
||||
- export PATH="$HOME/.cargo/bin:$PATH"
|
||||
- cargo build --release --locked
|
||||
- (cd tests/browser && npm install --no-audit --no-fund)
|
||||
- MARQDO_BIN="$(find /tmp/marqdo -maxdepth 2 -name marqdo -type f | head -1)" ./tools/test-browser.sh
|
||||
|
||||
release-bundle:
|
||||
image: rust:1.85-bookworm
|
||||
depends_on: [code]
|
||||
commands:
|
||||
- cargo build --release --locked
|
||||
- MARQDO_BIN="" ./tools/package.sh
|
||||
- sha256sum dist/marqdo-view-*.tar.gz
|
||||
- tar -tzf dist/marqdo-view-*.tar.gz | sort
|
||||
+23
-2
@@ -93,11 +93,32 @@ Protocol axes (Tool v1, Analysis v2, Trace v2) are versioned separately.
|
||||
(`tests/fixtures/security-project`) proving no script execution and no
|
||||
external requests; `tests/export.rs` export contracts; ADR-0005.
|
||||
|
||||
### Added (PR-06)
|
||||
|
||||
- `tools/acceptance.sh`: one-command RFC §18.1 acceptance running the frozen CLI
|
||||
from the release archive in an isolated tool home (fmt/clippy/test/build,
|
||||
bundle, archive install, view help/verify/export, Live browse, explicit
|
||||
CSRF-confirmed real run, export/security/browser suites, CLI SHA check) and
|
||||
generating `docs/evidence/<CLI-SHA>/manifest.json` from real exit statuses.
|
||||
- `tools/test-contract.sh`, `.woodpecker.yml` (code/contract/export/browser/
|
||||
release-bundle lanes; remote CI execution not verified).
|
||||
- `docs/ACCEPTANCE.md` gate table, `docs/audits/protocol-conformance.md`,
|
||||
ADR-0006 (documented RFC deviations), final README/STATUS/COMPATIBILITY.
|
||||
- Unicode/CRLF/duplicate-text goldens and `tests/unicode_spans.rs` (S-04);
|
||||
`tests/presentation_states.rs` degradation matrix (S-05..S-07); hostile
|
||||
stdout escaping test (X-05); keyboard accessibility browser checks (U-03).
|
||||
|
||||
### Known limitations
|
||||
|
||||
- First Beta: run is `pure`-only; project/strict grants UI, SSE streaming,
|
||||
cancellation and multi-run history are not implemented.
|
||||
- Variables/memory/proof states remain `UNSUPPORTED`; debugger/Notebook are
|
||||
non-goals.
|
||||
- No incremental export or multi-project site; one project per invocation.
|
||||
- Export still requires a core for semantic status; without it pages are
|
||||
exported as explicitly unverified prose.
|
||||
- Pixel-level comparison with the reference screenshot remains manual
|
||||
UNVERIFIED; SVG curve side notes are not implemented (inline keyed chips).
|
||||
- Remote CI is not executed in this environment; `.woodpecker.yml` is provided
|
||||
and local acceptance evidence is complete.
|
||||
- `project`/`strict` grant UI, streaming output, cancellation and debugger are
|
||||
not implemented; variables/memory/proof states remain `UNSUPPORTED`.
|
||||
- Pixel-level comparison with the reference screenshot remains a manual
|
||||
|
||||
+4
-1
@@ -34,10 +34,13 @@ Beta 版 CLI 必须使用 prerelease 范围(`>=3.0.0-beta.1,<4.0.0`);`>=3.
|
||||
| 静态离线导出(纯只读) | **已实现**(PR-05,同一渲染器) |
|
||||
| 逐语句变量值 / 参数实际值 / 内存快照 | **UNSUPPORTED**(Trace v2 不提供,绝不伪造) |
|
||||
| 知识“已证明”状态 | **UNSUPPORTED**(需要独立 Prove 协议与证书) |
|
||||
| `project`/`strict` 运行与 grants 授权 | **未实现**(首版仅 `pure`,其他模式 403) |
|
||||
| SSE 流式输出 / 取消运行 / 多运行历史 | **未实现**(运行后整页重载并保留位置) |
|
||||
| SVG 曲线侧注 | **未实现**(运行事件用内联 keyed chip,U-04 PARTIAL) |
|
||||
| 调试器/断点/单步 | **不实现**(首版非目标) |
|
||||
| Knowledge/Prove/Lint 引擎 | **不实现**(独立仓库/未来可选信息层) |
|
||||
|
||||
实际完成状态以 [`docs/STATUS.md`](docs/STATUS.md) 与 CI 证据为准,本文不代替现状。
|
||||
实际完成状态以 [`docs/STATUS.md`](docs/STATUS.md) 与 [`docs/ACCEPTANCE.md`](docs/ACCEPTANCE.md) 为准,本文不代替现状。远端 CI 未实际运行(`.woodpecker.yml` 已提供),本地冻结 CLI 验收证据见 `docs/evidence/`。
|
||||
|
||||
## 消费者契约
|
||||
|
||||
|
||||
@@ -1,39 +1,91 @@
|
||||
# marqdo-view
|
||||
|
||||
Marqdo View 是一个独立的可执行文档阅读器:以**原始 Markdown 为阅读主体**,把冻结 `marqdo` CLI 的静态语义(Analysis v2)与用户显式触发的真实运行轨迹(Trace v2)附着回原文,而不是把文档翻译成另一套语言。
|
||||
Marqdo View 是一个独立的可执行文档阅读器:以**原始 Markdown 为阅读主体**,把冻结
|
||||
`marqdo` CLI 的静态语义(Analysis v2)与用户显式触发的真实运行轨迹(Trace v2)
|
||||
附着回原文,而不是把文档翻译成另一套语言。
|
||||
|
||||
- 设计总规范:[`docs/RFC-VIEW-0001.md`](docs/RFC-VIEW-0001.md)
|
||||
- 实际实施状态(唯一现状来源):[`docs/STATUS.md`](docs/STATUS.md)
|
||||
- 旧 View 取证审计:[`docs/audits/legacy-render-paths.md`](docs/audits/legacy-render-paths.md)
|
||||
- 关键决策:[ADR-0001](docs/ADR/0001-single-package-single-pipeline.md) / [ADR-0002](docs/ADR/0002-embedded-assets-tool-protocol.md)
|
||||
- 视觉基准:`docs/design/reference-old-view-reader.png` 与 [`docs/design/visual-tokens.md`](docs/design/visual-tokens.md)
|
||||
- 状态(唯一现状来源):[`docs/STATUS.md`](docs/STATUS.md)
|
||||
- 验收结果与证据:[`docs/ACCEPTANCE.md`](docs/ACCEPTANCE.md)
|
||||
- 架构规范:[`docs/RFC-VIEW-0001.md`](docs/RFC-VIEW-0001.md)
|
||||
- 旧 View 静态审计:[`docs/audits/legacy-render-paths.md`](docs/audits/legacy-render-paths.md)
|
||||
- 协议一致性:[`docs/audits/protocol-conformance.md`](docs/audits/protocol-conformance.md)
|
||||
- 兼容性:[`COMPATIBILITY.md`](COMPATIBILITY.md) / 变更:[`CHANGELOG.md`](CHANGELOG.md)
|
||||
|
||||
## 当前状态
|
||||
## 能力
|
||||
|
||||
**开发中。** PR-00(基线/取证/设计基准)、PR-01(Tool Protocol v1 + verify)、PR-02(DocumentModel/Analysis v2 只读浏览 + 单一渲染器 + 本机 Live 阅读)与 PR-04(显式确认后运行 + Trace v2 可视化)已完成。`marqdo view [PATH]` 提供本机只读浏览;在 Live 页面点击“运行”并确认后,才会调用冻结核心执行 `pure` 模式并展示真实 Trace;`export` 按 PR-05 交付。任何未完成能力都在 `docs/STATUS.md` 与 CHANGELOG 明确标注,不以占位功能冒充已实现。
|
||||
| 能力 | 状态 |
|
||||
|---|---|
|
||||
| 原始 Markdown + GFM 阅读、源码态、文档态 | ✅ |
|
||||
| Analysis v2 静态语义(函数/Unit/签名/诊断/导入/引用/资源) | ✅ 严格校验,span 无效则降级 |
|
||||
| 本机 Live 阅读(默认 `127.0.0.1`,只读 API) | ✅ |
|
||||
| 用户确认后运行 + 真实 Trace v2 可视化(`pure` 模式) | ✅ 需要页面内确认 + CSRF |
|
||||
| 纯只读静态导出(离线 `file://`、manifest/哈希、原子发布) | ✅ |
|
||||
| 逐语句变量值 / 参数值 / 内存快照 | ❌ UNSUPPORTED(协议不提供,绝不伪造) |
|
||||
| 知识“已证明” / Prove / Lint / 调试器 | ❌ 非目标/等待独立协议 |
|
||||
| `project`/`strict` 运行、SSE、多运行历史 | ❌ 未实现(首版仅 `pure`) |
|
||||
|
||||
## 架构约束(摘要)
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
# 1) 取得官方冻结 CLI 发布包(示例:本地已解包的 3.0.0-beta.1)
|
||||
MARQDO_BIN=/absolute/path/to/marqdo
|
||||
"$MARQDO_BIN" --version
|
||||
|
||||
# 2) 构建并制作 Tool v1 bundle
|
||||
./tools/package.sh
|
||||
# → dist/marqdo-view/tool.json + dist/marqdo-view/bin/marqdo-view
|
||||
|
||||
# 3) 安装为 `marqdo view`
|
||||
"$MARQDO_BIN" tool install "$(pwd)/dist/marqdo-view/tool.json"
|
||||
"$MARQDO_BIN" view --help
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
```bash
|
||||
# 只读浏览(不会自动执行任何文档)
|
||||
marqdo view examples/welcome --no-open
|
||||
marqdo view examples/control-flow --port 0 --no-open
|
||||
|
||||
# 校验 CLI / Analysis / 源码绑定(无执行)
|
||||
marqdo view verify examples/mixed-modes/index.mq.md
|
||||
marqdo view verify examples/mixed-modes --refs --json
|
||||
|
||||
# 纯只读静态导出(永不执行;导出后可用 file:// 离线打开)
|
||||
marqdo view export examples/welcome --out ./site
|
||||
marqdo view export examples/mixed-modes --out ./site --no-annotations
|
||||
```
|
||||
|
||||
开发期可直接运行 `marqdo-view`(用 `--marqdo-bin` 指定冻结核心)。运行入口在 Live
|
||||
页面中:点击“运行”→ 阅读风险说明 → 点击“确认运行”,才会调用冻结核心执行
|
||||
`--mode pure`;页面刷新/打开/搜索/导出都不会运行。
|
||||
|
||||
## 架构(强制约束)
|
||||
|
||||
```text
|
||||
Browser / static HTML
|
||||
│
|
||||
Reader UI(唯一 reader.css + reader.js)
|
||||
Reader UI(唯一 assets/reader.css + assets/reader.js)
|
||||
│
|
||||
ReaderRenderer(唯一模板)
|
||||
ReaderRenderer(唯一模板,Live/Export 共用)
|
||||
│
|
||||
PresentationModel(唯一模型) ── DocumentModel / SemanticProjection / RunProjection
|
||||
PresentationModel(DocumentModel / SemanticProjection / RunProjection)
|
||||
│
|
||||
PublicCoreClient ── MARQDO_BIN 子进程 + 公开 JSON(check --emit / run --trace-file)
|
||||
PublicCoreClient ─ MARQDO_BIN 子进程 + 公开 JSON(check --emit / run --trace-file)
|
||||
│
|
||||
冻结发布版 marqdo CLI(不修改、不重编译、不链接)
|
||||
冻结发布版 marqdo CLI(不修改、不重编译、不链接、不读源码)
|
||||
```
|
||||
|
||||
- 单一 Rust package、单一渲染入口、单一主题文件;Live 与 Export 共用同一份渲染字节。
|
||||
- 不依赖旧 `marqdo` 仓库或 `marqdo-cli` 的私有 crate/源码;仅通过 `MARQDO_BIN` 与公开协议交互。
|
||||
- 默认纯只读、不自动执行;执行必须由用户在 UI 中显式确认,最低权限首选 `--mode pure`。
|
||||
- Trace v2 不提供逐语句变量值/内存快照;新 View 一律标 `UNSUPPORTED`,绝不伪造。
|
||||
- 单一 Rust package、单一渲染入口、单一主题文件;没有第二个 Markdown→语义管线。
|
||||
- Analysis v2 是唯一语义权威:函数/语句/分支/循环/诊断均来自 `check --emit`,
|
||||
源码字节 span 只用于绑定视觉位置。
|
||||
- Trace v2 与 Analysis 字节摘要严格绑定;`STALE/TRUNCATED/FAILED/UNSUPPORTED`
|
||||
状态显式呈现,不猜测未公开值。
|
||||
- Live/Export 内容同源;导出绝不执行、绝不覆盖项目源文件或无关目录。
|
||||
- 门禁:`tests/no_coupling.rs` 拒绝旧 crate/源码依赖、第二套渲染器/主题、shell 执行;
|
||||
`tests/asset_integrity.rs` 锁定内嵌资产与唯一主题层。
|
||||
|
||||
## 开发
|
||||
## 开发与验收
|
||||
|
||||
```bash
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
@@ -43,40 +95,36 @@ cargo test --locked
|
||||
cargo build --release --locked
|
||||
```
|
||||
|
||||
静态导出(纯只读、离线可打开,永不执行文档):
|
||||
全链路(Tool 安装、浏览、显式运行、导出、浏览器、安全、冻结内核 SHA 不变):
|
||||
|
||||
```bash
|
||||
marqdo view export examples/welcome --out ./site
|
||||
# 或:marqdo-view export examples/welcome --out ./site --marqdo-bin /path/to/marqdo
|
||||
export MARQDO_BIN=/absolute/path/to/frozen/marqdo
|
||||
./tools/acceptance.sh
|
||||
```
|
||||
|
||||
本机浏览(默认只绑定 127.0.0.1,不自动执行):
|
||||
|
||||
```bash
|
||||
MARQDO_BIN=/absolute/path/to/marqdo cargo run -- examples/welcome --no-open
|
||||
# 或用已安装 bundle:marqdo view examples/welcome --no-open
|
||||
```
|
||||
|
||||
安装到冻结 CLI(开发期):
|
||||
|
||||
```bash
|
||||
MARQDO_BIN=/absolute/path/to/marqdo
|
||||
./tools/package.sh
|
||||
"$MARQDO_BIN" tool install "$(pwd)/dist/marqdo-view/tool.json"
|
||||
"$MARQDO_BIN" view --help
|
||||
```
|
||||
|
||||
浏览器验收(需要一次性的 Playwright/Chromium 下载):
|
||||
单独套件:
|
||||
|
||||
```bash
|
||||
MARQDO_BIN=... ./tools/test-contract.sh # code + Tool v1 + verify + export
|
||||
MARQDO_BIN=... ./tools/test-export.sh # 纯只读导出 + file:// Chromium
|
||||
./tools/test-security.sh # HTTP/路径/XSS/导出对抗
|
||||
(cd tests/browser && npm install && PLAYWRIGHT_BROWSERS_PATH="$PWD/../.cache/pw-browsers" npx playwright install chromium)
|
||||
MARQDO_BIN=/absolute/path/to/marqdo ./tools/test-browser.sh
|
||||
MARQDO_BIN=/absolute/path/to/marqdo ./tools/test-export.sh
|
||||
./tools/test-security.sh
|
||||
MARQDO_BIN=... ./tools/test-browser.sh # 真实 Chromium 视觉/交互/响应式/运行
|
||||
```
|
||||
|
||||
完整安装/验收步骤见 RFC §18,脚本位于 `tools/`。
|
||||
协议 golden 由冻结 CLI 生成,见 `tests/golden/README.md` 与 `tools/gen-golden.sh`。
|
||||
|
||||
## 已知限制(诚实状态)
|
||||
|
||||
- 首版运行只支持 `--mode pure`;`project`/`strict` 及 grants 授权界面未实现。
|
||||
- 运行完成后整页重载并保留阅读位置;无 SSE 流式输出/取消/多运行历史。
|
||||
- 变量实际值、参数值、内存快照、知识证明状态不在 Trace v2 中,UI 一律标 UNSUPPORTED。
|
||||
- 平台仅 Linux x86_64 glibc 正式验证;macOS/Windows 未验证。
|
||||
- 视觉自动化门禁 PASS,但参考截图的像素级人工比对仍未执行(`U-01 UNVERIFIED`);
|
||||
SVG 曲线侧注未实现,运行事件以可访问的内联 chip 呈现(`U-04 PARTIAL`)。
|
||||
- 远端正 CI 未实际运行;`.woodpecker.yml` 已提供,本地验收证据完整。
|
||||
|
||||
## 许可
|
||||
|
||||
代码按 MIT / Apache-2.0 双许可发布(见 `LICENSE-MIT`、`LICENSE-APACHE`)。复用的旧 View 视觉资产授权与来源见 `assets/licenses/`。
|
||||
代码按 MIT / Apache-2.0 双许可发布(`LICENSE-MIT`、`LICENSE-APACHE`)。复用的旧
|
||||
View 视觉资产(Apache-2.0)来源与哈希见 `assets/licenses/ASSETS.md`。
|
||||
@@ -0,0 +1,61 @@
|
||||
# 验收状态(RFC-VIEW-0001 §18)
|
||||
|
||||
> 结论:首个 Beta 的 **P0 门禁全部 PASS**(由真实冻结 CLI + 真实 Chromium 生成,
|
||||
> 见 `docs/evidence/2c7c4f31e7a388d3fcfa717a77067e696ed13854/manifest.json`)。
|
||||
> P1 视觉/交互门禁大部分 PASS,**U-01 像素级人工比对与 U-04 动态曲线侧注未完成/未实现**,
|
||||
> 已在 README/CHANGELOG/STATUS 明确标注,不以自动化结果替代人工判断。
|
||||
|
||||
## P0 门禁
|
||||
|
||||
| ID | 结果 | 证据 |
|
||||
|---|---|---|
|
||||
| A-01 无旧 crate 依赖 | PASS | `tests/no_coupling.rs` 依赖/Cargo.lock/源码扫描 |
|
||||
| A-02 独立新仓库 clean build | PASS | acceptance `build`;无 `marqdo`/`marqdo-cli` 源码依赖 |
|
||||
| A-03 Tool v1 安装/分发 | PASS | acceptance `archive_install`、`tool_list`、`view_help`;`tools/install-smoke.sh` |
|
||||
| A-04 CLI SHA-256 前后相同 | PASS | acceptance `core_sha`;manifest 中 before==after=`062cb56e…` |
|
||||
| A-05 旧审计与截图基准 | PASS(静态) | `docs/audits/legacy-render-paths.md`(`LEGACY_RUNTIME_UNVERIFIED` 已声明) |
|
||||
| A-06 单一 Renderer/CSS 入口 | PASS | `tests/no_coupling.rs`、`tests/asset_integrity.rs`、ADR-0001/0002 |
|
||||
| S-01 Knowledge/Exec/继承 | PASS | `tests/rendering.rs`、`tests/unicode_spans.rs`、冻结 Analysis golden |
|
||||
| S-02 Emph/Strong/Code 载体 | PASS | `tests/rendering.rs`(4 个 Exec 锚点)、`tests/unicode_spans.rs` |
|
||||
| S-03 Knowledge 惰性 | PASS | `knowledge_emphasis_never_becomes_an_execution_anchor` |
|
||||
| S-04 中文/emoji/CRLF/重复语句 | PASS | `examples/unicode-spans` + 冻结 golden + `tests/unicode_spans.rs` |
|
||||
| S-05 check 失败可读 | PASS | `tests/presentation_states.rs`、浏览器 diagnostics 区 |
|
||||
| S-06 未知 Analysis major 拒绝 | PASS | `tests/semantic` 单测、`tests/presentation_states.rs`、`verify` 负测 |
|
||||
| S-07 digest/span 篡改 | PASS | `tests/trace_contract.rs`、`tests/presentation_states.rs` |
|
||||
| R-01 刷新 10 次不运行 | PASS | `tests/http_live.rs::opening_and_refreshing_never_runs_the_document` |
|
||||
| R-02 导出纯静态 | PASS | `tests/export.rs`(marker 假核心 + argv 无 run) |
|
||||
| R-03 用户确认后真实运行 | PASS | acceptance `real_run`(安装态、CSRF、真实 Trace) |
|
||||
| R-04 trace 不匹配 → STALE | PASS | `tests/trace_contract.rs`、`tests/http_live.rs` |
|
||||
| R-05 截断/运行错误 | PASS | 真实 truncated/arity golden + 页面状态 |
|
||||
| R-06 不猜未公开值 | PASS | Trace 模型无这些字段;UI `UNSUPPORTED`(`docs/design/state-matrix.md`) |
|
||||
| X-01 恶意 Markdown | PASS | `tests/rendering.rs`、`tests/fixtures/security-project` 浏览器 |
|
||||
| X-02 路径穿越/symlink | PASS | `tests/http_live.rs`、`SafeRelativePath` 单测 |
|
||||
| X-03 跨站 POST run | PASS | `tests/http_live.rs`(token/Origin/confirm/mode) |
|
||||
| X-04 无 JS/禁网/file:// | PASS | 浏览器 no-JS/外部请求检查;`tools/test-export.sh` file:// Chromium |
|
||||
| X-05 stdout 注入转义 | PASS | `tests/http_live.rs::program_stdout_is_escaped...` |
|
||||
| X-06 超时/子进程清理 | PASS | `tests/core_contract.rs::timeout_kills_the_process_group...` |
|
||||
| P-01 文档可复现 | PASS | README / RFC / STATUS / COMPATIBILITY / ADR / 审计 / 证据 |
|
||||
| P-02 archive clean install | PASS | acceptance 从 `.tar.gz` 解包到临时目录安装并运行 |
|
||||
| P-03 协议审计 | PASS | `docs/audits/protocol-conformance.md` |
|
||||
|
||||
## P1 门禁
|
||||
|
||||
| ID | 结果 | 说明 |
|
||||
|---|---|---|
|
||||
| U-01 1664×920 视觉 | **PARTIAL** | 截图已采集(`docs/evidence/PR-03/`),几何/颜色令牌/无溢出/无外部资源 PASS;与参考截图的**像素级人工比对未执行(UNVERIFIED)** |
|
||||
| U-02 多宽度 | PASS | 390/600/900/1280/1664/1920/2560 真实 Chromium:无横向溢出、Dock 在视口内 |
|
||||
| U-03 键盘/焦点/屏幕阅读器 | PASS(基础) | Tab 可达命名控件、Esc 关闭、Ctrl/Cmd+K 搜索;完整 screen-reader 手工走查未做 |
|
||||
| U-04 动态曲线侧注 | **PARTIAL** | 运行事件使用**内联 keyed chip**(无 JS/移动/打印均可读);SVG 曲线侧注未实现,不画错线 |
|
||||
| U-05 Welcome 仅显式配置 | PASS | `view.json` 驱动;`tests/rendering.rs`、浏览器 |
|
||||
| U-06 Live/Export 内容对照 | PASS | `tests/rendering.rs` 同模型对照;导出复用同一 renderer |
|
||||
|
||||
## 复现
|
||||
|
||||
```bash
|
||||
export MARQDO_BIN=/abs/path/to/frozen/marqdo-3.0.0-beta.1
|
||||
tools/acceptance.sh
|
||||
cat docs/evidence/2c7c4f31e7a388d3fcfa717a77067e696ed13854/manifest.json
|
||||
```
|
||||
|
||||
CI 配置见 `.woodpecker.yml`;本环境未实际运行远端 CI,因此 `CI URL` 仍为
|
||||
**UNVERIFIED**(证据来自本地可复现命令,不冒称 CI 通过)。
|
||||
@@ -0,0 +1,20 @@
|
||||
# ADR-0006:相对 RFC 建议目录/形态的实现偏差
|
||||
|
||||
- 状态:Accepted(记录偏差,避免后来者误以为遗漏)
|
||||
- 日期:2026-11-22
|
||||
- 关联:RFC-VIEW-0001 §7、§9.3、§15;PR-06
|
||||
|
||||
RFC 的目录/接口是**建议起点**,允许在更新文档与 ADR 后调整。本仓库的实际偏差如下,
|
||||
均不引入第二套渲染/解析/执行路径。
|
||||
|
||||
| 偏差 | 实际实现 | 理由 / 影响 |
|
||||
|---|---|---|
|
||||
| RFC 目录未列 `src/lib.rs` | 增加 `lib.rs`,`main.rs` 仅分派 | 集成测试与未来 server 复用;仍单 package、单渲染入口(ADR-0001) |
|
||||
| 测试按 crate 根级集成文件组织(`tests/*.rs`),非 `tests/contracts/...` 子目录树 | 12 个根级测试文件按职责命名 | Cargo 集成测试惯例;职责与 RFC 列表一致,门禁更易运行 |
|
||||
| 动态 SVG 曲线侧注 | 运行事件改为**内联 keyed chip**;不做曲线 | 首版优先正确性/无 JS 可读;U-04 标 PARTIAL,不画无来源线 |
|
||||
| 运行输出流式(SSE) | 运行完成后整页重载(保留阅读位置) | 复用同一 renderer 的服务端渲染;避免 JS 拼 HTML |
|
||||
| `Debug`/Notebook/Workbench | 不实现 | RFC 非目标;旧 `src/view` 不复制 |
|
||||
| 导出使用 `pages/<relative>.html` + `manifest.json`(`marqdo.view-export` 私有 schema) | 与 RFC §11.3 建议一致,schema 名由 View 自定 | 非 CLI 协议,不冒称官方 schema |
|
||||
| `view.json` 配置 | 按 RFC §9.4 的建议格式实现 `schema:marqdo.view-config` v1 | 只识别 welcome/site_title/theme;不授予权限、不改变语义 |
|
||||
| 首版运行只支持 `pure` | `POST /api/run` 拒绝 project/strict | `project/strict` 需要未来独立授权 UI(ADR-0004) |
|
||||
| README 状态 | 所有未完成/未验证项在 README/CHANGELOG/STATUS/ACCEPTANCE 标注 | 不以视觉相似或自动化 PASS 替代人工/CI 证据 |
|
||||
+60
-22
@@ -1,43 +1,81 @@
|
||||
# marqdo-view 现状(STATUS)
|
||||
|
||||
> 唯一现状来源。其他文档描述设计;本文件只记录**实际完成、证据与限制**。
|
||||
> 最后更新:2026-11-22(PR-00 完成)
|
||||
> 唯一现状来源。设计/规范见 RFC 与 ADR;本文只记录**实际完成、证据与限制**。
|
||||
> 最后更新:2026-11-22(PR-06 完成)
|
||||
|
||||
## 版本与基线
|
||||
|
||||
| 项 | 值 |
|
||||
|---|---|
|
||||
| View 版本 | `0.1.0`(开发中) |
|
||||
| View 版本 | `0.1.0` |
|
||||
| 目标 CLI 产品范围 | `>=3.0.0-beta.1,<4.0.0` |
|
||||
| 冻结 CLI 二进制 | `/root/work/marqdo-cli/dist/marqdo-3.0.0-beta.1-x86_64-unknown-linux-gnu/marqdo` |
|
||||
| 冻结 CLI 二进制 | 发布归档 `marqdo-3.0.0-beta.1-x86_64-unknown-linux-gnu.tar.gz` 中的 `marqdo` |
|
||||
| 冻结 CLI SHA-256 | `062cb56e226bee55c21d238e195920caa985e62bb3877ba7b07abcc04dc0fe3f` |
|
||||
| CLI 源码 SHA | `2c7c4f31e7a388d3fcfa717a77067e696ed13854`(tag `v3.0.0-beta.1`) |
|
||||
| 协议 | Tool v1 / Analysis v2 / Trace v2 / markdown profile `marqdo.md.v1` |
|
||||
| 目标平台 | Linux x86_64 glibc(正式);其他平台未验证 |
|
||||
| 视觉基准 | `docs/design/reference-old-view-reader.png`(1664×920) |
|
||||
| 验收证据 | `docs/evidence/<CLI-SHA>/manifest.json`(由 `tools/acceptance.sh` 真实命令生成) |
|
||||
|
||||
## 分阶段进度
|
||||
|
||||
| 阶段 | 状态 | 证据 |
|
||||
|---|---|---|
|
||||
| PR-00 基线与旧 View 取证 | **完成** | `docs/audits/legacy-render-paths.md`、`docs/design/visual-tokens.md`、`docs/design/state-matrix.md`、ADR-0001/0002 |
|
||||
| PR-00 基线与旧 View 静态取证 | **完成** | `docs/audits/legacy-render-paths.md`、`docs/design/*`、ADR-0001/0002 |
|
||||
| PR-01 Tool v1 安装闭环 | **完成** | `tool.json`、`tools/package.sh`、`tools/install-smoke.sh`、`tests/core_contract.rs`、`tests/no_coupling.rs` |
|
||||
| PR-02 DocumentModel + Analysis v2 浏览 | **完成** | `src/document.rs`、`src/semantic.rs`、`src/presentation.rs`、`src/render.rs`、`src/server.rs`、`tests/rendering.rs`、`tests/http_live.rs`、`tests/golden/analysis-v2/`(冻结 CLI 生成) |
|
||||
| PR-03 Reader 视觉重建 | **完成(像素级人工比对未执行)** | 单一 `assets/reader.css`/`assets/reader.js`;`tools/test-browser.sh` + `tests/browser/reader.browser.cjs` 在 7 个宽度、无 JS、打印、搜索、设置、显式运行下 PASS;截图证据见 `docs/evidence/PR-03/` |
|
||||
| PR-04 Trace v2 运行可视化 | **完成** | `src/trace.rs`、`POST /api/run`(CSRF/Origin/确认/并发)、`tests/trace_contract.rs`、`tests/http_live.rs`、`tests/golden/trace-v2/`(冻结 CLI 生成)、ADR-0004 |
|
||||
| PR-05 Live 安全强化 + 静态导出 | **完成** | `src/export.rs`、`tools/test-export.sh`、`tools/test-security.sh`、`tests/export.rs`、`tests/browser` 安全 fixture;ADR-0005 |
|
||||
| PR-06 冻结 CLI 端到端验收 | 进行中 | 打包/安装冒烟与真实核心浏览/运行/导出已手动通过;待补证据 manifest、CI 脚本、最终 README/RFC §18 门禁表 |
|
||||
| PR-02 DocumentModel + Analysis v2 浏览 | **完成** | `src/document.rs`、`src/semantic.rs`、`src/presentation.rs`、`src/render.rs`、`src/server.rs`、冻结 Analysis golden |
|
||||
| PR-03 Reader 视觉重建 | **完成(像素级人工比对未执行)** | 单一 `assets/reader.css`/`reader.js`;真实 Chromium 7 宽度/无 JS/打印/运行 PASS;`docs/evidence/PR-03/` |
|
||||
| PR-04 Trace v2 运行可视化 | **完成** | `src/trace.rs`、CSRF/确认运行 API、真实 Trace golden、`tests/trace_contract.rs`、ADR-0004 |
|
||||
| PR-05 Live 安全 + 静态导出 | **完成** | `src/export.rs`、`tools/test-export.sh`、`tools/test-security.sh`、`tests/export.rs`、ADR-0005 |
|
||||
| PR-06 冻结 CLI 端到端验收 | **完成(CI 远端未运行)** | `tools/acceptance.sh` 全部 PASS;`docs/evidence/<CLI-SHA>/manifest.json`;`docs/ACCEPTANCE.md`;ADR-0006 |
|
||||
|
||||
## 证据与限制
|
||||
## 能力现状
|
||||
|
||||
- 旧 View 运行时状态:`LEGACY_RUNTIME_UNVERIFIED`(旧仓库无预编译产物,且任务禁止修改/编译旧仓库;只做只读静态审计)。
|
||||
- PR-01 起 `marqdo view --help/--version/verify` 由本程序提供;PR-02 起 `marqdo view [PATH]` 提供本机只读浏览。
|
||||
- `export` 自 PR-05 起可用,且无条件纯只读;运行入口在 PR-04 起可用,但必须经过页面内显式确认 + CSRF 校验,且只允许 `pure` 模式。
|
||||
- 冻结 CLI 安装烟测通过前不得声称 Tool v1 闭环可用;证据由 `tools/install-smoke.sh` 生成。
|
||||
- PR-02 的 Analysis golden 全部由冻结 CLI `check --emit` 生成(见 `tests/golden/README.md`);`examples/diagnostics` 故意 check 失败且没有 golden。
|
||||
- 已知限制:逐语句变量值/参数值/内存快照/证明状态仍不可用且标为 UNSUPPORTED;`project`/`strict` 运行授权界面、SSE 流式输出、调试器未实现;`export` 未实现。
|
||||
- 视觉门禁:结构化/几何/无外部资源/无 JS/打印 PASS;与参考截图的像素级人工比对 `U-01` 仍为 UNVERIFIED,需人工复核(见 `docs/evidence/PR-03/README.md`)。
|
||||
- 运行安全:首版只提供 `--mode pure`;POST `/api/run` 要求同源 Origin(若提供)、CSRF token、`confirm:true`、单活动运行;运行缓存仅保存在进程内,重启即清空。
|
||||
- 导出:拒绝项目根内输出与未知非空目录;staging + rename 原子发布;manifest 无绝对路径;`--no-annotations` 只影响标注。浏览器安全 fixture 在真实 Chromium 中验证无脚本执行、无外部请求。
|
||||
- 已核对旧视觉资产许可(旧仓库 Apache-2.0):logo/blossom/feather 可复用,KaTeX 不引入。
|
||||
- 已知非目标:变量运行值、内存快照、调试器、Prove/Knowledge/Lint 引擎(均标 `UNSUPPORTED`)。
|
||||
| 能力 | 状态 |
|
||||
|---|---|
|
||||
| 原始 Markdown 阅读(GFM 表/任务列表/引用/围栏/数学原文) | 已实现 |
|
||||
| 文档态 / 源码态(原文逐行,含标记) | 已实现 |
|
||||
| Analysis v2 静态语义(Unit/Function/Signature/诊断/导入/引用/资源) | 已实现,严格校验 + 无效 span 降级 |
|
||||
| 单一 `ReaderRenderer`,Live/Export 共用 | 已实现(门禁测试) |
|
||||
| Live 只读 API(`/`、`/file`、`/assets`、`/api/document`、`/api/health`) | 已实现 |
|
||||
| 显式确认运行 + Trace v2 可视化(`pure` 模式) | 已实现(CSRF/Origin/单活动/超时) |
|
||||
| 静态离线导出(纯只读、manifest/哈希、原子发布) | 已实现 |
|
||||
| 搜索/导航/设置/打印/无 JS/响应式 | 已实现(真实浏览器验收) |
|
||||
| `view verify`(CLI/Analysis/source 绑定,无执行) | 已实现 |
|
||||
| 逐语句变量值 / 参数实际值 / 内存快照 | **UNSUPPORTED**(Trace v2 不提供,绝不伪造) |
|
||||
| 知识“已证明” / Prove / Knowledge / Lint | **UNSUPPORTED**(等待独立协议) |
|
||||
| 调试器/断点/单步、Notebook、旧 2.x 语法 | **不实现**(非目标) |
|
||||
| `project`/`strict` 运行与 grants 授权界面 | **未实现**(首版仅 `pure`,拒绝其他模式) |
|
||||
| SSE 流式输出、多运行历史、取消运行 | **未实现**(运行完成后整页重载) |
|
||||
| SVG 曲线侧注 | **未实现**(使用内联 keyed chip,U-04 PARTIAL) |
|
||||
| 像素级视觉比对 | **UNVERIFIED**(人工复核待办,U-01) |
|
||||
| 远端 CI 实际运行 | **UNVERIFIED**(`.woodpecker.yml` 已提供;本地可复现证据已生成) |
|
||||
|
||||
## 验收证据
|
||||
|
||||
- 一键:`MARQDO_BIN=/abs/path/marqdo tools/acceptance.sh`
|
||||
- 全链路结果:`fmt/clippy/test/build/bundle/archive_install/view_help/verify/export/browse/real_run/export_suite/security_suite/browser/core_sha` 全部 PASS。
|
||||
- 冻结核心 SHA-256 在验收前后完全相同(`062cb56e…`),View 从未重编译/链接 CLI。
|
||||
- 安装来自 `.tar.gz` 发布归档解包到临时目录;不读取 CLI 源码或旧仓库运行代码。
|
||||
- 浏览器:Chromium Headless Shell 131(Playwright 1.49),7 个宽度、无外部请求、无 console 错误、无 JS 可读、打印、恶意 fixture、显式运行。
|
||||
- 详见 `docs/ACCEPTANCE.md` 与 `docs/evidence/`。
|
||||
|
||||
## 已知限制与偏差
|
||||
|
||||
- 测试按 crate 根级集成测试文件组织,而非 RFC 建议的子目录树;职责与门禁不变(ADR-0006)。
|
||||
- 运行完成后整页重载;不实现 SSE/取消/历史。
|
||||
- 静态导出每个文档执行一次 `check`(非执行),无增量导出。
|
||||
- 首版运行仅 `pure`;`project`/`strict` grants 需要未来独立授权 UI。
|
||||
- 平台:仅 Linux x86_64 glibc 正式验证;macOS/Windows 未验证。
|
||||
- 视觉:几何/颜色/响应式/无外部资源自动化 PASS,但像素级人工比对未执行。
|
||||
|
||||
## 复现文档
|
||||
|
||||
- 一分钟使用:`README.md`
|
||||
- 规范:`docs/RFC-VIEW-0001.md`
|
||||
- 兼容性:`COMPATIBILITY.md`
|
||||
- 变更:`CHANGELOG.md`
|
||||
- 旧 View 审计:`docs/audits/legacy-render-paths.md`
|
||||
- 协议一致性:`docs/audits/protocol-conformance.md`
|
||||
- 验收:`docs/ACCEPTANCE.md`
|
||||
- 决策:`docs/ADR/0001..0006`
|
||||
@@ -0,0 +1,98 @@
|
||||
# 协议一致性审计(P-03)
|
||||
|
||||
> 结论:View 只消费冻结 CLI 的公开 Tool v1 / Analysis v2 / Trace v2 协议;
|
||||
> 未实现或未提供的能力显式标注 `UNSUPPORTED`。本文把规范条款映射到实现与测试,
|
||||
> 便于审阅者不依赖对话历史复核。
|
||||
|
||||
## 1. 权威来源
|
||||
|
||||
- `marqdo-cli` 发布二进制 `3.0.0-beta.1`,SHA-256
|
||||
`062cb56e226bee55c21d238e195920caa985e62bb3877ba7b07abcc04dc0fe3f`
|
||||
(`docs/STATUS.md`、`tests/golden/README.md`、`docs/evidence/<SHA>/manifest.json`)。
|
||||
- 规范阅读:`spec/tool-v1.md`、`spec/analysis-v2.md`、`spec/trace-v2.md`、
|
||||
`spec/mapping.md`、`spec/markdown-profile.md`、`spec/security.md`。
|
||||
- 旧仓库只作为视觉/历史证据(`docs/audits/legacy-render-paths.md`),不是运行时依赖。
|
||||
|
||||
## 2. Tool Protocol v1
|
||||
|
||||
| 条款 | 实现 | 测试/证据 |
|
||||
|---|---|---|
|
||||
| `tool.json` schema/字段/SemVer/command/entrypoint | `tool.json`、`tools/package.sh` | `tests/no_coupling.rs`;`tools/install-smoke.sh` |
|
||||
| 冻结核心安装、整包摘要、启动校验 | `tools/install-smoke.sh`、`tools/acceptance.sh` | acceptance `archive_install` PASS;手工篡改字节验证 README(PR-01 证据) |
|
||||
| 环境变量 `MARQDO_BIN`/协议协商 | `src/core_client.rs`、`src/version.rs` | `tests/core_contract.rs`、`tests/http_live.rs` |
|
||||
| argv 数组、无 shell、保留退出码/stdio | `src/core_client.rs` | `tests/core_contract.rs`(argv、timeout、fake core) |
|
||||
| 不链接/不重编译/不读 CLI 源码 | 依赖图 | `tests/no_coupling.rs`、`docs/ADR/0001` |
|
||||
| 篡改/缺文件/协议不兼容拒绝 | CLI 自身 + View 侧协商 | `tests/core_contract.rs`、`tools/install-smoke.sh` |
|
||||
|
||||
## 3. Analysis v2
|
||||
|
||||
| 条款 | 实现 |
|
||||
|---|---|
|
||||
| `check --emit` 仅成功时写、失败删除旧产物 | `src/core_client.rs`(退出码/文件存在性双检) |
|
||||
| `schema/schema_version=2`、未知 major 拒绝 | `src/semantic.rs`、`src/app.rs`、`verify` |
|
||||
| `producer.markdown_profile=marqdo.md.v1` | `src/semantic.rs` |
|
||||
| `project.root_id/identity_kind/lock_digest/stdlib` | `SemanticProjection` 字段 + `verify --json` |
|
||||
| `source_digest` 精确字节校验 | `src/semantic.rs`、`tests/unicode_spans.rs`(CRLF) |
|
||||
| modules/units/functions/signature/body kind/span | `src/semantic.rs`(typed projection) |
|
||||
| `resources[]` formula/code + `display`/language | `StaticResource`,渲染为惰性资源 |
|
||||
| `imports[]`/`references[]`/`calls[]` | 标签与引用状态;不重新解析优先级 |
|
||||
| `diagnostics[]`(span/line/column/severity/code/hints) | 页面诊断区;`check --json` 失败路径 |
|
||||
| `effects:["unknown"]` 不当作纯净证明 | UI 不显示“已证明”;`docs/design/state-matrix.md` |
|
||||
|
||||
## 4. Trace v2
|
||||
|
||||
| 条款 | 实现 |
|
||||
|---|---|
|
||||
| `schema/schema_version=2` | `src/trace.rs` |
|
||||
| `sha256(analysis bytes)==source.analysis_digest` | `verify_trace`;`tests/trace_contract.rs` |
|
||||
| `source.root_id==project.root_id` | `verify_trace` |
|
||||
| 事件 `module_id` ∈ Analysis modules | `verify_trace` |
|
||||
| `seq` 严格递增 | `verify_trace` |
|
||||
| 未知 event kind 忽略(不解释) | `TraceKind::Other`,不产生语义结论 |
|
||||
| `truncated != null` → TRUNCATED | `RunDisplayState::Truncated`;golden truncated |
|
||||
| 无参数值/秘密/内存/赋值历史 | 数据模型不存在这些字段;UI 标 `UNSUPPORTED` |
|
||||
| `run.status` / `run --json` 错误码 | `Failed` + `error_code`;golden arity 错误 |
|
||||
| 公开最终返回值 | 仅 `run --json` 的 `value`,标“Core 本次返回值” |
|
||||
|
||||
## 5. Markdown profile / mapping
|
||||
|
||||
| 条款 | 实现 |
|
||||
|---|---|
|
||||
| Comrak `=1.0.0` 冻结选项集 | `src/document.rs::markdown_options` |
|
||||
| 原始 Markdown 是阅读主体 | `DocumentModel` + `ReaderRenderer` |
|
||||
| 不重新决定可执行性 | 只有 `semantic.rs` 的 Analysis 事实创建锚点 |
|
||||
| `@exec/@knowledge` 显示前缀仅显示层剥离 | `docs/ADR/0003` |
|
||||
| 知识区强调/行内代码不执行 | `tests/unicode_spans.rs::knowledge_emphasis_never_becomes_an_execution_anchor` |
|
||||
| GFM 表/任务列表/围栏/数学可读且惰性 | `tests/rendering.rs`、`tests/export.rs` |
|
||||
| 原始 HTML 默认忽略、URL scheme 净化 | `src/render.rs`、浏览器安全 fixture |
|
||||
|
||||
## 6. Security 边界(View 自身)
|
||||
|
||||
| 条款 | 实现 | 测试 |
|
||||
|---|---|---|
|
||||
| loopback-only + Host 校验 | `src/server.rs` | `tests/http_live.rs` |
|
||||
| CSRF/Origin/确认 | `POST /api/run` | `tests/http_live.rs` |
|
||||
| 路径边界/单次解码/无遍历 | `SafeRelativePath`、`percent_decode` | `tests/http_live.rs`、`tests/project` 单测 |
|
||||
| 导出纯只读、无执行 | `src/export.rs` | `tests/export.rs`(marker 假核心) |
|
||||
| 离线文件:// | 内嵌资产 + 相对链接 | `tools/test-export.sh` Chromium file:// |
|
||||
| 输出/错误不泄露绝对路径 | `ViewError::public_message`、manifest 相对路径 | `tests/http_live.rs`、`tests/export.rs` |
|
||||
| 无第二渲染器/第二主题 | 代码门禁 | `tests/no_coupling.rs`、`tests/asset_integrity.rs` |
|
||||
|
||||
## 7. 明确 UNSUPPORTED / 非目标
|
||||
|
||||
- 逐语句赋值实际值、参数实际值、变量历史、Memory 全状态:Trace v2 不提供,UI 只显示静态分析目标并明确说明。
|
||||
- 知识“已证明”/Prove/Lint/Knowledge 引擎:不实现,等独立版本化协议。
|
||||
- 调试器/断点/单步、Notebook/旧 2.x 语法兼容、SSE 流式运行、多运行历史:非首版目标。
|
||||
- `inspect --ir` / 私有 IR / 旧 `ViewExecutionReport`:没有作为依赖;`tests/no_coupling.rs` 门禁。
|
||||
- 严格模式/项目 grants:首版运行仅 `pure`;`project`/`strict` 需要未来独立授权界面。
|
||||
|
||||
## 8. 复核命令
|
||||
|
||||
```bash
|
||||
export MARQDO_BIN=/abs/path/to/frozen/marqdo
|
||||
tools/acceptance.sh # §18.1 全链路 + evidence manifest
|
||||
tools/test-contract.sh # code + Tool v1 + verify + export
|
||||
tools/test-export.sh # 纯只读导出 + file:// Chromium
|
||||
tools/test-security.sh # HTTP/路径/XSS/导出对抗
|
||||
tools/test-browser.sh # 真实 Chromium 视觉/交互/响应式/运行
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
# 验收证据
|
||||
|
||||
本目录保存**由真实命令生成**的验收证据,命名 `<CLI-SOURCE-SHA>/manifest.json`:
|
||||
|
||||
- `view_source_sha`:生成证据时的 View Git SHA。
|
||||
- `view_binary_sha256`:发布 bundle 内 `bin/marqdo-view` 摘要。
|
||||
- `cli_binary_sha256_before/after`:冻结 CLI 在验收前后的 SHA-256,必须相同。
|
||||
- `cli_source_sha`:CLI 发布归档 `SOURCE_SHA`。
|
||||
- `tool/analysis/trace_protocol`、`target`、`archive_sha256`。
|
||||
- `gates`:`tools/acceptance.sh` 每一步的真实退出状态。
|
||||
- `tests`:contract/browser/export/security 的 PASS/FAIL/SKIP。
|
||||
|
||||
生成方式(不要手写/篡改):
|
||||
|
||||
```bash
|
||||
MARQDO_BIN=/abs/path/to/frozen/marqdo tools/acceptance.sh
|
||||
```
|
||||
|
||||
`manifest.json` 在验收的最后一步写入;若某一步失败,脚本以非零退出且不会声称 PASS。
|
||||
CI URL 只有在 `.woodpecker.yml` 真正运行后才可补入;本仓库当前未声称远端 CI 通过。
|
||||
|
||||
`PR-03/` 子目录保存浏览器截图证据(非协议证据),说明见其 `README.md`。
|
||||
@@ -0,0 +1,19 @@
|
||||
# @knowledge CRLF 文档
|
||||
|
||||
正文包含中文与 emoji 🙂。
|
||||
|
||||
# @exec 演示
|
||||
|
||||
## @exec main
|
||||
|
||||
`params(n: Int)`
|
||||
|
||||
**if n > 0**
|
||||
|
||||
`return n`
|
||||
|
||||
**else**
|
||||
|
||||
`return 0`
|
||||
|
||||
**end**
|
||||
@@ -0,0 +1,23 @@
|
||||
# @knowledge 中文 🙂 标题
|
||||
|
||||
正文包含 emoji 🙂 与组合字符 é,以及惰性 `代码`。**此处加粗是知识内容,不执行。**
|
||||
|
||||
| 名称 | 值 |
|
||||
| --- | --- |
|
||||
| 甲🙂 | 1 |
|
||||
|
||||
# @exec 演示
|
||||
|
||||
## @exec main
|
||||
|
||||
`params(n: Int)`
|
||||
|
||||
**if n > 0**
|
||||
|
||||
`return 1`
|
||||
|
||||
**else**
|
||||
|
||||
`return 1`
|
||||
|
||||
**end**
|
||||
@@ -0,0 +1,3 @@
|
||||
project:
|
||||
name: unicode-spans
|
||||
version: 0.1.0
|
||||
@@ -70,6 +70,30 @@ function localHostOnly(url) {
|
||||
(await page.locator('.mq-dock-btn[data-action="run"]').count()) === 1
|
||||
);
|
||||
|
||||
// Keyboard reachability: focus must move through named interactive elements.
|
||||
const namedTabStops = await page.evaluate(async () => {
|
||||
return Array.from(document.querySelectorAll("a[href], button")).map((el) => ({
|
||||
label: (el.getAttribute("aria-label") || el.textContent || "").trim(),
|
||||
hidden: el.offsetParent === null,
|
||||
}));
|
||||
});
|
||||
check(
|
||||
"interactive controls have accessible names",
|
||||
namedTabStops.filter((item) => !item.hidden && item.label.length > 0).length >= 8,
|
||||
JSON.stringify(namedTabStops.slice(0, 8))
|
||||
);
|
||||
let focusedNamed = 0;
|
||||
for (let index = 0; index < 10; index += 1) {
|
||||
await page.keyboard.press("Tab");
|
||||
const label = await page.evaluate(() => {
|
||||
const element = document.activeElement;
|
||||
if (!element) return "";
|
||||
return (element.getAttribute("aria-label") || element.textContent || "").trim();
|
||||
});
|
||||
if (label.length > 0) focusedNamed += 1;
|
||||
}
|
||||
check("Tab reaches named controls", focusedNamed >= 6, String(focusedNamed));
|
||||
|
||||
// Source/document mode switch through the single menu.
|
||||
await page.click('.mq-dock-btn[data-action="more"]');
|
||||
check("more dialog opens", await page.locator("#mq-dialog-more").isVisible());
|
||||
|
||||
@@ -74,7 +74,13 @@ fn degradation_without_core_keeps_prose_readable() {
|
||||
// invent semantic annotations or a fake run state.
|
||||
let project = common::TempProject::new("cli-degrade-no-core");
|
||||
project.marqdo_project("# @knowledge 标题\n\n正文 **加粗**。\n");
|
||||
let context = marqdo_view::app::AppContext::open(&project.dir, None).unwrap();
|
||||
// Explicitly point at a missing core so the test is independent of the
|
||||
// caller environment (acceptance scripts export MARQDO_BIN).
|
||||
let context = marqdo_view::app::AppContext::open(
|
||||
&project.dir,
|
||||
Some(std::path::Path::new("/definitely/missing/marqdo-frozen")),
|
||||
)
|
||||
.unwrap();
|
||||
let relative = context.project().entry().relative.clone();
|
||||
let model = context.load(&relative).unwrap();
|
||||
assert_eq!(model.source_status.data_value(), "core-unavailable");
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
{
|
||||
"diagnostics": [],
|
||||
"modules": [
|
||||
{
|
||||
"calls": [],
|
||||
"functions": [
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"arms": [
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"kind": "return",
|
||||
"span": {
|
||||
"end": 148,
|
||||
"start": 138
|
||||
},
|
||||
"value": {
|
||||
"kind": "variable",
|
||||
"name": "n",
|
||||
"span": {
|
||||
"end": 147,
|
||||
"start": 146
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"condition": {
|
||||
"kind": "binary",
|
||||
"left": {
|
||||
"kind": "variable",
|
||||
"name": "n",
|
||||
"span": {
|
||||
"end": 128,
|
||||
"start": 127
|
||||
}
|
||||
},
|
||||
"op": "gt",
|
||||
"right": {
|
||||
"kind": "literal",
|
||||
"span": {
|
||||
"end": 0,
|
||||
"start": 0
|
||||
},
|
||||
"type": "int",
|
||||
"value": "0"
|
||||
},
|
||||
"span": {
|
||||
"end": 132,
|
||||
"start": 127
|
||||
}
|
||||
},
|
||||
"condition_span": {
|
||||
"end": 134,
|
||||
"start": 122
|
||||
},
|
||||
"span": {
|
||||
"end": 134,
|
||||
"start": 122
|
||||
}
|
||||
},
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"kind": "return",
|
||||
"span": {
|
||||
"end": 174,
|
||||
"start": 164
|
||||
},
|
||||
"value": {
|
||||
"kind": "literal",
|
||||
"span": {
|
||||
"end": 0,
|
||||
"start": 0
|
||||
},
|
||||
"type": "int",
|
||||
"value": "0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"condition": {
|
||||
"kind": "literal",
|
||||
"span": {
|
||||
"end": 0,
|
||||
"start": 0
|
||||
},
|
||||
"type": "bool",
|
||||
"value": true
|
||||
},
|
||||
"condition_span": {
|
||||
"end": 134,
|
||||
"start": 122
|
||||
},
|
||||
"span": {
|
||||
"end": 134,
|
||||
"start": 122
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "branch",
|
||||
"span": {
|
||||
"end": 134,
|
||||
"start": 122
|
||||
}
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
"unknown"
|
||||
],
|
||||
"heading_span": {
|
||||
"end": 98,
|
||||
"start": 85
|
||||
},
|
||||
"id": "root:unicode-spans@0.1.0::crlf.mq.md::演示.main",
|
||||
"local_name": "main",
|
||||
"namespace": "演示",
|
||||
"signature": {
|
||||
"kind": "explicit",
|
||||
"params": [
|
||||
{
|
||||
"default": null,
|
||||
"name": "n",
|
||||
"required": true,
|
||||
"span": {
|
||||
"end": 115,
|
||||
"start": 109
|
||||
},
|
||||
"type": "Int"
|
||||
}
|
||||
]
|
||||
},
|
||||
"span": {
|
||||
"end": 185,
|
||||
"start": 85
|
||||
},
|
||||
"unit_id": "root:unicode-spans@0.1.0::crlf.mq.md#演示/main"
|
||||
}
|
||||
],
|
||||
"id": "root:unicode-spans@0.1.0::crlf.mq.md",
|
||||
"imports": [],
|
||||
"package_instance_id": "root:unicode-spans@0.1.0",
|
||||
"references": [],
|
||||
"relative_path": "crlf.mq.md",
|
||||
"resources": [],
|
||||
"source_digest": "3d6c99d8e1666b14cc51e6774a4cf514a3a252f3b2f9f541c7cde4a090551b1f",
|
||||
"units": [
|
||||
{
|
||||
"function": null,
|
||||
"id": "root:unicode-spans@0.1.0::crlf.mq.md#",
|
||||
"kind": "root",
|
||||
"level": 0,
|
||||
"name": "",
|
||||
"span": {
|
||||
"end": 185,
|
||||
"start": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": null,
|
||||
"id": "root:unicode-spans@0.1.0::crlf.mq.md#CRLF 文档",
|
||||
"kind": "namespace",
|
||||
"level": 1,
|
||||
"name": "CRLF 文档",
|
||||
"span": {
|
||||
"end": 24,
|
||||
"start": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": null,
|
||||
"id": "root:unicode-spans@0.1.0::crlf.mq.md#演示",
|
||||
"kind": "namespace",
|
||||
"level": 1,
|
||||
"name": "演示",
|
||||
"span": {
|
||||
"end": 81,
|
||||
"start": 67
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": "root:unicode-spans@0.1.0::crlf.mq.md::演示.main",
|
||||
"id": "root:unicode-spans@0.1.0::crlf.mq.md#演示/main",
|
||||
"kind": "function",
|
||||
"level": 2,
|
||||
"name": "main",
|
||||
"span": {
|
||||
"end": 98,
|
||||
"start": 85
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"producer": {
|
||||
"markdown_profile": "marqdo.md.v1",
|
||||
"name": "marqdo",
|
||||
"version": "3.0.0-beta.1"
|
||||
},
|
||||
"project": {
|
||||
"identity_kind": "manifest",
|
||||
"lock_digest": "",
|
||||
"root_id": "root:unicode-spans@0.1.0",
|
||||
"stdlib": {
|
||||
"digest": "sha256:5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713",
|
||||
"instance_id": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
},
|
||||
"schema": "marqdo.analysis",
|
||||
"schema_version": 2
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
{
|
||||
"diagnostics": [],
|
||||
"modules": [
|
||||
{
|
||||
"calls": [],
|
||||
"functions": [
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"arms": [
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"kind": "return",
|
||||
"span": {
|
||||
"end": 271,
|
||||
"start": 261
|
||||
},
|
||||
"value": {
|
||||
"kind": "literal",
|
||||
"span": {
|
||||
"end": 0,
|
||||
"start": 0
|
||||
},
|
||||
"type": "int",
|
||||
"value": "1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"condition": {
|
||||
"kind": "binary",
|
||||
"left": {
|
||||
"kind": "variable",
|
||||
"name": "n",
|
||||
"span": {
|
||||
"end": 253,
|
||||
"start": 252
|
||||
}
|
||||
},
|
||||
"op": "gt",
|
||||
"right": {
|
||||
"kind": "literal",
|
||||
"span": {
|
||||
"end": 0,
|
||||
"start": 0
|
||||
},
|
||||
"type": "int",
|
||||
"value": "0"
|
||||
},
|
||||
"span": {
|
||||
"end": 257,
|
||||
"start": 252
|
||||
}
|
||||
},
|
||||
"condition_span": {
|
||||
"end": 259,
|
||||
"start": 247
|
||||
},
|
||||
"span": {
|
||||
"end": 259,
|
||||
"start": 247
|
||||
}
|
||||
},
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"kind": "return",
|
||||
"span": {
|
||||
"end": 293,
|
||||
"start": 283
|
||||
},
|
||||
"value": {
|
||||
"kind": "literal",
|
||||
"span": {
|
||||
"end": 0,
|
||||
"start": 0
|
||||
},
|
||||
"type": "int",
|
||||
"value": "1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"condition": {
|
||||
"kind": "literal",
|
||||
"span": {
|
||||
"end": 0,
|
||||
"start": 0
|
||||
},
|
||||
"type": "bool",
|
||||
"value": true
|
||||
},
|
||||
"condition_span": {
|
||||
"end": 259,
|
||||
"start": 247
|
||||
},
|
||||
"span": {
|
||||
"end": 259,
|
||||
"start": 247
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "branch",
|
||||
"span": {
|
||||
"end": 259,
|
||||
"start": 247
|
||||
}
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
"unknown"
|
||||
],
|
||||
"heading_span": {
|
||||
"end": 227,
|
||||
"start": 214
|
||||
},
|
||||
"id": "root:unicode-spans@0.1.0::index.mq.md::演示.main",
|
||||
"local_name": "main",
|
||||
"namespace": "演示",
|
||||
"signature": {
|
||||
"kind": "explicit",
|
||||
"params": [
|
||||
{
|
||||
"default": null,
|
||||
"name": "n",
|
||||
"required": true,
|
||||
"span": {
|
||||
"end": 242,
|
||||
"start": 236
|
||||
},
|
||||
"type": "Int"
|
||||
}
|
||||
]
|
||||
},
|
||||
"span": {
|
||||
"end": 302,
|
||||
"start": 214
|
||||
},
|
||||
"unit_id": "root:unicode-spans@0.1.0::index.mq.md#演示/main"
|
||||
}
|
||||
],
|
||||
"id": "root:unicode-spans@0.1.0::index.mq.md",
|
||||
"imports": [],
|
||||
"package_instance_id": "root:unicode-spans@0.1.0",
|
||||
"references": [],
|
||||
"relative_path": "index.mq.md",
|
||||
"resources": [],
|
||||
"source_digest": "b4f8dd12f18a984af129974bc4dd153e97df99cc262bcafb2ae1187b6c5ce7d0",
|
||||
"units": [
|
||||
{
|
||||
"function": null,
|
||||
"id": "root:unicode-spans@0.1.0::index.mq.md#",
|
||||
"kind": "root",
|
||||
"level": 0,
|
||||
"name": "",
|
||||
"span": {
|
||||
"end": 302,
|
||||
"start": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": null,
|
||||
"id": "root:unicode-spans@0.1.0::index.mq.md#中文 🙂 标题",
|
||||
"kind": "namespace",
|
||||
"level": 1,
|
||||
"name": "中文 🙂 标题",
|
||||
"span": {
|
||||
"end": 31,
|
||||
"start": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": null,
|
||||
"id": "root:unicode-spans@0.1.0::index.mq.md#演示",
|
||||
"kind": "namespace",
|
||||
"level": 1,
|
||||
"name": "演示",
|
||||
"span": {
|
||||
"end": 212,
|
||||
"start": 198
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": "root:unicode-spans@0.1.0::index.mq.md::演示.main",
|
||||
"id": "root:unicode-spans@0.1.0::index.mq.md#演示/main",
|
||||
"kind": "function",
|
||||
"level": 2,
|
||||
"name": "main",
|
||||
"span": {
|
||||
"end": 227,
|
||||
"start": 214
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"producer": {
|
||||
"markdown_profile": "marqdo.md.v1",
|
||||
"name": "marqdo",
|
||||
"version": "3.0.0-beta.1"
|
||||
},
|
||||
"project": {
|
||||
"identity_kind": "manifest",
|
||||
"lock_digest": "",
|
||||
"root_id": "root:unicode-spans@0.1.0",
|
||||
"stdlib": {
|
||||
"digest": "sha256:5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713",
|
||||
"instance_id": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
},
|
||||
"schema": "marqdo.analysis",
|
||||
"schema_version": 2
|
||||
}
|
||||
@@ -509,6 +509,35 @@ fn failed_run_reports_core_error_code_without_fake_success() {
|
||||
assert!(!page.contains("data-run-state=\"succeeded\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn program_stdout_is_escaped_not_injected_as_markup() {
|
||||
let tmp = std::path::PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join(format!(
|
||||
"hostile-stdout-{}-{}.json",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.map(|d| d.as_nanos())
|
||||
.unwrap_or(0)
|
||||
));
|
||||
std::fs::write(
|
||||
&tmp,
|
||||
r#"{"command":"run","success":true,"stdout":"<script>alert(1)</script>","stderr":"<img src=x onerror=alert(2)>","trace":[],"value":{"type":"int","decimal":"3"}}"#,
|
||||
)
|
||||
.unwrap();
|
||||
let server = start_server_with(
|
||||
"examples/control-flow",
|
||||
"tests/golden/analysis-v2/control-flow.json",
|
||||
Some(tmp.to_str().unwrap()),
|
||||
Some("tests/golden/trace-v2/control-flow.trace.json"),
|
||||
);
|
||||
let (_, page) = run_and_get_page(&server);
|
||||
assert!(page.contains("<script>alert(1)</script>"));
|
||||
assert!(!page.contains("<script>alert(1)"));
|
||||
assert!(!page.contains("onerror=\""));
|
||||
assert!(!page.contains("<img src=x"));
|
||||
let _ = std::fs::remove_file(&tmp);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cli_verify_output_contract_still_holds_for_installed_style_invocation() {
|
||||
// Regression guard: `view verify` must remain a pure static check.
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
//! Degradation/state matrix contract (RFC-VIEW-0001 S-05..S-07, §12.3):
|
||||
//! prose stays readable while semantics become explicitly unusable.
|
||||
|
||||
mod common;
|
||||
|
||||
use common::{minimal_analysis, sha256_hex, FakeCore, TempProject};
|
||||
use marqdo_view::app::AppContext;
|
||||
use marqdo_view::presentation::SourceStatus;
|
||||
|
||||
fn project(name: &str) -> (TempProject, FakeCore) {
|
||||
let project = TempProject::new(name);
|
||||
project.marqdo_project("# @knowledge 标题\n\n正文 **加粗**,包含 `n`。\n");
|
||||
let core = FakeCore::new(&format!("{name}-core"));
|
||||
(project, core)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_check_keeps_prose_and_shows_core_diagnostics() {
|
||||
let (project, core) = project("state-check-fail");
|
||||
let source = std::fs::read(project.path("index.mq.md")).unwrap();
|
||||
// Emit a broken analysis too; it must NOT be used after a failed check.
|
||||
core.set_analysis(&minimal_analysis("index.mq.md", &sha256_hex(&source), 2));
|
||||
core.set_check(1, "");
|
||||
core.set_check_json(
|
||||
r#"{"command":"check","success":false,"errors":1,"diagnostics":[{"code":"sem.unclosed_control","column":1,"file":"/home/secret/index.mq.md","line":3,"message":"`if` is not closed by `end`","module":"root:fixture@0.1.0::index.mq.md","severity":"error"}]}"#,
|
||||
);
|
||||
let context = AppContext::open(&project.dir, Some(&core.script)).unwrap();
|
||||
let relative = context.project().entry().relative.clone();
|
||||
let model = context.load(&relative).unwrap();
|
||||
assert_eq!(model.source_status, SourceStatus::CoreError);
|
||||
assert!(
|
||||
model.semantic.is_none(),
|
||||
"failed check must revoke semantics"
|
||||
);
|
||||
assert!(model.document.plain_text().contains("正文"));
|
||||
assert!(model
|
||||
.diagnostics
|
||||
.iter()
|
||||
.any(|diagnostic| diagnostic.code == "sem.unclosed_control"));
|
||||
assert!(!model.source_status.semantics_usable());
|
||||
// Pending run state is explicit, never a success claim.
|
||||
assert_eq!(model.run_state().data_value(), "not-run");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn source_digest_mismatch_degrades_instead_of_misbinding() {
|
||||
let (project, core) = project("state-source-mismatch");
|
||||
core.set_analysis(&minimal_analysis("index.mq.md", &"0".repeat(64), 2));
|
||||
let context = AppContext::open(&project.dir, Some(&core.script)).unwrap();
|
||||
let relative = context.project().entry().relative.clone();
|
||||
let model = context.load(&relative).unwrap();
|
||||
assert_eq!(model.source_status, SourceStatus::SourceMismatch);
|
||||
assert!(model.semantic.is_none());
|
||||
assert!(model.source_status.label().contains("不一致"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_analysis_schema_is_a_hard_protocol_error() {
|
||||
let (project, core) = project("state-protocol");
|
||||
let source = std::fs::read(project.path("index.mq.md")).unwrap();
|
||||
core.set_analysis(&minimal_analysis("index.mq.md", &sha256_hex(&source), 3));
|
||||
let context = AppContext::open(&project.dir, Some(&core.script)).unwrap();
|
||||
let relative = context.project().entry().relative.clone();
|
||||
let err = context.load(&relative).unwrap_err();
|
||||
assert_eq!(err.code(), "view.protocol_incompatible");
|
||||
assert_eq!(err.exit_code(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_core_span_is_dropped_with_an_explicit_warning() {
|
||||
let (project, core) = project("state-span-invalid");
|
||||
let source = std::fs::read(project.path("index.mq.md")).unwrap();
|
||||
let mut analysis: serde_json::Value =
|
||||
serde_json::from_str(&minimal_analysis("index.mq.md", &sha256_hex(&source), 2)).unwrap();
|
||||
// A span in the middle of a multi-byte character / beyond EOF.
|
||||
analysis["modules"][0]["units"] = serde_json::json!([{
|
||||
"id": "x", "name": "坏", "level": 1, "kind": "namespace", "function": null,
|
||||
"span": {"start": 0, "end": 999_999}
|
||||
}]);
|
||||
core.set_analysis(&serde_json::to_string(&analysis).unwrap());
|
||||
let context = AppContext::open(&project.dir, Some(&core.script)).unwrap();
|
||||
let relative = context.project().entry().relative.clone();
|
||||
let model = context.load(&relative).unwrap();
|
||||
assert_eq!(model.source_status, SourceStatus::StaticOk);
|
||||
assert!(model.semantic.as_ref().unwrap().units.is_empty());
|
||||
assert!(model
|
||||
.warnings
|
||||
.iter()
|
||||
.any(|warning| warning.code == "view.source_span_invalid"));
|
||||
let _ = source;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_attached_to_changed_source_becomes_stale() {
|
||||
let repo_root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
let project = TempProject::new("state-stale-run");
|
||||
project.write(
|
||||
"marqdo.yaml",
|
||||
"project:\n name: control-flow\n version: 0.1.0\n",
|
||||
);
|
||||
let source =
|
||||
std::fs::read_to_string(repo_root.join("examples/control-flow/index.mq.md")).unwrap();
|
||||
project.write("index.mq.md", &source);
|
||||
let core = FakeCore::new("state-stale-run-core");
|
||||
let analysis =
|
||||
std::fs::read(repo_root.join("tests/golden/analysis-v2/control-flow.json")).unwrap();
|
||||
core.set_analysis(std::str::from_utf8(&analysis).unwrap());
|
||||
let context = AppContext::open(&project.dir, Some(&core.script)).unwrap();
|
||||
let relative = context.project().entry().relative.clone();
|
||||
|
||||
// Build a verified run directly from the golden trace + golden analysis.
|
||||
let source_index = marqdo_view::source_map::SourceIndex::new(&source);
|
||||
let verified_analysis =
|
||||
marqdo_view::semantic::verify_analysis(&analysis, &source, &source_index, "index.mq.md")
|
||||
.unwrap();
|
||||
let trace =
|
||||
std::fs::read(repo_root.join("tests/golden/trace-v2/control-flow.trace.json")).unwrap();
|
||||
let run_json: serde_json::Value = serde_json::from_slice(
|
||||
&std::fs::read(repo_root.join("tests/golden/trace-v2/control-flow.run.json")).unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
let run = marqdo_view::trace::verify_trace(marqdo_view::trace::TraceVerificationInput {
|
||||
trace_bytes: &trace,
|
||||
analysis_bytes: &analysis,
|
||||
semantic: &verified_analysis.projection,
|
||||
modules: &verified_analysis.projection.modules,
|
||||
source: &source,
|
||||
source_index: &source_index,
|
||||
run_json: &run_json,
|
||||
exit_code: 0,
|
||||
})
|
||||
.unwrap();
|
||||
let attached = context.load_with_run(&relative, Some(&run)).unwrap();
|
||||
assert_eq!(attached.run_state().data_value(), "succeeded");
|
||||
|
||||
// Change the source and rebuild through the same server path.
|
||||
std::fs::write(
|
||||
project.path("index.mq.md"),
|
||||
format!("{source}\n<!-- changed -->\n"),
|
||||
)
|
||||
.unwrap();
|
||||
let changed = context.load_with_run(&relative, Some(&run)).unwrap();
|
||||
assert!(
|
||||
changed.run_state().data_value() == "stale"
|
||||
|| changed.source_status == SourceStatus::SourceMismatch,
|
||||
"expected stale/source-mismatch, got run={} source={}",
|
||||
changed.run_state().data_value(),
|
||||
changed.source_status.data_value()
|
||||
);
|
||||
if let Some(run) = &changed.run {
|
||||
assert!(run.events.iter().all(|event| event.anchor_span.is_none()));
|
||||
}
|
||||
let _ = core;
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
//! Unicode/CRLF/duplicate-text span contract (RFC-VIEW-0001 S-04).
|
||||
//! Goldens are emitted by the frozen CLI from the exact fixture bytes.
|
||||
|
||||
use marqdo_view::document::{DocumentIdentity, DocumentModel};
|
||||
use marqdo_view::presentation::{self, BuildInput, Navigation, SourceStatus};
|
||||
use marqdo_view::project::{Project, SafeRelativePath, ViewConfig};
|
||||
use marqdo_view::render::{ReaderRenderer, RenderContext};
|
||||
use marqdo_view::semantic;
|
||||
use marqdo_view::source_map::sha256_hex;
|
||||
|
||||
fn repo_root() -> std::path::PathBuf {
|
||||
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
}
|
||||
|
||||
fn load(path: &str, golden: &str) -> (String, Vec<u8>, semantic::VerifiedAnalysis) {
|
||||
let root = repo_root();
|
||||
let source = std::fs::read_to_string(root.join(path)).unwrap();
|
||||
let index = marqdo_view::source_map::SourceIndex::new(&source);
|
||||
let analysis = std::fs::read(root.join(golden)).unwrap();
|
||||
let relative = std::path::Path::new(path)
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
let verified = semantic::verify_analysis(&analysis, &source, &index, &relative).unwrap();
|
||||
(source, analysis, verified)
|
||||
}
|
||||
|
||||
fn render(verified: &semantic::VerifiedAnalysis, source: &str, relative: &str) -> String {
|
||||
let root = repo_root().join("examples/unicode-spans");
|
||||
let project = Project::open(&root).unwrap();
|
||||
let entry = SafeRelativePath::parse(relative).unwrap();
|
||||
let document = DocumentModel::parse(source.to_string(), DocumentIdentity::placeholder(&entry));
|
||||
let navigation = Navigation::from_project(&project, &ViewConfig::default(), &entry);
|
||||
let model = presentation::build(BuildInput {
|
||||
document,
|
||||
analysis: Some(verified),
|
||||
status: SourceStatus::StaticOk,
|
||||
status_note: None,
|
||||
diagnostics: Vec::new(),
|
||||
navigation,
|
||||
core_version: Some("3.0.0-beta.1".to_string()),
|
||||
run: None,
|
||||
});
|
||||
ReaderRenderer::new()
|
||||
.render(&model, &RenderContext::live())
|
||||
.html
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unicode_spans_are_exact_and_duplicate_returns_get_distinct_anchors() {
|
||||
let (source, analysis, verified) = load(
|
||||
"examples/unicode-spans/index.mq.md",
|
||||
"tests/golden/analysis-v2/unicode-spans.json",
|
||||
);
|
||||
assert_eq!(
|
||||
verified.projection.source_digest,
|
||||
sha256_hex(source.as_bytes())
|
||||
);
|
||||
let function = &verified.projection.functions[0];
|
||||
let returns: Vec<_> = function
|
||||
.flattened_statements()
|
||||
.into_iter()
|
||||
.filter(|statement| statement.kind == semantic::StatementKind::Return)
|
||||
.collect();
|
||||
assert_eq!(returns.len(), 2);
|
||||
let first = returns[0].span;
|
||||
let second = returns[1].span;
|
||||
assert_ne!(first, second);
|
||||
let index = marqdo_view::source_map::SourceIndex::new(&source);
|
||||
// Core statement spans cover the whole carrier node (including markers).
|
||||
assert_eq!(index.source_text(&source, first), Some("`return 1`"));
|
||||
assert_eq!(index.source_text(&source, second), Some("`return 1`"));
|
||||
// The carrier text is identical, so only spans can distinguish the two.
|
||||
assert_eq!(first.start, source.find("`return 1`").unwrap() as u64);
|
||||
assert_ne!(first.start, second.start);
|
||||
|
||||
let html = render(&verified, &source, "index.mq.md");
|
||||
let statement_ids: Vec<&str> = html.matches("data-source-id=\"").map(|_| "").collect();
|
||||
let _ = statement_ids;
|
||||
// 3 anchored statements: branch header + two returns.
|
||||
assert_eq!(html.matches("class=\"mq-anchor\"").count(), 3, "{html}");
|
||||
let ids: Vec<&str> = html
|
||||
.split("data-source-id=\"")
|
||||
.skip(1)
|
||||
.filter_map(|rest| rest.split('"').next())
|
||||
.collect();
|
||||
let mut unique = ids.clone();
|
||||
unique.sort();
|
||||
unique.dedup();
|
||||
assert_eq!(ids.len(), unique.len(), "duplicate source ids: {ids:?}");
|
||||
// Emoji and CJK survive both rendering and source mapping.
|
||||
assert!(html.contains("中文 🙂 标题"));
|
||||
assert!(html.contains("甲🙂"));
|
||||
let _ = analysis;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crlf_source_keeps_exact_digest_and_line_mapping() {
|
||||
let (source, _analysis, verified) = load(
|
||||
"examples/unicode-spans/crlf.mq.md",
|
||||
"tests/golden/analysis-v2/unicode-spans-crlf.json",
|
||||
);
|
||||
assert!(source.contains("\r\n"), "fixture must stay CRLF");
|
||||
assert_eq!(
|
||||
verified.projection.source_digest,
|
||||
sha256_hex(source.as_bytes())
|
||||
);
|
||||
let index = marqdo_view::source_map::SourceIndex::new(&source);
|
||||
let function = &verified.projection.functions[0];
|
||||
for (_, statement) in verified
|
||||
.projection
|
||||
.all_statements()
|
||||
.into_iter()
|
||||
.filter(|(_, statement)| statement.kind == semantic::StatementKind::Return)
|
||||
{
|
||||
assert!(
|
||||
index
|
||||
.source_text(&source, statement.span)
|
||||
.map(|text| text.contains("return"))
|
||||
.unwrap_or(false),
|
||||
"span {:?} does not slice a return",
|
||||
statement.span
|
||||
);
|
||||
}
|
||||
let html = render(&verified, &source, "crlf.mq.md");
|
||||
assert!(html.contains("CRLF 文档"));
|
||||
// One list item per source line (SourceIndex counts the trailing line too).
|
||||
let source_lines = index.line_count();
|
||||
assert_eq!(html.matches("class=\"mq-line-text\"").count(), source_lines);
|
||||
let _ = function;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn knowledge_emphasis_never_becomes_an_execution_anchor() {
|
||||
let root = repo_root();
|
||||
let project = Project::open(&root.join("examples/mixed-modes")).unwrap();
|
||||
let entry = project.entry().relative.clone();
|
||||
let source = project.read_source_text(&entry).unwrap();
|
||||
let index = marqdo_view::source_map::SourceIndex::new(&source);
|
||||
let analysis = std::fs::read(root.join("tests/golden/analysis-v2/mixed-modes.json")).unwrap();
|
||||
let verified = semantic::verify_analysis(&analysis, &source, &index, entry.as_str()).unwrap();
|
||||
assert_eq!(
|
||||
verified.projection.source_digest,
|
||||
sha256_hex(source.as_bytes())
|
||||
);
|
||||
let document = DocumentModel::parse(source.clone(), DocumentIdentity::placeholder(&entry));
|
||||
let navigation = Navigation::from_project(&project, &ViewConfig::default(), &entry);
|
||||
let model = presentation::build(BuildInput {
|
||||
document,
|
||||
analysis: Some(&verified),
|
||||
status: SourceStatus::StaticOk,
|
||||
status_note: None,
|
||||
diagnostics: Vec::new(),
|
||||
navigation,
|
||||
core_version: Some("3.0.0-beta.1".to_string()),
|
||||
run: None,
|
||||
});
|
||||
let html = ReaderRenderer::new()
|
||||
.render(&model, &RenderContext::live())
|
||||
.html;
|
||||
// Exactly the four Exec statements are anchored (branch + assign + 2 returns).
|
||||
assert_eq!(html.matches("class=\"mq-anchor\"").count(), 4, "{html}");
|
||||
let knowledge_bold = "此处加粗是知识内容,不执行。";
|
||||
let position = html.find(knowledge_bold).expect("knowledge bold text");
|
||||
let before = &html[..position];
|
||||
let last_anchor = before.rfind("class=\"mq-anchor\"");
|
||||
let last_paragraph = before.rfind("<p>");
|
||||
assert!(
|
||||
last_anchor.is_none() || last_paragraph > last_anchor,
|
||||
"knowledge emphasis received an execution anchor"
|
||||
);
|
||||
}
|
||||
Executable
+227
@@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env bash
|
||||
# RFC-VIEW-0001 §18.1 one-command acceptance.
|
||||
#
|
||||
# Usage:
|
||||
# MARQDO_BIN=/abs/path/to/frozen/marqdo tools/acceptance.sh
|
||||
#
|
||||
# Optional:
|
||||
# CLI_SOURCE_SHA=<sha> override the CLI source SHA for the evidence manifest
|
||||
# SKIP_BROWSER=1 skip Chromium suite (recorded as SKIP, not PASS)
|
||||
#
|
||||
# The script never modifies or recompiles the frozen CLI; it records its
|
||||
# SHA-256 before and after and fails if it changes.
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$repo_root"
|
||||
|
||||
: "${MARQDO_BIN:?set MARQDO_BIN to the frozen marqdo release binary}"
|
||||
[[ -x "$MARQDO_BIN" ]] || { echo "error: MARQDO_BIN not executable" >&2; exit 1; }
|
||||
|
||||
work="$repo_root/dist/acceptance"
|
||||
rm -rf "$work"
|
||||
mkdir -p "$work"
|
||||
|
||||
statuses=""
|
||||
record() { statuses="${statuses}$1=$2\n"; echo "[acceptance] $1: $2"; }
|
||||
|
||||
run_step() {
|
||||
local name="$1"
|
||||
shift
|
||||
echo "==> $name"
|
||||
if "$@"; then
|
||||
record "$name" PASS
|
||||
else
|
||||
record "$name" FAIL
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
core_before="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
|
||||
cli_source_sha="${CLI_SOURCE_SHA:-}"
|
||||
if [[ -z "$cli_source_sha" && -f "$(dirname "$MARQDO_BIN")/SOURCE_SHA" ]]; then
|
||||
cli_source_sha="$(tr -d '[:space:]' < "$(dirname "$MARQDO_BIN")/SOURCE_SHA")"
|
||||
fi
|
||||
cli_source_sha="${cli_source_sha:-unknown}"
|
||||
view_source_sha="$(git rev-parse HEAD 2>/dev/null || echo unknown)"
|
||||
|
||||
export PATH="${HOME}/.cargo/bin:${PATH}"
|
||||
export CARGO_HOME="${CARGO_HOME:-$repo_root/.cargo-home}"
|
||||
|
||||
# 0. code quality / unit / contract tests
|
||||
run_step fmt cargo fmt --all -- --check
|
||||
run_step clippy cargo clippy --all-targets -- -D warnings
|
||||
run_step test cargo test --locked
|
||||
run_step build cargo build --release --locked
|
||||
|
||||
# 1. controlled Tool bundle + frozen-CLI install smoke
|
||||
run_step bundle env MARQDO_BIN="$MARQDO_BIN" ./tools/package.sh
|
||||
bundle="$repo_root/dist/marqdo-view"
|
||||
archive="$(ls -t "$repo_root"/dist/marqdo-view-*-x86_64-unknown-linux-gnu.tar.gz | head -1)"
|
||||
archive_sha="$(sha256sum "$archive" | cut -d' ' -f1)"
|
||||
|
||||
# 2. clean install from the *archive*, in a moved temporary directory
|
||||
mkdir -p "$work/extracted"
|
||||
tar -xzf "$archive" -C "$work/extracted"
|
||||
extracted_bundle="$work/extracted/marqdo-view"
|
||||
tool_home="$work/tool-home"
|
||||
mkdir -p "$tool_home"
|
||||
export MARQDO_TOOL_HOME="$tool_home"
|
||||
run_step archive_install "$MARQDO_BIN" tool install "$extracted_bundle/tool.json"
|
||||
run_step tool_list bash -c "'$MARQDO_BIN' tool list | grep -q view"
|
||||
run_step view_help bash -c "'$MARQDO_BIN' view --help | grep -q 'marqdo-view'"
|
||||
run_step verify "$MARQDO_BIN" view verify examples/mixed-modes/index.mq.md
|
||||
run_step export "$MARQDO_BIN" view export examples/control-flow --out "$work/site"
|
||||
test -f "$work/site/manifest.json"
|
||||
|
||||
# 3. Live browse smoke (no execution on open)
|
||||
browse_log="$work/browse.log"
|
||||
"$MARQDO_BIN" view examples/welcome --port 0 --no-open >"$browse_log" 2>&1 &
|
||||
browse_pid=$!
|
||||
trap 'kill "$browse_pid" 2>/dev/null || true' EXIT
|
||||
browse_url=""
|
||||
for _ in $(seq 1 100); do
|
||||
browse_url="$(grep -o 'http://127.0.0.1:[0-9]*/' "$browse_log" | head -1 || true)"
|
||||
[[ -n "$browse_url" ]] && break
|
||||
sleep 0.1
|
||||
done
|
||||
if [[ -n "$browse_url" ]] && curl -sf "${browse_url}api/health" | grep -q '"ok": true'; then
|
||||
record browse PASS
|
||||
else
|
||||
record browse FAIL
|
||||
cat "$browse_log" >&2
|
||||
exit 1
|
||||
fi
|
||||
kill "$browse_pid" 2>/dev/null || true
|
||||
wait "$browse_pid" 2>/dev/null || true
|
||||
trap - EXIT
|
||||
|
||||
# 4. Explicit real run through the installed tool + CSRF flow
|
||||
run_log="$work/run.log"
|
||||
"$MARQDO_BIN" view examples/control-flow --port 0 --no-open >"$run_log" 2>&1 &
|
||||
run_pid=$!
|
||||
trap 'kill "$run_pid" 2>/dev/null || true' EXIT
|
||||
run_url=""
|
||||
for _ in $(seq 1 100); do
|
||||
run_url="$(grep -o 'http://127.0.0.1:[0-9]*/' "$run_log" | head -1 || true)"
|
||||
[[ -n "$run_url" ]] && break
|
||||
sleep 0.1
|
||||
done
|
||||
if [[ -n "$run_url" ]]; then
|
||||
if python3 - "$run_url" <<'PY'
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
url = sys.argv[1]
|
||||
|
||||
def get(path):
|
||||
with urllib.request.urlopen(url.rstrip("/") + path, timeout=30) as response:
|
||||
return response.read().decode("utf-8")
|
||||
|
||||
page = get("/")
|
||||
match = re.search(r'name="mq-csrf-token" content="([0-9a-f]+)"', page)
|
||||
assert match, "csrf token missing"
|
||||
token = match.group(1)
|
||||
body = json.dumps({"path": "index.mq.md", "mode": "pure", "confirm": True}).encode()
|
||||
request = urllib.request.Request(
|
||||
url.rstrip("/") + "/api/run",
|
||||
data=body,
|
||||
headers={"Content-Type": "application/json", "X-MQ-CSRF": token},
|
||||
method="POST",
|
||||
)
|
||||
with urllib.request.urlopen(request, timeout=120) as response:
|
||||
result = json.loads(response.read().decode("utf-8"))
|
||||
assert result["ok"] is True, result
|
||||
assert result["state"] == "succeeded", result
|
||||
run_page = get(result["redirect"])
|
||||
assert 'id="mq-run-panel"' in run_page, "run panel missing"
|
||||
assert 'data-run-state="succeeded"' in run_page, "succeeded state missing"
|
||||
assert "mq-run-chip" in run_page, "trace chips missing"
|
||||
print("explicit real run: PASS (state=%s events=%s)" % (result["state"], result["events"]))
|
||||
PY
|
||||
then
|
||||
record real_run PASS
|
||||
else
|
||||
record real_run FAIL
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
record real_run FAIL
|
||||
cat "$run_log" >&2
|
||||
exit 1
|
||||
fi
|
||||
kill "$run_pid" 2>/dev/null || true
|
||||
wait "$run_pid" 2>/dev/null || true
|
||||
trap - EXIT
|
||||
|
||||
# 5. project-local verification suites
|
||||
run_step export_suite env MARQDO_BIN="$MARQDO_BIN" ./tools/test-export.sh
|
||||
run_step security_suite ./tools/test-security.sh
|
||||
if [[ "${SKIP_BROWSER:-0}" == "1" ]]; then
|
||||
record browser SKIP
|
||||
elif [[ -d "$repo_root/tests/browser/node_modules/playwright" && -d "$repo_root/tests/.cache/pw-browsers" ]]; then
|
||||
run_step browser env MARQDO_BIN="$MARQDO_BIN" ./tools/test-browser.sh
|
||||
else
|
||||
record browser SKIP
|
||||
fi
|
||||
|
||||
# 6. frozen core must be byte-identical
|
||||
core_after="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
|
||||
if [[ "$core_before" != "$core_after" ]]; then
|
||||
record core_sha FAIL
|
||||
echo "error: frozen core binary changed during acceptance" >&2
|
||||
exit 1
|
||||
fi
|
||||
record core_sha PASS
|
||||
|
||||
view_binary_sha="$(sha256sum "$bundle/bin/marqdo-view" | cut -d' ' -f1)"
|
||||
target="$(python3 -c 'import json;print(json.load(open("dist/marqdo-view/RELEASE_INFO.json"))["target"])')"
|
||||
evidence_dir="$repo_root/docs/evidence/$cli_source_sha"
|
||||
mkdir -p "$evidence_dir"
|
||||
python3 - "$evidence_dir/manifest.json" <<PY
|
||||
import datetime
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
path = pathlib.Path("$evidence_dir/manifest.json")
|
||||
statuses = {}
|
||||
for line in """${statuses}""".splitlines():
|
||||
if "=" in line:
|
||||
name, value = line.split("=", 1)
|
||||
statuses[name] = value
|
||||
manifest = {
|
||||
"schema": "marqdo.view-conformance",
|
||||
"schema_version": 1,
|
||||
"view_source_sha": "$view_source_sha",
|
||||
"view_binary_sha256": "$view_binary_sha",
|
||||
"cli_source_sha": "$cli_source_sha",
|
||||
"cli_binary_sha256_before": "$core_before",
|
||||
"cli_binary_sha256_after": "$core_after",
|
||||
"tool_protocol": 1,
|
||||
"analysis_protocol": 2,
|
||||
"trace_protocol": 2,
|
||||
"target": "$target",
|
||||
"archive_sha256": "$archive_sha",
|
||||
"generated_at_utc": datetime.datetime.now(datetime.timezone.utc).isoformat(),
|
||||
"tests": {
|
||||
"contract": statuses.get("test", "FAIL"),
|
||||
"browser": statuses.get("browser", "SKIP"),
|
||||
"export": statuses.get("export_suite", "FAIL"),
|
||||
"security": statuses.get("security_suite", "FAIL"),
|
||||
},
|
||||
"gates": statuses,
|
||||
"commands": {
|
||||
"script": "tools/acceptance.sh",
|
||||
"notes": "Generated from real command exit statuses; install/verify/export/run use the frozen CLI archive copied to an isolated tool home.",
|
||||
},
|
||||
}
|
||||
path.write_text(json.dumps(manifest, indent=2, sort_keys=True) + "\\n")
|
||||
print("evidence manifest:", path)
|
||||
PY
|
||||
|
||||
echo
|
||||
echo "acceptance: PASS"
|
||||
echo "evidence: $evidence_dir/manifest.json"
|
||||
echo "archive sha256: $archive_sha"
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# Contract-focused gate: formatting, lints, all tests, Tool v1 install smoke,
|
||||
# static verify and static export against the frozen core. No browser.
|
||||
#
|
||||
# Usage: MARQDO_BIN=/abs/path/marqdo tools/test-contract.sh
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$repo_root"
|
||||
|
||||
: "${MARQDO_BIN:?set MARQDO_BIN to the frozen marqdo binary}"
|
||||
export PATH="${HOME}/.cargo/bin:${PATH}"
|
||||
export CARGO_HOME="${CARGO_HOME:-$repo_root/.cargo-home}"
|
||||
|
||||
cargo fmt --all -- --check
|
||||
cargo clippy --all-targets -- -D warnings
|
||||
cargo test --locked
|
||||
cargo build --release --locked
|
||||
|
||||
MARQDO_BIN="$MARQDO_BIN" ./tools/package.sh
|
||||
|
||||
export MARQDO_TOOL_HOME="$repo_root/dist/contract-tool-home"
|
||||
rm -rf "$MARQDO_TOOL_HOME"
|
||||
"$MARQDO_BIN" tool install "$repo_root/dist/marqdo-view/tool.json" >/dev/null
|
||||
"$MARQDO_BIN" view --help >/dev/null
|
||||
"$MARQDO_BIN" view verify examples/mixed-modes/index.mq.md
|
||||
"$MARQDO_BIN" view export examples/tables-math --out "$repo_root/dist/contract-site"
|
||||
test -f "$repo_root/dist/contract-site/manifest.json"
|
||||
|
||||
echo "contract: PASS"
|
||||
Reference in new issue
Block a user