Skip to content

fix(cli): functions delete/download mark --project-ref telemetry-safe (Go parity)#5809

Merged
Coly010 merged 8 commits into
developfrom
columferry/cli-1864-functions-delete-add-safeflags-project-ref-telemetry-parity
Jul 7, 2026
Merged

fix(cli): functions delete/download mark --project-ref telemetry-safe (Go parity)#5809
Coly010 merged 8 commits into
developfrom
columferry/cli-1864-functions-delete-add-safeflags-project-ref-telemetry-parity

Conversation

@Coly010

@Coly010 Coly010 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix (Go CLI parity).

What is the current behavior?

Go marks --project-ref telemetry-safe on all four functions leaf commands (cmd/functions.go:151,153,165,178) — list, delete, deploy, download — so the flag value is recorded verbatim in the cli_command_executed PostHog event instead of being redacted.

The TS legacy port only did this for list and deploy. functions delete and functions download were both redacting --project-ref, diverging from Go and from their own sibling commands.

What is the new behavior?

  • Added safeFlags for --project-ref to functions delete and functions download, matching list/deploy and Go.
  • Hoisted the ["project-ref"] safe-flags list into a shared FUNCTIONS_PROJECT_REF_SAFE_FLAGS constant in shared/functions/functions.shared.ts, now referenced by all four commands instead of being duplicated inline.
  • Exported each command's composed handler (legacyFunctionsDeleteHandler, legacyFunctionsDownloadHandler) so integration tests can drive the exact effect Command.withHandler wires up, rather than re-testing the generic instrumentation wrapper in isolation.
  • Corrected stale/missing rows in delete/download's SIDE_EFFECTS.md (missing Files Written/Files Read/Environment Variables rows, a stale SUPABASE_API_URL claim, and a new Telemetry Events Fired section), reconciled against list's already-accurate doc.

Fixes CLI-1864

Coly010 added 2 commits July 7, 2026 01:34
…rity)

Go marks --project-ref telemetry-safe on both functionsListCmd and
functionsDeleteCmd (cmd/functions.go:150-153), but the TS port only did
so for list, so delete's project ref was redacted in telemetry unlike
Go and unlike list.

Fixes CLI-1864
Three reviewers (architect, engineer, DX) independently flagged that the
new command-level test never actually exercised delete.command.ts's real
wiring — it re-invoked withLegacyCommandInstrumentation directly, so it
would stay green even if safeFlags were dropped from the command. Fix by
exporting the composed handler (legacyFunctionsDeleteHandler) so the
integration test drives the exact effect Command.withHandler uses, with
mocked services instead of a real network call. Verified the new test
actually fails when the fix is reverted.

The engineer also found functions download has the identical gap: Go
marks --project-ref telemetry-safe there too (cmd/functions.go:178), but
download.command.ts never set safeFlags at all. Fixed the same way, and
hoisted FUNCTIONS_PROJECT_REF_SAFE_FLAGS into functions.shared.ts since
it's now used by four sibling commands (list, deploy, delete, download)
instead of being duplicated as a one-off per-command constant.

Also reconciled delete/download's SIDE_EFFECTS.md against list's (missing
Files Read/Environment Variables rows, a stale SUPABASE_API_URL claim,
and a new Telemetry Events Fired section), per findings from all four
reviewers.
@Coly010

Coly010 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: ba4c3925a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Coly010 Coly010 marked this pull request as ready for review July 7, 2026 10:15
@Coly010 Coly010 requested a review from a team as a code owner July 7, 2026 10:15
@Coly010 Coly010 self-assigned this Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@89d19712193a410b9f745befd13be9525566a3a9

Preview package for commit 89d1971.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba4c3925a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/cli/src/legacy/commands/functions/download/SIDE_EFFECTS.md
Comment thread apps/cli/src/legacy/commands/functions/download/SIDE_EFFECTS.md
…th delete/list

The previous commit reconciled delete's SIDE_EFFECTS.md against list's in full
but only partially reconciled download's — it added the Files Written rows and
fixed the SUPABASE_API_URL claim, but left the Files Read table, the
Environment Variables table, and the API Routes table out of sync. download's
handler wires LegacyCliConfig/LegacyProjectRefResolver/LegacyLinkedProjectCache/
LegacyTelemetryState identically to delete and list, so the same env vars
(SUPABASE_HOME, SUPABASE_PROFILE, SUPABASE_PROJECT_ID, SUPABASE_WORKDIR), the
same profile/project-ref/telemetry file reads, and the same best-effort
GET /v1/projects/{ref} cache-metadata request apply here too. Two Codex review
comments on PR #5809 caught the Environment Variables and API Routes gaps;
this also closes the identical Files Read gap they didn't flag.
@Coly010

Coly010 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@Coly010

Coly010 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

🤖 pr-autopilot needs a human here: this PR now shows mergeable: CONFLICTING / mergeStateStatus: DIRTY against develop.

develop advanced to 47e9a2c6 (#5811, "docs(cli): fix fabricated SUPABASE_API_URL and bare PROJECT_ID env-var references"), which edited the same "Environment Variables" table in apps/cli/src/legacy/commands/functions/delete/SIDE_EFFECTS.md that this PR's ed6cba91 also touches. Verified with git merge-tree — the conflict is confined to that one table (this PR's SUPABASE_HOME/SUPABASE_PROJECT_ID/SUPABASE_WORKDIR additions vs. #5811's SUPABASE_API_URL/PROJECT_ID wording fixes); delete.command.ts merges cleanly.

Per safety rules I'm not auto-resolving conflicts. CI is green on the current head (ed6cba91) and both review threads remain resolved — this conflict is the only blocker besides the outstanding human approval. Needs a rebase/merge of develop and a manual reconciliation of that table.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: ed6cba91d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…4-functions-delete-add-safeflags-project-ref-telemetry-parity

# Conflicts:
#	apps/cli/src/legacy/commands/functions/delete/SIDE_EFFECTS.md
#	apps/cli/src/legacy/commands/functions/download/SIDE_EFFECTS.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f74ece9724

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/cli/src/legacy/commands/functions/delete/SIDE_EFFECTS.md Outdated
Comment thread apps/cli/src/legacy/commands/functions/delete/SIDE_EFFECTS.md Outdated
Comment thread apps/cli/src/legacy/commands/functions/download/SIDE_EFFECTS.md Outdated
Comment thread apps/cli/src/legacy/commands/functions/download/SIDE_EFFECTS.md Outdated
Coly010 added 2 commits July 7, 2026 12:20
…ownload

Codex's re-review of the merge commit caught four more compatibility-checklist
gaps, all verified against the shared legacy layers delete and download both
wire (LegacyCliConfig, LegacyProjectRefResolver, LegacyCredentials):

- The profile file path honors SUPABASE_HOME
  (legacy-profile-file.ts:legacyProfileFilePath), not a hardcoded
  `~/.supabase/profile`.
- SUPABASE_NO_KEYRING disables the OS keyring before falling back to the
  access-token file (legacy-credentials.layer.ts:330), same as login's/logout's
  documented behavior.
- Interactive project-ref resolution without --project-ref/SUPABASE_PROJECT_ID
  calls GET /v1/projects for the picker prompt
  (legacy-project-ref.layer.ts:52), matching functions list's documented route.
- Workdir resolution walks up from cwd looking for supabase/config.toml before
  falling back to cwd (legacy-cli-config.layer.ts:resolveWorkdir), not a
  straight cwd fallback.

Applied to both delete's and download's SIDE_EFFECTS.md since both commands
share the exact same resolution layers.
…ode quality)

Table column widths were left inconsistent after the previous docs commit
widened cells, tripping oxfmt --check on functions delete/download docs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2747c1965c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/cli/src/legacy/commands/functions/delete/SIDE_EFFECTS.md Outdated
Comment thread apps/cli/src/legacy/commands/functions/download/SIDE_EFFECTS.md Outdated
…edaction in functions SIDE_EFFECTS.md (review: #PRRT_kwDOErm0O86O5RVY, #PRRT_kwDOErm0O86O5RVZ)

The access-token fallback file honors SUPABASE_HOME via
legacySupabaseHome() (legacy-credentials.layer.ts:322-324), not a
hardcoded ~/.supabase path. functions download also has three boolean
flags (use-api/use-docker/legacy-bundle) that withLegacyCommandInstrumentation
records verbatim per Go's isBooleanFlag branch (root_analytics.go:92,
106-108), so "every other flag redacted" was inaccurate for that command.
@Coly010

Coly010 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 3acde05668

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…4-functions-delete-add-safeflags-project-ref-telemetry-parity

# Conflicts:
#	apps/cli/src/legacy/commands/functions/download/download.integration.test.ts
#	apps/cli/src/shared/functions/functions.shared.ts
@Coly010

Coly010 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 89d1971219

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Coly010 Coly010 added this pull request to the merge queue Jul 7, 2026
Merged via the queue into develop with commit f7dc79c Jul 7, 2026
20 checks passed
@Coly010 Coly010 deleted the columferry/cli-1864-functions-delete-add-safeflags-project-ref-telemetry-parity branch July 7, 2026 15:16
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