Files
deepseek-harness/docs/rfc/proposed/2026-06-11-architectural-conformance.md
Tianyi Cui 7c400e9c02 docs: unify ADR/RFC trees into one lifecycle-organized RFC tree
Collapse docs/adr/ and docs/rfc/ into a single docs/rfc/ with proposed/,
implemented/, and rejected/ subfolders. Every file is renamed to
yyyy-mm-dd-topic-title.md, where the date is when the topic was first
proposed (from git history). ADRs and RFCs that covered exactly the same
topic are merged (property-based testing, session persistence); the
umbrella RFC 005 stays split across its three implemented decisions, and
RFC 006's deferred part-3 (API extractor reports) splits into its own
proposed RFC. All cross-references become machine-checkable relative
links instead of bare "ADR NNNN" / "RFC NNN" prose.

Add a verify-md-links doc-sync gate (scripts/verify-md-links.ts) that
checks every relative Markdown cross-link resolves, wired into doc-sync
alongside verify-md-wrap. This makes the reorganization self-verifying:
the same change that rewrote ~forty inter-doc links adds the check that
proves none dangle. Document the cross-link convention in a new
docs/AGENTS.md and record the gate as an implemented RFC.

doc-sync, typecheck, lint, and the full test suite (667) all pass.
2026-06-18 02:18:24 +08:00

2.0 KiB

RFC: Architectural conformance — dependency rules and the adapter kit

Status: proposed

Problem

Two architectural guarantees currently live only in prose: (1) nothing depends on the concrete loop package (the microkernel promise), and (2) every LlmAdapter speaks the chunk protocol correctly. Both should be mechanical (the quality-gates principle).

Proposal

dependency-cruiser with rules:

  • packages/* (except agent-loop's own tests and examples/) must not import @deepseek-ai/dsh-agent-loop.
  • No cross-package deep imports (@deepseek-ai/dsh-*/src/... paths) — public entry points only.
  • No import cycles anywhere in packages/.
  • vendor/* must not import from packages/*.
  • Layering: dsh-llm imports nothing from other dsh packages; dsh-session only dsh-llm; etc. (the dependency table in packages/README.md, enforced).

Adapter conformance kit in dsh-llm (@deepseek-ai/dsh-llm/conformance): a reusable vitest suite parameterized by an adapter factory, asserting the chunk-protocol contract — index monotonicity per block, no deltas after block-end for an index, exactly one finish, usage at most once, every tool-call-delta carries the call id, abort honored promptly. Run it against the mocks now; the DeepSeek V4 adapter inherits it on day one. Optionally a dev-mode strictAdapter() wrapper enforcing the same at runtime behind a debug flag (pairs with the dev-mode invariants).

Plan

dependency-cruiser config + CI step first (an hour of work, permanent guarantee); the conformance kit lands with its first consumer test against MockAdapter, and is a prerequisite for the V4 adapter phase.

Risks

Dep-cruiser rule maintenance as packages are added — keep rules pattern-based (dsh-*) rather than enumerated.