0070. Packages and manifests
- Status: Accepted
- Date: 2026-10-31
- Plan: M9.2 (Step 1; package loading follows in later steps)
- Review: Making Tenon plugin-first
Context
ADR-0064 provides root-relative modules. Reusable packages need explicit identity and dependencies without changing existing single-file builds or emitted source tables. Manifest typos must not silently select different behavior.
Decision
Read only the sibling harness.toml beside the root
source, never walk upward. NotFound/NotADirectory means no
package. A successful manifest is not a source file; add it to the
source map only to report an error.
Require [package] name, version and edition:
lowercase import-segment names, three decimal version components
and edition "2026". Optional capabilities list
stdin stdout stderr env fs process; omission remains
distinct from []. [dependencies] entries
select path or git plus a pinned 40-hex revision. One
version/source per package name is the package-graph policy for
later steps. Step 1 validates dependencies without loading or
fetching them.
Use a handwritten, dependency-free TOML subset: comments, dotted table headers, bare keys, basic strings with quote/backslash/newline/tab escapes, decimal integers, string arrays and nonnested one-line inline tables. Reject unsupported syntax/duplicates (E0930), unknown/missing fields (E0931), invalid package values (E0932) and invalid dependency specs (E0933).
Provide SHA-256 with canonical tree framing: regular files in
bytewise relative path order, each
relpath NUL decimal-length NUL bytes, slash-separated
paths, ignoring executable bits and empty directories. Reject
symlinks/special files; the future loader reports E0941. Hashing
assumes a stable tree. Lockfile storage and fetch behavior remain
later decisions.
Alternatives considered
- Full TOML through a crate expands dependencies and accepted syntax before manifests need them; the shared lockfile reader needs only this subset.
- Parent-directory discovery changes existing builds based on ambient files; sibling-only discovery keeps activation explicit and local.
- Semver resolution/multiple versions complicates whole-program coherence and package identity; pinned sources with one version per name are simpler.
Consequences
Successful manifests preserve emitted C and existing digests. The compiler can teach manifest errors with file-aware spans. Broader TOML features, package loading, lockfiles and capability enforcement require later M9.2 steps.