stdlib: Phase A 显式 Bundle 构建输入(issue #11) #12

Open
cflmy wants to merge 9 commits from architecture/issue-11-explicit-stdlib-bundle into master
pull from: architecture/issue-11-explicit-stdlib-bundle
Owner

范围:issue #11 阶段 A

只落阶段 A 的输入边界;阶段 B(生态主仓组装的 Bundle、删除仓内生产源码与 debug 源目录回退、替换旧 std: 入口)未做,等待生态 #2 与扩展验收结果。

变更

  • 新增 tools/stdlib/bundle.py + tools/stdlib/bundle-pin.json:唯一解析/校验器,固定 name/version/source commit/tree_digest/aliases_digest。
  • tools/pack-stdlib.py、tools/release/package.py 必须显式 --stdlib-dir,可选 --bundle-pin;缺失目录/manifest、摘要不符、pin 不符、符号链接在产出前失败;RELEASE_INFO.json.stdlib.source 记录来源提交。
  • 产品/性能/发布 CI 统一走 pinned Bundle(crates/cli/tests/support/stdlib.rs、tools/perf/runner.py);显式覆盖只改位置不改身份,错误覆盖不回退;loader 单测改为合成小 Bundle。
  • 新增 tools/ci/independent_build.py 与 tests/independent/language-only.mq.md:无 stdlib/ 源码的干净副本中 --locked 构建两个二进制,纯语言程序可运行,依赖标准库的程序失败关闭。
  • 归档 smoke / cold-install 在移走 stdlib/ 后同时验证纯语言程序仍可执行。
  • docs/ci.md、releasing.md、STATUS.md、CURRENT.md、README.md、tests/README.md 同步;新增 ADR-0070。

验证(候选 ab6b6b1)

  • workspace:634 passed / 0 failed / 2 ignored;cargo fmt --check、cargo clippy --workspace --all-targets -D warnings 通过。
  • 两次打包逐字节一致:stdlib archive f6dc8e7ad92bc58b815635aea923069919d6f5495078e53828ae4723d925a565,release archive f37e01c44e668a6daf0538b32e9825cc74392f0ccbd65362af2783629b6d2c48。
  • independent_build.py PASS;archive smoke PASS;ubuntu:24.04 --network none cold-install PASS。
  • 失败路径:缺失输入、缺失 manifest、tree/alias 摘要不符、pin 不符、符号链接、错误显式覆盖。

Evidence: docs/evidence/2026-11-26-issue-11-phase-a.md
ADR: docs/adr/0070-explicit-stdlib-bundle-build-input.md

Refs #11(阶段 B 完成后才关闭)。

## 范围:issue #11 阶段 A 只落阶段 A 的输入边界;阶段 B(生态主仓组装的 Bundle、删除仓内生产源码与 debug 源目录回退、替换旧 `std:` 入口)未做,等待生态 #2 与扩展验收结果。 ### 变更 - 新增 `tools/stdlib/bundle.py` + `tools/stdlib/bundle-pin.json`:唯一解析/校验器,固定 name/version/source commit/tree_digest/aliases_digest。 - `tools/pack-stdlib.py`、`tools/release/package.py` 必须显式 `--stdlib-dir`,可选 `--bundle-pin`;缺失目录/manifest、摘要不符、pin 不符、符号链接在产出前失败;`RELEASE_INFO.json.stdlib.source` 记录来源提交。 - 产品/性能/发布 CI 统一走 pinned Bundle(`crates/cli/tests/support/stdlib.rs`、`tools/perf/runner.py`);显式覆盖只改位置不改身份,错误覆盖不回退;loader 单测改为合成小 Bundle。 - 新增 `tools/ci/independent_build.py` 与 `tests/independent/language-only.mq.md`:无 `stdlib/` 源码的干净副本中 `--locked` 构建两个二进制,纯语言程序可运行,依赖标准库的程序失败关闭。 - 归档 smoke / cold-install 在移走 `stdlib/` 后同时验证纯语言程序仍可执行。 - `docs/ci.md`、`releasing.md`、`STATUS.md`、`CURRENT.md`、`README.md`、`tests/README.md` 同步;新增 ADR-0070。 ### 验证(候选 `ab6b6b1`) - workspace:634 passed / 0 failed / 2 ignored;`cargo fmt --check`、`cargo clippy --workspace --all-targets -D warnings` 通过。 - 两次打包逐字节一致:stdlib archive `f6dc8e7ad92bc58b815635aea923069919d6f5495078e53828ae4723d925a565`,release archive `f37e01c44e668a6daf0538b32e9825cc74392f0ccbd65362af2783629b6d2c48`。 - `independent_build.py` PASS;archive smoke PASS;`ubuntu:24.04 --network none` cold-install PASS。 - 失败路径:缺失输入、缺失 manifest、tree/alias 摘要不符、pin 不符、符号链接、错误显式覆盖。 Evidence: `docs/evidence/2026-11-26-issue-11-phase-a.md` ADR: `docs/adr/0070-explicit-stdlib-bundle-build-input.md` Refs #11(阶段 B 完成后才关闭)。
cflmy added 9 commits 2026-11-26 16:01:10 +08:00
Record ADR-0070 (one explicit stdlib Bundle build input) and the
issue #11 Phase A inventory of every direct checkout-stdlib reference.
Baseline 4bbefc9; bundle source 2cbde54; no runtime contract change.
Add tools/stdlib/bundle.py + bundle-pin.json as the single source-side
Bundle identity (name, version, source commit, tree/alias digests) and
require tools/pack-stdlib.py --stdlib-dir instead of reading the
checkout implicitly. Missing input, missing manifest, digest/alias
mismatch, pin mismatch and symlinks fail closed; two packs are
byte-identical. Tests: tools/ci/test_stdlib_bundle_tools.py.
package.py now requires --stdlib-dir and accepts --bundle-pin; it
verifies the manifest, required files, tree/alias digests and the pin
before staging, copies exactly that Bundle next to the binary, and
records stdlib.source{kind,repository,commit,path} in RELEASE_INFO.
Digest logic moves to tools/stdlib/bundle.py. GitHub/Woodpecker
release steps and docs/releasing.md pass the pinned input.
Add crates/cli/tests/support/stdlib.rs as the product/conformance test
resolver: explicit MARQDO_TEST_STDLIB_BUNDLE or the pinned path, always
verified against bundle-pin.json (name/version/commit/digests), with a
bad explicit override failing closed. Route stdlib_product,
stdlib_bundle, http, table, alias routing, p2_closure,
conformance_semantics and architecture_boundaries through it.

Loader unit tests now build small synthetic Bundles; discovery is split
into discover_with so the bad-override-no-fallback rule is testable.
Add tools/ci/independent_build.py: export HEAD without stdlib/, build
both shipped binaries with --locked, run a language-only check/call, and
require a stdlib-dependent run to fail closed with no sibling stdlib.
Add tests/independent/language-only.mq.md and run the lane as its own
GitHub job and Woodpecker step.

Perf runner resolves the pinned Bundle (--stdlib-dir/--bundle-pin),
exports it to every workload and records it in the report; GitHub and
Woodpecker lanes verify the pin and pass the product tests an explicit
Bundle. docs/ci.md and performance docs describe the lanes.
Moving the shipped stdlib aside must fail the print program with an
explicit diagnostic and still run a language-only program. The archive
smoke and the cold-install container now both call the factorial
example after the move, and the archive contract test pins the new
message.
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.
tools/ci/release_evidence.py accepts only its declared gate names; the
extra independent_build gate would have failed the release-evidence job.
The job still depends on independent-build and marks linux FAIL when it
does not pass.
Add the smoke commit and the CI gate follow-up so the evidence names the
reviewed implementation sequence instead of a relative commit.
All checks were successful
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/pr/main Pipeline was successful
This pull request has changes conflicting with the target branch.
  • docs/STATUS.md
  • docs/adr/README.md
  • docs/ci.md
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin architecture/issue-11-explicit-stdlib-bundle:architecture/issue-11-explicit-stdlib-bundle
git checkout architecture/issue-11-explicit-stdlib-bundle
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cflmy/marqdo-cli#12