docs: record the issue #11 Phase A state and evidence

Update STATUS, the architecture overview, README and tests/README with
the explicit Bundle input, pinned test/perf lanes and the independent
build. Add the Phase A evidence record: bundle identity, failure paths,
deterministic pack/package digests, independent build, archive smoke,
cold install and the 634-passed workspace gate. Phase B remains
explicitly unclaimed.
This commit is contained in:
cflmy committed 2026-11-26 15:52:04 +08:00
1 parent 0e1efc713e
commit 88ce91a9e1
5 files changed
+280 -7

No files matched your search

+15
View File
@@ -63,6 +63,21 @@ cargo build -p marqdo-cli
# binary: target/debug/marqdo (or $CARGO_TARGET_DIR/debug/marqdo) # binary: target/debug/marqdo (or $CARGO_TARGET_DIR/debug/marqdo)
``` ```
The CLI and Provider Worker compile without the stdlib sources. A release is
assembled from one explicit, verified Bundle (ADR-0070); the debug CLI still
discovers the checkout's `stdlib/` for the development loop, and
`MARQDO_STDLIB_DIR` is the explicit runtime override:
```bash
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
python3 tools/stdlib/bundle.py --print-path
python3 tools/release/package.py --source-sha "$(git rev-parse HEAD)" \
--version <version> --stdlib-dir stdlib \
--bundle-pin tools/stdlib/bundle-pin.json
```
See [`docs/releasing.md`](docs/releasing.md) for the full procedure.
## Quickstart ## Quickstart
```bash ```bash
+51 -4
View File
@@ -75,6 +75,47 @@ The `spec/` tree contains only current contracts; retired specifications are in
Git history and tagged archives. The earlier release records below describe Git history and tagged archives. The earlier release records below describe
their tagged binaries and are not current protocol claims. their tagged binaries and are not current protocol claims.
## 0.11 Explicit stdlib Bundle input — issue #11 Phase A (unreleased)
Phase A lands the build-input boundary only: the stdlib production sources and
the debug source fallback are still in this repository, and Phase B (the
ecosystem-assembled Bundle, source removal and `std:` replacement) is **not**
claimed. Executed candidate:
`ab6b6b1a23ec064fbc7de943c52befca18142a56`; bundle source commit
`2cbde54602c07f62a62f341400bc9cb4764a93f8`.
* `tools/stdlib/bundle-pin.json` pins `marqdo-stdlib@0.1.0` with tree digest
`sha256:5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713`
and alias digest
`sha256:5f513c0fdbb3c1e9829be3c9fa23a2d1e89cb8510073fb5eb1e8e2f5265a83bb`;
`tools/stdlib/bundle.py` is the single resolver/verifier.
* `tools/pack-stdlib.py` and `tools/release/package.py` require
`--stdlib-dir` and accept `--bundle-pin`. A missing directory, missing
manifest, tree/alias digest mismatch, pin mismatch or symlink fails before
an archive is written; `RELEASE_INFO.json.stdlib.source` records the pinned
kind/repository/commit/path.
* Product, performance and release lanes resolve that Bundle
(`crates/cli/tests/support/stdlib.rs`, `tools/perf/runner.py`). An explicit
`MARQDO_TEST_STDLIB_BUNDLE`/`--stdlib-dir` changes the location but must match
the pin; a bad override fails even when the default is valid. Loader unit
tests build small synthetic Bundles.
* `tools/ci/independent_build.py` exports a clean copy without `stdlib/`,
builds `marqdo-cli` + `marqdo-provider-worker` with `--locked`, runs the
language-only `tests/independent/language-only.mq.md`, and requires a
stdlib-dependent run to fail closed with no sibling `stdlib/`. GitHub and
Woodpecker run the lane.
* Archive smoke and cold-install keep the missing-Bundle failure and now also
require the language-only `factorial` call to succeed after the shipped
`stdlib/` is moved aside. Two packaging runs from the same input and
toolchain are byte-identical.
Evidence:
[`evidence/2026-11-26-issue-11-phase-a.md`](evidence/2026-11-26-issue-11-phase-a.md).
Runtime discovery is unchanged: `MARQDO_STDLIB_DIR` (invalid values still fail
hard), then `stdlib/` next to the executable, then the debug-only source
fallback. Phase B is gated on ecosystem issue #2 and the extension replacement
evidence named by issue #11.
## 0.10 Closed public Analysis boundary — issue #10 (RC.4 released) ## 0.10 Closed public Analysis boundary — issue #10 (RC.4 released)
The candidate replaces the program-only Analysis projection in place under The candidate replaces the program-only Analysis projection in place under
@@ -356,6 +397,9 @@ ownership / core resource kinds), ADR-0063 (foreign F-A). Executed evidence:
recompute both digests with the runtime algorithm and fail on mismatch; smoke recompute both digests with the runtime algorithm and fail on mismatch; smoke
removes the bundle and requires a fail-closed run (no source fallback). Release removes the bundle and requires a fail-closed run (no source fallback). Release
discovery only falls back to the compile-time source tree in debug builds. discovery only falls back to the compile-time source tree in debug builds.
Since issue #11 Phase A the Bundle is one required explicit build input
(`--stdlib-dir`) with a pinned identity and a recorded source commit
(ADR-0070); see §0.11.
- **H-04 core resource kinds:** `marqdo_host::CORE_RESOURCE_KINDS` is the single - **H-04 core resource kinds:** `marqdo_host::CORE_RESOURCE_KINDS` is the single
registry used by the CLI manifest validator and every trusted host registration registry used by the CLI manifest validator and every trusted host registration
path; all six core kinds are rejected as a provider name and as a declared kind path; all six core kinds are rejected as a provider name and as a declared kind
@@ -683,9 +727,11 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL
routed to the bundled stdlib (Compat-C, ADR-0030/0031); there is no legacy routed to the bundled stdlib (Compat-C, ADR-0030/0031); there is no legacy
host formatter. `tools/pack-stdlib.py` additionally emits a byte-deterministic host formatter. `tools/pack-stdlib.py` additionally emits a byte-deterministic
offline archive + descriptor as an extraction-ready artifact offline archive + descriptor as an extraction-ready artifact
([evidence](evidence/2026-11-20-stdlib-package.md)). The stdlib intentionally ([evidence](evidence/2026-11-20-stdlib-package.md)). Issue #11 Phase A now
stays in this repository for now (ADR-0039); extraction is a future option consumes the Bundle through one explicit `--stdlib-dir` and one pinned
when size/release cadence requires it, not a pending gate. identity (ADR-0070, §0.11); the production sources still stay in this
repository until Phase B, which is gated on ecosystem issue #2 and the
extension replacement evidence.
- Resource streams (RFC-CM CM-A06, ADR-0025/0026/0040): opaque host-issued - Resource streams (RFC-CM CM-A06, ADR-0025/0026/0040): opaque host-issued
`Resource` handles with `resource.open/read/write/close`; bytes move only `Resource` handles with `resource.open/read/write/close`; bytes move only
through `Memory`; stdin is read-only over one shared run cursor; stdout and through `Memory`; stdin is read-only over one shared run cursor; stdout and
@@ -703,7 +749,8 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL
pins the workspace graph, `marqdo-runtime -> marqdo-host`, the bundled stdlib pins the workspace graph, `marqdo-runtime -> marqdo-host`, the bundled stdlib
digest and the stdio/file/TCP endpoints; `crates/cli/tests/stdlib_product.rs` digest and the stdio/file/TCP endpoints; `crates/cli/tests/stdlib_product.rs`
runs every public stdlib module (`clock/compress/console/csv/datetime/demo/env/format/fs/http/io/json/path/process/random/regex/stream/table/text/utf8`) runs every public stdlib module (`clock/compress/console/csv/datetime/demo/env/format/fs/http/io/json/path/process/random/regex/stream/table/text/utf8`)
through `std:` imports over `stdlib/tests/*.mq.md`. `tools/pack-stdlib.py` through `std:` imports over `stdlib/tests/*.mq.md` resolved from the pinned
Bundle (`crates/cli/tests/support/stdlib.rs`). `tools/pack-stdlib.py`
now sorts `.mq.md` by the same relative path key as the CLI. Source/test baseline now sorts `.mq.md` by the same relative path key as the CLI. Source/test baseline
`0d40de7`; later docs-only commits keep code/test bytes identical. Evidence: `0d40de7`; later docs-only commits keep code/test bytes identical. Evidence:
[`docs-and-test-migration`](evidence/2026-11-21-docs-and-test-migration.md). [`docs-and-test-migration`](evidence/2026-11-21-docs-and-test-migration.md).
+6 -3
View File
@@ -140,8 +140,11 @@ Layer rules:
or a third-party plugin path. or a third-party plugin path.
2. The platform layer owns I/O, clocks, entropy, sockets and file handles. It must 2. The platform layer owns I/O, clocks, entropy, sockets and file handles. It must
not own JSON parsing, text formatting or memory allocation policy. not own JSON parsing, text formatting or memory allocation policy.
3. The stdlib is `.mq.md` and ships in this repository. New ordinary algorithms 3. The stdlib is `.mq.md` and ships in this repository during Phase A of
go to `stdlib/` + tests + docs; they do not become Rust builtins. issue #11. New ordinary algorithms go to `stdlib/` + tests + docs; they do
not become Rust builtins. Packaging and product tests take it as one
explicit, pinned Bundle input (ADR-0070); Phase B moves the production
sources to the ecosystem assembly after issue #2 acceptance.
4. The CLI selects inputs, resolves configuration, assembles the host and routes 4. The CLI selects inputs, resolves configuration, assembles the host and routes
human/machine output. It is not a semantic policy centre. human/machine output. It is not a semantic policy centre.
5. Callable Plugin and Resource Provider share one registry/authorization/audit 5. Callable Plugin and Resource Provider share one registry/authorization/audit
@@ -229,7 +232,7 @@ that a phase is complete.
| Priority | Gap | State | | Priority | Gap | State |
|---|---|---| |---|---|---|
| P0 | **Language syntax migration**: RFC-LANG-0002 single contract | **closed at `9c1723d`**; implementation, stdlib digest, examples and fixtures green; platform/strict evidence remains separate | | P0 | **Language syntax migration**: RFC-LANG-0002 single contract | **closed at `9c1723d`**; implementation, stdlib digest, examples and fixtures green; platform/strict evidence remains separate |
| P0 | Stdlib release is a bundle in this repo; extraction is deferred (ADR-0039) | accepted, keep in repo | | P0 | Stdlib extraction (issue #11): explicit `--stdlib-dir` + one pinned Bundle for tests/perf/release CI | **Phase A implemented** (ADR-0070); Phase B (ecosystem assembly, source removal) waits on ecosystem issue #2 and the extension replacement evidence |
| P0 | Documentation drift between `STATUS.md`, the architecture index and the evidence | being fixed by this migration and the docs gate | | P0 | Documentation drift between `STATUS.md`, the architecture index and the evidence | being fixed by this migration and the docs gate |
| P1 | `std:fs/file` read/write/copy, metadata/directory, append/read_at/walk are implemented; watch and binary offset reads remain open | open | | P1 | `std:fs/file` read/write/copy, metadata/directory, append/read_at/walk are implemented; watch and binary offset reads remain open | open |
| P1 | No file watch or binary `read_at` | open; future Resource Operation extension | | P1 | No file watch or binary `read_at` | open; future Resource Operation extension |
@@ -0,0 +1,190 @@
# Issue #11 Phase A — one explicit stdlib Bundle input
Date: 2026-11-26.
Implementation baseline: `4bbefc92449ee480c8a2c89b0308feb4cda8d0e7`.
Bundle source commit: `2cbde54602c07f62a62f341400bc9cb4764a93f8`.
Decision: [ADR-0070](../adr/0070-explicit-stdlib-bundle-build-input.md).
Inventory:
[`2026-11-26-stdlib-source-coupling-inventory.md`](2026-11-26-stdlib-source-coupling-inventory.md).
Candidate commits (in order):
| Commit | Change |
|---|---|
| `b9c72e1` | ADR-0070 + source-coupling inventory |
| `1b9d9c4` | `tools/stdlib/bundle.py`, `bundle-pin.json`, required `pack-stdlib.py --stdlib-dir` |
| `422b9de` | `package.py --stdlib-dir/--bundle-pin`, `RELEASE_INFO.stdlib.source` |
| `3a68260` | pinned test resolver, synthetic loader tests, product/conformance rewiring |
| `ab6b6b1` | independent-build lane, perf Bundle pin, CI and docs |
| this docs commit | STATUS/README/tests/CURRENT + this evidence |
Executed host: Linux x86_64 (glibc 2.43), `rustc 1.100.0 (0ef1bc386
2026-11-09)`, `cargo 1.100.0 (3acc79c0c 2026-11-05)`, Python 3.14.4; the
cold-install container is `ubuntu:24.04` (glibc 2.39) with `--network none`.
## 1. Pinned Bundle identity
```console
$ python3 tools/stdlib/bundle.py
{
"aliases_digest": "sha256:5f513c0fdbb3c1e9829be3c9fa23a2d1e89cb8510073fb5eb1e8e2f5265a83bb",
"file_count": 42,
"name": "marqdo-stdlib",
"root": "<checkout>/stdlib",
"source_commit": "2cbde54602c07f62a62f341400bc9cb4764a93f8",
"tree_digest": "sha256:5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713",
"version": "0.1.0"
}
```
`tools/stdlib/bundle-pin.json` records the same identity. The resolver accepts
an explicit location but never an explicit identity: a valid-but-unpinned
Bundle is rejected.
## 2. Failure paths (tools/ci/test_stdlib_bundle_tools.py)
64 `tools/ci` unit tests pass. The new cases cover:
* `--stdlib-dir` is required and a missing input fails before any output;
* a missing `stdlib.json`, a tree-digest mismatch, an alias-digest mismatch and
`public_aliases` without `aliases_digest` fail;
* a symlink inside the Bundle is rejected;
* an explicit Bundle that does not match the pin fails, even when the pinned
default is valid;
* a bad pin schema fails;
* the `bundle.py` CLI exits 1 on an invalid explicit input and 0 with
`--print-path` otherwise.
The runtime override rule is pinned by the loader unit test
`bad_override_fails_closed_even_with_a_valid_sibling` (a bad
`MARQDO_STDLIB_DIR` fails although a valid sibling `stdlib/` exists).
## 3. Deterministic packaging
Two standalone stdlib packs from the same explicit input and toolchain are
byte-identical:
```console
$ python3 tools/pack-stdlib.py --stdlib-dir stdlib \
--bundle-pin tools/stdlib/bundle-pin.json --out-dir <a>
$ python3 tools/pack-stdlib.py --stdlib-dir stdlib \
--bundle-pin tools/stdlib/bundle-pin.json --out-dir <b>
$ sha256sum <a>/marqdo-stdlib-0.1.0.tar.gz <b>/marqdo-stdlib-0.1.0.tar.gz
f6dc8e7ad92bc58b815635aea923069919d6f5495078e53828ae4723d925a565 <a>/marqdo-stdlib-0.1.0.tar.gz
f6dc8e7ad92bc58b815635aea923069919d6f5495078e53828ae4723d925a565 <b>/marqdo-stdlib-0.1.0.tar.gz
```
Two release archives built from `ab6b6b1` with `--skip-example-build` (the
host-built example artifacts were already present) are byte-identical:
`f37e01c44e668a6daf0538b32e9825cc74392f0ccbd65362af2783629b6d2c48`.
`RELEASE_INFO.json.stdlib.source` records
`{"kind":"in-repo","repository":"cflmy/marqdo-cli","commit":"2cbde54602c07f62a62f341400bc9cb4764a93f8","path":"stdlib"}`
and the tree/alias digests equal `stdlib.json`.
## 4. Product and performance lanes
The product, HTTP, table, alias-routing, P2 closure and semantic harnesses
resolve the pinned Bundle through `crates/cli/tests/support/stdlib.rs`
(`MARQDO_TEST_STDLIB_BUNDLE`/`MARQDO_TEST_BUNDLE_PIN` overrides are verified
against the pin). Loader unit tests build synthetic Bundles instead of the
product tree.
```console
$ cargo test -p marqdo-cli --bin marqdo stdlib --offline
4 passed (synthetic loader tests)
$ cargo test -p marqdo-cli --test stdlib_product --offline
16 passed
$ cargo test -p marqdo-cli --test stdlib_bundle --test stdlib_http \
--test stdlib_table --test stdlib_alias_routing --offline
13 passed
$ cargo test -p marqdo-cli --test architecture_boundaries \
--test conformance_semantics --test p2_closure --offline
16 passed
$ python3 tools/perf/runner.py --no-build --binary target/debug/marqdo \
--warmups 1 --samples 3 --allow-smoke --only hello-check ...
correctness=VERIFIED status=SMOKE
stdlib={... "source_commit":"2cbde54602c07f62a62f341400bc9cb4764a93f8" ...}
```
## 5. Independent build (clean copy without stdlib)
`tools/ci/independent_build.py` exported `ab6b6b1` with `git archive`, removed
`stdlib/`, and built both binaries with `--locked`:
```json
{
"status": "PASS",
"source_sha": "ab6b6b1a23ec064fbc7de943c52befca18142a56",
"binaries": {
"marqdo": {"sha256": "428c25c60caa7762348bcffad96558591adf52440d44549a645390c927558757"},
"marqdo-provider-worker": {"sha256": "3787942de6d35ce1c7f03c0848c8e08b6037495e98005c62704d34e664da795c"}
},
"checks": {
"stdlib_source_removed": true,
"language_only_check": "PASS",
"language_only_call": "PASS:3",
"stdlib_dependent_missing_bundle": "PASS",
"no_sibling_stdlib": true
}
}
```
The stdlib-dependent `run examples/hello.mq.md` failed with an explicit
stdlib/print diagnostic instead of falling back to a source tree; the built
`target/debug` directory contains no `stdlib/`.
## 6. Archive smoke and cold install
```console
$ python3 tools/release/smoke.py --archive <archive>
smoke: verified stdlib 0.1.0 tree=sha256:5407d36... aliases=sha256:5f513c0... files=42
smoke: archive version 3.0.0-rc.4, source ab6b6b1a23ec064fbc7de943c52befca18142a56
smoke: bundled stdlib missing -> fail-closed OK
smoke: language-only program runs without the bundled stdlib
smoke: PASS
```
```console
$ bash tools/release/cold-install.sh <archive> ab6b6b1a23ec064fbc7de943c52befca18142a56
你好,Marqdo
checked 2 module(s): ok
checked 1 module(s): ok
6
runtime error[kernel.unavailable]: 打印 requires the bundled stdlib print module; install the official CLI bundle
<language-only factorial call still prints 120>
```
The container is `ubuntu:24.04`, `--network none`, user `65534:65534`, with no
Cargo and no source checkout; only the archive bytes are mounted. Moving the
shipped `stdlib/` aside keeps the language-only factorial call working and
makes the `打印` program fail with the explicit `kernel.unavailable` message.
## 7. Gates on the candidate tree
```console
$ cargo fmt --all -- --check
FMT_OK
$ cargo clippy --workspace --all-targets --offline -- -D warnings
exit=0
$ cargo test --workspace --locked --offline
exit=0
634 passed, 0 failed, 2 ignored across 72 test binaries
```
The workspace run includes `docs_consistency` (7 passed),
`architecture_boundaries`, the frozen conformance suites and every product
lane. It was executed on the candidate tree plus this documentation change and
is reproducible with `cargo test --workspace --locked`. Platform-native
Windows/macOS runs were not re-executed for this docs-only candidate; the
existing GitHub matrix remains the lane for them.
## 8. Not claimed
* Phase B: switching to the ecosystem-assembled Bundle, removing the in-repo
production sources, removing the debug source fallback and deleting replaced
`std:` entries. It is gated on ecosystem issue #2 and the extension
replacement evidence named by issue #11.
* Any `std:`/`stdlib.json`/`marqdo.stdlib-package`/Analysis/Observation shape
change; none was made.
* A docker cold-install on a Windows/macOS host or a native Windows/macOS
product run for this candidate.
+18
View File
@@ -53,6 +53,24 @@ Rust harnesses (all in `crates/cli/tests/`):
| `integration_cli.rs` | Real CLI contract: `init`, `check`, `run`, `call`, `inspect`, `fmt`, multi-module imports/cycles, `lock`/`sync --locked`, plugin inspection and explicitly trusted plugin invocation. | | `integration_cli.rs` | Real CLI contract: `init`, `check`, `run`, `call`, `inspect`, `fmt`, multi-module imports/cycles, `lock`/`sync --locked`, plugin inspection and explicitly trusted plugin invocation. |
| `execution_events.rs` | Execution Events v1 black-box contract: pure JSONL, seq/terminal ordering, byte-exact base64 chunks, live delivery before exit, value redaction/selection, trace coexistence, truncation, output budget and broken-pipe failure. | | `execution_events.rs` | Execution Events v1 black-box contract: pure JSONL, seq/terminal ordering, byte-exact base64 chunks, live delivery before exit, value redaction/selection, trace coexistence, truncation, output budget and broken-pipe failure. |
## Stdlib Bundle lanes (ADR-0070)
The product lane consumes one pinned Bundle, never an implicit checkout path:
* `tools/stdlib/bundle-pin.json` pins the Bundle name, version, source commit,
tree digest and alias digest; `tools/stdlib/bundle.py` resolves and verifies
it.
* `crates/cli/tests/support/stdlib.rs` gives the product/conformance harnesses
the same Bundle. `MARQDO_TEST_STDLIB_BUNDLE` or `--stdlib-dir` changes the
location but the Bundle must still match the pin; `MARQDO_TEST_BUNDLE_PIN`
changes the pin file. A bad explicit input fails even when the default
location is valid.
* Loader unit tests in `crates/cli/src/stdlib.rs` build small synthetic
Bundles, so loader logic does not depend on the product tree.
* `tests/independent/language-only.mq.md` is the program
`tools/ci/independent_build.py` runs through a CLI built from a copy without
`stdlib/`; a stdlib-dependent program must fail closed in that copy.
## Running ## Running
Use the workspace cargo cache/target as documented in `AGENTS.md`: Use the workspace cargo cache/target as documented in `AGENTS.md`: