Skip to content

Compiler-enforced backend boundary between executor and sdk/mpr #518

@ako

Description

@ako

Problem

The PR checklist includes: "No sdk/mpr write imports in executor." This rule exists because executor handlers must route through the backend interface (mdl/backend/), never calling the MPR writer directly. Today this is enforced only in code review. An AI code generator that bypasses the backend produces code that compiles but violates the architecture — the mistake ships unless a reviewer catches it.

Proposed solution

Convert this checklist rule into a compiler or linter error so violations are caught before review.

Option A — Go internal/ package: Move MPR write types into sdk/mpr/internal/writer/. Go's visibility rules prevent any package outside sdk/mpr/ from importing it.

Design note: mdl/backend/mpr/ (the legitimate consumer) lives under mdl/, not sdk/mpr/, so the internal/ mechanism would also block it. This requires either restructuring the package layout or using Option B.

Option B — Linting rule: Add a depguard or gomodguard rule to CI that flags any import of specific sdk/mpr write symbols from mdl/executor/. Enforced at CI, not compile time, but achieves the same practical effect.

Implementation steps

  1. Decide on Option A (package restructure) or Option B (linting rule)
  2. For Option A: move write-path types into sdk/mpr/internal/writer/, update mdl/backend/mpr/ imports, verify compile
  3. For Option B: configure depguard in .golangci.yml with a deny rule on write imports in mdl/executor/, add to make lint
  4. Verify the rule catches a deliberate violation in a test branch

Expected outcome

Any code in mdl/executor/ that imports sdk/mpr write types fails at compile time (Option A) or CI lint (Option B). The architecture is self-enforcing.

See proposal: docs/11-proposals/PROPOSAL_agentic_architecture_improvements.md (Change 5)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions