Repository navigation
Description
Context
Follow up on #189: audit kernal-api for other APIs that duplicate running-process definitions or mechanically translate between equivalent types, then plan their replacement with direct Rust re-exports under the kernal-api namespace.
The requested direction is one canonical definition and implementation, not two enums/structs that coincidentally match:
pub use running_process::SomeType;
pub use running_process::SomeType as PublicName;
pub use running_process::some_operation as public_operation;Aliases preserve actual Rust type identity. They stay synchronized with the selected dependency version without maintaining conversion tables. This does not mean automatically upgrading Cargo dependency versions.
This issue is an audit and migration plan for later work. Do not implement a repository-wide refactor as part of the audit.
Investigation
Two investigation rounds on local kernal-api revision 35c258e: inventory of public process/platform types and facade policy, then inspection of concrete backend translation paths and matching running-process definitions. Open/closed searches for re-exports and duplicate facades found #189 as the directly related current work.
Initial candidates, not claims that every listed pair is already semantically interchangeable:
src/daemon_frame_v1.rs: importsrunning_process::frame_v1 as backend; owns DaemonFrame, DaemonFrameKind, DaemonPayloadEncoding, codec/decode/error types and from/to-backend conversions. Preserve unknown discriminants, raw trace header bytes, framing limits, and codec behavior when deciding canonical ownership.src/daemon_registration.rsandsrc/daemon_registration_v2.rs: backend registration adapters, facade enums/errors/records, including explicit CacheRootKind variant conversion. Unknown values and schema/validation guarantees must not disappear in a re-export.src/daemon_identity.rs: identity, endpoint, policy and error wrappers; compare actual semantics before selecting replacements.src/platform/process.rs: SpawnStdio, DaemonStdio, DaemonStdioSource, StdioSource, DaemonChild and SpawnedChild have corresponding substrate facilities inrunning-process-platform-internal/src/platform/process.rs. Public exposure must go through running-process rather than adding a direct internal-crate dependency.src/lib.rsandsrc/process_adapter.rs: stream/session/output/options/errors and conversions around running-process AsyncProcessSessionEvent, StreamKind, and ProcessError. Distinguish genuine facade lifetime/bounds behavior from mechanical duplication.tests/facade_policy.rs:implementation_crates_are_not_publicly_reexportedexplicitly forbidspub use running_process;process_substrate_is_exact_feature_minimal_and_privatealso rejects public backend spellings. ARCHITECTURE.md and AGENTS.md require facade-owned types today. Those rules need a deliberate update for approved canonical re-exports rather than adding more wrapper code to satisfy them.
Proposal
- Inventory duplicated types, constants, traits, functions, default implementations, forwarding wrappers and conversion tables across kernal-api and running-process. Start with the candidates above, then search other adapter modules for the same pattern.
- Produce a checked-in audit table with: facade symbol/path, canonical source symbol/path and revision, actual differences, proposed
pub use/alias, feature gates, signature/serialization/trait compatibility, consumer impact, and migration order. - Make direct re-export the target for confirmed equivalents. Prefer canonicalizing shared semantics in running-process when necessary so kernal-api can delegate without recreating the type. Every retained wrapper must have a concrete behavioral or compatibility reason and a proposed resolution where practical.
- Identify additional public substrate exports required from running-process; do not expose its private platform crate directly or reverse the dependency graph. Link or file narrowly scoped implementation follow-ups for the resulting migration batches.
- Plan changes to documentation and policy tests that permit approved re-exports while retaining intentional boundaries for unrelated native/runtime internals. Avoid a blanket whole-crate re-export or disabling all facade checks.
- Preserve application protocols, unknown wire values, trait implementations, error detail, bounded execution and cleanup guarantees. Record source-breaking changes and a release/consumer migration strategy rather than assuming aliases preserve every wrapper method.
Acceptance criteria
- Publish a source-linked inventory covering the candidate areas and the remaining adapter modules, with explicit duplicate/semantic-difference findings.
- Every confirmed duplicate has a direct re-export/rename plan or a documented blocker and concrete canonicalization follow-up; no replacement mirror types.
- Plan the necessary running-process public exports and keep the dependency direction kernal-api -> running-process.
- Record required architecture/AGENTS/policy-test revisions, feature-gate/default=[] implications, exact dependency-pin updates and consumer compatibility risks.
- Create/link ordered implementation batches with measurable closure conditions, separating this audit from later code changes and avoiding duplicate work from feat: re-export canonical running-process Inherited and Independent spawn API #189.
- Each implementation batch requires RED -> GREEN evidence: compile-time cross-namespace assignability without conversions for re-exported types, plus focused tests for any migrated behavior/wire contract. Equal variant names or debug output alone do not prove type identity.
- Do not perform the migration as part of this audit issue; implementation is deferred to the follow-ups.
Decisions
- File the coordinating audit in kernal-api because it owns the duplicate facade definitions and restrictive policy. Link running-process follow-ups where canonical exports/semantics require changes there.
- Adopt direct namespace re-export/renaming as the desired end state, following the user's correction in feat: re-export canonical running-process Inherited and Independent spawn API #189; duplication is not justified solely by the old facade rule.
- Focus on overlap with running-process first. Record other discovered duplication, but do not automatically expose every third-party crate API.
- P2 planned maintenance. This request authorizes issue filing now; implementation will happen later.
- Verify semantic equivalence instead of assuming similar names mean equivalent contracts. Preserve useful semantics in the canonical API where possible.
Related issues
- feat: re-export canonical running-process Inherited and Independent spawn API #189 — canonical SpawnMode re-export and delegation, the concrete precedent.
- feat: add Inherited and Independent spawn modes with scheduler and broker backends zackees/running-process#1202 — canonical Inherited/Independent native spawn contract.
Activity
zackees commentedon Sep 16, 2026
Closing as superseded, not as done. This is a decision issue whose requested direction was reversed by a later change, and implementing it today would fail three guards.
The ordering
fix!: treat running-process as a third-party backendThe
!is the whole story.What this issue asks for, and what now forbids it
The proposal is to replace duplicated APIs with direct re-exports under the kernal-api namespace:
AGENTS.mdnow says the opposite, as a hard rule:And it is enforced three ways, each of which this proposal would trip:
tests/facade_policy.rs::implementation_crates_are_not_publicly_reexported—"pub use running_process"is in its forbidden list.dylints/kernal_api_boundary—running_processis inOWNED_IMPLEMENTATION_CRATES, and the lint's own documentation names the aliasing case explicitly: "A rename (pub use running_process::StreamKind as CaptureStream) or a glob".AGENTS.mdnames both of the above as the enforcement.The prescribed
pub use running_process::SomeType as PublicNameis now the documented counter-example rather than the recommendation.Why it was reversed
#263 concluded that a re-export hands a client the backend's type identity, and with it the backend's versioning and vocabulary — which is exactly what the facade exists to absorb. A facade-owned type that happens to match is a contract; an alias is a dependency. That reasoning applies whether or not the types coincide today.
What survives
The audit half is still meaningful and is not what makes this stale — finding APIs that mechanically translate between equivalent types, or that maintain conversion tables, is worthwhile under any policy. Only the prescription changed: the replacement is a facade-owned semantic type, not a re-export.
If that audit is still wanted, it is worth refiling under the current rule so the acceptance criteria say "facade-owned type with no conversion table" rather than "direct re-export". I have not filed it, because I have not done the audit and do not want to open an issue asserting a scope I have not measured.
🤖 Generated with Claude Code