Skip to content

Latest commit

 

History

History
100 lines (73 loc) · 10.5 KB

AGENTS.md

File metadata and controls

100 lines (73 loc) · 10.5 KB

AGENTS.md

Rust workspace (edition 2021, MSRV 1.89, resolver = "2"). unsafe_code = "deny", clippy all = warn.

This file is an index, not a second copy of the rules. Every section below names the architecture/ deep dive that owns the detail. When you change code, CI, the gate, or the plan system, follow the doc chain in architecture/tooling-governance.md §7.3 and the docs-hygiene skill.

Workspace layout

Full dependency rules and per-crate boundary rationale: architecture/tooling-governance.md §2.

  • crates/eggup-core — policy-neutral local mechanics: InstallPlan → Prepared → Verified → Validated → Receipt. Deps: sha2, plus self-replace Windows-only (deferred deletion of a replaced running image; non-Windows graphs stay sha2 only). Never add transport, service-manager, or Eggpack deps here.
  • crates/eggup-acquisition — transport-neutral seam (AcquisitionTransport, FixtureTransport, ComposedTransport, FetchLimits). Zero dependencies — not even sha2. No eggup deps.
  • crates/eggup-eggfetch — native HTTP adapter (eggfetch-core + tokio + futures-util); depends only on eggup-acquisition. Must not know eggup-curl exists.
  • crates/eggup-curl — external-curl adapter, no embedded HTTP/TLS stack; depends only on eggup-acquisition. Must not know eggup-eggfetch exists. Transport composition lives in the seam, never in an adapter.
  • crates/eggup-service — manager-neutral lifecycle; depends only on eggup-core (+ windows-args, + windows-service on Windows).
  • crates/eggup-archive — bounded allowlisted local tar.gz/zip extraction; deps tar, zip, flate2, fs_at, sha2, dev-dep eggup-core. No transport, authenticity, or live-installation policy.
  • crates/eggup-eggpack — optional leaf adapter for Eggpack ReleaseManifest v1; latest published version is 0.2.0 (its immutable package pins Eggup dependencies at =0.2.0). The workspace source candidate is 0.2.1 and its three local pins are =0.2.1; it depends on core + archive + acquisition (local paths) + eggpack-manifest = "=0.1.2" from the registry. Its exact dependency list is owned by crates/eggup-eggpack/Cargo.toml. Only crate allowed to touch producer types.
  • crates/eggup-transport-footprint — non-published (publish = false) footprint fixtures: curl_only / eggfetch_only / dual binaries behind required-features, with a source-level linkage-discipline guard in tests/cross_link_guard.rs. The isolated single-adapter configurations are built by stable and macos and checked at the MSRV floor by msrv; windows-check builds none of them.

New crates must join Cargo.toml members, inherit the 5 shared keys (version, edition, rust-version, license, repository), and set [lints] workspace = true. The 7 library crates also carry #![forbid(unsafe_code)] and #![deny(missing_docs)]; eggup-transport-footprint is the sole exception (binary-only, no lib.rs, and no README.md/CHANGELOG.md — see §3.4 of the governance deep dive).

Verify (in this order)

Gate is scripts/check-local.sh; rationale, per-line purpose, and the coverage gaps are in architecture/tooling-governance.md §4–§5.

./scripts/check-local.sh
# = cargo fmt --all -- --check
# + cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
# + cargo test --workspace --all-targets --all-features --locked
# + cargo doc --workspace --no-deps --locked
# + cargo tree --workspace --locked  # executed for resolution; review boundary output manually
# + ./scripts/check-docs-truth.sh  # source versions, published versions, and docs truth

cargo tree always exits 0 on a resolvable graph. Read it: the dependency-boundary rules are enforced by human review only.

Focused runs: cargo test -p eggup-core, cargo test -p eggup-core <name>, cargo clippy -p <crate> --all-targets --locked -- -D warnings.

CI (.github/workflows/ci.yml) adds what the script lacks: stable (fmt/clippy/test/doc plus the packaged-service step on Linux), msrv (workspace cargo check and the packaged-service step on 1.89.0), service-systemd (registry-only published 0.1.2 negative controls, current real-systemd fixtures, and published registry-only 0.1.3 positive quiescence and ownership controls), macos (full cargo test plus the packaged-service step), and windows-check — which runs ten cargo test steps, then cargo package -p eggup-service --locked. The packaged-service step verifies the packaged service crate against the registry, strictly: its eggup-core = "^0.2" requirement resolves against the published eggup-core 0.2.1, and the packaged sources are compiled. Windows tests cover acquisition/archive/curl, eggpack, three named service diagnostic tests, SCM, the live SCM fixture, Core current_executable and stale_lock_recovery, then the full workspace. Core M010/M011 self-replacement and lock-race fixtures execute natively, not merely compile. Neither msrv nor windows-check passes --all-features on its workspace check, but msrv checks the three feature-gated footprint configurations by dedicated steps, so the footprint binaries are built by stable and macos and checked at the 1.89 floor by msrv; only windows-check builds none of them. CI never publishes; releases are manual.

