Skip to content

TestRoundtrip_AnchorLineDeleted_Outdated flakes when run in full suite #456

@tomasz-tomczyk

Description

@tomasz-tomczyk

Symptoms

Test TestRoundtrip_AnchorLineDeleted_Outdated in roundtrip_integration_test.go (build tag e2e_github):

  • Passes when run in isolation: ./scripts/e2e-roundtrip.sh -run TestRoundtrip_AnchorLineDeleted_Outdated -v
  • Fails with HTTP 422 from gh api (on the second crit push) when run as part of the full suite via make e2e-roundtrip.

Observed at least twice in CI runs against the sandbox PR. Re-running the test in isolation passes cleanly.

Likely cause

Each scenario gets its own throwaway branch + PR via newRoundtripEnv, so cross-test PR pollution is unlikely. More plausible:

  • The sandbox repo accumulates rapid-fire PR-create + close + delete-branch operations during the suite. The 422 may be GitHub catching up with branch deletion or PR state when this scenario tries to resync after its own force-push.
  • Race between gh pr close --delete-branch cleanup from a prior test and this test's force-push + add-comment.

Repro

export CRIT_ROUNDTRIP_REPO=crit-md/crit-roundtrip-sandbox
make e2e-roundtrip
# Observe TestRoundtrip_AnchorLineDeleted_Outdated FAIL with HTTP 422 on the second push
./scripts/e2e-roundtrip.sh -run TestRoundtrip_AnchorLineDeleted_Outdated -v
# Passes on its own

Suggested investigation

  • Add a short gh api repos/{slug}/pulls/{N} poll after the force-push to confirm GitHub recomputed the diff before the second crit push fires.
  • Or stagger scenarios: t.Parallel() is already implicit-off; consider an explicit time.Sleep(2*time.Second) after the force-push as a temporary mitigation while the underlying race is investigated.

Source

Surfaced during the body-hash refactor on PR #445.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions