Skip to content

fix(roadmap): the review_window git transcript does not match the code #4865

Closed

Description

@dan-petty

Problem Description

The git transcript tests/fixtures/git/review_window.json (scenario review_window of tests/support/git_scenarios.py, #4794) does not match what the code does on origin/main. The contract suite fails on it, and a new recording changes the transcript.

Reproduction Steps

  1. Check out origin/main at 9f0e0c8.
  2. Run uv run devops ci test tests/core/test_git_contract.py (or uv run pytest tests/core/test_git_contract.py -k review_window).
  3. Run uv run python -c "import sys; from tests.support.git_recording import main; sys.exit(main(['--check']))".

Expected vs Actual Behavior

Expected: both contract cases of review_window pass, and --check reports that the transcripts match.

Actual: test_a_scenario_over_the_git_fake_gives_the_recorded_result[review_window] and test_a_scenario_over_the_process_fake_starts_the_recorded_commands_and_gives_the_result[review_window] fail. --check reports committed/review_window.json as different; a new recording with git 2.55.0 gives 8 insertions and 272 deletions (the cat-file blob exchanges go). No commit after #4794 changed src/devops_cli/roadmap/project_review/ or the scenario, so the scenario or its code is probably not deterministic (for example, it reads the current date).

Environment Diagnostics

git 2.55.0, Python 3.14.10, the devcontainer.

Logs, Traces, or Terminal Output

FAILED tests/core/test_git_contract.py::test_a_scenario_over_the_git_fake_gives_the_recorded_result[review_window] - AssertionError: assert {'origin': 'e...9', ...}, ...} == {'origin': 'e...9', ...}

Found while building #4670.

Source: #4670

Alternatives check of 2026-11-14: none.
Tool: none found.

Proposed design

Problem statement

The committed git transcript tests/fixtures/git/review_window.json does not match what the code gives. Two contract cases fail, and the git row of devops ci reports a difference. The period_facts of the result differ, and a new recording with git 2.55.0 drops the cat-file blob exchanges. The fix isolates the scenario from the host and records the transcript again, so that the file matches on every host.

Acceptance criteria

Requirement: Contract replay of review_window

The contract suite SHALL replay the scenario review_window over the process fake and over GitFake and get the recorded result.

Scenario: Both review_window cases pass

  • WHEN uv run pytest tests/core/test_git_contract.py -k review_window runs on the change.
  • THEN The cases test_a_scenario_over_the_process_fake_starts_the_recorded_commands_and_gives_the_result[review_window] and test_a_scenario_over_the_git_fake_gives_the_recorded_result[review_window] pass, and the process fake reports no started command that differs from its record.

Requirement: Recording check

The recorder SHALL find no difference between a committed transcript and a new recording.

Scenario: The git row passes

  • WHEN uv run python -c "import sys; from tests.support.git_recording import main; sys.exit(main(['--check']))" runs on the change.
  • THEN The report holds no line that starts with +++ git/.

Requirement: Recorded complexity fact

The recorded result MUST hold the fact lizard.complexity with status ok and three files, in version_facts and in period_facts.

Scenario: The complexity fact is present

  • WHEN A test loads tests/fixtures/git/review_window.json and reads the two fact lists.
  • THEN Each list holds lizard.complexity with status ok and n 3, and each fact of the two lists has status ok.

Requirement: No host git configuration

The environment that the scenario gives the code MUST read no git configuration of the host.

Scenario: The code's git is isolated

  • WHEN A test enters Workspace.environment() and reads the process environment.
  • THEN The environment holds GIT_CONFIG_NOSYSTEM at 1 and GIT_CONFIG_GLOBAL at os.devnull.

Requirement: Reproducible recording

Two recordings of one scenario MUST give the same text.

Scenario: The recorder is idempotent

  • WHEN The recorder runs twice in a row on one checkout.
  • THEN The second recording reports no line that starts with +++ git/.

Requirement: Review facts replay

The test that replays review_window through review_facts SHALL pass.

Scenario: The version window facts test passes

  • WHEN uv run pytest tests/roadmap/project_review/test_review_facts.py::test_the_facts_of_a_version_window runs on the change.
  • THEN The test passes.

Existing Tool Considered

The alternatives check of 2026-11-14 found no open, maintained tool (verdict: none). The only candidate, time-machine (https://pypi.org/project/time-machine, MIT), patches Python wall-clock reads only and cannot make a transcript that the real git records deterministic. The repository's own git fake and recording harness (tests/support/git_scenarios.py, tests/support/git_recording.py) already own the need. The change builds no new tool: it isolates the scenario and records the transcript again. Cost: about 20k tokens to record, compare and fix the scenario, and under one hour of elapsed time. No code stays to keep.

Key questions

  • Which commands and results of the committed transcript differ from the code?: The process fake starts git for-each-ref ... refs/tags/v* where the transcript records git cat-file blob .... A new recording with git 2.55.0 gives 8 insertions and 272 deletions, and the cat-file blob exchanges go. The period_facts of the result also differ. [sources: tests/fixtures/git/review_window.json, tests/core/test_git_contract.py, tests/support/git_scenarios.py]
  • Why does the committed transcript hold git cat-file blob exchanges?: The fact lizard.complexity reads each hotspot path at the base and at the head with git cat-file blob <commit>:<path>. Its query in the transcript states that command. A recording that drops those exchanges means the complexity fact did not run, so the new transcript must keep that fact with status ok. [sources: tests/fixtures/git/review_window.json, tests/support/git_scenarios.py]
  • Does the scenario review_window read the current date?: No. The scenario passes now = datetime(2026, 10, 6, tzinfo=UTC) to parse_window, sets the date of each commit, makes each tag a lightweight tag whose creatordate is the date of its commit, and excludes read_at from each fact. The repository that it builds is the same on every run. [sources: tests/support/git_scenarios.py:556]
  • Which git configuration does the code's git read during a recording?: Workspace.environment() sets only HOME, LC_ALL and DEVOPS_CLI_USER_DATA_ROOT. The git that the code starts therefore reads the system file /etc/gitconfig of the host. The git that builds the repository reads no host configuration, because setup_env sets GIT_CONFIG_NOSYSTEM=1 and GIT_CONFIG_GLOBAL=/dev/null. [sources: tests/support/git_scenarios.py]
  • How does the recording become independent of the host?: Set GIT_CONFIG_NOSYSTEM=1 and GIT_CONFIG_GLOBAL=os.devnull in Workspace.environment(), as setup_env does for the build. Record again each transcript that this isolation changes. (best practice) [sources: tests/support/git_scenarios.py, tests/support/git_recording.py]
    • Chosen: Isolate the code's git. The recorder must give one file on every host. The git that builds the repository already reads no host configuration, and the code's git must do the same.
    • Rejected: Record again on each host. The file would differ between the devcontainer, the runner image and CI, so the git row would fail on one of them.
    • Rejected: Record inside the container image only. The devcontainer and the runner image still record on their own hosts, so the drift stays.
  • Does the change record the transcript again or change the code?: Record the transcript again with the repository's recorder, then check each fact of the result against the fixture. Do not edit the JSON by hand. (best practice) [sources: tests/support/git_recording.py, tests/core/test_git_contract.py, tests/fixtures/git/review_window.json]
    • Chosen: Record again, then check each fact. The transcript is stale. The check keeps a defect of the code out of the file.
    • Rejected: Record again and accept the output. It would record an error fact, such as a lizard.complexity that did not run, as the expected result.
    • Rejected: Change the code to give the recorded commands. No source shows that the code is wrong, and the recorded order does not match the code.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. A contract test fails in CI, but the scope is one transcript and one scenario.
    • Value: Medium. It restores a passing CI check but adds no user-facing behaviour.
    • Effort: Low. The fix is likely a re-recording or a small non-determinism patch in one scenario.
    • Related: feat(roadmap): collect the git facts of a project review window #4686, which asks for a different change. Both concern the review_window git scenario, but #4686 delivers the feature while the candidate fixes its recorded transcript.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    The local devops ci gate "git transcripts (recorded again with the real git)" failed the same way on a branch from origin/main at 7f09921, with git 2.55.0: tests/fixtures/git/review_window.json differs from the new recording near line 500. That branch does not change the transcript or src/devops_cli/roadmap/project_review/.

  6. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    This still fails on main at f4b1d73 (2026-11-12): uv run pytest tests/core/test_git_contract.py -k review_window gives 2 failed (test_a_scenario_over_the_process_fake_starts_the_recorded_commands_and_gives_the_result[review_window] and test_a_scenario_over_the_git_fake_gives_the_recorded_result[review_window]). The period_facts of the result differ from the transcript.

  7. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Impact evidence (2026-11-12): these tests fail each full-suite verify in the devcontainer and in the runner image, so they block implement groups that verify with the full uv run devops ci test.

    Thus each full-suite verify in the runner fails until this item is fixed. No builder slot is free now, so this comment only makes the impact visible for its priority.

  8. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    Evidence (2026-11-13): the git row of uv run devops ci --check --only git also fails on this transcript. It reports "The committed git transcripts differ from git version 2.55.0" with a diff of review_window.json (the cat-file blob calls). Seen in a worktree at origin/main 9717c9b plus a change that touches no git transcript or git code.

  9. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    Evidence (2026-11-13): a full uv run devops ci test in a worktree at origin/main 4ef7c6f plus an infra change (no git code, no git transcript) gives 3 failures on this transcript. The third test also replays review_window: tests/roadmap/project_review/test_review_facts.py::test_the_facts_of_a_version_window (the fixture checkout calls git_fake.replay("review_window")). The other two are the contract cases that this issue names.

  10. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches turned up no tool or library that fixes a stale/divergent recorded git transcript; the answers were generic pages, and the only relevant candidate, the clock fake time-machine, patches Python wall-clock reads only and cannot make a transcript recorded by the real git binary deterministic. The need is an in-repo fix of the review_window scenario and its transcript, which the project's own git fake and recording harness (tests/support/git_scenarios.py, tests/support/git_recording.py) already own.

    Tool: none found

    Lacks:

    • A library that replays real git command output deterministically across git versions (the transcript records git cat-file blob exchanges that git 2.55.0 no longer produces)
    • A tool that reconciles a recorded transcript with the current scenario code, or that removes the non-determinism (for example a current-date read) from the scenario
    • Coverage of the tests/roadmap/project_review/test_review_facts.py replay of review_window, which fails with the same fixture

    Tools considered:

    Searches run:

    • record and replay git command transcripts test fixtures deterministic, results: 5
    • time-machine python library freeze current date in tests, results: 5
    • python library fake git subprocess test double record commands, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  11. added
    status/ready
    and removed
    status/new
    on Nov 15, 2026
  12. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at ca62d6a (see proposed design in issue body).

  13. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 18, 2026
  14. removed
    status/in-review
    on Nov 18, 2026
  15. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-18 13:25 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/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions