Skip to content

Seam rule does not forbid host SDK imports outside the adapter layer #580

Backlog

Description

@ocsi-architect

Problem

The seam rule inspects internal paths only, so nothing prevents shared, harness-generic source from importing a host's SDK. The design statement requires the core to stay generic and the seam to be enforced mechanically rather than by discipline; today that half of the seam is held only by the fact that nobody has written such an import.

Baseline, measured on main at ad176f9

  • Shared source outside src/adapters/ importing a host SDK: 0 files.
  • Adapter-layer files importing it: 3.

That zero is the property to pin. Without a test it can only be rediscovered by review, and a single import of a host type into shared code is enough to make every other harness's adapter inherit an assumption it cannot satisfy.

Required

  • Extend the dependency-boundary check so a host SDK specifier outside src/adapters/** is a violation, naming the file and the specifier.
  • Keep the check's own fail-before fixtures: add this specifier shape alongside the existing ones so the coverage is pinned, with a negative control that an unrelated external package stays clean.
  • Sweep the same dependency forms the rule already handles — static, import type, export *, named re-export, dynamic import(), require, and typeof import().

Acceptance

A shared file given a host SDK import fails the boundary test while typecheck passes; the adapter layer's existing three imports stay clean; the fixture set proves each dependency form is caught rather than intended.

Activity

  1. added
    test-integrity
    severity:medium
    verified-on-main
    on Nov 28, 2026
  2. ocsi-architect commented on Dec 2, 2026

    @ocsi-architect
    Author

    Architect

    Baseline correction, before this closes. The numbers in the problem statement do not survive recount, and the difference matters because the ticket's whole case is that the zero is measurable.

    claim recount method
    "Adapter-layer files importing it: 3" 2 at ad176f9, this ticket's own baseline commit the walker's own import forms, not a from "…" grep
    shared source outside src/adapters/ 0 at every commit measured same
    adapter-layer files at 2bc96e7 8 all forms the walker inspects

    So "3" was never a file count at any relevant commit; the nearest thing it matches is the number of adapter directories at head. The direction of the error is worth noting: the ticket understated its own baseline by counting too narrowly, which is the same from "…"-only blind spot that gives a naive recount 6 instead of 8 — two import()-only adapter files are invisible to a string search that assumes the keyword form.

    What the ticket was right about, and what PR #643 pins: the zero on the shared side was real and unprotected. It is now a live asserted scan rather than a fact discoverable by review, with a negative control — planting a host-SDK import in src/core/ fails the suite naming file, line and specifier.

    Set membership, for the record, since a rule is only as good as its list: four roots are live host SDKs (@opencode/plugin, @earendil-works/pi-coding-agent, @oh-my-pi/pi-coding-agent via dynamic import, @oh-my-pi/pi-ai); solid-js belongs on evidence rather than intuition — it is a peerDependencies >=1.9.0 entry, engine consumers typecheck without it, and its only importer is an adapter; five further roots are prophylactic declared dependencies (the @opentui/* pair appears only in pragmas), and @mariozechner/pi-coding-agent is historical — it is absent from package.json entirely, so it guards a name that could return, not one in use.

    Nothing here changes what the ticket asked for. It changes what "verified on main" meant, which is the part a later reader relies on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity:mediumtest-integrityverified-on-main

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions