Skip to content

chore(docs): reconcile vapor + capability-gating drift across M2-M5 - #68

Merged
brunota20 merged 2 commits into
deploy/cow-1076-observe-on-m5from
chore/docs-reconciliation-m2-m5
Jun 24, 2026
Merged

chore(docs): reconcile vapor + capability-gating drift across M2-M5#68
brunota20 merged 2 commits into
deploy/cow-1076-observe-on-m5from
chore/docs-reconciliation-m2-m5

Conversation

@brunota20

Copy link
Copy Markdown

What does this PR do?

Reconciles the M2-M5 design docs with shipped code. Removes vapor (features described in docs but absent from code per ADR-0009) and aligns the capability-gating section to reflect what 0.2 actually validates (boot-time link-time enforcement, not per-call dispatch). Documentation only - no Rust source files touched, runtime behaviour unchanged.

Two logical commits:

  1. chore(docs): vapor sweep - mark unshipped features as future direction - all eight non-diagram docs.
  2. chore(docs): align capability gating to shipped link-time enforcement - docs/diagrams/diagrams.md only.

Why

Pre-empts the doc-and-claims findings that would otherwise burn in mfw78's review. The conformance check at bruno-brain/wiki/projects/shepherd-audits/m2-m5-conformance-2026-06-23.md flagged five vapor items - the #[nexum::module] / #[shepherd::module] proc macros, the cargo-nexum cargo subcommand, a separate nexum-sdk crate, the :8080/health JSON endpoint, and per-module [module.resources] manifest caps - and one spec drift (per-call capability dispatch claimed in docs/diagrams/diagrams.md). Mfw78's recurring theme #3 is "docs must match shipped code, no drift", so this PR closes the gap without changing any runtime behaviour.

ADR-0009 already captured the M3 architectural decision (host-trait seam supersedes the proc-macro design). This PR teaches the rest of the doc set to point at ADR-0009 rather than describe the superseded shape as if it ships.

Changes

  • docs/00-overview.md:

    • Module-package block dropped the unshipped [module.resources] section; added a "not in 0.2 scope" future-direction note covering both the resource caps and the optional trap-stub fallback.
    • SDK section rewritten: shipped surface (shepherd-sdk + shepherd-sdk-test, host-trait seam per ADR-0009, helpers, prelude) replaces the previous two-crate proc-macro table; the layered split + macros + cargo-nexum are framed as future direction.
    • Observability table dropped the :8080/health row; explained that 0.2 liveness is signalled by the :9100/metrics scrape and the structured tracing JSON; flagged the JSON endpoint as future direction.
    • Repo-structure block updated to match the shipped layout.
    • Grant-milestones table M3 entry updated to describe shipped crates rather than vapor.
  • docs/02-modules-events-packaging.md: renamed nexum.toml -> module.toml (per ADR-0001); dropped [module.resources] / [module.restart] from the example manifest; updated [capabilities] prose to describe actual boot-time link-time enforcement; added future-direction note.

  • docs/05-sdk-design.md: top status box rewritten to flag the entire doc as 0.3+ north-star and point at ADR-0009; cargo-nexum CLI subsection prefaced "not in 0.2 scope".

  • docs/06-production-hardening.md: resource-enforcement intro updated to use compile-time globals (DEFAULT_FUEL_PER_EVENT, DEFAULT_MEMORY_LIMIT from crates/nexum-engine/src/runtime/limits.rs); memory + storage subsections rewritten to describe what the engine actually does; Health-Checks section reframed (JSON endpoint as future direction); deployment-Docker block replaced with the shipped shape (port 9100, tini, nexum-engine binary).

  • docs/01-runtime-environment.md: guest-side author experience sections prefaced as future-direction macro form pointing at sdk.md.

  • docs/07-rpc-namespace-design.md: SDK-shape note at top: macro-driven authoring model is future direction; ADR-0009 is the shipped seam.

  • docs/08-platform-generalisation.md: SDK-layering subsection updated to flag the two-crate split as 0.3+ target; summary table updated accordingly.

  • docs/migration/0.1-to-0.2.md: engine-crate-rename paragraph no longer lists nexum-sdk + cargo-nexum as shipped.

  • docs/diagrams/diagrams.md: diagram-2 class caption and diagram-7 (Capability Dispatch) caption rewritten to describe link-time enforcement (manifest::enforce_capabilities against KNOWN_CAPABILITIES); per-call dispatch preserved as 0.3+ direction.

