Skip to content

Give install-tools a JSON Report Mode a Program Can Read - #2259

Merged
ptr727 merged 6 commits into
developfrom
feature/install-tools-json-report
Oct 1, 2026
Merged

ptr727 merged 6 commits into
developfrom
feature/install-tools-json-report

Conversation

@ptr727

@ptr727 ptr727 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Addresses #1645. install-tools.sh --json and install-tools.ps1 -Json write the report as one JSON object, so a scheduled reporter can read it without parsing the table.

  • Shape: schema (1), platform, a tools list, and a top-level notes list for what belongs to no tool. Each tool row carries tool, installed, available, source, mechanism, status, and that tool's own notes. Windows rows also carry scope. A version that was not read is null.
  • mechanism: like source, it names how the script manages the tool. On Linux it is apt, binary, or docker-desktop (docker inside WSL). On Windows it is winget.
  • Encoding: both sides write ASCII only. Bash has a pure-bash UTF-8 encoder, since jq is one of the tools the script installs and glibc iconv -c passes some malformed sequences through. It drops bytes that do not decode. PowerShell uses -EscapeHandling EscapeNonAscii.
  • Refusal: the flag is refused beside any other action, before the host is read.
  • Table output: byte-identical to develop on a live host.

Verification

  • tests/test_install_tools.py (new, 8 tests) drives each installer's own report functions with host reads stubbed. Every guard in the encoder and in the note slicing was mutated, and a test failed for each one.
  • On this Linux host, a live --json run parses as valid ASCII JSON, and an unsupported locale adds no stderr noise.
  • The encoder gives the same output on bash 4.4, 5.1, and 5.2.
  • shellcheck, shfmt, PSScriptAnalyzer, markdownlint, editorconfig-checker, cspell, ruff, mypy, pyright, the prose gate, and spec/validate.py are all clean.
  • Windows is not natively verified. The PowerShell report was exercised under pwsh on Linux with winget stubbed. A native check is install-tools.ps1 -Json | ConvertFrom-Json on a Windows host.

Filed Along the Way (pre-existing)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Linux and Windows setup tools can now generate structured JSON reports with tool versions, availability, installation source and method, status, and relevant notes.
    • The existing table report remains the default. JSON reporting is limited to report mode; combining it with install, upgrade, or list actions is rejected.
  • Documentation
    • Setup guides now describe the JSON report fields, including platform-specific details.

ptr727 and others added 5 commits October 1, 2026 10:35
install-tools.sh --json and install-tools.ps1 -Json write the report as one
object carrying the table's rows, each tool's own notes, and the mechanism
that moves it, so a downstream reporter no longer has to parse the table.
The flag applies only to the report and is refused beside any other action.

Fixes #1645

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sion

On a WSL distribution no apt upgrade moves docker, so its row reports the
docker-desktop mechanism. A Windows row whose winget versions do not resolve
to one reports installed as null rather than a joined list, its note naming
them, and a note raised while a tool's state is read now files under it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The bash encoder drops bytes that are not UTF-8 through iconv rather than
switching locale per string, and the PowerShell report escapes every
non-ASCII character, so neither can emit text a UTF-8 reader rejects. The
Windows README names docker-desktop and what source holds there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
glibc iconv passes some sequences that are not UTF-8, so the encoder now
decodes UTF-8 itself, writes every non-ASCII character as an escape, and
drops what does not decode, matching the Windows side's ASCII output with
no external command. mechanism is defined, like source, as how the script
manages a tool rather than where the installed copy came from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 18:36
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (2)
CODESTYLE.md — configured
GOVERNANCE.md — configured

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 84235645-a8a1-46a3-9fd8-8a62921792ac

📥 Commits

Reviewing files that changed from the base of the PR and between 1030f12 and 816b137.

📒 Files selected for processing (5)
  • host-setup/linux/README.md
  • host-setup/linux/install-tools.sh
  • host-setup/windows/README.md
  • host-setup/windows/install-tools.ps1
  • tests/test_install_tools.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Linux and Windows installers add JSON report modes. Reports include tool versions, source and management details, statuses, and notes. Both installers restrict JSON mode to report actions. Documentation and tests describe and check the output.

Changes

Installer JSON reports

Layer / File(s) Summary
Linux JSON report
host-setup/linux/install-tools.sh, host-setup/linux/README.md, tests/test_install_tools.py
The Linux installer serializes JSON reports with tool details, mechanisms, and notes. The documentation describes the schema and WSL Docker version source. Tests cover encoding, report contents, and action restrictions.
Windows JSON report
host-setup/windows/install-tools.ps1, host-setup/windows/README.md, tests/test_install_tools.py
The Windows installer emits JSON reports with tool details, scope, and notes. The documentation describes the report fields. Tests cover report contents and action restrictions.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 816b1

This change adds an optional JSON report mode and keeps the table output as the default. No merge-blocking issue was identified.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 816b1

