Skip to content

feat(ci): catch boundary and async mistakes before review - #49

Merged
allisonmahmood merged 2 commits into
mainfrom
feat/issue-38-taste-as-lint
Aug 27, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
feat/issue-38-taste-as-lint

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

The repository’s lint and CI gates let package-boundary violations, direct environment/output access, unsafe TypeScript, floating promises, and unformatted changes reach review. That left architectural and async mistakes as reviewer-only concerns.

This makes ESLint type-aware across every TypeScript extension, restricts the CLI to @patchy/core, keeps console and process.env at composition roots, and adds a CI formatting gate. The pre-commit hook runs only Prettier, and the existing tree is normalized once so the new check starts green.

The Effect-port-specific lint step is recorded on #23 for the port map to inherit.

Verification

  • pnpm lint
  • Manual negative probes confirmed every base rule fails, including alias and relative package-boundary imports and .mts coverage
  • pnpm format:check
  • pnpm typecheck
  • pnpm test — 454 tests passed
  • CLI focused suite — 82 tests passed
  • Two-axis code review — Standards: 0 findings; Spec: 0 findings

Closes #38

Built with OpenAI Codex GPT-5.6 in the Oh My Pi coding harness.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area size:l 501-1,000 changed lines labels Aug 27, 2026

@allisonmahmood allisonmahmood left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two-axis review of feat/issue-38-taste-as-lint vs origin/main (8c09545...8740608), against #38. Extra sections after Spec are method and YAGNI, as requested.

Issue 38 asked for base taste-as-lint now (CLI @patchy/core only, console/process.env at entrypoints + packages/config, no-explicit-any + type-aware no-floating-promises, format check in CI, prettier-only pre-commit) and Effect rules later, listed as a port-map build step.

What landed matches that shape: one root eslint.config.js, a synthetic tsconfig.lint.json so type-aware lint does not need ^build, pnpm format:check in the lint job, and lint-staged → Prettier only. Effect rules stayed out of ESLint and were written onto #23.


Standards

No hard documented-standard breaches. Dependency pins (exact esbuild/npm, TS v6, parse5 catalog) are untouched. CLI still talks to @patchy/core only (docs/agents/domain.md, packages/cli/CONTEXT.md). any removal matches the repo’s typesafety bias. app.ts / public-url.ts / json-db.ts / packages/config/src/index.ts / scripts/*.mjs are wrap-only besides the items below.

Judgement calls

Shotgun Surgery — one commit turns on format:check and also retouches CLI/db/start logic, then Prettier-rewrites examples/plan.html, skill HTML, docs/ADRs, and pnpm-lock.yaml quotes. The reformat is required for the new CI gate, but it buries the typed hunks.

Divergent Change — root lint is now workspace-wide, while six packages still ship an ESLint-8 CLI and turbo still builds first:

// package.json
"lint": "eslint \"**/*.{ts,mts,cts,tsx}\"",
// packages/cli/package.json (and the other packages)
"lint": "eslint src --ext .ts",
// turbo.json
"lint": { "dependsOn": ["^build"] }

pnpm lint (CI) is the real gate. turbo run lint / pnpm --filter … lint still lint src only, so they miss tests the new no-explicit-any / no-floating-promises rules cover. Leftover dual entry points.

Allowlist is file-coarse (eslint.config.js). One override turns off both no-console and process.env for packages/config/**/*.ts (config does not log) and the whole CLI index.ts. readEnv is the intended chokepoint but is not enforced inside that file. Simple, and CLI console is the publishing interface (packages/cli/CONTEXT.md). Splitting the two rules would be tighter, not required.

tsconfig.lint.json paths map @patchy/{config,core,db,storage} → src/index.ts so type-aware lint need not ^build. Correct. Lint tsconfig would still resolve @patchy/db from CLI files; no-restricted-imports is the real domain gate.

