Developer Reference

Domain newtypes census

Boundary decision record for Ownership item 4 (plan 020). Each named concept records the intended type or an explicit primitive decision at real boundaries.

Six names

NameTypeOwnerDecision
WorkspaceNamejackin_core::WorkspaceNamecoreAdopted — validated config-file stem (existing).
SessionIdjackin_core::SessionIdcoreAdopted — non-zero u64; the capsule SessionSupervisor registry stores typed keys and converts raw ids at pane/control protocol edges.
ContainerIdjackin_core::ContainerIdcoreAdopted — non-empty name without whitespace/path separators; runtime attention deduplication stores typed identities and the launch pipeline validates before deriving Docker resource names.
RoleRefcore/manifestPrimitive for now (String / RoleSelector) — selector + namespaced key already exist; newtype deferred until a validation rule beyond selector parse is needed.
TokenCountusagePrimitive for now (u64) — usage/pricing paths already use domain structs; avoid double-wrapping until a cross-crate unit mismatch appears.
MountPathconfig/isolationPrimitive for now (String/PathBuf) — mount tables mix host absolute paths and container dst paths; a single newtype would blur that distinction. Prefer host_src/container_dst field names.

Error taxonomy pilot

jackin-config now exposes ConfigResult<T> from every public fallible function. ConfigError carries machine-matchable validation/lookup variants plus transparent source variants for IO, TOML, path, workspace-name, and collapse failures; internal orchestration may still use anyhow. The conversion changed public signatures but required adapters at fewer than 30% of implementation sites, so the pilot is positive: repeat this pattern at runtime/capsule library boundaries while retaining anyhow in top-level reporting flows. remove_workspace_errors_when_missing matches UnknownWorkspace directly as the caller proof.

Adjunct decisions

  • Result-first constructors: newtypes use Result constructors (SessionId::new, ContainerId::parse, WorkspaceName::parse).
  • Boundary proof: the capsule registry rejects zero ids, attention ingestion rejects path-like container names, and production launch calls DockerResources::from_container_id before Docker resource derivation. Persisted and wire structs retain transparent primitive schemas.
  • async fn in trait Send: public port traits that cross spawned-task boundaries require Send; local-only traits document the absence. No blanket async_trait expansion is needed on the current stable compiler.
  • #[non_exhaustive]: extensible public taxonomies such as ConfigError are #[non_exhaustive]; the two newtype constructor errors are deliberately closed because validation has an exhaustive, stable rule set.

Public-surface note (plan 019)

Executable public-surface ratchet (public_surface_pub_mods) measures root pub mod counts per crate. Growth is shrink-only; API snapshots were intentionally not chosen as the gate.

Env-pilot guard (cargo xtask lint archcheck_curated_pub_mods) allowlists root pub mods for curated crates (jackin-envtest_support only). Full jackin-config / jackin-core root narrowing is STOP-deferred (import blast radius); the ratchet bounds the surface until module-cluster slices land.

Trait-sealing spot audit (jackin-core / jackin-config)

TraitCrateDisposition
AgentRuntimecoreSealed (private::Sealed) — extension only via in-crate adapters
DockerApicoreIntentionally implementable — fakes + production Docker client
CommandRunnercoreIntentionally implementable — process runner fakes
ClockcoreIntentionally implementableSystemClock / ManualClock
DebugLogSinkcoreIntentionally implementable — test/production sinks
OperatorNoticeSinkcoreIntentionally implementable
StandaloneDialogSinkcoreIntentionally implementable
BuildLogSinkcoreIntentionally implementable
LaunchDiagnostics / LaunchHostTerminal / LaunchOutputSinkcoreIntentionally implementable — launch harness ports
(none public)configNo public traits at root; error types are enums

Non-extension points that remain open are port/fake seams; sealing them would break the intentional test-double surface. No additional seals required this track.

On this page