Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ADR: Put tests at the closest layer with a decisive oracle

- **Date:** 2026-03-29
- **Status:** accepted
- **Supersedes:** none
- **Related:** [Testing Architecture](../../../doc/2026-03-29T00-00-00Z_reference_testing_architecture/2026-03-29T00-00-00Z_reference_testing_architecture.md)

## Context

The repository has distinct Rust, TypeScript, browser, deployment, and Nix
surfaces. A single test layer cannot give fast feedback for pure logic and
also prove real user-facing or deployment behavior. The reference record catalogs these layers and their coverage; it does not
record an explicit alternatives analysis. As this ADR's synthesis, the tradeoff
is between relying mainly on narrow unit tests, which miss cross-system
behavior, and pushing coverage into end-to-end tests, which is slower and
often depends on host state.

## Decision

Place each test at the closest layer that can decisively check its behavior:
unit tests for pure logic, integration or CLI tests for command behavior,
TypeScript tests for frontend logic, Playwright for interactive web behavior,
and VM/deployment tests for system integration. Keep CI checks hermetic;
retain local full end-to-end coverage for cases that depend on host state.

## Consequences

Contributors can choose a test layer using the behavior under test rather
than defaulting to one broad suite. Fast, hermetic checks remain suitable for
CI, while local end-to-end coverage can catch cross-system behavior that a
sandbox cannot faithfully exercise. No layer is a substitute for another
when its oracle cannot decide the behavior in question.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ADR: Run Roc worlds as server-authoritative, mediated programs

- **Date:** 2026-10-07
- **Status:** accepted
- **Supersedes:** none
- **Related:** [Roc-Defined Multiplayer Worlds](../../../doc/2026-10-07T00-20-00Z_architecture_roc_worlds/2026-10-07T00-20-00Z_architecture_roc_worlds.md); [Attenuated capabilities for world access](../../../doc/2026-10-09T09-59-07Z_design_attenuated_capabilities/2026-10-09T09-59-07Z_design_attenuated_capabilities.md)

## Context

Multiplayer worlds need shared, reproducible state without granting guest
programs ambient access to the host. The source record contrasts server
authority with peer consensus and revises its initial stateless transition
sketch. As an ADR synthesis, the alternatives are client-authoritative
execution, which moves authority to peers; consensus-based execution, which
adds peer coordination; and unrestricted native code, which makes an
untrusted program indistinguishable from host code. This ADR records the
settled per-world Store+Instance design rather than the initial sketch.

## Decision

The server is authoritative for each world. World programs run through a
versioned Roc/Wasm boundary in a per-world Store+Instance, with no ambient
filesystem, network, clock, randomness, or process access. Host effects are
explicit mediated capabilities, constrained by administrator-set limits and
the program's trust tier; a node identity is not itself authorization.
Unpinned or peer-supplied code remains in the Wasm tier and is never promoted
to native execution. Persist world changes in the durable event-sourced
`.id-worlds/` journal; retain the protocol's versioning and provenance rules.

## Consequences

The server owns ordering and world state, and guests remain portable across
transports and constrained by a declared host interface. The host must maintain the ABI, capability mediation, execution limits, and
durable journal semantics. The native tier is implemented as an administrator opt-in worker isolated
with OS controls, including Landlock, seccomp, rlimits, and a per-call
deadline. A dead worker poisons the program; after a server restart, the
worker and journal state are restored from stored artifacts. Native execution
is not claimed to be resource-safe in-process. It requires explicit trusted provenance rather than language or
peer identity; distributed consensus and general replicated writes are
outside this decision. Follow-up: preserve the worker isolation and
admin-configured resource limits ([source record](../../../doc/2026-10-07T00-20-00Z_architecture_roc_worlds/2026-10-07T00-20-00Z_architecture_roc_worlds.md)).
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ADR: Separate world presentation from transport and bound host effects

- **Date:** 2026-10-14
- **Status:** accepted
- **Supersedes:** none
- **Related:** [Portable world surfaces and controlled execution profiles](../../../doc/2026-10-14T19-39-30Z_architecture_portable_world_surfaces/2026-10-14T19-39-30Z_architecture_portable_world_surfaces.md); [World presentation, rendering, and fuel](../../../doc/2026-10-31T17-47-20Z_design_world_presentation_and_fuel/2026-10-31T17-47-20Z_design_world_presentation_and_fuel.md)

## Context

World programs may be presented by terminals, browsers, or other transports.
The alternatives were transport-specific ANSI/HTML/CSS, which couple guests
to one renderer, or arbitrary guest markup, which bypasses host validation.
Likewise, interpreting “direct control” as unrestricted host access would
exceed the intended operator-controlled capability boundary.

## Decision

Use a validated, versioned presentation value as the program-to-transport
seam. The guest emits structured rows and style spans (with legacy text
fallback); the host validates bounds and shape, then each transport renders
the same model. Keep effects explicit and named under per-world ceilings and
validated limits. The planned source-only policy accepts source for the configured trusted
compiler when enabled; it is not yet implemented. Raw Wasm remains a
trusted-artifact path. A configuration
toggle does not grant ambient filesystem, network, or process access; any
future direct host integration requires a separately audited least-privilege
adapter.

