Skip to content

lint:deps cannot stop a target package from importing its adapter #30458

Open

Description

@wmadden-electric

What a maintainer sees. ADR 198 says a target package never imports its adapter; the adapter depends on the target. pnpm lint:deps does not enforce that. architecture.config.json maps the PostgreSQL, SQLite and MongoDB target packages (packages/3-targets/3-targets/*, packages/3-mongo-target/1-mongo-target) to the extensions domain, and the extensions domain may import from the targets layer where the adapters sit. A target importing its adapter passes lint:deps today. For MongoDB the rule is held only by a hand-written test, packages/3-mongo-target/1-mongo-target/test/layering.test.ts.

Where. architecture.config.json (the entries for packages/3-targets/3-targets/postgres/**, packages/3-targets/3-targets/sqlite/** and packages/3-mongo-target/1-mongo-target/**), and the dependency-cruiser rules that read it.

Likely fix. Give target packages their own domain or layer below the adapters, so the existing direction rules forbid a target-to-adapter import. Then replace the Mongo layering test with the dependency-cruiser rule. This touches all three targets, so it is a change of its own.

Where it came from. Found while moving the Mongo codecs into the target package, #30396.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions