Skip to content

fix: test_latest_per_keeps_the_latest_sibling flakes on a one-second completion tie #1758

Closed

Description

@Jammy2211

Overview

test_autofit/results/test_identity.py::test_latest_per_keeps_the_latest_sibling failed on main at 963ff296a (Tests run 41456192737, unittest-nojax leg). That failure blocks the release-validation preflight ("PyAutoFit: CI failure").

The test runs two tiny fits of the same search back to back, then expects Aggregator.latest_per() to keep the second. completed_at comes from the status record's updated stamp, which has one-second resolution (%Y-%m-%dT%H:%M:%SZ, autofit/non_linear/status/record.py::_now). When both fits finish within the same second they tie, and latest_per breaks the tie by the greater path, which is an identifier hash. So the test passes or fails by chance. It failed 1 of the last 15 Tests runs.

That tie behaviour is correct: it's deterministic, and real reruns are minutes apart. The bug is in the test.

Plan

  • Test-only fix: after the three fits, rewrite the first fit's <output_path>.status.json updated to one minute earlier, so the second fit is unambiguously the later sibling whatever the clock does.
  • No library change.

Tier: judge — merge mode: human /prm (corrective PR: unblocks release validate)

Detailed implementation plan

Affected Repositories

  • PyAutoFit (primary)

Suggested branch: feature/latest-per-test-tie

Steps

  1. test_autofit/results/test_identity.py::test_latest_per_keeps_the_latest_sibling: capture first = _fit(...), then load its status JSON, set updated to second's minus 60 s, and write it back before building the aggregator. Keep every existing assertion.
  2. Run the test 20× under -p no:randomly, plus the results folder and the nojax-emulated leg.

Original Prompt

Click to expand

Human 2026-11-02: "Fix, then validate" (after release validate preflight was blocked by this failure).

Activity

  1. Jammy2211 commented on Nov 2, 2026

    @Jammy2211
    CollaboratorAuthor

    Library PR Created: #1759 (test-only; 20/20 passes). Merge it, then release validate can run (its preflight is blocked by this red main).

  2. Jammy2211 commented on Nov 2, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped. #1759 merged — the latest_per sibling test no longer depends on two fits finishing in different seconds.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions