Repository navigation
Conversation
## Summary Refs #4262. `scripts/secrets_sync.py` refuses root before any call. So under a root test runner almost every case in `tests/test_secrets_sync.py` failed at that refusal: 170 failures and 1 error in a root container. - Under real root, the base case patches `refuse_root` to a no-op rather than faking the euid. The euid stays 0, consistent with the owner of the files the runner creates, so the ownership check reads them as owned. - `test_root_is_refused_before_any_call` restores the real function and runs as root. - The interrupt cases' subprocess driver stubs `refuse_root` as it already stubs `ask`. - A shared `RUNNING_AS_ROOT` in `tests/host_capability.py` skips the one case root genuinely changes: root lists a mode-000 directory. ## Verification In `python:3.13-slim`, with a copy of the tree: - As uid 0: 163 tests OK, 1 skipped, with both interrupt cases running. On `develop`: 170 failures, 1 error. - As uid 1234: OK. - The root-refusal case fails as root when the real function is not restored. On this host as a normal user: OK. No stub process survived. ## Local strict review Three passes. Round 1 replaced a faked euid, which caused 11 avoidable skips, with the `refuse_root` stub and a shared predicate. Round 2 moved the interrupt cases onto the same stub. Round 3 raised nothing. ### Dropped findings - Inline euid-0 predicates in `tests/test_restore_secrets.py`, `test_secrets_sh.py`, `test_install_agents.py`, `test_skills_install.py`, `test_bootstrap.py`, and `test_build_dist.py`, `consolidation` on text this change did not touch. `RUNNING_AS_ROOT` is the primitive they can move onto. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
## Summary Refs #4266. Every fleet repository carries `catalog/snippets/hub_fetch_run.py` at its root, where a carrier's own strict type checker can reach it and the carrier may not edit it. `mypy --strict` failed it with `no-any-return`, because typeshed types `urlopen(...).read()` as `Any`. That body is now annotated as `bytes`. The hub now gates the snippet with the real strict checkers: - A `Type-check the carried hub_fetch_run.py strictly step` in the hub's validate action runs `mypy --strict` with no config, and pyright, on the snippet. Neither hub type check reached `catalog/` before. The root's Python leg runs only mypy, never pyright, since its mypy section outranks pyright. - A `# pyright: strict` line in the snippet keeps pyright strict wherever the file is checked, the step and every carrier included. A per-module `strict = true` mypy override was tried first. It made every hub module strict, with 4,167 errors. ## Verification - `mypy --strict` and strict pyright on the snippet pass. With the old line restored, mypy fails at `hub_fetch_run.py:90`. With an unannotated-parameter probe, strict pyright fails, with no config entry. - `tests/test_hub_fetch_run.py`, plus `test_cli_usage`, `test_python_directories`, `test_pre_commit_hook`, `test_release_guards`, `test_prose_lint`, and `test_audit_helpers`, all pass. - The hub's own `mypy` reports no issues. ## Local strict review Three passes before the opening push. Round 1 replaced a hand-copied mypy flag list with the step. Round 2 moved pyright's strictness into the file. Round 3 raised the finding below, after the edit budget for this push was spent. ### Introduced findings, fixed in this pull request - `.github/actions/validate/action.yml`, `introduced`: the step checked the snippet as Linux only. Fixed in f19e7ac, which runs both checkers as Linux, macOS, and Windows code. An unguarded `os.killpg(pid, signal.SIGKILL)` probe passed on Linux and Darwin and failed both checkers on win32. A fourth local pass over the fix raised nothing. The pull request carries the `comments` label for the one pragma line. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the changes include strict cross-platform type validation plus targeted root-aware test adjustments.
No open issues 🎉
What changed in this PR
This promotion hardens the carried fetch helper with strict type validation and keeps secrets_sync tests meaningful when executed as root.
Changes:
- Adds strict mypy and pyright checks for Linux, macOS, and Windows targets.
- Annotates the fetched response body and enables strict pyright checking in the carried helper.
- Adapts root-sensitive tests while preserving root-refusal coverage and skipping the root-incompatible permission case.
| File | Description |
|---|---|
| tests/test_secrets_sync.py | Adapts test setup and interrupt coverage for root execution while preserving root-specific assertions. |
| tests/host_capability.py | Adds the shared root-detection capability used by the tests. |
| catalog/snippets/hub_fetch_run.py | Enables strict pyright checking and annotates the HTTP response body as bytes. |
| .github/actions/validate/action.yml | Adds cross-platform strict mypy and pyright validation for the carried helper. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4282 +/- ##
=======================================
Coverage 79.21% 79.21%
=======================================
Files 42 42
Lines 15502 15502
=======================================
Hits 12280 12280
Misses 3222 3222
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action performed
|
Summary
Promotes
developtomain. It carries these changes:hub_fetch_run.pypass every carrier's strict checker.urlopenbody is annotated asbytes, which clearsmypy --strict'sno-any-return. Every carrier holds this file at its root and may not edit it.mypy --strictwith no config, and pyright, on the snippet, once each as Linux, macOS, and Windows code. A# pyright: strictline keeps pyright strict wherever the file is checked.tests/test_secrets_sync.pymeaningful under a root runner. Root used to give 170 failures and 1 error. Under root the base case now stubs the script's root refusal, the refusal case restores it, and the interrupt driver stubs it too. Only the mode-000 listing case skips, through a sharedRUNNING_AS_ROOTintests/host_capability.py.Closes #4266
Closes #4262
🤖 Generated with Claude Code
Summary by CodeRabbit