Skip to content

Assert on the rendered legacy field instead of a bare "99" so the PR-fix comment test stops failing on the footer timestamp #1257

Closed

Description

@itsmiso-ai

Ask

Assert the legacy totalAttempts field is absent by its rendered form rather than by a bare 99, so src/lib/pr-fix-surfacing.test.ts stops failing whenever the rendered footer timestamp happens to contain the digits 99.

What happens

src/lib/pr-fix-surfacing.test.ts ends the "renders workerExecutions and enqueueRows separately, never as 'attempts' (#1218)" case with:

expect(body).not.toContain("Total attempts");
expect(body).not.toContain("99");

The body under test ends with a footer rendered from new Date(), e.g.

Posted automatically by Dispatch on 2026-10-14T05:47:20.799Z

The 99 in the millisecond field (.799) satisfies the second assertion, so the test fails whenever the run's wall-clock milliseconds happen to contain two consecutive nines — roughly a few percent of runs, unrelated to any code change. Observed on 2026-10-14 during PR #1247 local validation: one full-suite run failed on this case, and three targeted reruns of the file passed without any change.

Why the bare-digit assertion exists

The field being guarded is the deprecated totalAttempts: 99 passed into buildNeedsHumanComment (src/lib/pr-fix-surfacing.ts). The intent is "the legacy total is never rendered", which the neighbouring not.toContain("Total attempts") already covers at the label level.

Acceptance

  • The legacy field's absence is asserted against a form that cannot collide with the timestamp — either drop not.toContain("99") now that not.toContain("Total attempts") covers it, or match a rendered fragment the comment would actually contain if the field leaked.
  • The rendered comment body is passed a fixed/frozen clock in this test so the footer is deterministic regardless.
  • npx vitest run src/lib/pr-fix-surfacing.test.ts passes on repeated runs across differing millisecond values.

Scope

Test-only, src/lib/pr-fix-surfacing.test.ts (and src/lib/pr-fix-surfacing.ts only if the body needs a seam to freeze the clock).

Found while

Validating PR #1247 (src/lib/pr-fix-surfacing.test.ts is not touched by that PR).

Activity

  1. added
    type/bugSomething isn't working
    type/choreRoutine tasks and maintenance
    status/readyReady for Dispatch worker pickup.
    status/in-reviewPull request or human review is in progress.
    and removed
    status/readyReady for Dispatch worker pickup.
    on Oct 14, 2026
  2. added and removed
    status/in-reviewPull request or human review is in progress.
    on Oct 15, 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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions