Skip to content

ci(install): audit a local fixture site in every install test - #591

Merged
nc9 merged 3 commits into
mainfrom
claude/release-install-network-tests-tonu2t
Oct 9, 2026
Merged

nc9 merged 3 commits into
mainfrom
claude/release-install-network-tests-tonu2t

Conversation

@nc9

@nc9 nc9 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Refs #423

Each install test now runs a 1-page audit of a throwaway site that the runner serves from 127.0.0.1, using the installed binary in a scratch HOME. No outside host is involved, so the check is deterministic. The change is limited to .github/workflows/test-install.yml (plus the line numbers in .secrets.baseline, which shifted).

Acceptance criteria

  • Each platform runs squirrel skills install into a scratch HOME and asserts both skills land. Deliberately out of scope here. The released binary hardcodes its skills source and has no override, so this cannot be done deterministically without a product change. That change needs its own security review and is tracked in cli: loopback-only source override so install tests can exercise skills install offline #590. This criterion now points there.
  • Each platform runs a 1-page audit and asserts exit 0 with one page crawled. New step "Audit a local fixture site" on Linux glibc, Linux musl, macOS arm64, macOS x64 and Windows. It runs audit http://127.0.0.1:18765/ -m 1 --disable-discovery-probes --no-publish --format json --output <file>, then asserts exit 0, status == "completed" and meta.totalPages == 1. It also asserts the fixture server's access log contains the request, which proves the binary really fetched over the network. Evidence: a manual dispatch of test-install.yml on this branch passed the new step on all five platforms, and the extracted Linux step ran locally against the CLI built from this tree. This also confirms the crawler accepts a loopback target.
  • A network failure fails the job with the command output visible. Evidence: the same step run locally with the audit pointed at a closed port failed with ::error::squirrel audit exited non-zero, followed by the squirrel output, the audit JSON and the fixture server log. The failure helper prints all of these for every assertion.

Notes

  • Loopback is used on purpose: the fixture is served by the runner (python http.server), so DNS, TLS and third-party uptime cannot flake the job. Alpine installs python3 for this.
  • The release path still does not check the repository out. The fixture page is written inline by the step.
  • The squirrelscan agent skill needs no change. This only touches CI.
  • No docs change: nothing user-facing changes.

nc9 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Status: ready for review. I dispatched test-install.yml on this branch for a first run on all platforms (the Windows step was not run locally) and will fix anything it or the bot review finds, one push per round. Not merging.

@nc9 nc9 mentioned this pull request Oct 8, 2026
2 of 3 tasks
@claude

claude Bot commented Oct 8, 2026

Copy link
Copy Markdown

Reviewed the diff of .github/workflows/test-install.yml. I didn't run the workflow, so none of this has been checked in CI. I did check that the new steps match the CLI: renderJson emits .status and .meta.totalPages (packages/report/src/output/json.ts), and the SQUIRREL_NO_UPDATE and NO_TELEMETRY env vars are read in src/self. I found no blocking issues. The new network check is a good addition, and asserting on the fixture server's access log is a solid way to prove the binary made the request.

  • (low) test-install.yml (Windows step): the comment says the audit runs as the install user, but on Windows it runs as the runner user with USERPROFILE, HOME, LOCALAPPDATA and APPDATA overridden. Run it as testuser, or reword the comment so it doesn't overclaim what the check covers.
  • (low) test-install.yml (all jobs): port 18765 is fixed. Self-hosted or reused runners could collide on it. Picking a free port at runtime, or failing explicitly when the port is taken, would avoid a confusing readiness failure. Python's http.server would also exit on a bind error, but the /ready curl could still be answered by whatever else holds the port.
  • (nit) The ~50-line step is copy-pasted across the glibc, musl and macOS jobs, which differ only in the binary path. A small composite action or a script under .github/scripts/ would stop the copies drifting apart.
  • (nit) The macOS x64 and arm64 steps are identical, apart from the shared comment block that the others repeat. If you keep the copies, make the comment consistent (Windows already says "see the Linux job").
  • (nit) grep -q '"GET / ' depends on the http.server log format. It works today and doesn't match GET /ready, but a short comment saying so would help the next reader.

Test coverage: this is CI-only. If a failure here ever turns out to be a real bug, a unit test for it would belong in apps/cli/tests.

nc9 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the review. There are no critical, high or medium findings, so I'm not pushing for these. Responses:

  • Windows comment (low): the comment was written for the unix steps and overclaims for Windows. That job already runs the other steps as the runner user with an overridden profile, so I'm keeping it consistent. I'll reword the comment if this PR gets another push.
  • Fixed port (low): hosted runners are fresh per job, so a collision is unlikely. If something else did hold the port, the "fixture server never saw the audit's request" assertion would still fail the job and print the server log, so it can't pass silently.
  • Copy-paste and macOS comment (nits): the workflow has always repeated its steps per platform, and the release path deliberately has no checkout, so a script under .github/scripts/ isn't available there. I'm keeping the copies for now.
  • GET / log format (nit): noted, and I'll add a one-line comment with the next push.

The dispatched run of this branch's workflow passed on Windows. The other platforms were still running when I last looked.

