Skip to content

guardrails: run the main-checkout edit guard's suite in Windows CI #17027

Description

@kyle-sexton

plugins/guardrails/hooks/block-main-checkout-edit.test.sh (added by #16954) is not selected by the Windows test jobs, so the guard's ownership check ([[ -O ]]), its cd -P path resolution and its drive-letter handling are untested under Git Bash in CI. pr-verify noted this on #16954, and #17018 leaves it unverified.

One manual check exists: on 2026-11-17 the hook script, run under Git Bash against a Windows checkout on its default branch with the option on, denied an Edit of a tracked file (exit 2) and passed a git-ignored path (exit 0). That was the script alone, on one machine.

Done when

  • The suite is selected for the Windows guard test job and passes there, or each case that cannot run on Windows is skipped with its reason.
  • A failure of the ownership check on Windows is shown to make a test fail, since the guard allows the edit silently when that check fails.

Activity

  1. added
    needs-triage
    on Nov 18, 2026
  2. github-actions commented on Nov 18, 2026

    @github-actions
    Contributor

    Size: Small
    Complexity: Medium
    Uncertainty: Knowable
    Flags: none
    Blocked by: none
    Blast radius: the Windows guards CI job, its test plan file, and the main-checkout edit guard's test suite. Maintainers and pull request checks read or run these.
    Reversible: yes; revert the workflow, plan file and test edits.
    Open questions: none
    Understood: the main-checkout edit guard's suite is not selected by the Windows guards job. The ownership check, cd -P path resolution and drive-letter handling are therefore untested under Git Bash. The request is to select the suite there. Cases that cannot run on Windows should print a counted skip with the reason, and a failing ownership check must turn the suite red. The refinement comment already lists acceptance criteria. Confirming the Windows pass needs a real Windows CI run. I found no open duplicate and no merged pull request that already does this. #17015 is related, since it may change the default the suite asserts.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triage
    on Nov 18, 2026
  4. melodic-automation-lanes commented on Nov 18, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane: its done-when asks for what an unattended lane run cannot perform: item 5 (named-host: "The suite's tests that need ln -s (alias, link-to-main, out) and any other ..."); recommended split: keep the other items here as the admissible issue and move these to a child issue for the host queue (host-run). Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).

  5. melodic-automation-lanes commented on Nov 18, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: The main-checkout edit guard's suite runs in the Windows guards CI job, passes under Git Bash or skips each Windows-impossible case with a printed reason, and fails when the real ownership check fails.

    Acceptance criteria

    • scripts/test-windows-plan.txt has a line test-windows-guards plugins/guardrails/hooks/block-main-checkout-edit.test.sh (optionally with the guard and hooks.json as extra patterns).
    • .github/workflows/pr-test-platforms.yml has a step in the test-windows-guards job, with an if: contains\(fromJSON\(needs.select-tests-windows.outputs.steps\), 'plugins/guardrails/hooks/block-main-checkout-edit.test.sh'\) condition, that runs bash plugins/guardrails/hooks/block-main-checkout-edit.test.sh.
    • bash scripts/plan-test-lanes.test.sh passes, so the plan file and the workflow step conditions name the same keys.
    • The job's comment block and timing table in pr-test-platforms.yml (the GUARDRAILS list near line 119 and the per-job table near line 143) mention the new suite.
    • The suite's tests that need ln -s (alias, link-to-main, out) and any other case that cannot run under Git Bash on windows-2025 are gated on a host probe and print a counted SKIP line with the reason, and the suite still passes on Linux with the same case count of non-skipped cases.
    • A new test case makes the guard's real \[\[ -O \]\] path decide the outcome with no GUARDRAILS_TEST_UNOWNED_PATH override: the existing deny cases on an owned checkout (block-main-checkout-edit.test.sh:57-74) must exit 2, so an -O that returns false on Windows makes them fail.
    • A test shows that a failing ownership check turns the suite red: for example it runs the guard with -O forced false (a copy of the guard or a test-only hook) and asserts a deny case then fails, which is checkable on Linux.
    • Any Windows-specific cases the suite lacks are covered: a drive-letter path such as C:/... and a backslash path to a tracked file are denied (exit 2), and a git-ignored path exits 0.
    • The suite passes on Linux locally or in the Linux lane with bash plugins/guardrails/hooks/block-main-checkout-edit.test.sh.
    • A .changes entry is added if the repository's change-log convention requires one for CI or test changes.

    External state: none

    Dependencies

    • #​16954 (merged work that added the suite and guard; already closed, so the work can start now).
    • A real Windows CI run of the test-windows-guards job (pull request checks) is the only place the Windows pass can be confirmed; the unattended run can only check the Linux side and the wiring.

    Related work

    Sources read

    • plugins/guardrails/hooks/block-main-checkout-edit.test.sh:1-143: the suite; it uses ln -s at lines 69, 73, 104, a stubbed git, and a GUARDRAILS_TEST_UNOWNED_PATH override at lines 90-95 that never hits the real -O.
    • plugins/guardrails/hooks/block-main-checkout-edit.sh:80-85: mce::owned uses \[\[ -O \]\] and every failure exits 0, allowing the edit silently.
    • plugins/guardrails/hooks/block-main-checkout-edit.sh:34-52: backslash normalization, drive-letter match and cd -P resolution.
    • .github/workflows/pr-test-platforms.yml:332-370: the test-windows-guards job runs only hardcoded-path-check and block-root-delete-target-resolve.
    • .github/workflows/pr-test-platforms.yml:119-134: the comment says a host-gated case that cannot run must print a counted SKIP line, and each new step needs a line in scripts/test-windows-plan.txt.
    • scripts/test-windows-plan.txt:23-24: the test-windows-guards lines; no line for block-main-checkout-edit.test.sh.
    • scripts/plan-test-lanes.test.sh: checks the plan lines and the workflow step conditions name the same keys (per the plan file header).

    Automated refinement by the lanes App. Intake triages the issue again with it.

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

    Fields

    Work status

    confirmed

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions