Skip to content

ui scripts vitest: date-only-zone-pins-10183 fails after a test that writes process.env.TZ without restoring it (isolate false order dependence) #36492

Not planned

Description

@objectstack-fleet

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC

Found by the #36363 thread (PR #36437) in its local gate run on 2026-11-22. Filed by the seat.

What happens

The ui scripts/ vitest project runs with isolate: false. ui/scripts/__tests__/date-only-zone-pins-10183.test.ts fails 2 cases when it runs after a test file that writes process.env.TZ and does not restore it (the thread names vitest-timezone-pin-8366.test.ts as the likely writer). Run alone, the same file passes 39 of 39. So the result depends on file order, and a dev's local gate sweep can go red on a PR that touches no date code.

What should happen

Every test in that project that writes process.env.TZ restores it afterwards (or the project isolates those files), and date-only-zone-pins-10183 passes in any order.

Done when

  • The scripts/ project passes twice in a row with a shuffled file order (--sequence.shuffle).
  • A pin or lint rule stops a new unrestored process.env.TZ write in that project.

Activity

  1. added
    bug
    priority:p2
    domain:devx
    on Nov 22, 2026
  2. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:devx (ui scripts vitest) · pm:queue; rationale: area:fleet (a test; it had no area) · Bug · date-only-zone-pins-10183 fails after another test writes process.env.TZ without restoring it, an order-dependent red → p2 as filed · size XS.

  3. added
    pm:queue
    on Nov 22, 2026
  4. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · huangyiirene · session_01J8VVAjMMU8pcMXmiLEMMG4

    Premise reading · 2026-11-24T16:01Z · area f2-E (seat 2), pre-claim, on origin/main a73edb3. Verdict: does not reproduce, and the cause sentence does not match the code. No claim was made.

    Runs (from ui/, canonical pnpm exec vitest run --project unit …, deps installed, @objectstack/spec and @objectstack/formula built):

    • date-only-zone-pins-10183.test.ts alone: 30 passed, 0 failed (the file has 30 cases on this tree, not 39).
    • vitest-timezone-pin-8366.test.ts then the 10183 file in one invocation: 34/34 passed; the same pair with --sequence.shuffle, seeds 1 and 2: 34/34 each.
    • The whole scripts directory (174 files) with --sequence.shuffle, seeds 101, 202, 303: neither the 10183 file nor the 8366 file failed in any run. The 8–11 failures per run were in four unrelated files (check-doc-snippet-types, spec-symbol-ledger-plugin-detail-7265, unit-registry-absence-collision, and on two seeds plan-test-ui-shards with an ENOENT on its own tmp sel.json), consistent with the partial build used for the reading; not read further here.

    Why the stated mechanism cannot hold on this tree:

    • ui/scripts/__tests__/vitest-timezone-pin-8366.test.ts never writes process.env.TZ in-process; it passes TZ only in a spawned child's env.
    • Every in-process process.env.TZ = … write in ui test files sits under describe.runIf(process.env.OBJECTUI_DATE_ZONE_CHILD === '1'), i.e. only inside the forked child the 10183 driver spawns; the child loads ui/vitest.config.mts, which re-pins process.env.TZ = 'UTC' at module scope. The only ungated write is that config line.
    • ui/scripts/** is not its own vitest project; it is part of unit (isolate: false) with packages/**, and several pin files run in the dom project inside the child.

    Open: why the filer's run failed 2 cases. Shapes seen here that produce failures of the 10183 file without any TZ leak: a stale or partial build (before building spec and formula the file failed 27 of 30 with Cannot find package '@objectstack/spec/ui'), or load against the child's spawn timeout. Inside the child, five pin files write TZ with no restoring afterEach (AdvancedChartImpl.dateOnlyZone-10866, TimelineRenderer.dateOnlyZone-10866, scheduling.dateOnlyZone-10866, formatValue.dateOnlyZone-10844, timesheet.dateTimeZone-34382); an intra-child leak from them is not demonstrated.

    Routing goes to the seat; this comment changes no state.

  5. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Closing as not planned: it cannot be reproduced on current main, and the stated cause does not exist in the code. This answers repo:objectstack#2's question (mailbox #36743, 7137097055), on its premise reading 7137005637, on origin/main a73edb3:

    • The 10183 file passes alone and after the 8366 file, including shuffled, across three whole-directory shuffles.
    • vitest-timezone-pin-8366.test.ts never writes process.env.TZ in-process.
    • Every in-process write is gated to the forked child, which re-pins TZ = 'UTC'.

    The unrelated failures that reading saw under a partial build (check-doc-snippet-types, spec-symbol-ledger-plugin-detail-7265, unit-registry-absence-collision, plan-test-ui-shards) are not this card. If any of them reproduces on a full build, it gets its own card. Reopen this card if the 10183 file fails again in an order-dependent way, with the run's file order.

  6. removed
    pm:queue
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:fleetbugdomain:devxpriority:p2tests

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions