feat: add offline environment report and document-structure contract
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/pr/main Pipeline was canceled

Implements the two CLI-owned P0 sub-issues of the ecosystem architecture
tickets without adding document-language syntax.

Environment report (marqdo-cli#26 §9.2, binding for #20):
- `marqdo inspect --environment [--json]` emits `marqdo.environment` v1:
  producer version and build-embedded source commit, platform/arch/glibc and
  real strict probe, adjacent provider-worker version/SHA (offline
  `--build-info`, bounded), verified Bundle identity, current protocol
  revisions and path-free diagnostics. Project-independent, offline, and
  exclusive with document inspection flags.
- Release builds embed `MARQDO_BUILD_SOURCE_SHA`; the CI `build` lane sets it.
  `tools/release/package.py` refuses to stage an archive whose binaries report
  another commit or Bundle digest, and `tools/release/smoke.py` re-verifies the
  extracted archive.
- Spec: `spec/environment.md`. Tests: `environment_report.rs` (5 cases) and
  in-module unit tests; docs/releasing/COMPATIBILITY/STATUS updated.

Document-structure contract (marqdo-cli#25):
- `spec/document-structure.md` states the current author/tool semantics once:
  heading mode inheritance (nearest ancestor, only Exec H2 callable), unit
  identity and duplicate-name rules, anchor collision numbering, byte-exact
  half-open spans, `index.mq.md` entry vs directory-dependency import meaning,
  link != import != call, Proposed annotations marked not implemented, and the
  Analysis fields consumers may rely on. It links the single authoritative
  specs instead of duplicating them.
- Tests: `document_structure.rs` (6 cases) + docs_consistency coverage.

No runtime behavior change, no new language surface, no new cross-repo
dependency. `docs_consistency` and `architecture_boundaries` remain green.
This commit is contained in:
cflmy committed 2026-11-30 11:35:24 +08:00
1 parent 63776735e9
commit 0f87f856db
25 files changed
+1780 -7

No files matched your search

+35
View File
@@ -79,6 +79,41 @@ The `spec/` tree contains only current contracts; retired specifications are in
Git history and tagged archives. The earlier release records below describe
their tagged binaries and are not current protocol claims.
## 0.13 Document structure contract — issue #25 (unreleased)
[`spec/document-structure.md`](../spec/document-structure.md) now states the
current author/tool semantics in one place: heading mode inheritance (nearest
ancestor, never a sibling; only Exec H2 callable), unit identity and
`sem.duplicate_unit_name`, anchor slug collision numbering, byte-exact
half-open spans (BOM/CRLF/missing final newline), `index.mq.md` entry vs
directory-dependency import meaning, and the link ≠ import ≠ call separation.
It links the authoritative `mapping.md`/`analysis.md`/`references.md`/
`package-format.md` facts instead of duplicating them, marks heading annotations
as Proposed (not implemented) and lists the Analysis fields consumers may rely
on. Contract tests: `crates/cli/tests/document_structure.rs` (6 cases) plus
`docs_consistency`. No document-language syntax was added; no runtime behavior
changed.
## 0.12 Installed-environment diagnostic report — issue #26 §9.2 (unreleased)
`marqdo inspect --environment --json` emits the `marqdo.environment` v1 report:
product version, build-embedded source commit, platform (including the real
strict probe and glibc version), adjacent provider-worker build identity,
verified Bundle name/version/tree digest, current protocol revisions and
path-free diagnostics. It is offline and project-independent: it does not load
a module, start a provider session, open a plugin or print a path/credential.
* Spec: [`spec/environment.md`](../spec/environment.md).
* Tests: `crates/cli/tests/environment_report.rs` (schema, determinism,
no-leak, verified/invalid Bundle, argument exclusivity) and unit tests in
`crates/cli/src/environment.rs`.
* Release binding: the release build embeds `MARQDO_BUILD_SOURCE_SHA`;
`tools/release/package.py` refuses an archive whose binary reports another
commit, and `tools/release/smoke.py` re-verifies the extracted archive. CI's
`build` lane exports the variable before `cargo build --release`.
* Window/macOS native lanes are **UNVERIFIED**; the report is Linux-verified
only. This work is not part of the tagged rc.6 release record.
## 0.11 Explicit stdlib Bundle input — issue #11 Phase A (unreleased)
Phase A lands the build-input boundary only: the stdlib production sources and
+10 -2
View File
@@ -40,9 +40,12 @@ Foreign wire v1, Provider manifest v2, lock v4 and markdown profile
providers, extension selection and lock v4.
5. [analysis-observation.md](analysis-observation.md) — the public static/dynamic data
contracts and digest binding.
6. [compatibility.md](compatibility.md) — version axes, platform matrix and the
6. [document-structure.md](../../spec/document-structure.md) — heading modes,
units/anchors/spans, `index.mq.md` entry meaning and the link≠import≠call
separation (single author/tool overview).
7. [compatibility.md](compatibility.md) — version axes, platform matrix and the
prerelease policy.
7. [release-limits.md](release-limits.md) — the honest beta limitations (this
8. [release-limits.md](release-limits.md) — the honest beta limitations (this
file ships in the archive as `KNOWN_LIMITATIONS.md`).
The full worked handbook is
@@ -82,8 +85,13 @@ export MARQDO_BIN=/absolute/path/to/marqdo
# Put marqdo-provider-worker next to it for provider tests, exactly as the
# release archive does.
$MARQDO_BIN --version
$MARQDO_BIN inspect --environment --json # version, embedded source SHA, Bundle, protocols
```
The environment report is the supported way to record which CLI/Bundle a
consumer tested against; see [`../../spec/environment.md`](../../spec/environment.md).
It reads only installed identity and prints no host paths or credentials.
Compute the binary SHA-256 before and after your suite; it must not move. The
reference implementation of this gate is
[`marqdo-extension-conformance`](https://git.cflmy.cn/cflmy/marqdo-extension-conformance)
+18
View File
@@ -217,6 +217,24 @@ shared-node exception applies, pass
Stable releases use `--profile stable --require-release` and require native
Windows and macOS PASS in addition to the Linux and contract gates.
### 5.1 Environment identity binding
Release builds must embed the release commit in both binaries:
```bash
export MARQDO_BUILD_SOURCE_SHA="$(git rev-parse HEAD)"
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
```
`tools/release/package.py` runs the staged `marqdo inspect --environment --json`
and refuses to stage an archive unless `producer.source.sha` and
`worker.source_sha` equal `--source-sha` and the adjacent Bundle reports
`status: verified` with the archived `tree_digest`.
`tools/release/smoke.py` re-runs the same check from the extracted archive, so
a release asset cannot claim a source commit it was not built from. The report
is specified by [`../spec/environment.md`](../spec/environment.md); it never
prints credentials, Analysis content or absolute host paths.
## 6. Tagging and publication (owner approval required)
Only after all gates above are green on the frozen SHA: