Skip to content

fix(tests): pass the review_window git contract with git 2.55 #6380

Description

@dan-petty

Problem

Two cases of tests/core/test_git_contract.py fail in the devcontainer and pass in CI on the same commit (29e3a03, Tests & Coverage green on 2026-11-19):

  • test_a_scenario_over_the_process_fake_starts_the_recorded_commands_and_gives_the_result[review_window]: the code starts git -C <project> for-each-ref --format=%(refname:short)%09%(creatordate:unix) refs/tags/v* where the recording expects git -C <project> cat-file blob 4c12ae57...:a.py.
  • test_a_scenario_over_the_git_fake_gives_the_recorded_result[review_window]: the result differs from the recorded result.

The failure stays with an empty HOME and XDG_* directories, without DEVOPS_CLI_CONFIG, without the GIT_CONFIG_* variables of the devcontainer, and with TZ=UTC. The scenario (review_window in tests/support/git_scenarios.py) fixes now. The difference left is git: the devcontainer has git 2.55.0, and the CI runner has git 2.56.1. The owner rule is that every test passes in the devcontainer and on a stock runner.

Expected

  • Find the cause and fix it at its source: the code or the scenario must not depend on the git version (for example how creatordate reads a lightweight tag), or the recording records what both versions give.
  • Both cases pass in the devcontainer and in CI.
  • The devtools image work (one image for the devcontainer and the Job images) gives one git version to both; this item does not wait for it.

Alternatives check of 2026-11-19: none.
Tool: none found.
Reason: Searches returned no open, maintained tool or library for a repository-internal git contract test; the fix changes the project's own git_read and transcript, and adds no library.

Lacks:

  • No tool to record the review_window transcript
  • No tool to make tag dates version-independent
  • No external library fits an in-repo contract test

Proposed design

Problem statement

Fix the test environment and not read_tags. A local venv holds no lizard from the optional review extra, and the git version is not the cause. Two review_window contract cases and one review-facts case then fail, and they pass in CI. The fix declares lizard in the dev dependency group of pyproject.toml and adds a guard test. The read_tags change is dropped.

Acceptance criteria

Requirement: The dev group declares the review package

The dev dependency group in pyproject.toml SHALL declare lizard, so that a plain uv run installs it.

Scenario: A plain sync installs lizard

  • WHEN uv run python -c "import lizard" runs in a fresh clone with no extra flag.
  • THEN The command exits 0.

Requirement: A guard names the missing extra

A test in tests/invariants/ SHALL fail with a message that names uv sync --all-extras when the test environment holds no lizard.

Scenario: The guard gives the sync command in its message

  • WHEN uv run pytest tests/invariants/test_review_extra_present.py runs, and one case replaces importlib.util.find_spec with a function that returns None for lizard.
  • THEN The case asserts that the guard raises AssertionError with a message that holds uv sync --all-extras, and it passes.

Requirement: The review_window cases pass in a new worktree

The two review_window contract cases and the review-facts case SHALL pass under a plain uv run pytest in a new worktree.

Scenario: No case fails in a new worktree

  • WHEN uv run pytest tests/core/test_git_contract.py tests/roadmap/project_review/test_review_facts.py -k 'review_window or test_the_facts_of_a_version_window' runs in a fresh worktree with a new .venv.
  • THEN The run reports 0 failed cases.

Requirement: The git row matches in a new worktree

The git row of devops ci SHALL report no difference for review_window in a new worktree venv.

Scenario: The git row matches

  • WHEN uv run devops ci --check --only git runs in a fresh worktree with a new .venv.
  • THEN The row reports that the git transcripts match and exits 0.

Existing Tool Considered

The alternatives check in the issue body (2026-11-19) records verdict none with no tool; that block holds its Lacks: list. The change adds no library. It declares the existing lizard package in the dev dependency group of pyproject.toml, which the review extra already names, and it adds one pytest guard. Written cost of the guard: about 5k tokens to write, 1k per later fix, and 30 minutes elapsed.

