6.4 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| core/review-core-sync | Review alknet-core ADR-029/030/031/034/035 sync for spec conformance | completed |
|
moderate | low | phase | review |
Description
Review the alknet-core implementation after the ADR-029/030/031/034/035 sync
for spec conformance, pattern consistency, and correctness. This is the quality
checkpoint at the end of the core phase — before alknet-call (which depends on
the new Identity.id = peer_id semantics) begins its sync.
Review Checklist
-
PeerEntry / AuthPolicy conformance (config.md, auth.md, ADR-030):
PeerEntryhas all 7 fields (peer_id, fingerprints, auth_token_hash, scopes, resources, display_name, enabled)AuthPolicy.authorized_fingerprintsremoved;peers: Vec<PeerEntry>in placeAuthPolicy.api_keysunchangedresolve_identity_from_fingerprintresolves fingerprint → PeerEntry →Identity { id: peer_id }resolve_identity_from_tokenresolves auth_token_hash → PeerEntry → falls through to ApiKeyEntryIdentity.idis the stablepeer_id, not the fingerprint- Disabled peers (
enabled: false) return None - Duplicate
peer_idvalidation
-
ConfigIdentityProvider conformance (auth.md, ADR-030):
resolve_from_fingerprintdelegates toAuthPolicy::resolve_identity_from_fingerprintresolve_from_tokendelegates toAuthPolicy::resolve_identity_from_token(PeerEntry first, ApiKeyEntry fall-through)- Reads from ArcSwap on every call (hot-reloadable — unchanged)
- Does NOT implement
IdentityStore
-
CredentialStore conformance (auth.md, ADR-031/035):
CredentialStoretrait with syncget, asyncput/deleteInMemoryCredentialStoredefault adapter (async put/delete with no .await points)EncryptedDatacore mirror (4 fields, serializable, no vault dep)StoreErrorenum (#[non_exhaustive], thiserror, 3 variants)- No
listmethod - No vault dependency added to core
-
IdentityStore conformance (auth.md, ADR-035):
IdentityStore: IdentityProvidersupertraitput_peer/update_peer/remove_peerall asyncConfigIdentityProviderdoes NOT implement itIdentityProvidertrait unchanged (read-only, sync)
-
Fingerprint normalization conformance (auth.md, ADR-030 §6):
- Ed25519 raw key (SPKI) →
ed25519:<lowercase hex of 32 bytes> - X.509 cert →
SHA256:<hex of DER>(unchanged) - iroh path →
ed25519:<hex>(unchanged) - Same key, same fingerprint across quinn and iroh
- No-client-cert → None (no regression)
- Ed25519 raw key (SPKI) →
-
Three remote roles documentation (ADR-034):
auth.rscomments document the three roles and verifier selection ruleendpoint.rscomments clarify server-side vs client-side verifier concerns
-
Pattern consistency:
- ArcSwap used consistently for DynamicConfig (unchanged)
- Repo/adapter pattern consistent (trait + in-memory default, no backend dep in core)
- No russh dependency in core (unchanged)
- Feature flags (quinn, iroh) gate transport code correctly
-
Security constraints:
PeerEntry.enabled: false→ resolution returns None (revoked peers)StoreErroris#[non_exhaustive]EncryptedDatacarries no plaintext (encrypted blob only)- No env vars in the credential path (ADR-014 invariant preserved)
-
Test coverage:
- PeerEntry resolution (fingerprint, auth_token_hash, ApiKeyEntry fall-through)
- Multi-fingerprint PeerEntry
- Disabled peer → None
- Duplicate peer_id validation
- CredentialStore get/put/delete round-trip
- EncryptedData serialization round-trip
- Fingerprint normalization (Ed25519 → ed25519:, X.509 → SHA256:)
- Config reload with PeerEntry model
Acceptance Criteria
- All PeerEntry / AuthPolicy types match config.md and auth.md
- ConfigIdentityProvider resolution matches auth.md (PeerEntry multi-credential path)
- CredentialStore trait + InMemoryCredentialStore + EncryptedData + StoreError match ADR-031/035
- IdentityStore trait matches ADR-035 (read/write split, ConfigIdentityProvider posture)
- Fingerprint normalization matches ADR-030 §6 (ed25519: for raw keys, SHA256: for X.509)
- Three remote roles documented in source comments (ADR-034)
- No
authorized_fingerprintsreferences remain - No
remote_safe/trusted_peerreferences in core (those are call-side) - ArcSwap pattern consistent
- No russh dependency, no vault dependency in core
- Test coverage adequate for all new functionality
cargo fmt --check -p alknet-corepassescargo clippy -p alknet-corepasses with no warnings- All tests pass
References
- docs/architecture/crates/core/README.md
- docs/architecture/crates/core/auth.md
- docs/architecture/crates/core/config.md
- docs/architecture/decisions/030-peerentry-and-identity-id-decoupling.md
- docs/architecture/decisions/031-credentialstore-repo-trait.md
- docs/architecture/decisions/033-storage-boundary-and-repo-adapter-pattern.md
- docs/architecture/decisions/034-outgoing-only-x509-and-three-peer-roles.md
- docs/architecture/decisions/035-concrete-persistence-adapter-shapes.md
Notes
This review verifies core is spec-conformant after the ADR-029/030/031/034/035 sync before alknet-call begins its sync. alknet-call depends heavily on the new
Identity.id = peer_idsemantics (PeerCompositeEnv keys, PeerRef::Specific routing, AccessControl-based peer authorization) — any issues here propagate to call. If deviations are found, document and fix before proceeding to the call phase.
Summary
All 9 review checklist sections passed (PeerEntry/AuthPolicy, ConfigIdentityProvider, CredentialStore, IdentityStore, fingerprint normalization, three-roles docs, pattern consistency, security constraints, test coverage). Verification: cargo build/clippy(-D warnings)/fmt --check all clean; 135 tests pass. Negative criteria confirmed: no authorized_fingerprints, no remote_safe/trusted_peer, no russh, no vault/honker/rusqlite/sqlx deps in core (honker appears only in a doc comment describing the SQLite adapter — not a dependency), no env::var, no list method, ConfigIdentityProvider does not implement IdentityStore. No fixes applied — implementation was conformant.