Files
deepseek-harness/docs/rfc/proposed/process/2026-06-11-architectural-conformance.md
Tianyi Cui e6fad266a6 docs(rfc): define and enforce a uniform RFC format; adopt it across the corpus
Define the in-file RFC contract in docs/rfc/README.md § The file format:
the header block (`# RFC: <title>` plus a dateless Status enum
cross-checked against the lifecycle folder), the per-lifecycle body
skeleton (a Problem opener everywhere; Proposal/Alternatives considered/
Acceptance criteria/Risks in proposed/; present-tense Decision/
Consequences with proposal-era headings banned in implemented/; the
frozen proposal shape in rejected/), and a mandatory Alternatives
considered section with a date-fenced grandfather comment for pre-format
RFCs whose alternatives are not reconstructible from the record.

Enforce it with a new doc-sync gate, scripts/verify-rfc-format.ts, and
normalize all 112 RFCs to it: ~15 Status-line spellings collapse to the
enum, 29 Context openers become Problem, the 39 legacy-format XXX debt
markers are resolved and banned from reappearing, proposal-era sections
in implemented RFCs are rewritten to shipped reality (including the
web/fs/subagent seam RFCs' migration plans and test checklists, closing
the doc-tiers deferred-work item on the web seam), every RFC gains an
Alternatives considered section or the grandfather comment, and the
bilingual pair is re-mirrored and re-recorded.

Move the generated index tables out of README.md into a fully generated
docs/rfc/INDEX.md — gen-rfc-index now writes the whole file, and
verify-rfc-classification checks its freshness and rejects index-shaped
rows in the curated README — which makes room for the format contract to
live in the README front door instead of a separate FORMAT.md.

The decision record, and the first RFC written in the new format, is
docs/rfc/implemented/process/2026-07-05-uniform-rfc-format.md.
2026-07-05 22:58:25 +08:00

2.3 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.

Acceptance criteria

  • dependency-cruiser runs in CI with the rule families above; a violating import fails the build.
  • The conformance kit runs against the mock adapter and both shipping adapters, and a new adapter package inherits the suite by invoking it with its factory.

Risks

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