You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The machine face returned before anything was compared: `if (flags.json) {
… return; }` sat ahead of both the `--check` needs-`--out` guard and the
comparison block, so `--check --json` exited 0 on a tree whose bundles had
provably drifted. Driven on one fixture, two invocations differing only by
`--json`: the first exited 1 reporting `missing:` and the drift sentence, the
second exited 0 with the ordinary payload. Same shape as the `--dry-run`
branch in #16480.
Under `--json`, `--check` is a verdict mode, so the comparison now runs before
the one document the run is allowed to write. Drift leaves through this
command's existing `{ error, …errorCodeFields }` envelope with exit 1 — no
new payload member — and the needs-`--out` refusal is reachable there too. An
in-sync tree and a `--json` run that did not ask for `--check` are unchanged.
The file list and the comparison are now one closure each (`emittedFiles`,
`compareCommitted`, `driftMessage`), read by both faces, so the console and
machine `--check` cannot diverge about what this run produces.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YFY46JydE1gMxQG1TqBcMZ
`os i18n extract --check --json` now COMPARES. It used to exit 0 having compared nothing, on a tree whose bundles had provably drifted.
6
+
7
+
The machine face returned before the comparison ran: `if (flags.json) { … return; }` sat ahead of both the `--check` needs-`--out` guard and the comparison block. Driven on one fixture, two invocations differing only by `--json` — the first exited 1 with `missing: OUT/zh-CN.objects.generated.ts` and `Translation bundles have drifted from the schema`, the second exited 0 with the ordinary extract payload. The first run is the second one's positive control: the drift was really there. Same shape as the `--dry-run` branch repaired one release earlier, and `--json` is if anything the more likely CI spelling of the two, because a pipeline that wants to parse the result reaches for it.
8
+
9
+
⚠️ **A pipeline that runs `os i18n extract … --check --json` and was green may now go red, and that is this repair working.** The green was a comparison that never happened; the red is the drift that was already in the tree. The fix is the one the failure names — re-run the same command without `--check` and commit what it writes.
10
+
11
+
What each invocation now does, with no new member on any published payload:
12
+
13
+
-**drift found** — the run ends on this command's existing `{ "error": … }` envelope with exit 1, carrying the same sentence the console face prints, the regenerate-and-commit command included. Deliberately not a new `drift` / `missing` / `stale` payload member: every other way this command can fail already speaks that envelope, and naming the drifted files in the machine payload would widen a published output face.
14
+
-**in sync** — unchanged: the ordinary extract payload, exit 0.
15
+
-**`--check` with no `--out`** — the refusal is now reachable under `--json` too, in the same `{ "error": … }` envelope with exit 1. It used to exit 0 with a payload, having been asked for a comparison it could not make.
16
+
-**`--json` without `--check`** — unchanged in every respect.
17
+
18
+
The run leaves through exactly one of those faces, so stdout still parses as exactly one JSON document.
0 commit comments