Skip to content

fix(dev): support stdin '-' and normalize path separators in ci-pytest-batches.py - #1767

Merged
potiuk merged 3 commits into
apache:mainfrom
Kaap10:fix/workspace-pytest-windows-stdin-paths
Oct 23, 2026
Merged

potiuk merged 3 commits into
apache:mainfrom
Kaap10:fix/workspace-pytest-windows-stdin-paths

Conversation

@Kaap10

@Kaap10 Kaap10 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Support stdin - and normalize Windows path separators in tools/dev/ci-pytest-batches.py, resolving FileNotFoundError and silent test drops on Windows (fix(dev): workspace-pytest hook crashes on Windows with FileNotFoundError for /dev/stdin and drops backslash paths #1766).
  • Update tools/dev/run-workspace-check.sh to pass --changed-file - and strip \r from command substitution so Windows paths do not fail uv run --directory.
  • Add try/except OSError: pytest.skip(...) with target_is_directory=True in tools/dev/tests/test_ci_pytest_batches.py for platforms where symlink privileges are unheld, and add a unit test for stdin - with backslash paths.

Type of change

  • Skill change (.claude/skills/<name>/) — eval fixtures updated below
  • Tool / bridge contract (tools/<system>/*.md)
  • Python package (tools/*/ with pyproject.toml)
  • Groovy reference impl
  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
  • Documentation (docs/, README.md, CONTRIBUTING.md)
  • Project template (projects/_template/)
  • CI / dev loop (prek, workflows, validators)
  • Other:

Test plan

  • For Python packages touched: uv run pytest / ruff check / mypy passes
  • End-to-end verified on Windows with Git Bash:
    • printf 'tools/agent-guard/src/agent_guard/__init__.py\n' | python3 tools/dev/ci-pytest-batches.py --changed-file - --paths -> outputs tools/agent-guard
    • printf 'tools\\agent-guard\\src\\agent_guard\\__init__.py\n' | python3 tools/dev/ci-pytest-batches.py --changed-file - --paths -> outputs tools/agent-guard
    • tools/dev/run-workspace-check.sh pytest "pytest --version" tools/agent-guard/src/agent_guard/__init__.py tools/vcs/src/vcs/__init__.py -> passes across all 3 applicable members cleanly without CRLF syntax errors.

RFC-AI-0004 compliance

  • HITL — any new mutation is gated on explicit user confirmation
  • Sandbox — no new unrestricted host access; network reach declared in the adapter
  • Vendor neutrality — placeholders (<PROJECT>, <tracker>, <upstream>, <security-list>) used in all skill / tool prose (the check-placeholders prek hook is the mechanical gate)
  • Conversational + correctable — agentic-override path documented if behaviour is adopter-tunable
  • Write-access discipline — no autonomous outbound messages; drafts only, sent on confirmation
  • Privacy LLM — private content does not reach a non-approved LLM; redactor invoked where needed

Linked issues

Closes #1766

@github-actions github-actions Bot added family:tools tools/* family:ci .github workflows, prek, validators substrate:framework-dev Tool substrate: build / validate / eval the framework itself labels Oct 23, 2026
@Kaap10

Kaap10 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

While testing the new selective pytest hook from #1764 on Windows, noticed it crashed on /dev/stdin resolution and silently dropped backslash paths. Opened this PR to standardize on stdin -, normalize path separators, and keep the hook cleanly cross-platform.

Ready for review whenever you get a chance @potiuk - happy to address any feedback or requested changes!

Kaap10 and others added 2 commits October 23, 2026 15:30
- module docstring: `--changed-file` names a file, or `-` to read the
  changed paths from stdin
- `--help` text for `--changed-file`: add "or - for stdin"

Generated-by: Claude Code (Opus 5.5)
@Kaap10
Kaap10 force-pushed the fix/workspace-pytest-windows-stdin-paths branch from 7b217f8 to 5687143 Compare October 23, 2026 10:02
@github-actions github-actions Bot added family:setup setup-* skills capability:reassess Re-run historical issues against current code capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) labels Oct 23, 2026
@Kaap10

Kaap10 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for adding the docstrings @potiuk!

Formatted tools/dev/ci-pytest-batches.py with ruff format, rebased on upstream/main, and also formatted test_probe_1_ssh_agent.py to keep workspace-ruff-format green across the workspace.

@potiuk
potiuk merged commit 5841d2e into apache:main Oct 23, 2026
16 checks passed

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the list from stdin with - and normalising \ to / is the right fix for #1766: pipefail keeps a Python failure visible through the new | tr -d '\r', the CI path (tests.yml passes a real file) is unchanged, and the new test covers stdin with backslash paths. The one gap was documentation, so rather than ask for another round I pushed it to your branch as 7b217f8 before merging:

  • tools/dev/ci-pytest-batches.py module docstring: --changed-file now says it takes a file, or - to read the changed paths from stdin.
  • tools/dev/ci-pytest-batches.py --help text for --changed-file: added "or - for stdin".

This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Magpie handles maintainer review:
Contributing guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) capability:reassess Re-run historical issues against current code family:ci .github workflows, prek, validators family:setup setup-* skills family:tools tools/* substrate:framework-dev Tool substrate: build / validate / eval the framework itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(dev): workspace-pytest hook crashes on Windows with FileNotFoundError for /dev/stdin and drops backslash paths

2 participants