Repository navigation
chore(deps): move to Effect 4.0.6 - #974
allisonmahmood wants to merge 3 commits into
Conversation
The effect group moves together to 4.0.6. What it changed underneath us: - SqlClient.make requires a driver name; the hand-built company clients pass their source's. - HttpApiSchema.status stores the status as a key annotation, so refuse reads it where HttpApi does instead of answering 400. One OpenAPI component now serves every status of RuntimeFailure, which shrinks docs/API.md. - A failing migration step fails with MigrationError instead of dying. - Node servers drain a body past MaxBodySize and fail the read as BodyTooLarge rather than cutting the socket, so readBody, the device form and the OAuth token request answer a streamed overflow with the same 413 as a declared one. - HttpApiClient methods infer a streaming payload's services, which picks up any from Effect.all's parameter; patchy list uses Effect.zip (4.0.7 fixes the inference upstream). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- statusOf honours a present httpApiStatus annotation even when undefined, as HttpApi does. - The OAuth token request gets socket coverage for a declared and a streamed oversized body, both 413 invalid_request. - The management body test expects the streamed 413 that drained bodies now get, not a 400 or a closed connection. - Comments on BodyTooLarge and RuntimeApi's body reader say what 4.0.6 does: a streamed body is refused at the cap, and Node discards up to 256 KiB of the unread rest after the response. Co-Authored-By: Claude Opus 5.5 <[email protected]>
BodyTooLarge carries the HttpServerError that passed the cap, as the service conventions ask, and is absent for a declared length refused unread. TrustedProxies stops saying Effect's xForwardedHeaders has no allow-list, which 4.0.6 added. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review: GPT-6.1-Sol (xhigh), two rounds over the stack (#973 + #974)Round 1, on 8736a69: nothing blocking.
Also from Round 2, on aa6c0e6: nothing blocking.
The review loop stops here: round 2 found nothing blocking. |
Acceptance: PASS with notesChecked Done means
Golden journeys
Rollback answers: They match the diff. No migration record, persisted format, stored-data deletion or infrastructure changes are introduced. A revert restores the earlier dependency and HTTP behavior without leaving state the earlier release cannot read; no Not run
Notes
Independent local evidenceAll instance data was generated from the scenarios in the acceptance checkout. No production or existing developer instance was used. |
## What changed When an agent passed a bad flag with `--json`, `patchy` printed the command's help to stdout before the JSON failure on stderr, so stdout held usage text where an agent expects nothing or a result. A parse error under `--json` now leaves stdout empty: one failure document on stderr, exit 1. Help that is asked for still prints, with or without `--json`. Closes #1072 ## Look at **Where the help came from.** On a parse error, Effect 4.0.5's `Command.runWith` logs the help doc with `Console.log`, then the errors with `Console.error` (`showHelp` in `effect/cli/Command.ts`). An explicit `--help` goes through the same `formatHelpDoc` + `Console.log`, so the formatter alone can't tell the two apart. `formatErrors` has one caller, the invalid-invocation branch, which makes it the signal. **The fix, in `packages/patchy/src/index.ts`.** Under `--json` only: - `formatHelpDoc` holds the help and returns an empty string. A console wrapper skips that lone empty line. - `formatErrors` drops the held help. - When the run ends, any help still held is printed. That covers `--help`, `-h`, and commands without a handler such as bare `patchy` or `patchy auth`. The output is byte-identical to before. Without `--json`, a command's own parse errors still print usage, then the one line. **Two more paths review found.** - **A global flag's own bad value.** For example `--log-level loud` or `--completions nope`. These fail with a raw `InvalidValue` outside Effect's usage path, so the runtime printed an error and stack on stdout, with or without `--json`. The entrypoint now catches that tag and writes it through the same renderer: one line, or one document under `--json`. It exits 1 through `Output.Failed`, which is now exported. - **How `--json` is read before parsing.** It was `argv.includes("--json")`. Now `jsonRequested`, beside `JsonFlag` in `Output.ts`, reads it the way Effect does: the first `--json`, `--json=<b>`, `-json=<b>`, `--json <b>` or `--no-json` before `--` decides, reading past a `--no-json <b>` that Effect refuses. **Docs.** ADR-0004's "Parse errors" bullet now states the contract instead of the exception. `packages/patchy/README.md` says the same in one line. The global `patchy` skill drops its "usage on stdout" warning, since its general failure contract now covers parse errors, and `skills-lock.json` carries the new hash. **Later.** Effect 4.0.7 adds `CliOutput.Presenter`, which receives an `InvalidInvocation` separately from `Help`. Once the Effect bump (#974, then 4.0.7) lands, about ten lines of `Presenter` replace the held-help state. The comment in `index.ts` says so. <!-- patchy-dev:transcript:json-parse-errors --> #### Transcript `json-parse-errors` Before is `e778152` (where this branch left main) and after is `f1841dd` (fix/1072-json-parse-error-stdout), both on the `team` scenario, from `pnpm dev transcript`. Each line ran in its own `bash -c` from the side's agent workspace, as the scenario's signed-in CLI, with stdin closed. Each side's origin reads `<origin>`, its environment folder `<env>`, its checkout `<checkout>` and the home folder `~`; nothing else is normalized. Nothing in it matched a collected secret (each side's CLI state, machine-token and login-code shapes, email addresses outside the scenarios' example domains, secret-named variables, and any accounts the run acts as). 7 of 10 lines changed. ##### Under --json, a bad flag value: stdout **Changed.** Before, exit 1 in 0.2 s; after, exit 1 in 0.2 s. ```console $ patchy init notes --tier 7 --json 2>/dev/null ``` ```diff -DESCRIPTION - Create a patch repo at tier 1 by default, or tier 2 with server handlers. - -USAGE - patchy init [flags] [<dir>] - -ARGUMENTS - dir string Directory for the new repo; defaults to the current directory (optional) - -FLAGS - --tier choice Runtime tier for the new repo; defaults to 1 (choices: 1, 2) - --purpose string What this patch is for; required for agent, --json and non-terminal calls; otherwise prompted - -GLOBAL FLAGS - --help, -h Show help information - --version, -v Show version information - --wizard Start wizard mode for a command - --completions <bash|zsh|fish|powershell|sh|pwsh> Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh) - --log-level <all|trace|debug|info|warn|warning|error|fatal|none> Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none) - --json Print the result as one JSON document on stdout - --api-url string The Patchy Cloud instance to talk to (its API base URL) ``` ##### ...and stderr, with its exit code <details><summary><code>$ patchy init notes --tier 7 --json 2>&1 >/dev/null</code>: no change, exit 1 in 0.2 s</summary> ```console $ patchy init notes --tier 7 --json 2>&1 >/dev/null {"ok":false,"error":"Invalid value for flag --tier: \"7\". Expected: \"1\" | \"2\"","kind":"local"} ``` </details> ##### An unknown flag and a missing required flag: stdout **Changed.** Before, exit 1 in 0.2 s; after, exit 1 in 0.2 s. ```console $ patchy publish --bogus --json 2>/dev/null ``` ```diff -DESCRIPTION - Publish the current patch repo, or a single self-contained HTML file. - -USAGE - patchy publish [flags] [<file>] - -ARGUMENTS - file string HTML file path (optional) - -FLAGS - --name string Set the patch's name in its company - --patch string Update an existing patch only; never creates a patch - --share choice Who can open the patch: your company or anyone with the link (choices: company, public) - --description string Set the description when publishing an HTML file - --force Accept the reported dependant or source breakage; ask the person first - --new Always create a new patch - -GLOBAL FLAGS - --help, -h Show help information - --version, -v Show version information - --wizard Start wizard mode for a command - --completions <bash|zsh|fish|powershell|sh|pwsh> Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh) - --log-level <all|trace|debug|info|warn|warning|error|fatal|none> Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none) - --json Print the result as one JSON document on stdout - --api-url string The Patchy Cloud instance to talk to (its API base URL) ``` **Changed.** Before, exit 1 in 0.2 s; after, exit 1 in 0.2 s. ```console $ patchy look publish ./x --json 2>/dev/null ``` ```diff -DESCRIPTION - Admins: publish a look folder (look.css, LOOK.md, optional logo.svg) as the company's next revision. - -USAGE - patchy look publish [flags] <dir> - -ARGUMENTS - dir string The look folder to publish - -FLAGS - --note string Why this revision, such as darker green (required) - -GLOBAL FLAGS - --help, -h Show help information - --version, -v Show version information - --wizard Start wizard mode for a command - --completions <bash|zsh|fish|powershell|sh|pwsh> Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh) - --log-level <all|trace|debug|info|warn|warning|error|fatal|none> Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none) - --json Print the result as one JSON document on stdout - --api-url string The Patchy Cloud instance to talk to (its API base URL) ``` ##### Effect's other spellings of the flag count too **Changed.** Before, exit 1 in 0.2 s; after, exit 1 in 0.2 s. ```console $ patchy init notes --tier 7 --json=true 2>/dev/null ``` ```diff -DESCRIPTION - Create a patch repo at tier 1 by default, or tier 2 with server handlers. - -USAGE - patchy init [flags] [<dir>] - -ARGUMENTS - dir string Directory for the new repo; defaults to the current directory (optional) - -FLAGS - --tier choice Runtime tier for the new repo; defaults to 1 (choices: 1, 2) - --purpose string What this patch is for; required for agent, --json and non-terminal calls; otherwise prompted - -GLOBAL FLAGS - --help, -h Show help information - --version, -v Show version information - --wizard Start wizard mode for a command - --completions <bash|zsh|fish|powershell|sh|pwsh> Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh) - --log-level <all|trace|debug|info|warn|warning|error|fatal|none> Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none) - --json Print the result as one JSON document on stdout - --api-url string The Patchy Cloud instance to talk to (its API base URL) ``` **Changed.** Before, exit 1 in 0.2 s; after, exit 1 in 0.2 s. ```console $ patchy init notes --tier 7 -json=true 2>/dev/null ``` ```diff -DESCRIPTION - Create a patch repo at tier 1 by default, or tier 2 with server handlers. - -USAGE - patchy init [flags] [<dir>] - -ARGUMENTS - dir string Directory for the new repo; defaults to the current directory (optional) - -FLAGS - --tier choice Runtime tier for the new repo; defaults to 1 (choices: 1, 2) - --purpose string What this patch is for; required for agent, --json and non-terminal calls; otherwise prompted - -GLOBAL FLAGS - --help, -h Show help information - --version, -v Show version information - --wizard Start wizard mode for a command - --completions <bash|zsh|fish|powershell|sh|pwsh> Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh) - --log-level <all|trace|debug|info|warn|warning|error|fatal|none> Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none) - --json Print the result as one JSON document on stdout - --api-url string The Patchy Cloud instance to talk to (its API base URL) ``` ##### A global flag's bad value, with and without --json: stdout, then stderr **Changed.** Before, exit 1 in 0.2 s; after, exit 1 in 0.2 s. ```console $ patchy whoami --log-level loud --json 2>/dev/null ``` ```diff -[00:51:45.914] ERROR (#1): ~effect/cli/CliError/InvalidValue: Invalid value for flag --log-level: "loud". Expected: "all" | "trace" | "debug" | "info" | "warn" | "warning" | "error" | "fatal" | "none" - at file://<env>/cli/node_modules/patchy/dist/index.js:63778:73 - at file://<env>/cli/node_modules/patchy/dist/index.js:4003:95 ``` **Changed.** Before, exit 1 in 0.2 s; after, exit 1 in 0.2 s. ```console $ patchy whoami --log-level loud 2>&1 >/dev/null Invalid value for flag --log-level: "loud". Expected: "all" | "trace" | "debug" | "info" | "warn" | "warning" | "error" | "fatal" | "none" ``` ```diff +Invalid value for flag --log-level: "loud". Expected: "all" | "trace" | "debug" | "info" | "warn" | "warning" | "error" | "fatal" | "none" ``` ##### Help asked for under --json still prints <details><summary><code>$ patchy init --help --json | head -4</code>: no change, exit 0 in 0.2 s</summary> ```console $ patchy init --help --json | head -4 DESCRIPTION Create a patch repo at tier 1 by default, or tier 2 with server handlers. USAGE ``` </details> ##### Without --json, usage still prints before the one-line error <details><summary><code>$ patchy init notes --tier 7 2>&1 | tail -4</code>: no change, exit 0 in 0.2 s</summary> ```console $ patchy init notes --tier 7 2>&1 | tail -4 --log-level <all|trace|debug|info|warn|warning|error|fatal|none> Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none) --json Print the result as one JSON document on stdout --api-url string The Patchy Cloud instance to talk to (its API base URL) Invalid value for flag --tier: "7". Expected: "1" | "2" ``` </details> <!-- /patchy-dev:transcript:json-parse-errors --> ## How it was verified - **The focused test.** `cli.test.ts` › help › "under --json, a parse error is one document on stderr, and help still prints" covers: - a bad value, under `--json`, `--json=true` and `-json=true` - an unknown flag, a missing flag and a missing argument - `--log-level loud` Each must have empty stdout and exactly one document line on stderr. With `--no-json`, the text error and usage must be back, and `--log-level loud` without `--json` must be one stderr line. `init --help --json` and `auth --json` must print the same stdout as without `--json`. It fails against main's `index.ts` (21 lines of help on stdout) and passes with the fix. - **The old assertion.** `cliRepoPublish.test.ts` asserted the old help on stdout for `init --tier 0 --json`. It now asserts empty stdout. - **Review.** Three GPT 6.1 Sol (xhigh) passes. Every finding is fixed in the later commits: global flag values, the `--json=true` and `-json=true` spellings, a refused `--no-json false` before `-json=true`, and `catchTag` → `catchTags`. - **Checks.** `pnpm check` format, lint, typecheck and synth pass, and `pnpm typecheck` is 24/24. On this shared dev machine, offline CLI stub-server tests failed in a rotating set from the host's stray `GET /` probes. Each either passes when run alone or fails the same way with main's `index.ts`. CI decides. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required Under `--json`, a parse error's stdout loses the help text that nothing read as a result. Without `--json`, a global flag's bad value is one stderr line instead of a stack on stdout. Exit codes are unchanged. - **What does a revert leave behind?** Nothing: no schema, data or wire change. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
Dependabot's patch group #949 failed 10 checks. Its Effect 4.0.6 changes five things underneath us, and this PR moves the five Effect packages together with the fixes. One fix changes what clients see: a streamed request body over a route's cap now answers 413, the same as a declared one, instead of having its connection cut.
Stacked on #973, which carries #949's turbo, pglite and vite. Together they replace #949.
Look at
Why #949 is red. There were no flakes; the failures come from five breaks.
@patchy/company-databasestopped building, and lint, image, cli-smoke, release-tarball, tier2-smoke and browser all build first.SqlClient.makenow requires adrivername (Effect #9222):ConnectionTimingand the retained PGlite lease pass the driver of the client they wrap, and the retained Postgres lease passes"pg"besidePgClient.makeCompiler(). Two test clients get the same.PatchesApi.test.tsalone, plus ApiGuard, SdkApi, ConnectionsApi, LookApi and the auth suites:HttpApiSchema.statusnow stores the status as a key annotation, so one schema reused at several statuses stays one OpenAPI component.refuseinpackages/api/src/respond.tsread only the plainhttpApiStatusannotation and fell back to 400. It now reads the status the way HttpApi does, plain annotation first. Effect's own resolver is@internal, so there is no public helper to call.docs/API.mdchanged: a consequence of (2) that improves the doc.RuntimeFailureand its eight copies,RuntimeFailure_1to_8, collapse into one component (net −144 lines). Regenerated withpnpm --filter @patchy/api render-docs.MigrationError(kind: "Failed") instead of dying (Effect #9598).migrate's callers already handleMigrationErrorfor duplicate ids and foreign ledgers, so only thesql.test.tsassertion and a supervisor comment change.patchy listtyped its requirements asany. Client methods are now generic over a streaming payload's services. An inline call insideEffect.all([...])infers them fromEffect.all'sEffect<any, any, any>parameter:Effect.zip(a, b, { concurrent: true })makes the same two concurrent requests and infers cleanly. Effect 4.0.7 fixes the inference upstream (NoInfer<PayloadR>).The 413. Node servers now drain a body that passes
MaxBodySizeand fail the read withRequestParseErrorreasonBodyTooLarge, where before they destroyed the socket (Effect 3934c0c). The four socket tests that expected a cut connection got a 400 instead, becausereadBodycalled every failed read malformed, and the execution management test, which allowed either, got a 400. A newisBodyTooLargein@patchy/apiletsreadBody, the device login form and the OAuth token request answer a streamed overflow with the 413 they already give a declared one. The tests now send both framings and expect the same 413, including a new socket test for the token request (400 without the fix), and the API descriptions say "An oversized body answers 413, declared or streamed" where they said streamed bodies are cut off. The other capped form handlers never answered 413; an oversized streamed form now gets whatever they answer for an unreadable one, where it used to get a cut connection.Not taken: Effect 4.0.7, which npm published at 03:36 UTC today, inside the workspace's one-day
minimumReleaseAge.How it was verified
pnpm typecheckfailed on (1) and (5); the suites above failed as on CI.pnpm typecheck24/24 andpnpm lintclean. A targeted run ofpackages/auth,packages/sql,packages/api,packages/company-database,packages/integrations,PatchesApi,Server,QueryRollups,cliRepoandcliRepoBuildpasses 740/740 tests in 72 files.pnpm verify, first run on 8736a69: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and browser passed.testfailed on the management test above, now fixed, and six timeouts under machine load that pass when rerun alone. Second run, on aa6c0e6: all ten suites pass (2,500 unit tests, 81 browser tests). 5ffc522 after it only addsBodyTooLarge's optionalcauseand a comment; typecheck, lint, the api/auth/patches/serving suites and CI cover it.pnpm install --frozen-lockfilepasses,--lockfile-onlychanges nothing,pnpm dedupe --checkis clean. The diff is the five Effect packages,@effect/platform-node-sharedand undici 8.12.3 under platform-node.Release impact
A dependency patch release. The one client-visible difference is a 413 response where an oversized streamed body used to get a reset connection; a client that treated the reset as failure still sees a failure, now with a reason. Every other status, body and schema is unchanged; the doc change is one shared component instead of nine copies.
Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).