From 2271db66b44cb6b4ef316d5faf2e3db7bf7294c6 Mon Sep 17 00:00:00 2001 From: Sumeeth HBe Date: Thu, 24 Sep 2026 00:13:39 +0530 Subject: [PATCH] [CI] Drop stale service references from remaining dependency-cruiser rules --- .dependency-cruiser.cjs | 14 ++++----- .../plugin/test/depcruise-boundary.test.ts | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.dependency-cruiser.cjs b/.dependency-cruiser.cjs index 7f73b97..2e88e77 100644 --- a/.dependency-cruiser.cjs +++ b/.dependency-cruiser.cjs @@ -6,18 +6,16 @@ module.exports = { forbidden: [ { name: "domain-is-io-free", - // TODO(#291): this rule still names the deleted `service` package, in the - // comment below and in the last clause of `to.path`. Tracked separately. comment: "@otta-sh/domain imports nothing with IO — no pg/kysely/better-sqlite3/hono/http, " + - "and no dependency on adapter/service/plugin packages (DEVELOPMENT.md §3).", + "and no dependency on adapter/plugin packages (DEVELOPMENT.md §3).", severity: "error", from: { path: "^packages/domain/src" }, to: { // Matches the forbidden module whether it resolves into node_modules // (direct or pnpm-store path) or stays a bare specifier (pnpm strict // isolation leaves undeclared imports unresolved). - path: "(node_modules/(pg|pg-pool|kysely|better-sqlite3|hono|node-fetch|undici)(/|$)|^(pg|pg-pool|kysely|better-sqlite3|hono|node-fetch|undici)(/|$)|^(node:)?(http|https)(/|$)|^packages/(store-[^/]+|service|plugin|payments-[^/]+)/)", + path: "(node_modules/(pg|pg-pool|kysely|better-sqlite3|hono|node-fetch|undici)(/|$)|^(pg|pg-pool|kysely|better-sqlite3|hono|node-fetch|undici)(/|$)|^(node:)?(http|https)(/|$)|^packages/(store-[^/]+|plugin|payments-[^/]+)/)", }, }, { @@ -206,21 +204,19 @@ module.exports = { "its own caller. Nothing else caught the inversion — `plugin-is-sandbox-" + "clean` admits store-emdash, this rule said nothing about the plugin, and " + "the console rules bind neither package — so the cycle would have been " + - "a review catch rather than a build failure. Sibling adapters, the service " + - "and the payment packages are likewise named in all three spellings " + + "a review catch rather than a build failure. Sibling adapters and the " + + "payment packages are likewise named in all three spellings " + "rather than in the packages clause alone, for the bare-specifier reason " + "the plugin rule's comment sets out. Every case this rule and " + "the plugin rule turn on are executed in " + "packages/plugin/test/depcruise-boundary.test.ts.", - // TODO(#291): this rule still names the deleted `service` package, in the - // comment above and in three clauses of `to.path`. Tracked separately. severity: "error", from: { path: "^packages/store-emdash/src" }, to: { // Both spellings, as above. The builtin half is the optional-`node:` // form the plugin rule's comment explains — dependency-cruiser reports // `from "node:fs"` under the bare name `fs`. - path: "(node_modules/(pg|pg-pool|kysely|better-sqlite3|workerd|hono|node-fetch|undici|axios|ws)(/|$)|node_modules/@otta-sh/((?!store-emdash(/|$))store-[^/]+|service|payments-[^/]+|admin-react|plugin)(/|$)|^(pg|pg-pool|kysely|better-sqlite3|workerd|hono|node-fetch|undici|axios|ws)(/|$)|^@otta-sh/((?!store-emdash(/|$))store-[^/]+|service|payments-[^/]+|admin-react|plugin)(/|$)|^(node:)?(fs|child_process|net|http|https|os|dgram|dns|tls|worker_threads|cluster|vm)(/|$)|^packages/(service|payments-[^/]+|admin-react|plugin)/|^packages/(?!store-emdash(/|$))store-[^/]+/)", + path: "(node_modules/(pg|pg-pool|kysely|better-sqlite3|workerd|hono|node-fetch|undici|axios|ws)(/|$)|node_modules/@otta-sh/((?!store-emdash(/|$))store-[^/]+|payments-[^/]+|admin-react|plugin)(/|$)|^(pg|pg-pool|kysely|better-sqlite3|workerd|hono|node-fetch|undici|axios|ws)(/|$)|^@otta-sh/((?!store-emdash(/|$))store-[^/]+|payments-[^/]+|admin-react|plugin)(/|$)|^(node:)?(fs|child_process|net|http|https|os|dgram|dns|tls|worker_threads|cluster|vm)(/|$)|^packages/(payments-[^/]+|admin-react|plugin)/|^packages/(?!store-emdash(/|$))store-[^/]+/)", }, }, { diff --git a/packages/plugin/test/depcruise-boundary.test.ts b/packages/plugin/test/depcruise-boundary.test.ts index e76332c..f764e8f 100644 --- a/packages/plugin/test/depcruise-boundary.test.ts +++ b/packages/plugin/test/depcruise-boundary.test.ts @@ -320,4 +320,33 @@ describe("the store-emdash perimeter", () => { rulesViolatedBy("store-emdash", 'import type { Pool } from "pg";\nexport type P = Pool;\n'), ).toEqual(["store-emdash-is-sandbox-clean"]); }); + + test("a RESOLVED payment adapter is forbidden here — store-emdash is not the payments layer", () => { + expect( + rulesViolatedBy( + "store-emdash", + 'import { stub } from "@otta-sh/payments-stripe";\nexport const x = stub;\n', + ), + ).toEqual(["store-emdash-is-sandbox-clean"]); + }); +}); + +describe("the domain perimeter", () => { + test("a RESOLVED SQL store adapter is forbidden", () => { + expect( + rulesViolatedBy( + "domain", + 'import { stub } from "@otta-sh/store-sqlite";\nexport const x = stub;\n', + ), + ).toEqual(["domain-is-io-free"]); + }); + + test("the plugin is forbidden — the domain cannot depend on its callers", () => { + expect( + rulesViolatedBy( + "domain", + 'import { stub } from "@otta-sh/plugin";\nexport const x = stub;\n', + ), + ).toEqual(["domain-is-io-free"]); + }); });