loopx icon indicating copy to clipboard operation
loopx copied to clipboard

[Task]: pin the fail-closed repository change window and its terminal pending-change lifecycle

Open YZJF opened this issue 2 months ago • 0 comments

Task ID or area

area: capability / repository change window (loopx/capabilities/repository_change_window/)

Technical direction

Core control-plane hardening

Intent

I am proposing a new task

Goal and acceptance gap

Goal/source: the visible-governance row of the contributor task board asks for one provider-neutral negative fixture proving a locked repository window rejects writes and pending ledger rows resolve with a typed lifecycle after merge or close. The capability shipped in #3319 with positive-path coverage, so that negative contract is currently unasserted.

Current gap: tests/capabilities/test_repository_change_window.py covers the policy boundaries, provider install/status/uninstall, drift, ssh transport and the ledger's restart-safe idempotency, but no test asserts a denial, a terminal resolution, or any of the fail-closed validations. Concretely uncovered: inside_blocked_window with its next_eligible_at, the merged / superseded / abandoned lifecycle, immutability of a terminal resolution, "a resolved pending change cannot be reopened", and the policy / change-id / resolution / state-filter rejections.

Accepted outcome (before → after): before, a regression that silently admitted a write inside a blocked window, reopened a resolved row, overwrote a terminal resolution, or accepted a malformed policy would pass the suite. After, each of those fails a named negative case.

Proposed scope

In scope / owner: one new provider-neutral negative test module for the shipped change-window capability, synthetic only, no production change. I will own it.

Existing related work / dependencies: #3319 (repository gate and pending ledger, commit a51435792); existing coverage in tests/capabilities/test_repository_change_window.py.

Out of scope: the managed Git-hook provider install path and its runtime contract (needs an activated loopx executable on PATH, which the current sandbox does not provide); any change to the policy, ledger or CLI behaviour.

If staged: complete within this scope.

Intended base branch

main

Relevant files or commands

  • tests/capabilities/test_repository_change_window_negative.py (new)
  • loopx/capabilities/repository_change_window/policy.py
  • loopx/capabilities/repository_change_window/ledger.py
  • python -m pytest tests/capabilities/test_repository_change_window_negative.py

Validation plan

Accepted result and independent oracle: the new module passes and every case fails when its guard is removed — a mutation check on the terminal-resolution guard makes test_terminal_resolution_is_immutable_and_requires_its_successor fail.

Actual entrypoint / safe command: python -m pytest tests/capabilities/test_repository_change_window_negative.py — 9 passed on the rebased head; the pre-existing change-window modules keep their baseline result.

Negative or recovery case: the module is the negative case; a denied window keeps the row open and locatable, a rejected resolution attempt does not consume the open row, and a resolved row cannot be reopened.

Frontend / Lark / CLI impact or verified N/A: verified N/A — test-only, no public invocation, payload or exit code changes.

Public/private boundary

  • [x] This issue does not include private benchmark traces, verifier output, credentials, internal document links, raw agent sessions, or local runtime state.
  • [x] I will not run or duplicate maintainer-owned benchmark cases unless a maintainer explicitly splits out a public task.

YZJF avatar Sep 17 '26 11:09 YZJF