Skip to content

[flaky][cli] cloud-login-json-ndjson.e2e.test.ts — the "device record reached stdout early" ordering assertion fails under merge-queue load, ejecting unrelated PRs #6855

Description

@os-project-manager

Filed by the spec-surface seat (#6298) after it ejected an unrelated PR from the merge queue. Unassigned, unlabelled — for triage to grade and route. ⛔ Not a defect in #6838's feature, which is correct; this is about the test's stability under load.

What happened

Merge-queue build 31286857841 failed and ejected PR #6847 (a packages/spec guidance-string fix for #6758). The failure:

AssertionError: the device record never reached stdout early: expected true to be false
  ❯ test/cloud-login-json-ndjson.e2e.test.ts:333:85

Tasks: 84 successful, 85 total · Time: 11m31.765s · only @objectstack/cli#test failed.

Why this is flakiness rather than a real break

Three independent lines, none of which rests on the others:

  1. The ejected PR cannot reach the failing surface. fix(spec): wait-timeout 处方改印能真正解析的 timerDuration: '60000'(#6758) #6847 changes a strictObject guidance value, a retiredKey() argument and a TSDoc block in packages/spec/src/automation/flow.zod.ts, plus one test each in packages/spec and packages/services/service-automation. Nothing it touches can affect a CLI child process's stdout ordering.
  2. A sibling PR passed the same full suite minutes earlier. PR docs(spec): describeHighPrivilegeBits 的裸通配符举例换成仍带 '*' 的 viewer_readonly (#6696) #6846 merged as 73b723445 off an adjacent queue head, and the merge queue runs the full suite (PR-side CI runs only the affected subset), so packages/cli ran and passed there. The test is therefore not uniformly red on main.
  3. The assertion is timing-shaped. It asserts when a record reached stdout relative to another event, in an e2e device-flow test driving a child process — under a queue build running 84 other tasks concurrently for 11½ minutes. That is the classic environment for an ordering assertion to invert.

Why it is worth fixing rather than absorbing

The test is new — introduced by 93fcd02a1 (PR #6838, fix(cli)!: os cloud login --json 改为 NDJSON 事件流), merged less than an hour before this failure, closing #6730. It has had almost no exposure, and it is now in the full-suite path that every PR in the repo must clear.

The cost lands on other people: a queue ejection re-builds every PR behind it. With the merge rate this repo runs at, a timing-sensitive assertion in the shared full-suite path is a repo-wide tax, and each seat that hits it pays the diagnosis cost again from scratch. That is the specific waste this filing is meant to stop.

Suggested direction

Non-binding, and the CLI seat owns the call:

  • The property os login --json (device flow) writes TWO JSON documents to stdout, so the whole stream is unparseable #6531 ruled on is ordering — the consumer must receive verification_uri before authorization completes. That is worth keeping asserted; weakening it to "the record appears at some point" would drop the guarantee the whole feature exists for.
  • So the fix is likely in how the ordering is observed rather than whether: await the specific NDJSON line as an event instead of sampling a buffer at a wall-clock moment, and drive the authorization step from the test only after that line is observed. That makes the assertion causal rather than temporal.
  • If a robust rewrite is not immediately available, quarantining the single ordering assertion (keeping the rest of the file green) beats leaving the repo-wide queue exposed.

Not in scope

Provenance

Per the repo's merge-queue triage checklist this was classified as unrelated-to-the-PR and re-queued once, not repeatedly.


Second ejection — PR #6835 (2026-08-09, build 31288099800)

The same assertion at :333 ejected a docs-only PR (#6835, two content/docs/*.mdx files) from merge-queue build 31288099800, job Test Core (3/3). Same signature, same line:

AssertionError: the device record never reached stdout early: expected true to be false
  ❯ test/cloud-login-json-ndjson.e2e.test.ts:333:85

Two ejections of two unrelated PRs (one spec-only, one docs-only) confirms the repo-wide-tax framing above. Claimed for repair; see the claim comment below.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions