[wrangler] Categorise deploy positional path in command telemetry#14587
Open
MattieTK wants to merge 1 commit into
Open
[wrangler] Categorise deploy positional path in command telemetry#14587MattieTK wants to merge 1 commit into
MattieTK wants to merge 1 commit into
Conversation
Record a coarse, non-identifying category for the first positional argument of `wrangler deploy` and `wrangler versions upload` under `sanitizedArgs.path` (file/directory/current-dir/parent-relative/ not-found, or null when absent). The raw path is never sent. Positionals are otherwise excluded from telemetry, so this adds a Categoriser transform to the sanitization allow-list and applies it via categoriseArgs against the full args object.
🦋 Changeset detectedLatest commit: 41e1e9b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
Contributor
|
✅ All changesets look good |
Contributor
|
The changeset is correct: I've thoroughly reviewed this PR:
No actionable issues found. LGTM |
@cloudflare/autoconfig
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
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.
What this does
wrangler deploy(andwrangler versions upload) accept an optional first positional argument – the path to a Worker entry point or a directory of static assets. Today that positional is dropped from telemetry entirely (positionals are excluded bysanitizeArgKeysunless passed as a--flag), so we have no signal about how people use it.This adds a coarse, non-identifying category for that positional to the command event under
sanitizedArgs.path:file– resolves to a filedirectory– resolves to a directorycurrent-dir–.or./parent-relative–..,../example, etc.not-found– provided but doesn't resolve on disknull– no positional passedThe raw path is never sent, only the category. Categorisation mirrors how deploy actually interprets the positional (
statSync→ directory vs file), with relational references (.,..) surfaced as their own categories so they can be analysed separately.How
Rather than special-casing the generic command-event wrapper with deploy knowledge, this extends the existing per-command allow-list in
metrics/sanitization.ts:Categoriserallow-list value type (alongsideALLOW/REDACT/fixed arrays).categorisePositionalPath()– maps a raw path to a category (returnsnullwhen absent so the property is always present).categoriseArgs()– applies categorisers against the full args object, which is what lets positional args be safely categorised.deployandversions uploadallow-list entries opt theirpathpositional into categorisation.register-yargs-command.tsspreadscategoriseArgs(args, allowedArgs)intosanitizedArgs.A picture of a cute animal (not mandatory, but encouraged)
🦫