Skip to content

Fix failure-issue creation to parse the gh issue create URL output - #5336

Merged
Trecek merged 5 commits into
developfrom
impl-rectify_issue_5249_cli_boundary_2026-10-30_171916-20261104-080526
Nov 4, 2026
Merged

Trecek merged 5 commits into
developfrom
impl-rectify_issue_5249_cli_boundary_2026-10-30_171916-20261104-080526

Conversation

@Trecek

@Trecek Trecek commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

IssueUpdater._create ran gh issue create ... --json number and parsed JSON from stdout. gh issue create has no --json flag and prints the new issue's URL, so every failure-issue creation through this updater failed against the real CLI. The tests missed it because the gh mocks returned JSON for creation, so nothing checked what the executable accepts.

This fixes the one shared creation boundary used by probe failure issues, initial E2E occurrence issues, and body-limit successor issues, and adds a test that checks the production arguments against the installed gh.

Changes

src/autoskillit/_probe_canary.py

  • Drop --json number from the gh issue create arguments.
  • Parse the issue URL from stdout (https?://<host>/<owner>/<repo>/issues/<N>, whitespace-stripped, any host so Enterprise hosts and HTTP URLs work) into a positive int.
  • The nonzero-exit check still runs before parsing, and unexpected output keeps the existing gh issue create returned unexpected output error.
  • Body-file transport and cleanup, integer returns and saved state, occurrence content, successor links, and rollover sequencing are unchanged.

tests/execution/backends/test_probe_canary.py

  • The three creation mocks now return issue URLs instead of JSON; the list and view mocks stay JSON.
  • Creation is parameterized over an HTTPS URL and an HTTP Enterprise-host URL with surrounding whitespace, asserting int results.
  • New rejection cases for legacy JSON, a nonnumeric issue identifier, and issue 0: each raises, leaves last_issue_number untouched, and removes the temporary body file.
  • The create-failure test now returns a URL with a nonzero exit and still expects gh issue create failed.
  • New test_issue_create_arguments_are_supported_by_installed_gh runs the real _create arguments (including the live body file) against the installed gh with --help appended. Creation is never executed, and no credentials or network are needed. A missing gh fails the test rather than skipping it.
  • The module is reclassified small -> medium because it now spawns a subprocess.

Verification

  • Red before the fix: the focused module failed, including the installed parser rejecting the old arguments with unknown flag: --json.
  • Green after the fix: the focused module passes with no skips.
  • Related guards pass via task test-local-gate: this module, the live conformance-probe module, size-marker, regex-import, layer-marker, env-workaround, package-gateway, probe-script and filter-cascade tests.
  • pre-commit run --all-files passes.
  • Not run locally: the full task test-local-gate suite, left to CI.

Notes

  • The contract test certifies the gh installed where tests run (2.98.0 here). It does not certify the version pinned in scripts/docker/Dockerfile or used by historical E2E runs.
  • Rollover still closes the old issue before creating its successor, so a later create failure can leave the old issue closed. That is existing sequencing and is not changed here.

Closes #5249

🤖 Generated with Claude Code

Trecek and others added 5 commits November 4, 2026 08:11
…5249)

IssueUpdater._create passed `--json number` to `gh issue create`, which the
CLI does not support, and parsed JSON from stdout. Permissive mocks returned
JSON, so no test noticed. Drop the flag and parse the documented issue URL
(HTTP(S), any host) into a positive int, keeping the nonzero-exit check ahead
of parsing and the existing diagnostics.

Correct the creation fixtures to URL output, add unexpected-output cases, and
add a contract test that runs the production arguments against the installed
`gh` with `--help` appended. The module now spawns a subprocess, so it is
classified medium.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The test only runs `gh issue create ... --help`, which validates flags but
cannot observe the real stdout shape (gh issue create has no dry-run). Rename
it to say what it checks and document where the stdout contract is pinned.
If production stopped passing --body-file, the gh contract test failed with a
bare ValueError from list.index. Assert the flag first, matching the style of
the neighbouring tests, so the failure names the contract violation.
The live-CLI contract test hard-asserted that gh is installed, so on a host
without the CLI it errored instead of skipping. Follow the repo's live-CLI
contract convention (tests/AGENTS.md, CLI Flag-Spec Coverage) and skip only
when the binary is absent.
The module imported both `subprocess` and `from subprocess import
CompletedProcess`. Consolidate on the existing from-import convention.
@Trecek
Trecek added this pull request to the merge queue Nov 4, 2026
Merged via the queue into develop with commit e73767f Nov 4, 2026
10 checks passed
@Trecek
Trecek deleted the impl-rectify_issue_5249_cli_boundary_2026-10-30_171916-20261104-080526 branch November 4, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant