Question
Can the four derive-macro crates that downstream clients still depend on directly — serde, prost, thiserror, clap — be brought under kernal-api later, so that a client like soldr ends up depending only on kernal-api (plus zccache)?
This is a follow-up / research issue, not a request to change policy now. Filed from soldr's dependency-consolidation work, where the owner accepted this interim end state:
soldr → kernal-api + zccache + serde + prost + thiserror + clap
and asked for this issue so the last four can be revisited.
Why they are not covered today
AGENTS.md forbids re-exporting backends: "never re-export, alias, or name a backend type in a public position. There are no exceptions." (enforced by tests/source_policy/facade_policy.rs::implementation_crates_are_not_publicly_reexported and the kernal_api_boundary lint). These four are also not on the lint's owned-backend list, so clients may depend on them directly — which is what soldr will do in the meantime.
kernal-api already offers derive-free alternatives for some uses: json (a value tree, #211), command-schema (a schema API over a private clap, #215), error-context (#218). Moving a client onto those is a rewrite, not a dependency swap.
What each crate would take (measured in soldr, 2026-09-18)
| Crate |
soldr usage |
Path override in the derive? |
Implication |
serde (1.0.229) |
219 derives, 170 #[serde(..)] |
Yes: #[serde(crate = "...")] |
A path-override route is mechanical but touches every container |
prost (0.14.4) |
55 derives, 232 #[prost(..)] |
Yes: #[prost(prost_path = "...")] (prost-derive/src/lib.rs); generated code also needs bytes via that path |
Mechanical |
thiserror (2.x) |
14 derives, 75 #[error] |
No — emits the absolute path ::thiserror::__private (thiserror-impl fallback.rs, expand.rs) |
Cannot be satisfied by a re-export; needs a companion crate or a kernal-api-owned error derive |
clap (4.6) |
24 derives, ~250 attributes |
No override attribute, but emits relative clap:: paths |
Possibly satisfiable by a scoped use; unverified |
Options to evaluate
- Status quo — clients keep these four directly. Zero cost; the interim end state above.
- A kernal-api-owned derive companion (e.g.
kernal-api-derive, a proc-macro crate) providing serde/prost/error/CLI derives that expand to kernal-api-owned paths. Consistent with the no-re-export rule, since the backend never appears in a client's public position. Note zccache's amalgamation script has no proc-macro handling, and #1579 recorded that adding a proc-macro companion "needs a call from the owner".
- Rewrite clients onto the existing derive-free facades (
json, command-schema, error-context). Largest client-side cost (~310 derive sites in soldr alone); changes wire/config/CLI code shape.
- A narrowly scoped exception to the re-export rule for these four. Explicitly contrary to
AGENTS.md; listed for completeness.
Also worth deciding here
thiserror is the forcing case: whichever option is chosen must handle its absolute-path expansion.
- Version ownership: kernal-api already pins
thiserror =2.0.20 and optionally serde, prost, clap =4.6.0. If clients keep direct deps, they must stay compatible with those exact pins (soldr currently locks clap 4.6.6, which a =4.6.0 pin would downgrade if kernal-api's command-schema feature is enabled).
Related: zackees/soldr dependency-consolidation tracking issue (linked below once filed).
Question
Can the four derive-macro crates that downstream clients still depend on directly —
serde,prost,thiserror,clap— be brought underkernal-apilater, so that a client like soldr ends up depending only onkernal-api(pluszccache)?This is a follow-up / research issue, not a request to change policy now. Filed from soldr's dependency-consolidation work, where the owner accepted this interim end state:
and asked for this issue so the last four can be revisited.
Why they are not covered today
AGENTS.mdforbids re-exporting backends: "never re-export, alias, or name a backend type in a public position. There are no exceptions." (enforced bytests/source_policy/facade_policy.rs::implementation_crates_are_not_publicly_reexportedand thekernal_api_boundarylint). These four are also not on the lint's owned-backend list, so clients may depend on them directly — which is what soldr will do in the meantime.kernal-api already offers derive-free alternatives for some uses:
json(a value tree, #211),command-schema(a schema API over a private clap, #215),error-context(#218). Moving a client onto those is a rewrite, not a dependency swap.What each crate would take (measured in soldr, 2026-09-18)
serde(1.0.229)#[serde(..)]#[serde(crate = "...")]prost(0.14.4)#[prost(..)]#[prost(prost_path = "...")](prost-derive/src/lib.rs); generated code also needsbytesvia that paththiserror(2.x)#[error]::thiserror::__private(thiserror-implfallback.rs,expand.rs)clap(4.6)clap::pathsuse; unverifiedOptions to evaluate
kernal-api-derive, a proc-macro crate) providing serde/prost/error/CLI derives that expand to kernal-api-owned paths. Consistent with the no-re-export rule, since the backend never appears in a client's public position. Note zccache's amalgamation script has no proc-macro handling, and #1579 recorded that adding a proc-macro companion "needs a call from the owner".json,command-schema,error-context). Largest client-side cost (~310 derive sites in soldr alone); changes wire/config/CLI code shape.AGENTS.md; listed for completeness.Also worth deciding here
thiserroris the forcing case: whichever option is chosen must handle its absolute-path expansion.thiserror =2.0.20and optionallyserde,prost,clap =4.6.0. If clients keep direct deps, they must stay compatible with those exact pins (soldr currently locksclap4.6.6, which a=4.6.0pin would downgrade if kernal-api'scommand-schemafeature is enabled).Related: zackees/soldr dependency-consolidation tracking issue (linked below once filed).