Breaking changes

None. Documentation-only.

Testing

  • cargo doc --workspace --no-deps clean (one pre-existing warning in crates/shepherd-sdk/src/cow/app_data.rs:19 for an unresolved EMPTY_APP_DATA_JSON link; that source file is not touched by this PR and is out of scope).
  • No code changes; runtime behaviour unchanged.
  • Verified crates/nexum-engine/src/manifest/capabilities.rs::enforce_capabilities is link-time-only against KNOWN_CAPABILITIES + manifest required union optional, with no per-call dispatch hook in HostState.

Notes for reviewers

The 0.2 capability model uses link-time enforcement: an undeclared capability prevents the module from importing the relevant WIT, so unauthorised calls fail at component link rather than at per-call dispatch. Functionally equivalent for the current 0.2 capability set, but the design space for per-call dispatch (runtime capability revocation, finer-grained policies under a richer threat model) remains open for 0.3+. The diagram-7 caption explicitly preserves that direction rather than deleting it.

Base branch is deploy/cow-1076-observe-on-m5 because that is where the M2-M5 docs being reconciled actually live; opening this against main would surface a multi-milestone diff that has nothing to do with this PR.

Two items the audit flagged but were intentionally not touched:

  • ADR-0006 promises KNOWN_CAPABILITIES does not gain "twap" / "ethflow" entries (delivered). The ADR does not actually promise per-call gating - that claim was only in docs/diagrams/diagrams.md.
  • ADR-0009 itself is the canonical superseding decision and was deliberately not edited; this PR only points the rest of the doc set at it.

Deviations from the brief

  • The audit's "find docs/adr/0006" instruction found ADR-0006 had no per-call promise to amend; the actual stale claim was in docs/diagrams/diagrams.md, so the capability-gating fix landed there only. No ADR file was modified.
  • The brief mentioned "diagram 8 caption" for capability gating; in docs/diagrams/diagrams.md the capability-dispatch diagram is numbered 7 (diagram 8 is the repo-dependency map). Edits applied to diagram 7 + the diagram-2 class caption that also carried the stale claim. Brain-side architecture.md was not touched per the brief.

AI assistance disclosure

AI Assistance: Claude Code (Opus 4.7) made these doc edits by cross-referencing the conformance audit findings against the shipped code at HEAD of deploy/cow-1076-observe-on-m5. A human (Bruno) is accountable for the result and will review before requesting mfw's review.

Reconciles the M2-M5 design docs with what shipped at 0.2. The conformance
audit at bruno-brain/wiki/projects/shepherd-audits/m2-m5-conformance-2026-06-23.md
flagged five vapor items - features documented as part of 0.2 that do not
exist in code (per ADR-0009). This commit removes the claims that they
ship today and re-frames each as future direction with a clear "not in
0.2 scope" qualifier. No code is touched; runtime behaviour is unchanged.

Vapor items addressed:

- #[nexum::module] / #[shepherd::module] proc macros. Absent in code; the
  shipped surface is the host-trait seam from ADR-0009. doc 00 SDK table
  and repo-structure block updated; doc 01 author-experience sections
  framed as future direction; doc 05 (north-star) status box rewritten to
  point at ADR-0009; doc 07 RPC-design adds an SDK-shape note pointing at
  ADR-0009; doc 08 SDK-layering diagram caption marked as 0.3+ target.

- cargo-nexum CLI. Absent in code. doc 00 SDK table / repo structure no
  longer lists it; doc 05 CLI subsection prefaced as future direction.

- Separate nexum-sdk crate. Only shepherd-sdk + shepherd-sdk-test ship.
  doc 00 SDK section, doc 05 status box, doc 08 platform-generalisation
  summary table and SDK-layering subsection all updated to describe the
  one-crate shipped reality with the two-crate split as future direction.

- :8080/health JSON endpoint. Engine binds no health port; only the
  metrics scrape exists. doc 00 observability table and doc 06
  Health-Checks section rewritten to describe the 0.2 liveness signal
  (metrics scrape + tracing JSON + Docker TCP probe) with the JSON
  endpoint flagged as future direction.

- Per-module [module.resources] manifest caps. Not parsed; the engine
  uses compile-time DEFAULT_FUEL_PER_EVENT (1B) and DEFAULT_MEMORY_LIMIT
  (64 MiB) from crates/nexum-engine/src/runtime/limits.rs. doc 00 module
  package block dropped the [module.resources] section + added a future-
  direction note; doc 02 manifest example updated and the misnamed
  nexum.toml replaced with module.toml (per ADR-0001); doc 06 Resource-
  Enforcement intro and Memory / Storage subsections updated to use the
  shipped global defaults; the runtime config TOML at end of doc 06
  flagged [runtime.defaults.resources] / [runtime.defaults.restart] as
  future direction.