Key questions

  • Why do the review_window contract cases fail in a local venv and pass in CI?: The venv holds no lizard, which the review extra of pyproject.toml installs. _complexity in facts.py sees find_spec("lizard") is None, sets lizard.complexity to skipped, and reads no blob. The replay then meets for-each-ref where the recording holds cat-file blob. [sources: pyproject.toml, src/devops_cli/roadmap/project_review/facts.py, tests/support/git_scenarios.py, tests/core/test_git_contract.py]
  • Does the git version cause the failure?: No. The contract suite starts no program, because the no_program_starts fixture refuses every start. The recording row passes with git 2.55.0, so the two git versions give the same transcript. [sources: tests/core/test_git_contract.py, tests/core/test_git_recording.py]
  • How does the test environment get lizard in the devcontainer, a new worktree and CI?: Declare lizard in the dev dependency group of pyproject.toml. A plain uv run syncs the default groups, so the devcontainer and a new worktree get the package. CI syncs all groups and all extras, so it keeps the package. (best practice) [sources: pyproject.toml, AGENTS.md]
    • Chosen: Declare lizard in the dev dependency group. A plain uv run syncs the default groups, so every test environment gets the package that the recording needs.
    • Rejected: Skip the cases when lizard is absent. The cases would not pass in the devcontainer, and the git row would still show a difference there.
    • Rejected: Read the tag date with git log -1 --format=%ct. The git version is not the cause, and the contract suite starts no real git.
    • Rejected: Record the transcript in a venv without the extra. CI installs the extra, so its recording would differ from the committed one.
  • Which check stops the failure from returning?: One test in tests/invariants/ asserts that the test environment holds lizard. Its message names uv sync --all-extras. A second case gives find_spec a None result and asserts that message. (best practice) [sources: AGENTS.md, tests/invariants/test_hermetic_floor.py]
    • Chosen: A pytest guard in tests/invariants/. AGENTS.md rule 11 asks for a check that fails if the problem returns.
    • Rejected: A note in docs/TESTING.md. A document does not fail a check.
    • Rejected: No guard. The same failure returns with no signal.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    status/new
    value/medium
    effort/medium
    scope/tests
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  5. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (6)

    Searches run:

    • git log -1 --format=%ct commit date of tag dereference library python, results: 5
    • git for-each-ref creatordate lightweight tag vs annotated tag version difference, results: 5
    • python git library parse tags commit date pure python GitPython3, results: 5
    • GitPython python library read git tags without git binary, results: 5
    • stackoverflow git tag commit date for-each-ref creatordate annotated tag tagger date, results: 5
    • git-for-each-ref documentation creatordate field, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 19, 2026
  7. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  8. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    The problem is still on main at 165463c (2026-11-20) in the devcontainer: uv run pytest tests/core/test_git_contract.py tests/roadmap/project_review/test_review_facts.py gives 3 failures, the two review_window cases and test_the_facts_of_a_version_window. The process fake sees git for-each-ref --format=%(refname:short)%09%(creatordate:unix) refs/tags/v* where the recording holds git cat-file blob <sha>:a.py.

  9. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    The cause is not git 2.55. It is the missing review extra (lizard) in a local venv.

    Evidence, on main e01bf84 with git 2.55.0 in a new worktree:

    • uv run python -c "import lizard" gives ModuleNotFoundError. A plain uv run syncs no extra, and lizard is in the extra review of pyproject.toml.
    • With no lizard, _complexity in roadmap/project_review/facts.py gives lizard.complexity the status skipped (find_spec("lizard") is None) and reads no blob. So the replay of review_window meets for-each-ref ... refs/tags/v* where the recording expects the cat-file blob ...:a.py of lizard.
    • The same cause fails a third test: tests/roadmap/project_review/test_review_facts.py::test_the_facts_of_a_version_window (lizard.complexity is skipped, and the test expects ok with 3 files).
    • uv run --extra review pytest tests/core/test_git_contract.py tests/roadmap/project_review/test_review_facts.py -k 'review_window or test_the_facts_of_a_version_window' gives 4 passed with git 2.55.0.

    CI runs uv sync --all-groups --all-extras, so it has lizard. A fix at the source: the tests that need lizard skip with a reason when the extra is missing, or the local setup syncs the extra.

  10. 1 remaining item

  11. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Returning to New: this item cannot be built as specified because the premise in its Proposed design is disproven by command output, and the proposed change does not fix the real failure.

    Evidence (checked at origin/main da9753e40, git version 2.55.0)

    1. uv run devops ci --check --only git passes in the devcontainer with git version 2.55.0 (The 22 git transcripts match git version 2.55.0.), proving git 2.55.0 and CI git produce identical transcripts for for-each-ref creatordate.
    2. uv run pytest -n 0 tests/core/test_git_contract.py tests/core/test_git_recording.py passes (96 passed in 1.59s), including all 3 review_window cases.
    3. tests/core/test_git_contract.py forbids spawning real git (no_program_starts fixture), so git 2.55.0 vs 2.56.1 cannot cause the contract replay failure. As the prior comment on this issue also showed, the mismatch occurs when a worktree venv lacks the optional review extra (lizard), causing complexity_fact (src/devops_cli/roadmap/project_review/facts.py:221) to skip cat-file blob exchanges and jump directly to for-each-ref.
    4. Replacing for-each-ref creatordate in read_tags with per-tag git log -1 --format=%ct calls would add N+1 subprocesses without fixing a missing lizard environment.

    Needs re-refinement to target the missing lizard (review extra) setup or test skip condition instead of read_tags.

  12. added
    status/new
    and removed
    status/ready
    on Nov 25, 2026
  13. added
    status/ready
    and removed
    status/new
    on Nov 25, 2026
  14. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  15. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 25, 2026
  16. removed
    status/in-review
    on Nov 25, 2026
  17. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 17:09 UTC

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

    effort/mediumpriority/p2-mediumscope/testssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions