Record App Security finding counts in command analytics - #8743
Merged
Merged
Conversation
jplhomer
marked this pull request as ready for review
October 2, 2026 19:10
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Finding-count semantics are correctly implemented and tested, and the generated instructions are synchronized.
Review effort: Balanced
Findings: None
What changed in this PR
Adds App Security finding counts to standard command analytics while clarifying telemetry behavior.
Changes:
- Upgrades the Monorail schema and exposes finding-count metadata.
- Records appropriate counts for security check, record, and review commands.
- Updates tests and regenerated agent instructions.
| File | Description |
|---|---|
packages/cli-kit/src/public/node/monorail.ts |
Updates topic and analytics fields. |
packages/app/src/cli/metadata.ts |
Exposes security metadata fields. |
packages/app/src/cli/services/app-security-metadata.ts |
Adds metadata recording helper. |
packages/app/src/cli/services/security-check.ts |
Records deterministic finding count. |
packages/app/src/cli/services/security-check.test.ts |
Tests check telemetry counts. |
packages/app/src/cli/services/security-record.ts |
Records accepted agent findings. |
packages/app/src/cli/services/security-record.test.ts |
Tests record telemetry behavior. |
packages/app/src/cli/services/security-review.ts |
Records all active combined findings. |
packages/app/src/cli/services/security-review.test.ts |
Tests filtering and missing results. |
packages/app/src/cli/services/app-security-engine/INSTRUCTIONS.md |
Clarifies telemetry and opt-out behavior. |
packages/app/src/cli/services/app-security-engine/checks/embedded.ts |
Regenerates embedded instructions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
jek
approved these changes
Oct 2, 2026
dmerand
approved these changes
Oct 5, 2026
Bump the command topic to app_cli3_command/1.30, which adds num_security_findings and num_security_findings_resolved, and set num_security_findings from the App Security commands: - check: the number of deterministic issues the scan found. - record: the number of findings in the recorded agent document. - review: the number of active findings across every combined check, ignoring --check-id. Unset when there are no result files. num_security_findings_resolved stays unset: stored findings have no stable identity, so a previous-run comparison would count moved code as resolved. INSTRUCTIONS.md no longer claims telemetry is disabled. It now says the CLI sends standard usage telemetry with finding counts, never code or finding content, and that SHOPIFY_CLI_NO_ANALYTICS opts out. Co-authored-by: Qlaw <noreply@qlaw.quick.shopify.io>
jplhomer
force-pushed
the
joshlarson/app-security-telemetry
branch
from
October 5, 2026 18:36
4b23056 to
e7dea83
Compare
jplhomer
enabled auto-merge
October 5, 2026 18:38
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/monorail.d.ts@@ -2,7 +2,7 @@ import { JsonMap } from '../../private/common/json.js';
import { DeepRequired } from '../common/ts/deep-required.js';
export { DeepRequired };
type Optional<T> = T | null;
-export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.28";
+export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.30";
export interface Schemas {
[MONORAIL_COMMAND_TOPIC]: {
sensitive: {
@@ -77,6 +77,8 @@ export interface Schemas {
cmd_app_validate_valid?: Optional<boolean>;
cmd_app_validate_issue_count?: Optional<number>;
cmd_app_validate_file_count?: Optional<number>;
+ num_security_findings?: Optional<number>;
+ num_security_findings_resolved?: Optional<number>;
cmd_dev_tunnel_type?: Optional<string>;
cmd_dev_tunnel_custom_hash?: Optional<string>;
cmd_dev_urls_updated?: Optional<boolean>;
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Fixes https://github.com/shop/issues-develop/issues/23969 (App Security submission telemetry).
Monorail
app_cli3_command/1.30(Shopify/monorail#24622) addednum_security_findingsandnum_security_findings_resolved, but the CLI still sends 1.28 and none of theapp securitycommands record any counts. Separately,INSTRUCTIONS.mdtells agents "Telemetry is disabled for this workflow", which isn't true: the standard command event is sent for every run.WHAT is this pull request doing?
MONORAIL_COMMAND_TOPICtoapp_cli3_command/1.30and adds both fields as optional numbers. I checked the 1.30 schema: it contains every field the CLI sends exceptcmd_app_validate_*, which 1.28 didn't have either, so nothing regresses.PickByPrefix.num_security_findings(through a new injectedrecordMetadatadependency, following the existing DI pattern):check: the number of deterministic issues, the same number as "N security issues found".record: the number of findings in the recorded agent document, the same number as "Recorded N findings". A rejected document records nothing.review: the number of active findings across every combined check. That excludes suppressed findings and findings superseded underprefer-agent, and it ignores--check-idso the number doesn't depend on the filter. Left unset when neither results file exists.reviewis the only command that sees the combined view, so this is the best "issues remaining" signal.num_security_findings_resolvedunset. Stored findings have no stable identity (only file/line/message), so comparing with the previous run would count moved code as resolved + new. The trend can be computed in the warehouse from successive per-app counts until findings get an identity.INSTRUCTIONS.mdtelemetry line: the CLI sends standard usage telemetry including the number of findings, doesn't send source code, finding details, or artifacts, and users can opt out withSHOPIFY_CLI_NO_ANALYTICS=1(peranalyticsDisabled()in cli-kit). Regeneratedchecks/embedded.ts.Not in scope:
api_key/organization_idattribution. That fits better on top of #8736 / #8737, which move the security commands ontolocalAppContextwith the selected--path/--config.Expected conflicts with #8736 / #8737:
security-check.tsandsecurity-record.tssignatures, andINSTRUCTIONS.md(a different line). EachrecordMetadatacall is one line, so the rebase is trivial either way.embedded.tsneeds regenerating.No changeset: the commands are still hidden.
How to manually test your changes?
With
SHOPIFY_CLI_ENV=developmentthe CLI skips sending analytics and logs the payload instead, so nothing reaches Monorail:SHOPIFY_CLI_ENV=development shopify app security check --path <app> --verbose. In theSkipping command analytics, payload:debug line, look fornum_security_findingsmatching the reported issue count.shopify app security record --path <app> --verbose, then runshopify app security review --path <app> --verbose, and checknum_security_findingsin each payload. The topic constant isapp_cli3_command/1.30.Checklist
Warehouse follow-up (separate repos): the new columns still need selecting in
base__monorail_app_cli3_command.sqlandcli3_commands_v1.sql.PR authored by Qlaw