refactor: accept the ecosystem stdlib Bundle and remove the in-repo sources
ci/woodpecker/push/main Pipeline failed
ci/woodpecker/pr/main Pipeline failed

Phase B of ADR-0070 (issue #11): the CLI no longer owns standard-library
sources. The pin names the accepted ecosystem Bundle (marqdo-stdlib@0.2.0,
root commit + tree/alias digests); tools/ci/fetch_ecosystem_bundle.py
materializes it from the pinned root commit and stdlib gitlinks and verifies
the digests. bundle.py and the test harness require an explicit verified Bundle
for the accepted identity, and runtime discovery has no compile-time source
fallback in any profile.

Delete stdlib/ (modules, self-tests, aliases manifest). Module and domain tests
stay with their component owners; the CLI product lane now verifies the
external Bundle's public surface, std: resolution and official print/打印 alias
routing (tests/product-stdlib). Composition assertions whose owner is the
ecosystem (Table split, print-format equivalence) moved to the root Bundle
acceptance; the generic TCP round-trip stays a CLI test. Spawned-CLI tests name
the verified Bundle explicitly.

CI (Woodpecker + GitHub) materializes the pinned Bundle before product tests,
packaging and performance lanes; packaging and release take --stdlib-dir from
that artifact. Docs, STATUS, ADR-0070 and a Phase B evidence record updated.

Refs cflmy/marqdo#9, cflmy/marqdo-cli#11
This commit is contained in:
cflmy committed 2026-11-27 01:04:01 +08:00
1 parent f8b82d4143
commit 72f57beee0
85 files changed
+796 -5939

No files matched your search

+25
View File
@@ -193,6 +193,31 @@ This is an architecture correction, not a product/protocol change. Decision:
- ADR-0072 and the old issue-#15 evidence carry Superseded banners. The remote
replica is gone; Git history retains the decision/implementation record.
## 0.14 External ecosystem stdlib Bundle — issue #11 Phase B (unreleased candidate)
Phase B finishes the extraction ADR-0070 prepared: this repository has **no**
`stdlib/` source tree and no compile-time source fallback. The accepted Bundle
identity is the ecosystem pin:
`marqdo-stdlib@0.2.0`, source `cflmy/marqdo@48189243f7`, tree digest
`sha256:db905508...`, aliases digest `sha256:5f513c0f...` (17 modules, no
component self-tests). `tools/stdlib/bundle.py` requires an explicit
`--stdlib-dir`/`MARQDO_TEST_STDLIB_BUNDLE` for the accepted Bundle;
`tools/ci/fetch_ecosystem_bundle.py` materializes it from the pinned root
commit and component gitlinks.
Moved with their ownership: module self-tests and domain behaviour tests live
in the component repositories (six std repos, `marqdo-ext-http`,
`marqdo-ext-regex`, `marqdo-ext-archive`); the CLI product lane now verifies
the accepted Bundle's public surface and official `print`/`打印` routing
(`tests/product-stdlib/`), and the Table-split / print-format composition
assertions live in the root Bundle acceptance. The generic TCP endpoint
round-trip stays a CLI test (`tcp_round_trip.rs`); the HTTP-over-TCP domain
test moves to the HTTP package owner.
Runtime discovery is now only `MARQDO_STDLIB_DIR` then the installed sibling
`stdlib/` (no debug fallback). Bundle release packaging still ships the Bundle
next to the CLI, so installed behaviour is unchanged.
## 0.10 Closed public Analysis boundary — issue #10 (RC.4 released)
The candidate replaces the program-only Analysis projection in place under
@@ -1,6 +1,7 @@
# ADR-0070 — One explicit stdlib Bundle build input (Phase A)
Status: **Accepted for implementation on the 3.0 prerelease line** (2026-11-26).
Status: **Phase A accepted and implemented (2026-11-26); Phase B accepted and
implemented on the 3.0 prerelease line (2026-11-27).**
Relates to: issue
[#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11), ADR-0028 (bundled
stdlib and `std:` imports), ADR-0039 (deferred extraction), ADR-0058 (public
@@ -99,6 +100,31 @@ replacement evidence named by issue #11. This ADR records the Phase A input
boundary only; it does not authorize deleting sources or changing `std:`
semantics.
## Phase B implementation (2026-11-27)
The gate above was met by ecosystem issue #9's candidate combination, so the
pin and CI changed and the sources were removed:
* `tools/stdlib/bundle-pin.json` names
`source.kind = "ecosystem"`, `repository = cflmy/marqdo`, the exact root
commit that pins the component gitlinks, and the accepted digests. The pin no
longer records a vendored `source.path`.
* `crates/cli/src/stdlib.rs` has no compile-time source fallback in any build
profile; discovery is `MARQDO_STDLIB_DIR` then the installed sibling Bundle.
* The in-repo `stdlib/` tree is deleted. Module sources, self-tests and domain
behaviour tests live in the component repositories.
* `tools/ci/fetch_ecosystem_bundle.py` materializes the pinned Bundle from the
ecosystem root commit + stdlib gitlinks and verifies it against the pin;
Woodpecker and GitHub CI use it before product tests, packaging and
performance lanes.
* Product tests (`crates/cli/tests/stdlib_product.rs`) verify the CLI's own
responsibility against the external Bundle: required public surface,
`std:` execution and official alias routing. Composition fixtures whose
ownership is the ecosystem (Table split, print-format equivalence) live in
the root Bundle acceptance; removed CLI tests were not replaced by mocks.
* A missing `MARQDO_TEST_STDLIB_BUNDLE` fails the product lane closed; the
product contract never reads a sibling source tree.
## Consequences
* A packaging run can be pointed at a downloaded or separately built Bundle and
+7 -6
View File
@@ -29,7 +29,8 @@ contract (rust:1.100-bookworm, python3-jsonschema, both shipped binaries):
dependency-direction gate (tools/ci/check_dependency_boundaries.py)
test (rust:1.100-bookworm, clippy/rustfmt, Node.js 22, MinGW, both binaries):
python3 tools/stdlib/bundle.py (verify the pinned Bundle)
python3 tools/ci/fetch_ecosystem_bundle.py (materialize the pinned ecosystem Bundle)
python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo build --locked -p marqdo-provider-worker
@@ -44,7 +45,7 @@ test (rust:1.100-bookworm, clippy/rustfmt, Node.js 22, MinGW, both binaries):
cargo check --workspace --all-targets --target x86_64-pc-windows-gnu
independent-build (rust:1.100-bookworm, git, python3):
git archive HEAD, remove stdlib/, no ecosystem checkout
git archive HEAD, no stdlib source tree exists, no ecosystem checkout
cargo build --locked -p marqdo-cli -p marqdo-provider-worker
language-only check/call through the built CLI
stdlib-dependent run must fail closed; no stdlib/ next to the binary
@@ -54,7 +55,7 @@ minimum-rust (rust:1.89-bookworm):
build (depends on test, minimum-rust, contract):
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
python3 tools/stdlib/bundle.py; package --stdlib-dir stdlib --bundle-pin ...
materialize the pinned Bundle; package --stdlib-dir target/ecosystem-stdlib --bundle-pin ...
from-archive smoke (tools/release/smoke.py)
frozen external conformance (tools/ci/run_frozen_extensions.sh, 7/7)
```
@@ -108,9 +109,9 @@ syntax; Debian bookworm's Node 18 fails those tests.
`cargo check --workspace --all-targets --target x86_64-pc-windows-gnu`
compile gate (native Windows/macOS runtime lanes stay on the GitHub matrix).
* **ADR-0070 explicit Bundle:** the `test` lane verifies
`tools/stdlib/bundle-pin.json` and runs the product suite once with an
explicit `MARQDO_TEST_STDLIB_BUNDLE`; the new `independent-build` lane builds
both binaries from a copy without `stdlib/` and requires the stdlib-dependent
`tools/stdlib/bundle-pin.json`, materializes the pinned ecosystem Bundle and
runs the product suite with an explicit `MARQDO_TEST_STDLIB_BUNDLE`; the
`independent-build` lane builds both binaries with no Bundle checkout and requires the stdlib-dependent
program to fail closed.
* The Woodpecker **build** lane and the GitHub **release-candidate** lane build
`marqdo` **and** `marqdo-provider-worker` and package both as siblings; the
@@ -0,0 +1,76 @@
# Issue #11 Phase B — the accepted Bundle is the ecosystem artifact
Date: 2026-11-27.
Decision: [ADR-0070](../adr/0070-explicit-stdlib-bundle-build-input.md).
Parent: ecosystem issue [#9](https://git.cflmy.cn/cflmy/marqdo/issues/9) and
CLI issue [#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11).
This is a **candidate record** for the Phase B change set. The repository has no
`stdlib/` source tree; the accepted Bundle identity is pinned to the ecosystem
root commit. CI evidence is recorded on the PR; the numbers below are the local
candidate host results.
## 1. Bundle identity
```json
{
"schema": "marqdo.stdlib-bundle-pin",
"schema_version": 1,
"name": "marqdo-stdlib",
"version": "0.2.0",
"source": {
"kind": "ecosystem",
"repository": "cflmy/marqdo",
"commit": "48189243f747d5f73d5a38a565010e64e2db74e7",
"producer": "scripts/build-stdlib.py"
},
"tree_digest": "sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7",
"aliases_digest": "sha256:5f513c0fdbb3c1e9829be3c9fa23a2d1e89cb8510073fb5eb1e8e2f5265a83bb"
}
```
`tools/ci/fetch_ecosystem_bundle.py` fetches that root commit, initializes the
six stdlib component gitlinks it records, runs the root-owned
`scripts/build-stdlib.py`, and verifies the produced Bundle against the pin.
The CLI never builds the Bundle from a branch or an unknown checkout.
## 2. Source ownership after Phase B
| Source | Owner |
| --- | --- |
| 17 default-Bundle modules (`clock`, `datetime`, `env`, `process`, `random`, `format`, `io*`, `path`, `fs/file`, `data/json`, `data/csv`, `collections/table`, `data/table`, `text*`) | six `marqdo-std-*` repositories |
| HTTP / regex / gzip domain modules | `marqdo-ext-http`, `marqdo-ext-regex`, `marqdo-ext-archive` explicit Packages |
| Module self-tests and domain behaviour tests | the owning component repository |
| Bundle assembly, digest/alias manifest, composition acceptance | `cflmy/marqdo` (root) |
| CLI loader/runtime, `std:` resolution, official alias routing, generic resources | `marqdo-cli` |
Removed from the CLI: `stdlib/` sources and self-tests, the debug source
fallback, `stdlib_http.rs`/`stdlib_table.rs`/`http_over_tcp.rs` domain tests and
the `stdlib/demo.mq.md` formatting test. The print/format equality and Table
split assertions moved to the root composition lane; the generic TCP round-trip
stays a CLI test (`tcp_round_trip.rs`); the HTTP loopback client test follows
the HTTP package owner (tracked as a follow-up on `marqdo-ext-http`).
## 3. Local candidate verification
Host: Linux x86_64, `rustc 1.100.0`, Python 3.14; Bundle materialized by
`tools/ci/fetch_ecosystem_bundle.py --out /root/work/marqdo/.build/cli-ecosystem-bundle`.
| Gate | Command | Result |
| --- | --- | --- |
| Bundle identity | `python3 tools/stdlib/bundle.py --stdlib-dir <bundle>` | PASS (matches pin) |
| Formatting | `cargo fmt --all -- --check` | PASS |
| Lints | `cargo clippy --workspace --all-targets -- -D warnings` | PASS |
| Workspace tests | `MARQDO_TEST_STDLIB_BUNDLE=<bundle> cargo test --workspace --locked` | 72 test binaries, 0 failed |
| Python tool tests | `MARQDO_TEST_STDLIB_BUNDLE=<bundle> python3 -m unittest discover -s tools/ci -p "test_*.py"` | 75 tests, OK |
| Product lane | `cargo test -p marqdo-cli --test stdlib_product` | 4 tests PASS (surface, aliases, `std:` execution, missing-Bundle fail-closed) |
| Independent build | `python3 tools/ci/independent_build.py` | see CI/PR record |
## 4. Unverified / follow-ups
- CI execution of this candidate is the gating evidence; it is recorded on the
PR rather than in this file.
- Release archive cold-install with the new Bundle and the root candidate
promotion are part of MIG-RELEASE (ecosystem issue #9), not this candidate.
- HTTP-over-TCP domain test migration to `marqdo-ext-http` and multi-platform
release evidence remain open; they are not claimed here.
+1 -1
View File
@@ -117,7 +117,7 @@ version="$(cargo metadata --no-deps --format-version 1 --offline \
| python3 -c 'import json,sys; print(next(p["version"] for p in json.load(sys.stdin)["packages"] if p["name"]=="marqdo-cli"))')"
sha="$(git rev-parse HEAD)"
python3 tools/release/package.py --version "$version" --source-sha "$sha" \
--stdlib-dir stdlib --bundle-pin tools/stdlib/bundle-pin.json
--stdlib-dir target/ecosystem-stdlib --bundle-pin tools/stdlib/bundle-pin.json
# dist/marqdo-<version>-x86_64-unknown-linux-gnu.tar.gz(+.sha256)
```