Skip to content

ci(effect): fail typecheck on Effect language-service diagnostics - #65

Merged
allisonmahmood merged 2 commits into
mainfrom
ci/effect-diagnostics
Aug 28, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
ci/effect-diagnostics

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Aug 28, 2026 •

Copy link
Copy Markdown
Owner

pnpm typecheck ran plain tsc, so @effect/language-service diagnostics only showed up in editors and never gated CI.

effect-language-service patch now bakes the plugin into the installed TypeScript (6.0.3) from both prepare and typecheck (idempotent, ~5s), and tsconfig.base.json sets the diagnostic severities. Verified by experiment: a file whose only defect is an Effect diagnostic (deterministicKeys) passes unpatched tsc and fails pnpm typecheck with exit 2. @effect/tsgo also works on this repo but needs two more dev deps (@effect/tsgo, @typescript/native-preview), per-package script changes and a backup-cleanup script, so the tsc patch wins on simplicity.

Two departures from t3code's block, both explained in comments in the file:

  • Whole-file rules that also flag plain Node code (nodeBuiltinImport, globalConsole, globalDate, globalRandom, globalTimers, globalFetch, cryptoRandomUUID) are warning rather than t3code's error — they hit 46 sites in the unported cli/server/db/storage today. So this is not the full t3code promotion; promote per package as the port lands under Effect v4 port map #54. All *InEffect variants and the structural rules are error. Effect warnings exit 2 by default, so ignoreEffectWarningsInTscExitCode: true is what keeps those seven reporting without reddening CI.
  • Rules that are v3-only in language-service 0.87.2 (missingEffectServiceDependency, schemaSyncInEffect, nonObjectEffectServiceType, scopeInLayerEffect, schemaUnionOfLiterals) are inert on Effect 4 and are recorded in a comment rather than configured. lazyEffect does not exist in 0.87.2 and was dropped.

turbo.json gains globalDependencies: ["tsconfig.base.json"]. Turbo does not follow tsconfig extends, so without it a severity change did not invalidate the typecheck cache.

Resolves #58

Made by Claude Fable 5 via Claude Code (workflow subagent).

@github-actions github-actions Bot added area:ci CI, shared testing infrastructure, development scripts and tooling size:s Under 100 changed lines labels Aug 28, 2026
Base automatically changed from chore/pin-effect-rc to main August 28, 2026 13:13
@allisonmahmood allisonmahmood linked an issue Aug 28, 2026 that may be closed by this pull request
`pnpm typecheck` ran plain tsc, so @effect/language-service diagnostics
never reached CI. `effect-language-service patch` now bakes the plugin
into the installed TypeScript 6.0.3 from both `prepare` and `typecheck`
(idempotent, ~5s), and tsconfig.base.json promotes the rules t3code
promotes. Whole-file rules that also flag plain Node code stay warnings
until the port lands, with ignoreEffectWarningsInTscExitCode so they show
without failing.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0191mSZ5Nrvn7FMoNMRbKxhS
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Reviewed d8aa32b after rebasing ci/effect-diagnostics onto latest main (45f247b). Diff is two files: package.json (prepare / typecheck patch) and tsconfig.base.json (plugin + severities).