The inspected entrypoints keep JSON reporting separate from installation and configuration actions, and report content is encoded as data. No introduced security issue was established. Native Windows behavior, downstream consumers, and the target-branch comparison remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure is the invoking host's inventory and advisory report under the caller's authority. The inspected JSON branches emit data rather than selecting privileged apply operations. Downstream use and any resulting authority expansion remain outside the supplied evidence.

Trust Boundaries and Controls

  • observed — Host- and package-derived strings cross an encoding boundary before JSON emission. Linux quotes metacharacters and controls, encodes valid UTF-8, and drops malformed sequences; Windows serializes object values with EscapeNonAscii. The inspected emission paths do not evaluate report text as code.
  • observed — Windows distinguishes an unreadable installed-state query from a successful query finding no installation. Report status preserves unreadable, multiple, and other states rather than treating every null installed version as proof of absence.

Resilience and Maintainability Implications

  • inferred — Each public invocation initializes its own note state and calls the report once, bounding stale-note and concurrent-process ownership concerns. Linux emits JSON through multiple writes, so interruption can leave an incomplete document; the inspected report transition does not require recovery of installation state.

Hardening Proposals

  • proposed — Downstream automation should require successful completion, parse the complete object, validate schema and platform, and interpret null versions together with status before initiating maintenance. This is a consumer safeguard, not an observed consumer defect.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 2 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a program-readable JSON report mode to install-tools.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 2 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

A distro jq reads binary with no note, so the README sentence saying the
status and notes report what is actually installed was false. The WSL docker
wording now names what the script does rather than what moves the copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.84%. Comparing base (1030f12) to head (816b137).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2259   +/-   ##
========================================
  Coverage    56.84%   56.84%           
========================================
  Files           16       16           
  Lines         7519     7519           
========================================
  Hits          4274     4274           
  Misses        3245     3245           
Flag Coverage Δ
python-3.13 56.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ptr727

ptr727 commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit b52ab3e into develop Oct 1, 2026
10 of 11 checks passed
@ptr727
ptr727 deleted the feature/install-tools-json-report branch October 1, 2026 19:15
ptr727 added a commit that referenced this pull request Oct 1, 2026
## Summary

Copilot's review of promotion PR #2254 raised a "previously missed"
finding against #2259's install-tools JSON report. `add-host-tool`'s
procedure says a change to report behavior must update
`docs/host-setup.md` as well as the platform READMEs, and #2259 updated
only the READMEs.

`docs/host-setup.md` now has one paragraph saying:

- the flags are `--report --json` on Linux and `-Report -Json` on
Windows, and the JSON flag applies to no other action;
- the output is one object with a `schema` number, the `platform`, a
`tools` list, and a top-level `notes` list;
- a change to what a field means raises `schema`.

For the shared fields it links to the Linux README, and for its one
added field and the values that differ it links to the Windows README.
It doesn't restate them, so a third copy of the field list can't drift.

## Verification

- `local-strict-review` checked each claim against both installers and
both READMEs and found nothing. Its receipt is recorded.
- `prose_lint --diff origin/develop`, `docker_lint.py` (markdownlint,
cspell, editorconfig), and `spec/validate.py` are all clean. The full
`unittest discover` run passes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
ptr727 added a commit that referenced this pull request Oct 2, 2026
…#2254)

## Summary

Promotes develop to main, carrying the pull requests below. Each was
already reviewed and merged into develop.

- [#2253](#2253): Track
Qodo's open-source login and state its star gate.
- [#2259](#2259): Give
install-tools a JSON report mode a program can read. Copilot could not
review it, since Copilot code review has reached its weekly rate limit
(#2261). CodeRabbit reviewed its head with no findings, and recorded
local passes covered every push.
- [#2263](#2263): Declare
Python and Codecov on Blog's registry entry.
- [#2265](#2265): Keep the
fork iteration PR open and never merged in
`upstream-contribution-workflow`, and let an unregistered fork under the
owner host a handoff chain, with `handoff.py new --create-label`
creating only the `handoff` label there.
- [#2266](#2266): Bound
`handoff.py`'s writes whatever the label state, refusing `new` and
`link` against another owner's repository, or an unregistered non-fork,
before the label is read. This answers Copilot's High finding on this
promotion.
- [#2267](#2267): State
the install-tools JSON report in `docs/host-setup.md`, answering
Copilot's previously-missed finding on #2259's report mode.
- [#2269](#2269): Drop two
false pointers from Blog's deploy-secret drift note, and recast every
semicolon in the registry's driftNotes, answering Copilot's
previously-missed finding on #2263's note.

With the open-source login tracked, `qodo_open` double-counts that app's
threaded findings and never clears them on PlexCleaner. That is a known,
loud error, accepted for this promotion and tracked in #2252.

Closes #1465
Closes #1645
Closes #2264

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Clarified which review commands to use when a reviewer posts a skip
notice.
* Updated reviewer evaluation guidance to reflect when CodeRabbit and
Qodo findings are recorded, including Qodo’s repository eligibility
requirements.
* **Bug Fixes**
* Updated Qodo reviewer tracking to recognize its current open-source
app identity, improving how its reviews and findings are identified.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

2 participants