feat(stdlib): ship a verified bundled stdlib with std: imports

- Move the Compat-A print prototype into stdlib/ as the official offline
  bundle with stdlib.json (version 0.1.0 + sha256 content digest).
- Add std:<relative> import resolution in the loader with bundle path
  confinement, extension inference and fail-closed digest verification.
- Record the verified version/digest/instance_id in Analysis v2
  project.stdlib; stdlib modules get a std:name@version#digest instance id.
- Add CLI tests: std:io execution, digest-tamper rejection, missing manifest,
  Analysis identity, no foreign/plugin calls, and frozen binary hash equality.
- Update ADR-0028, specs, status, changelog and evidence.

Gate: fmt, clippy -D warnings, 415 tests passed.
This commit is contained in:
cflmy committed 2026-11-20 21:43:14 +08:00
1 parent 1a978c7a42
commit 1377af1601
28 files changed
+879 -23

No files matched your search

+11 -1
View File
@@ -31,7 +31,12 @@ Analysis v1. v1 was never released; it is kept as history and is not written.
"project": {
"root_id": "root:quantum@0.1.0",
"identity_kind": "manifest",
"lock_digest": "sha256:<64 hex>"
"lock_digest": "sha256:<64 hex>",
"stdlib": {
"version": "0.1.0",
"digest": "sha256:<64 hex>",
"instance_id": "std:marqdo-stdlib@0.1.0#<64 hex>"
}
},
"modules": [],
"diagnostics": []
@@ -48,6 +53,11 @@ Analysis v1. v1 was never released; it is kept as history and is not written.
`project.lock_digest` is the SHA-256 of the exact `marqdo.lock` bytes prefixed
with `sha256:`, or `""` when there is no lock. It is not a logical identity.
`project.stdlib` records the verified bundled standard library identity used by
this load: declared version, content digest and package instance id. It is
`null` when no bundle was available. A digest mismatch is a hard load error, so
an Analysis artifact can only name a bundle whose bytes matched the manifest.
`AnalysisDigest` is the lowercase hex SHA-256 of the exact UTF-8 bytes written
by `check --emit` (pretty JSON). This is what Trace v2 binds to
`source.analysis_digest`; an independent consumer can verify it by hashing the