Intent (#58)

Matches with justified departures.

#58 asked which mechanism makes pnpm typecheck fail on an @effect/language-service diagnostic on TS 6: try both, keep the one that works, wire it into prepare and CI, promote t3code’s diagnostics to error, note v3-only rules.

That is what landed. The tsc patch is the right answer for this repo’s TypeScript 6.0.3; tsgo is t3code’s TS 7 path and would add @effect/tsgo + @typescript/native-preview plus per-package scripts.

Two departures from the letter of #58:

  • The named probe was missingEffectServiceDependency. That rule is v3-only in language-service 0.87.2 and cannot fail on this Effect 4 tree. The live probe (deterministicKeys + globalConsoleInEffect, unpatched tsc 0 / patched tsc 2) is the question the issue actually needed answered.
  • Whole-file Node rules (nodeBuiltinImport, globalConsole, globalDate, globalRandom, globalTimers, globalFetch, cryptoRandomUUID) stay warning instead of t3code’s error, because 46 hits would red main before any package ports. *InEffect and the structural t3code errors stay error. That is staging for a package-by-package port, not a weaker Effect v4 port map #54 guardrail.

The resolution comment on #58 is the right record. One factual error in that comment and in tsconfig.base.json: cryptoRandomUUID / cryptoRandomUUIDInEffect are v4-only and live, not v3-only.

Method

Sound, with caveats. The tsc patch is the first-party path for TS 6. Language-service 0.87.2 refuses TS 7 and points at @effect/tsgo; this repo is on typescript@^6.0.3. Patching node_modules/typescript/lib/_tsc.js (and typescript.js) is what the plugin’s own README tells you to do. CI already runs pnpm typecheck; the lint job on this SHA emitted effect(globalConsole|nodeBuiltinImport|globalFetch) annotations, so patched tsc is live.

Caveats:

  1. ignoreEffectWarningsInTscExitCode: true means Effect warnings never fail the build. Only errors gate CI. Combined with the whole-file rules left as warning, those seven t3code errors print and pass.
  2. Turbo caches typecheck with default package-file inputs and no globalDependencies. tsconfig.base.json is not hashed (turbo does not follow extends). CI is fine today (fresh runner, no remote cache). A later remote cache, or a local replay from main, can hide a config-only severity change. --force is the workaround already noted on Make Effect diagnostics fail typecheck on TS 6 #58.
  3. Dual patch on prepare and typecheck is idempotent. Official docs only require prepare. The typecheck copy is a cheap no-op after the first patch and covers --ignore-scripts; it does not fix the turbo hole.

YAGNI

The mechanism is the small thing. The tsconfig is a t3code paste plus a holding pen.

Keep: effect-language-service patch on prepare (and the extra typecheck patch if you want the --ignore-scripts belt); the error map that actually fires on v4 today; the first comment (plugins in tsconfig do not fail tsc alone).

Cut or fix:

  • missingEffectServiceDependency and schemaSyncInEffect at error — they no-op on Effect 4. Make Effect diagnostics fail typecheck on TS 6 #58 asked to note v3-only rules, not keep them armed “so they gate when the LS ports.”
  • The comment that groups cryptoRandomUUID* with those v3-only rules — wrong; they are live v4. Whole-file cryptoRandomUUID belongs with the Node staging set; cryptoRandomUUIDInEffect can stay error.
  • "strictEffectProvide": "off" and "strictBooleanExpressions": "off" — already the defaults.
  • namespaceImportPackages — completions/style, not the typecheck gate. This repo has no Effect namespace imports yet.
  • ignoreEffectWarningsInTscExitCode plus listing the whole-file rules as warning — two knobs for one job (don’t fail CI on 46 Node hits). Omitting those keys until a package can take them at error is smaller. The flag is also blunt: it drops all Effect warnings, including defaults this PR never promoted.

Beautiful would be: patch scripts + only the error map that can fail today + one line that v3-only and whole-file Node rules are omitted until they can be error.

Standards

No hard documented-standard breaches. One concern, conventional title, problem-then-fix body. effect-service-conventions does not apply (no Effect service in this diff).

package.json — no findings. effect-language-service patch on both prepare and typecheck is the smallest model that makes patched tsc unsurprising locally and in CI. A wrapper script would be extra machinery.

tsconfig.base.json

(a) Judgement call — YAGNI / second checklist. AGENTS.md / CLAUDE.md: channel YAGNI; “do not preserve a second checklist in the repository”; “Review notes belong in PR comments, not in the working tree.”

          // Whole-file rules that flag plain Node code too. Warnings until the
          // Effect port lands; promote to error as each package is ported.

The first sentence explains why those keys are warnings (keep). “promote to error as each package is ported” is a work reminder; the port is already #54.

(b) Judgement call — Speculative Generality (Fowler; same YAGNI default)

          // Effect v3-only in @effect/language-service 0.87.2; kept at error so
          // they start gating the moment the language service ports them to v4.
          "missingEffectServiceDependency": "error",
          "schemaSyncInEffect": "error",
          "cryptoRandomUUID": "warning",
          "cryptoRandomUUIDInEffect": "error"

missingEffectServiceDependency and schemaSyncInEffect are v3-only in 0.87.2 — config for a future LS port, not current Effect 4. The same comment also labels cryptoRandomUUID*, which the 0.87.2 README marks v4-only (live), not v3-only. Repo YAGNI would drop the two inert keys until they exist on v4; the live cryptoRandomUUID* keys stay.

No other Fowler smells. Dual-script patch is not worth extracting. Plugin + severity map is the required surface, not impressive machinery.

Spec

Diff is package.json (prepare / typecheck patch) and tsconfig.base.json (plugin + severities). CI already runs pnpm typecheck; ci.yml is unchanged.

(a) Missing / partial

  1. Spec: “keep the one that fails on a deliberate missingEffectServiceDependency.”
    Both routes were scored on a deterministicKeys + globalConsoleInEffect probe. The named diagnostic was never shown to fail typecheck. It is v3-only in 0.87.2, so the probe cannot fire on this Effect 4 tree; that was not substituted in the spec.

  2. Spec: “promote the diagnostics t3code sets to error in tsconfig.base.json.”
    t3code sets nodeBuiltinImport, globalConsole, globalDate, globalRandom, globalTimers, globalFetch, and cryptoRandomUUID to error. This diff leaves them as warning.

(b) Scope creep

  1. Spec never asks for ignoreEffectWarningsInTscExitCode. t3code does not set it (default false).
    README: “effect-related warnings won't change the exit code of tsc.” Combined with (a)(2), those seven rules print and pnpm typecheck still exits 0.

(c) Looks implemented, but wrong

  1. Spec: “Note which rules the chosen route lists as v3-only.”
    Recorded in tsconfig.base.json and the Make Effect diagnostics fail typecheck on TS 6 #58 Resolution. The comment groups cryptoRandomUUID / cryptoRandomUUIDInEffect as “Effect v3-only in @effect/language-service 0.87.2.” The 0.87.2 README table marks those v4-only (v3 empty, v4 ✓). Actual v3-only among the configured set: missingEffectServiceDependency, schemaSyncInEffect. (README also lists nonObjectEffectServiceType, scopeInLayerEffect, schemaUnionOfLiterals as v3-only; those are not in this block.)

  2. Same comment: “kept at error so they start gating.” cryptoRandomUUID is warning, not error; with (b) it would not fail typecheck even if it fired.

prepare and CI wiring for the tsc patch is complete. lazyEffect drop is fine (t3code has it off; it is absent from 0.87.2).

Summary

Standards: 0 hard, 2 judgement calls; worst is speculative generality on inert v3-only keys plus a comment that mislabels live v4 cryptoRandomUUID* rules.

Spec: 5 findings; worst is t3code’s whole-file diagnostics left as warning with ignoreEffectWarningsInTscExitCode, so they never fail pnpm typecheck.

The method is the right one for TS 6. The thing to fix before merge is the v3/v4 comment (and, if we want the tsconfig to stay small, drop the inert keys, the default-off keys, and namespaceImportPackages). The warning-vs-error split for unported Node code is a product call, not a bug — just don’t call it a full t3code promotion.

Reviewed by Grok 4.6 via Grok Build (/code-review).

Review found the v3/v4 comment mislabelled cryptoRandomUUID and
cryptoRandomUUIDInEffect as v3-only; the 0.87.2 README marks them v4-only,
so they are live on this tree. Dropped the two genuinely inert v3-only keys
(missingEffectServiceDependency, schemaSyncInEffect), the two keys that only
restated defaults (strictEffectProvide, strictBooleanExpressions) and
namespaceImportPackages, which is import style rather than the typecheck
gate. The v3-only set is now recorded in one comment instead of as armed
config.

Also added tsconfig.base.json to turbo's globalDependencies. Turbo does not
follow tsconfig `extends`, so a severity change did not invalidate the
typecheck cache: promoting globalConsole to error replayed a cached pass
instead of the exit 2 it should produce. It now re-runs and fails correctly.

Co-Authored-By: Claude Fable 5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Worked through this against 0.87.2's README table and by running the probes. 661ba49.

Fixed

  • cryptoRandomUUID* mislabelled v3-only. Correct — the README table's last two columns are v3/v4 and both rules are blank/✓, i.e. v4-only and live. The comment grouping is gone.
  • Inert v3-only keys at error. Dropped missingEffectServiceDependency and schemaSyncInEffect. Make Effect diagnostics fail typecheck on TS 6 #58 asked to note v3-only rules, so they are now one comment listing all five (including nonObjectEffectServiceType, scopeInLayerEffect, schemaUnionOfLiterals) instead of armed config.
  • strictEffectProvide / strictBooleanExpressions set to "off". Both are ➖ (off) by default in the table. Dropped.
  • namespaceImportPackages. Import-style config for completions and auto-imports, not the typecheck gate, and the repo has zero Effect namespace imports today. Dropped.
  • "promote to error as each package is ported" comment. Trimmed; Effect v4 port map #54 owns that.

Not a redundancy — kept

ignoreEffectWarningsInTscExitCode plus the warning keys are not two knobs for one job. The flag defaults to false, so warnings do fail tsc. Probe on a lone console.log:

  • flag true → warning TS60 effect(globalConsole), exit 0
  • flag false → same diagnostic, exit 2
  • rule at error with flag true → exit 2 (the flag does not neuter errors)

Omitting the seven keys instead is not equivalent either: they are ➖ off by default, so they would go silent rather than report. Both keys are required for report-but-don't-fail, which is the intended staging state. Agreed on not calling it a full t3code promotion — the body now says so explicitly.

Also fixed (your caveat 2, and it is real)

The turbo hole reproduces. With a warm cache, promoting globalConsole to error — which the probe above proves is exit 2 — replayed a cached pass and exited 0. Since this PR makes tsconfig.base.json the CI gate, added globalDependencies: ["tsconfig.base.json"] to turbo.json; the same experiment now invalidates and fails correctly.

On the missingEffectServiceDependency probe in the spec: it cannot fire on an Effect 4 tree, so the substitution stands, and the rule is now dropped rather than left armed.

pnpm lint, typecheck, format:check and test (458) all pass. Not merging — leaving that to you.

Reviewed and fixed by Claude Fable 5 via Claude Code (workflow subagent).

@allisonmahmood
allisonmahmood merged commit 5d2f200 into main Aug 28, 2026
7 checks passed
@allisonmahmood
allisonmahmood deleted the ci/effect-diagnostics branch August 28, 2026 14:19
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 size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Effect diagnostics fail typecheck on TS 6

1 participant