## Consequences

Multiple presenters can share one validated guest model, and legacy
text-only consumers continue to work. The host owns parsing, validation, and
rendering adapters. Follow-up work includes P9.2 input events and P9.3 source-only mode,
compiler provenance, and per-world profiles ([Phase 9 plan](../../../.opencode/plans/phase-9-portable-platform.md); [source record](../../../doc/2026-10-14T19-39-30Z_architecture_portable_world_surfaces/2026-10-14T19-39-30Z_architecture_portable_world_surfaces.md)). New host effects require explicit review and mediation; compiler identity/version provenance is not solved here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ADR: Establish trusted foundations before expanding platform flexibility

- **Date:** 2026-10-17
- **Status:** accepted
- **Supersedes:** none
- **Related:** [Next stage of the platform: foundations, then flexibility](../../../doc/2026-10-17T15-00-00Z_architecture_next_stage_platform/2026-10-17T15-00-00Z_architecture_next_stage_platform.md)

## Context

Feature work depends on trustworthy CI and observable runtime behavior. The
source record identifies test setup failures and missing measurements as
foundational risks, and names rollback and host-reach boundaries that should
not be deferred until after new journal entries or effects ship. The source
record states the principles but does not enumerate alternatives; this ADR
frames the tradeoff as expanding features in parallel with foundation repair,
which makes failures harder to attribute and recovery less reliable, versus
optimizing before measuring, which leaves no trustworthy baseline.

## Decision

Repair and trust the foundation before feature expansion: CI repair is a
prerequisite, and performance work is measured before optimization. Keep one
authoritative client projection, require a versioned format/check/backup
rollback path before introducing a journal entry type, prefer data registries
and manifests for extensibility, and make every new capability ceilinged,
audited, and off by default.

## Consequences