postgres-db any → row types is a real typesafety fix, not a cast wrapper. CLI parsers (parseWhoamiResponse / parseUploadResponse / readResponseJson) are real guards, not one-line casts. Fail-closed cache/identity on a non-object JSON body is a behavior tighten.

void shutdown() in apps/server/src/start.ts satisfies no-floating-promises without changing SIGINT fire-and-forget.

lint-staged is prettier-only; eslint is CI-only. Matches keep-it-simple.


Spec

Base rules are in eslint.config.js. Type-aware lint uses parserOptions.project → tsconfig.lint.json. CI runs pnpm format:check. Pre-commit is Prettier-only via lint-staged. Effect rules did not land in ESLint.

(a) Missing / partial

“Done when: pnpm lint fails on each of the base rules.” Config would flag CLI import '@patchy/db', console.log / process.env outside the allowlist, : any, and an unhandled Promise. There is no test or probe that proves each rule fires. PR verification only ran a green pnpm lint.

“the port map has the Effect rules listed as a build step.” Effect rules correctly stay out of this PR. The listing is a comment on #23 (chart-the-map), not on a port map. No child map exists; #23 is still the wayfinder task.

(b) Not asked for

“Format check in CI” asked for a gate, not a rewrite. Diff Prettiers shipped HTML (examples/plan.html, skill welcome-draft.html), skill docs, ADRs, SELF_HOSTING.md, package files arrays, lockfile quotes, and scripts/*.mjs. (A one-time normalize is implied by turning the gate on against a dirty tree.)

“Package-boundary no-restricted-imports (the CLI depends only on @patchy/core).” Extra pattern bans CLI ../ imports. Spec was CLI-only @patchy/*; CLI-only is what was asked.

Also extra: turbo.json globalDependencies after pnpm lint left turbo; simple-git-hooks allowBuilds (needed for the hook).

CLI JSON parsers and Postgres row types are to satisfy “no-explicit-any back on”, not product scope.

(c) Implemented, but broader / off

“No console / process.env outside entrypoints and packages/config.” Allowlist also disables both for **/*.test.* and test/postgres.ts (called “composition roots”). Tests are not entrypoints. packages/db/src/migrate.ts is an extra unnamed entry.

no-restricted-properties only matches process.env member access (import { env } from "node:process" and const p = process; p.env would not fire). .mjs scripts and CLI test helpers are outside the lint glob.

Fully met: no-explicit-any error; no-floating-promises error with project wired; format check in CI; formatter-only pre-commit; Effect rules deferred.


Method

The method is the right one for this ticket. “Taste as lint” is an ESLint policy, not a new module, not eslint-plugin-boundaries, not a per-package config forest. One root flat config + one type-aware block + one CLI override + one allowlist is the smallest shape that matches #38.

