Repository navigation
feat(cli): measure the first run: setup, login and first-audit telemetry, persist install source #1194 - #1198
Conversation
|
Review of #1198 (first-run telemetry). I read the non-test source diff. I did not run the tests. I checked the main privacy risk. Dropping
Otherwise the opt-out checks, the slug validation ( |
|
Triage:
|
Auto-review did not completeThe
Permission denials (1)Partial findings recovered from the session (incomplete, unverified, and NOT a merge signal): Show partial reviewI reviewed the full diff and found no blockers. The nits and mediums below are mostly about telemetry accuracy and consent. I read the code only: I ran no tests and checked no CI results. What looks right:
Findings:
Test coverage looks adequate for the new modules per the PR description. I'd add two cases: a pre-existing install reporting its first audit (the marker case above), and an unparseable |
|
Review of #1198. I read the diff and checked how the api-client resolves `token: null`. I did not run the tests.
Test coverage looks good: new tests for setup, first-run, install-source and install-meta. The docs and CHANGELOG are updated. The PR description says the private API change must be deployed before the CLI release. Make sure that ordering is enforced. |
|
Round 2 fixes: telemetry notice re-shown once to existing installs (telemetry_notice_version 2), unparseable session expiry fails closed (tested), first-audit marker re-read from disk before sending, CHANGELOG notes it. Token on every event is intended (decided: telemetry carries the user after login), tested signed-out and org-key cases. setup_audit_* are wired in #1195's PR. |
47e9834 to
30b739d
Compare
|
Review of the first-run telemetry change. Privacy handling is careful (slug allowlist on detail, token only sent to the production API URL,
Docs, CHANGELOG and the notice bump are present and consistent. Please confirm the detect-secrets baseline passes after the test edits ( |
|
Review of the first-run telemetry PR. I read the diff and grepped the CLI source. I did not run the tests.
Nothing here blocks the merge. The main thing to confirm is the token scope and handling. |
|
Round 3 (independent privacy review): DO_NOT_TRACK=1/true honoured in the CLI gate, install.sh and install.ps1; project-scope telemetry:false respected (unreadable project or user file fails closed); first-audit marker is written only after the gate (opt-out never consumes it); login session token attached only once telemetry_notice_version>=2; notice and README reworded truthfully (session token is sent after login, never an API key); install_source schema uses the slug regex (bad value reads as unset); docs say the notice reappears once. /v1/traces treats an unknown or revoked sqcli_ bearer as anonymous (apps/api routes/v1/traces.ts: lookup in try/catch, userId stays null, no reject). setup_audit_accepted/declined are emitted by the follow-up PR for #1195. |
|
Review of #1198 (first-run telemetry). Overall the privacy hardening is solid: the
No critical or high issues found. |
|
Round 4 triage. Fixed: CHANGELOG now lists DO_NOT_TRACK and project opt-out; one INSTALL_SOURCE_PATTERN shared by the env reader and the schema. Rebutted: (a) setup_audit_accepted/declined are emitted by #1201 and are already in the deployed private allow-list; (b) unreadable-project-file fail-closed is intended and tested ("an unreadable project settings file fails closed" in first-run-telemetry.test.ts); (c) per-call local-scope read is one small file lookup on rare paths (events, registration), no startup hot path; (d) marker before send is deliberate (once over at-least-once), a failed-then-successful first audit reports the failure only; (e) trackFirstAudit sits after the report handling, which every audit status (completed, failed, blocked) reaches; the early-exit paths before it are usage errors, not audits. |
…try, persist install source #1194 Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
…n macOS #1194 Signed-off-by: Nik Cubrilovic <[email protected]>
…ail closed on a bad session expiry, re-read the first-audit marker #1194 Signed-off-by: Nik Cubrilovic <[email protected]>
…et-scan pragma #1194 Signed-off-by: Nik Cubrilovic <[email protected]>
…rst-audit marker, session token only after the v2 notice, truthful notice and README #1194 Signed-off-by: Nik Cubrilovic <[email protected]>
…tes the first-audit marker #1194 Signed-off-by: Nik Cubrilovic <[email protected]>
…d project opt-out #1194 Signed-off-by: Nik Cubrilovic <[email protected]>
… setup_audit_* events (owned by #1201) Signed-off-by: Nik Cubrilovic <[email protected]>
67dda9c to
35e0aba
Compare
|
Review of #1198 (first-run telemetry, install source, DO_NOT_TRACK).
No security blockers found. The token is sent only to the production API, only for |
…vent union (#1198 left them to this PR) Signed-off-by: Nik Cubrilovic <[email protected]>
…vent union (#1198 left them to this PR) Signed-off-by: Nik Cubrilovic <[email protected]>
…ad with it #1195 (#1201) Closes #1195. Depends on #1198 (this branch is built on its head, so the diff shows its commits until it merges; I rebase once it lands). Tracked internally. ## What - install.sh and install.ps1 closing message lead with `squirrel audit https://your-site.com` (one line saying what it does); `squirrel setup` comes second. - `squirrel setup` ends by asking for a site URL and offering to run the audit now. A bare host (`example.com`) is taken as https; a typed URL runs the audit in-process; enter skips; one retry on a malformed answer. - Non-interactive (no TTY, CI, an agent), `--yes` and `--dry-run` never ask or block: they print the audit command. - Emits `setup_audit_accepted` / `setup_audit_declined` (no URL), the two event names #1198 added to the allow-list. - Docs: setup, quickstart, cli index, `--yes` help text. CHANGELOG. No new flag, so no completion change. ## Skill No change needed to the squirrelscan skill (no new command or flag). ## Verified format:check, lint, typecheck, tangly strict; tests by path (setup-audit-offer: URL parser + `--yes`/`--dry-run` print the command and make no network call; setup-telemetry). Smoke: built binary, isolated HOME under ops/scratch, pty-driven `squirrel setup`: declined sign-in and skills, typed a site at the offer, the audit ran (3 pages via a project max_pages) and printed the report; `setup --yes </dev/null` and `--dry-run` print the command and exit. Nothing was written to the real ~/.squirrel.
Closes #1194. Tracked internally.
What
squirrel setupsendssetup_started, onesetup_stepper step (step:outcomeslug only) andsetup_completed. Nothing on--dry-run.squirrel auth loginsendslogin_completedonce the session is saved.first_audit_okorfirst_audit_failed(failure class from the engine's fixedstatusReasonCodevocabulary, orexception), once; markerfirst_audit_reported_atin settings.sqcli_...) so the API attributes the user. Only to the production API URL; an org API key (env or settings) is never sent. Anonymous when signed out.NO_TELEMETRYandtelemetry=falsesend nothing (also re-checked from disk inside the sender for callers that had no settings).SQUIRREL_INSTALL_SOURCEis validated (^[a-z0-9-]{1,32}$, else dropped) and persisted byself installasinstall_source, because registration runs on a later command whose env no longer has it (so every install reportedbinary). Registration re-validates and sends it assource. install.sh default stamp changes frominstall.sh(dot, now invalid) toinstall-sh.docs/cli/self.mdxand the FAQ list the events and state the user-ID and opt-out behaviour. CHANGELOG entries.Order
The private API accepts the new event names (squirrelscan/repo#3555, merged first). The CLI release must follow its deploy.
Skill
No change needed to the squirrelscan skill (internal telemetry, no new command or flag).
Verified
CLI typecheck,
bun run lint,format; tests by path: first-run-telemetry, install-source, install-meta, telemetry, setup-telemetry, auth-login, startup, banner (66+47 pass);tangly check --strictpasses. A focused privacy review (Sonnet, codex unavailable) found hardening items, all fixed: settings opt-out re-check in the sender, token only to the production API, persisted source re-validated.Privacy review note (accepted):
install_sourceis persisted in~/.squirrel/settings.json(a slug, mode 0600) even with telemetry off; it is only ever sent through the gated registration.