nc9 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Secret scan failed on the first commit because the new steps pushed two existing baselined lines in test-install.yml (the Windows test user's password) further down the file. detect-secrets reported a baseline line-number update and no new secrets. The latest push refreshes those line numbers in .secrets.baseline, and the hook now exits 0 locally. It also adds the one-line comment on the access-log match that the review asked for.

nc9 added 2 commits October 10, 2026 08:43
The install tests only ran --version, self version and self doctor, so a
build where every fetch fails would pass all platforms. Each platform now
serves a one-page site from 127.0.0.1 and runs a 1-page audit of it with
the installed binary in a scratch HOME, asserting exit 0, a completed run
with one crawled page, and that the fixture server saw the request. A
failure prints the command output and the server log.

Refs #423

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the claude/release-install-network-tests-tonu2t branch from 5c1be7a to 39ff9c9 Compare October 9, 2026 21:44
@claude

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Review of #591 (network smoke check in test-install.yml).

I checked the assertions against the code. renderJson emits top-level status and meta.totalPages, and the flags and env vars the audit step uses all exist. Loopback targets are only blocked for cloud handoffs, not for crawling. I did not run the workflow, so none of this is confirmed by CI.

  • (low) .github/workflows/test-install.yml: the roughly 50-line fixture step is pasted four times (glibc, musl, macOS arm64, macOS x64), and the Windows step follows the same design. A future fix (port, flags, assertions) will have to be made in five places and is likely to drift. A small shared script or a composite action would remove most of that. If you keep the copies, a comment pointing at the canonical one would help.
  • (low) .secrets.baseline: the baseline stores line numbers (216 and 669). Any later edit to this workflow will shift them and trip the secrets hook again. Regenerating the baseline with detect-secrets is more reliable than editing by hand.
  • (low) Windows readiness probe: readiness is detected by grepping server.log for GET /ready, not by a successful response. The -u flag makes this work, but it depends on log buffering and format. Checking that the Invoke-WebRequest call succeeds, or that the port accepts connections, would be sturdier. The probe also fails silently if /ready returns 404, because the 404 is swallowed by catch and only the log line counts.
  • (nit) The port 18765 is hardcoded. A collision on a shared or self-hosted runner would show up as "fixture server did not start", which is a clear failure and acceptable. Choosing a free port and passing it through would avoid it.
  • (nit) Windows runs the binary as the runner user with USERPROFILE redirected, while Linux and macOS run it as testuser. That is reasonable, but the Windows comment could say so.
  • (nit) grep -q '"GET / '" depends on the http.serverlog format. It is stable today, but the match is loose, for example if the server logs HEAD requests. Checking forGET / HTTP` would be tighter.

Overall the approach is sound: it needs no outside network, it checks the server's access log as well as the report, and it has cleanup traps. I found nothing blocking.

nc9 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Second review round: again nothing critical, high or medium, so no push this round. Responses to the points not already answered above:

  • Windows readiness (low): the probe checks the server log for GET /ready because the 404 is expected, so a successful response can't be the signal. The manual dispatch passed on Windows, and a failure still ends in "fixture server did not start" with the log printed. I'm leaving it.
  • GET / HTTP (nit): the match is already anchored on the trailing space, so it can't match /ready, and a HEAD request would log HEAD, not GET. Leaving it.
  • Baseline line numbers (low): agreed that a later edit to this workflow will need a regenerate. That is how the baseline works for every file in the repo, and the failing check says exactly what to run.
  • Copies and port (low, nit): unchanged from my earlier reply.

The branch has been rebased onto current main (not by me), and the workflow content is identical to what I tested. I removed the generated-by footer from the PR description.

@claude

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Review of the local-fixture audit step added to test-install.yml. I read the diff and checked the CLI flags and the JSON shape against the source. I didn't run the workflow, so none of the new steps have been exercised.

I found no blocking problems. --disable-discovery-probes, --no-publish, -m and --output all exist in apps/cli/src/cli/commands/audit.ts. The JSON report always emits .status (defaulting to completed) and .meta.totalPages, so the jq gate is valid.

  • (medium) test-install.yml:~160 The audit targets 127.0.0.1, and apps/cli/src/lib/non-public-host.ts and utils/reachability.ts look like loopback or private-host guards. I didn't check whether they block or alter a crawl of a loopback host, for example by refusing it or asking for confirmation. If so, the step fails on every platform. The first CI run will show this, so confirm it is green before merging.
  • (low) The ~50-line step is copy-pasted across glibc, musl and macOS arm64 and x64. Only the binary path differs. A composite action or a script under .github/scripts/ would stop the copies drifting apart.
  • (low) .secrets.baseline line numbers are hand-edited. Re-run detect-secrets scan --baseline so they stay correct. The new line numbers are 216 and 669, but the flagged lines have moved again.
  • (low) Port 18765 is hardcoded. That is fine on ephemeral runners, but a collision would give a confusing "server did not start" error.
  • (low) On Windows the readiness probe greps the server log for GET /ready. Python's http.server buffers stderr redirected to a file. -u mitigates this, but a readiness check based on the Invoke-WebRequest result would be more robust. Also, GET / can match the later audit request but not /ready, which is correct.
  • (nit) On Linux, sudo -u testuser creates $work/home inside a chmod 777 directory. That is fine for CI. A comment saying 777 is intentional would help.
  • (nit) The macOS and Windows steps don't check server.log to prove the request came from the audit rather than the probe. Linux does, via '\"GET / '. This is consistent, so no change is needed.

Test coverage: this PR is itself CI coverage. It adds a real-fetch smoke test for the installed binary on all five platforms.

nc9 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Third review round. The only medium finding is already disproved by evidence, so I'm not pushing.

  • Medium, loopback guard might block the crawl: it does not.
  • Baseline line numbers "moved again" (low): the baseline was regenerated with detect-secrets-hook rather than edited by hand, and the Secret scan check passes on the current head (39ff9c9).
  • Other low items and nits: the copies, port, Windows readiness probe and GET / match are answered above. The chmod 777 is intentional: the scratch directory has to be writable by the testuser account that runs the audit.

All 15 checks on the head are green.

@nc9
nc9 merged commit ab37d82 into main Oct 9, 2026
15 checks passed
@nc9
nc9 deleted the claude/release-install-network-tests-tonu2t branch October 9, 2026 22:32
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