Three caveats on how it was wired:

  1. Lint resolution is looser than tsc. tsconfig.lint.json path-maps every @patchy/* to source so lint can run without building. Real package tsconfigs do not: the CLI maps only @patchy/core, everyone else is NodeNext → dist. A CLI file can type import "@patchy/db" under eslint and still be rejected by package typecheck. no-restricted-imports is the actual boundary. Fine if you know it; easy to forget.

  2. The turbo lint cutover is unfinished. Root pnpm lint used to be turbo run lint. It is now a workspace eslint invocation (correct: one program, one tsconfig.lint.json). The turbo lint task, globalDependencies addition, and six package "lint": "eslint src --ext .ts" scripts are leftover. CI never hits them. Either finish the cut (delete the dead path) or keep turbo as the gate and drop the root one-liner.

  3. Package.json cannot be the CLI boundary. @patchy/cli is an esbuild bundle and does not even list @patchy/core as a dependency. Lint is the only enforcement that a future import "@patchy/db" fails. That is why the rule belongs here, not in dependencies.

The code moves that are policy, not wrap: void shutdown(); postgres map*(row: any) → query<DraftRow>(); CLI body: any → parsers. Env was already at getServerConfig / CLI readEnv / start.ts / migrate.ts. Nobody extracted a new env layer just to please the linter.


YAGNI / beautiful code

The policy file is ~70 obvious lines. That is the beautiful part. readEnv and direct console.* were already on main. Tests were rewrapped, not re-clevered. void shutdown() is the floating-promise idiom, not a wrapper factory. Postgres row types and the CLI response parsers are the honest cost of turning any back on — Matt-Pocock-shaped, not one-line casts.

Would delete:

  • The CLI parent-directory import regex. The ticket said “depends only on @patchy/core.” The CLI is one file; from "../…" has no current customer.
  • The leftover turbo/package lint entry points (and turbo.json globalDependencies if root eslint stays the gate).

Would keep: the parsers, the row types, void, the HTML/markdown one-time normalize (format-check cannot go green otherwise).

Would not do: extract env/console wrappers, split the allowlist into two override blocks, add a lint-rule regression suite. The ticket’s “pnpm lint fails on each of the base rules” is an acceptance check you run once by violating a file, not a new test package.

One real behavior change mixed into the lint PR: a 200 whose JSON body is not an object used to flow undefined into the draft cache; it now errors. Fail-closed and better, but it is not a formatting change.

Verdict: mostly-fine, with prettier blast + unfinished turbo cutover as the two things that make a small policy ticket look like size:l.


Standards: 0 hard violations, 3 judgement calls — worst is the leftover dual lint path (root eslint vs turbo/--filter src --ext .ts).
Spec: 2 partial, 2 broader-than-asked — worst is the allowlist treating every *.test.ts as an entrypoint for both console and process.env, against “entrypoints and packages/config.”

@allisonmahmood

Copy link
Copy Markdown
Owner Author

I verified the review against the source and the current green CI run. I will address two findings:

  1. Finish the root-lint cutover. pnpm lint is now the complete typed gate, so the six package-local lint scripts, Turbo lint task, and lint-only globalDependencies are obsolete alternate paths. Keeping them would let filtered/Turbo lint report a misleading partial success. I’ll remove them rather than maintain two contracts.
  2. Tighten the global-access allowlist. The wildcard test exemption is broader than today’s actual need. I’ll split no-console from process.env and name only the executable composition roots that currently need each capability. This preserves subprocess-test environment isolation without granting every future test both capabilities.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

I’m not changing the remaining observations:

  • No permanent lint-rule regression suite. I exercised deliberate violations for every base rule, including forbidden package/relative imports and .mts coverage, before filing. The review itself correctly calls this a one-time acceptance probe; a fixture test package would duplicate ESLint’s own behavior and add maintenance without a product contract. I’ll add the probe result to the PR verification text instead.
  • Effect port-map location. The child port map does not exist yet; Chart the Effect v4 port map #23 is the canonical task that will create it. Recording the explicit build step there is the only actionable place until that map exists.
  • CLI parent-traversal restriction. I’m keeping it. An @patchy/*-only pattern can be bypassed with a relative import into a sibling package, so it would not enforce the requested package boundary.
  • One-time Prettier normalization. The new repository-wide format check cannot start green without normalizing the tracked baseline. Keeping it makes subsequent format diffs small and enforceable.
  • Alias-based process.env bypasses. The requested rule is a syntactic placement guard, not a security boundary. A custom scope-aware rule to prevent intentional aliases would be disproportionate and can still be bypassed with an ESLint disable.
  • migrate.ts, test setup, and .mjs helpers. migrate.ts is the db:migrate executable; the named test files set up child-process/global test execution; the .mjs files are scripts/helpers rather than implementation modules. These are composition roots, not hidden domain access.

@allisonmahmood
allisonmahmood merged commit 84d5fbf into main Aug 27, 2026
7 checks passed
@allisonmahmood
allisonmahmood deleted the feat/issue-38-taste-as-lint branch August 27, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area area:server Touches the server area size:l 501-1,000 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ci): taste as lint: boundaries, no console/env, no-any, floating promises, format check

1 participant