Feature sequencing may be slower until the checks and recovery path are
reliable, but changes have a measurable baseline and a defined rollback
route. Extensibility can be added through data without creating a second
authority for visibility. New effects cannot gain reach merely through a
configuration switch; longer-term protocol choices explicitly left open in
the source record remain undecided. Follow-up: repair and validate the CI and
rollback foundations in [Phase 11](../../../.opencode/plans/phase-11-foundations.md) before the extensibility work in [Phase 12](../../../.opencode/plans/phase-12-platform-flexibility.md), including journal safeguards ([#227](https://github.com/developing-today/code/issues/227), [#244](https://github.com/developing-today/code/issues/244)) and the measured fuel work ([#247](https://github.com/developing-today/code/pull/247), [#248](https://github.com/developing-today/code/pull/248)); CI deadline adjustment is tracked by [#224](https://github.com/developing-today/code/issues/224).
39 changes: 39 additions & 0 deletions planning/architecture/adr/2026-11-01_id-crate-split-phase-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ADR: Split `pkgs/id` at low-dependency module seams without changing callers

- **Date:** 2026-11-01
- **Status:** accepted
- **Supersedes:** none
- **Related:** [`pkgs/id` crate split: Phase 1 architecture](../../../doc/2026-11-01T15-42-00Z_architecture_id_crate_split/2026-11-01T15-42-00Z_architecture_id_crate_split.md); [crate split design](../../../doc/2026-11-01T16-53-00Z_design_id_crate_split/2026-11-01T16-53-00Z_design_id_crate_split.md); [crate-split follow-on mapping](../../../doc/2026-11-04_id-program-essay-answers.md); [#3447](https://github.com/developing-today/code/issues/3447); [#3471](https://github.com/developing-today/code/pull/3471); [#3195](https://github.com/developing-today/code/issues/3195)

## Context

The `id` compilation unit is large, but changing its public paths, CLI
behavior, wire formats, or test coverage would make a compilation-boundary
refactor a behavior change. The source record identifies low-dependency leaf
modules as a separable seam while keeping the binary and root-only
construction in the existing package.

## Decision

Keep `pkgs/id` as the package and workspace root and extract the selected
low-dependency leaves into an `id-core` workspace member. Move modules rather
than copy them; move leaf-owned types with their defining module, and keep
root-only construction behind narrow interfaces. Re-export extracted items
at their historical `crate::` paths and explicitly forward relevant feature
selections with defaults disabled. Keep test utilities dev-only, include both
crates in workspace checks, and update freshness/build guards to account for
the new crate boundary. As an ADR framing of the tradeoff (the source record
does not enumerate alternatives), extracting without historical-path
re-exports would break callers; extracting more modules in Phase 1 would
expand risk beyond the low-dependency seam.

## Consequences

The dependency seam can be compiled and checked independently while existing
callers, CLI output, wire formats, and tests remain stable. The workspace, feature forwarding, build freshness, and shipped-dependency
guards must all recognize both crates. Validation commitments are formatting,
all-features workspace tests with unchanged test count, unchanged shipped
binary and `id --help`, the existing Nix build, and cold Cargo/Nix build-time
measurements using [issue #3195](https://github.com/developing-today/code/issues/3195)
as the method. Follow-up: the separately queued `id-worlds` extraction
([#4408](https://github.com/developing-today/code/issues/4408); [source record](../../../doc/2026-11-01T15-42-00Z_architecture_id_crate_split/2026-11-01T15-42-00Z_architecture_id_crate_split.md)) remains out of scope; later sync, groups, web, and binary-facing extractions require separate decisions.
40 changes: 40 additions & 0 deletions planning/architecture/adr/2026-11-03_provider-registry-slice-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ADR: Derive provider readers from one descriptive registry

- **Date:** 2026-11-03
- **Status:** accepted
- **Supersedes:** none
- **Related:** [F12.4 Provider Registry — Slice 1](../../../doc/2026-11-03T10-06-40Z_architecture_provider_registry_slice1/2026-11-03T10-06-40Z_architecture_provider_registry_slice1.md); [#1061](https://github.com/developing-today/code/issues/1061); [#838](https://github.com/developing-today/code/issues/838); [#4656](https://github.com/developing-today/code/pull/4656)

## Context

The capability catalog, ledger, compile gate, and CLI risked drifting as
separately maintained views. After merged PR #4656 established `CatalogEntry`, `CATALOG_ENTRIES`, and the
narrower `default_ceiling_names()` seam, a second registry would duplicate
authority. Issue #838 was the safety gate preventing registered providers
from widening existing world ceilings. The initial task packet
also predated that catalog and is not the settled design.

## Decision

Extend the existing `CatalogEntry`/`CATALOG_ENTRIES` seam from merged PR
#4656, statically registering the current 17 capabilities only; do not add
providers or dynamic loading in this slice. Record provider names,
versions, argument schemas, bounds, required scopes, and default ceilings as
descriptive manifests, and derive the legacy catalog, ledger, compile-gate,
and CLI readers from that registry. Preserve the distinction between the
full catalog and `default_ceiling_names()`; every default path must use the
narrower guard so registering a provider cannot widen world ceilings. Keep
request, subscription, and
platform-module manifest boundaries distinct; metadata does not move
validation or dispatch from their existing boundaries, and parser `wants`
limits remain global.

## Consequences

Readers share one inventory without changing accepted requests, refusal
codes, or execution behavior. The default-ceiling API remains intentionally
narrower than the explicit catalog, and future providers or dynamic loading
require separate decisions under the broader provider-registry work
([#1061](https://github.com/developing-today/code/issues/1061); later F12.4
slice 2). Slice 1 does not authorize a behavioral change to validation,
dispatch, or parser limits.
9 changes: 6 additions & 3 deletions planning/architecture/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ revises an earlier record without rewriting it.

## Index

_No ADRs yet. The first entries are expected from slice 2 of
[#6380](https://github.com/developing-today/code/issues/6380): ADRs for
the major decisions the architecture index surfaces._
- [2026-03-29 — Put tests at the closest layer with a decisive oracle](2026-03-29_testing-at-the-closest-decidable-layer.md) — accepted; [source](../../../doc/2026-03-29T00-00-00Z_reference_testing_architecture/2026-03-29T00-00-00Z_reference_testing_architecture.md)
- [2026-10-07 — Run Roc worlds as server-authoritative, mediated programs](2026-10-07_server-authoritative-roc-worlds.md) — accepted; [source](../../../doc/2026-10-07T00-20-00Z_architecture_roc_worlds/2026-10-07T00-20-00Z_architecture_roc_worlds.md)
- [2026-10-14 — Separate world presentation from transport and bound host effects](2026-10-14_portable-world-surfaces-and-bounded-effects.md) — accepted; [source](../../../doc/2026-10-14T19-39-30Z_architecture_portable_world_surfaces/2026-10-14T19-39-30Z_architecture_portable_world_surfaces.md)
- [2026-10-17 — Establish trusted foundations before expanding platform flexibility](2026-10-17_foundations-before-platform-flexibility.md) — accepted; [source](../../../doc/2026-10-17T15-00-00Z_architecture_next_stage_platform/2026-10-17T15-00-00Z_architecture_next_stage_platform.md)
- [2026-11-01 — Split `pkgs/id` at low-dependency module seams without changing callers](2026-11-01_id-crate-split-phase-1.md) — accepted; [source](../../../doc/2026-11-01T15-42-00Z_architecture_id_crate_split/2026-11-01T15-42-00Z_architecture_id_crate_split.md)
- [2026-11-03 — Derive provider readers from one descriptive registry](2026-11-03_provider-registry-slice-1.md) — accepted; [source](../../../doc/2026-11-03T10-06-40Z_architecture_provider_registry_slice1/2026-11-03T10-06-40Z_architecture_provider_registry_slice1.md)