Where to look

Start at architecture/overview.md (birds-eye view, module map, cross-cutting invariants, deep-dive index), then the deep dive for the crate at hand:

  • eggup-core → architecture/core-transaction.md + contracts in crates/eggup-core/docs/{domain,verification,transaction}.md
  • eggup-acquisition → architecture/acquisition.md
  • eggup-eggfetch → architecture/eggfetch-adapter.md
  • eggup-curl → architecture/curl-adapter.md
  • eggup-service → architecture/service-lifecycle.md
  • eggup-archive → architecture/archive-extraction.md
  • eggup-eggpack → architecture/eggpack-adapter.md
  • eggup-transport-footprint → architecture/transport-footprint.md
  • workspace, CI, plans/process, release, agent surface → architecture/tooling-governance.md
  • consumer-facing how-to (docs/) → architecture/tooling-governance.md §7.4. docs/ is non-normative and must never be the place a rule is introduced — it points at the contracts, it does not restate them.

Skills (on-demand, via the skill tool)

In .opencode/skills/. Each summarizes a normative source; none adds policy. A drifting skill is corrected by rewriting the skill.

  • planning-workflow — plan → implement → closure → registry; 16-section template
  • verify-workflow — local gate, CI lanes, coverage gaps
  • docs-hygiene — which doc owns which fact; the doc-change chain; recurring drift classes
  • release-workflow — manual crates.io publication, dependency ordering, exact-pin cascade

There is no .skills/ directory; plans/ + architecture/ remain the source of truth.

Core rules (not obvious from filenames)

Full statements with citations are in architecture/overview.md (cross-cutting invariants) and architecture/tooling-governance.md.

  • Authoritative contracts: crates/eggup-core/docs/{domain,verification,transaction}.md + architecture/*.md. SHA-256 is integrity evidence only — no authenticity/signature claims, no invented timeouts, no crash-journaling claims.
  • Ownership Absent | Owned | Foreign | Unknown is caller-proven via OwnershipVerifier; Owned is never inferred. commit revalidates ownership + staged digests under lock; Foreign/Unknown/flap fails closed with a receipt (RolledBack/RecoveryRequired), not Err — only lock contention/setup failures return Err.
  • validate requires every member to carry IntegrityStatus::Verified. A member declared IntegrityRequirement::None (NotRequired) always fails — there is no escape hatch.
  • Core never creates live destination parents and never decides that a lock is stale. MutationLock::acquire never recovers; recovery is opt-in per commit via a caller-supplied StaleLockVerifier and displaces only the exact observed record. Staging is owner-private (0700/0600 on Unix); its placement is an authority decision — ordinary plans stage beside the install root, InstallPlan::for_current_executable stages inside it so a self-update never needs write authority above the executable's directory.
  • A program can replace the executable it is running through the same transaction model (InstallPlan::for_current_executable). The old generation is renamed aside, not deleted, so RollBack stays possible; on Windows a kept-installed update reports CleanupDisposition::DeferredToProcessExit because the old image is still mapped.
  • eggup-eggpack archives stop at extraction-required evidence; URL/install-root/ownership/permission/authenticity policy stays caller-owned.

Planning governance

Process detail: architecture/tooling-governance.md §6. Full checklist: the planning-workflow skill.

  • plans/000–003 (spec, terminology, roadmap, process) are normative — do not edit in ordinary work. Accepted ADRs in plans/adrs/ are superseded, never rewritten.
  • Work flow: subsystem roadmap → bounded implementation/<subsystem>/NNN-*.md plan (16-section template in implementation/README.md, needs SHA baseline + non-goals + failure semantics + verification commands) → implement → closure/<subsystem>/NNN-status.md (requirement→evidence matrix, exact commands, per-platform results) → update plans/registry.md + roadmap status table.
  • "medium-or-higher" is the de facto blocking-severity gate: any such issue still open forces a new corrective before the milestone closes.
  • Public API changes need rustdoc; keep library-crate README.md + CHANGELOG.md (Unreleased, with a no-publication/no-migration disclaimer) current. The root CHANGELOG.md aggregates but does not replace the per-crate ones — an unpublished fix (notably a security fix in an already-published crate) must appear in both.

Releasing

Publication is a tracked milestone, never a side effect and never automated by CI. See the release-workflow skill and architecture/tooling-governance.md §8. Note that eggup-eggpack pins its Eggup dependencies exactly (see crates/eggup-eggpack/Cargo.toml), so a seam fix needs a separate adapter republication to reach it.