Drift-while-in-there:

- doc 02 renamed nexum.toml -> module.toml per ADR-0001 (decision
  shipped, doc was stale).
- doc 06 Deployment-Docker block: replaced the speculative `nexum` binary
  + 8080/9090 ports with the actual shipped Dockerfile shape (nexum-
  engine binary, tini PID1, port 9100 for metrics; see
  docs/deployment/docker.md for the canonical operator config).
- doc 00 observability table updated metrics port 9090 -> 9100 to match
  the shipped Dockerfile.
- doc 01 guest-experience subsections marked as future-direction macro
  form, pointing at sdk.md + the example modules for the shipped pattern.
- docs/migration/0.1-to-0.2.md crate-rename paragraph no longer lists
  nexum-sdk + cargo-nexum as shipped 0.2 siblings.

The 0.2 capability model is link-time, not per-call. That spec drift is
in docs/diagrams/diagrams.md and is addressed in the next commit.

## AI assistance disclosure

AI Assistance: Claude Code (Opus 4.7) made these doc edits by cross-
referencing the conformance audit findings against the shipped code at
HEAD of deploy/cow-1076-observe-on-m5. A human (Bruno) is accountable
for the result and will review before requesting mfw's review.
The 0.2 capability model is link-time, not per-call. Updates two
captions in docs/diagrams/diagrams.md that previously claimed the
HostState performs a per-call manifest.required check and that per-call
gating is the M2 target. Neither claim matches the shipped code.

What 0.2 actually enforces:

- At boot, manifest::enforce_capabilities (in
  crates/nexum-engine/src/manifest/capabilities.rs) cross-checks every
  capability-bearing WIT import of the component against
  [capabilities].required + [capabilities].optional in module.toml, with
  names validated against KNOWN_CAPABILITIES.
- A module that imports a capability it did not declare fails
  instantiation - it never reaches dispatch.
- This is structurally equivalent to per-call gating for the 0.2
  capability set: an undeclared capability cannot link the relevant WIT,
  so unauthorised calls fail at component link rather than at per-call
  dispatch.

Per-call gating in HostState (returning host-error { kind: denied } per
invocation, useful for finer-grained policies or capability revocation
at runtime) remains a future direction for 0.3+ if a richer threat
model demands it; the design space is preserved in the diagram-7
caption rather than deleted.

Files touched:

- docs/diagrams/diagrams.md: diagram-2 (class diagram) caption for
  HostState reworded to say "Capability authorisation is enforced at
  boot (link-time) by manifest::enforce_capabilities, not per call - see
  diagram 7 for the dispatch path"; diagram-7 (Capability Dispatch)
  HostState row rewritten with the full link-time-vs-per-call
  explanation pointing at the actual code path.

No code changes. No ADR edits (ADR-0006 does not actually promise
per-call dispatch; it only references KNOWN_CAPABILITIES at boot, which
ships).

## AI assistance disclosure

AI Assistance: Claude Code (Opus 4.7) made these doc edits by cross-
referencing the conformance audit findings against
crates/nexum-engine/src/manifest/capabilities.rs at HEAD of
deploy/cow-1076-observe-on-m5.
@brunota20
brunota20 merged commit 04381d3 into deploy/cow-1076-observe-on-m5 Jun 24, 2026
2 checks passed
brunota20 added a commit that referenced this pull request Jun 25, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
brunota20 added a commit that referenced this pull request Jun 25, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
brunota20 added a commit that referenced this pull request Jun 25, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
brunota20 added a commit that referenced this pull request Jun 25, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
brunota20 added a commit that referenced this pull request Jun 26, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
jean-neiverth pushed a commit that referenced this pull request Jun 29, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
jean-neiverth pushed a commit that referenced this pull request Jun 30, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
jean-neiverth pushed a commit that referenced this pull request Jun 30, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
jean-neiverth pushed a commit that referenced this pull request Jun 30, 2026
)

Squash of PR #68 - 9 markdown files reconciled (5 vapor items rephrased as future direction + capability-gating diagrams aligned to link-time enforcement). Verified: cargo doc --workspace --no-deps clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant