Review dp function - #62
Conversation
Add `brevo function list` and `brevo function get <id>` commands for managing Brevo Functions, plus the "Brevo Function" app type choice in `brevo app create`. - New service (src/services/function.ts) with list, draft list, and get - New command handlers (src/commands/function/list.ts, get.ts) - Register functionCommandGroup in definitions.ts and bin/index.ts - Add Function commands section to root help screen - Add brevo_function template flag for app-config.json rendering - Add Brevo Function app type to interactive create prompt (private only) - Unit tests for service, list command, and get command (23 tests) - Command registration tests in definitions.test.ts (4 tests) - Help formatting tests updated for functionCommandGroup - New smoke suite (scripts/smoke/function.ts) exercising list, list --draft, get, and get-not-found against a real account — opt-in via `yarn smoke --suite=function` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `brevo-function-type` to FEATURE_STAGE as a preview feature - Move function group definition to preview-definitions.ts so esbuild can eliminate it from published builds - Gate the Brevo Function choice in `app create` behind __BREVO_PREVIEW__ - Gate the Function commands section in help.ts behind __BREVO_PREVIEW__ - Add `aliases` support to SubcommandGroupDefinition so `brevo fn list` and `brevo fn get` work as shortcuts - Update tests for the conditional export and gated app-type prompt Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add three management commands to the Brevo Function group: - `brevo function activate <id>` — PATCH with is_active: true - `brevo function deactivate <id>` — PATCH with is_active: false - `brevo function delete <id>` — DELETE with --force to skip confirmation All three are gated behind __BREVO_PREVIEW__ alongside the existing list and get commands. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat: add brevo function activate, deactivate and delete commands
piyushsarin-sib
left a comment
There was a problem hiding this comment.
Review — Brevo Function commands + Function app type
Reviewed the full diff against features_set-dp-function. Verified locally on this head: yarn lint clean, yarn test 65 suites / 1361 tests pass, yarn build succeeds. The findings below are the things those green checks don't cover.
Blocking
brevo_functionis never written toapp-config.json— no template consumes{{BREVO_FUNCTION_JSON}}, so a Function app is byte-identical to an OAuth app on disk. Details inline onproject-writer.ts.functionServiceships in the published bundle —container.tsinstantiates it unconditionally, so esbuild can't drop it. Inline oncontainer.ts.function delete --jsondeletes with no confirmation and no--force. Inline ondelete.ts.- The
functionsmoke suite can never pass —scripts/smoke/core.ts:714still gates the preview build on thepublicsuite only. Inline onsmoke/function.ts.
Not anchored to a diff line
scripts/build.mjs:127 — LEAK_MARKERS not extended. The list stops at resolveDeploymentTarget; there are no previewFunctionGroup / *FunctionCommand entries. The in-file comment calls this array the real elimination guard, so it's now blind in both directions for this feature: a future stray import that ships the function commands publicly passes, and a preview build that eliminates them by mistake also passes. Elimination does work today — nothing enforces that it keeps working. This is also what would have caught finding 2.
yarn.lock: +270/−383 with package.json untouched. Incidental lockfile re-resolution riding along in a feature PR. It silently moves transitive versions in a diff nobody will review for that — worth dropping or splitting out.
Test gaps. Three pieces of new logic have no coverage:
- that the Function choice is hidden when
--distribution public(the new conditional atcreate.ts:142-148) - that a Function app's
app-config.jsondiffers from an OAuth app's — this is precisely why finding 1 slipped through green tests - the
fnalias
Repo conventions. No changeset, no RELEASE-CHECKLIST.md Before Brevo-Functions GA section, no ## Per-branch verification entry, nothing in docs.md. All four are called for by CLAUDE.md when a new gated feature lands. (SKILL.md / AGENTS.md correctly left alone — gated features carry no reference text until GA.)
Checked and fine
The command surface itself is eliminated from a public build — I confirmed Manage Brevo Functions, all four spinner strings, and every handler are absent from dist/bin/index.js after a plain yarn build. The gating pattern is right; it's the service and the core-lang strings that leak past it.
Also checked and not an issue: the let response; / let fn; declarations in list.ts / get.ts. TypeScript's evolving-let narrows them to the service return types, so the new DpFunction* interfaces do constrain the print sites — I probed it with a bogus property read and it fails typecheck as expected. Explicit annotations would read better, but it's style, not a hole.
Blocking issues — reproductionsFollowing up on my review with concrete reproductions for the four blocking items. Each was reproduced on this head ( 1. Picking "Brevo Function" produces an OAuth projectbrevo app create # choose "Brevo Function" at the app-type prompt
cat app-config.json # byte-identical to an OAuth app — no brevo_function key
Fix: add the Why CI is green: nothing asserts on a Function app's rendered config. A test that creates with 2. The gated service ships in the published bundleyarn build # no PREVIEW=1
grep -o 'DP_FUNCTIONS:"[^"]*"' dist/bin/index.js
grep -c 'activateFunction\|deleteFunction' dist/bin/index.jsOutput: Verbatim from the public bundle: async activateFunction(id){await client2.patch(ENDPOINTS.DP_FUNCTION(id),{is_active:!0})},
async deactivateFunction(id){...},
async deleteFunction(id){await client2.delete(ENDPOINTS.DP_FUNCTION(id))}
Fix: gate the export behind 3.
|
What matters here, in priority orderConsolidating the review into a merge checklist. The four blocking items and their reproductions are in the comment above — not repeating them. This is everything else, ranked, so it's clear what's a merge gate and what's a follow-up. Must fix before mergeBeyond the four blocking items, two of these are cheap and have consequences well past this PR: 1. Route the service through Same for This is a scripting contract. Fixing it after release is a breaking change; fixing it now costs nothing. 2. Add 3. Fix the three comments that assert the opposite of what the code does — 4. Extend Should fix in this PR5. Pagination. 6. Move 7. Collapse the duplicated 404 branch. The same 12-line 8. Test the three untested behaviours: the Function choice hidden under 9. Add the root-help lines for 10. Process artifacts: changeset, Follow-up, not merge gates
Checked and explicitly not asking forTwo things that look like convention violations but aren't, so nobody spends time on them:
Also verified sound: the command-elimination pattern itself. |
|



Summary
Phase-1 integration of DP Functions into brevo-cli — adds the
brevo functioncommand group for managing Brevo Functions, plus the Function app type inbrevo app create. All new commands are gated behind__BREVO_PREVIEW__and eliminated from published builds.Epic: PP-2110
Jira tickets
brevo function listcommandbrevo function get <id>commandbrevo function activate/deactivate/delete <id>commands__BREVO_PREVIEW__) for CLI DP function flowWhat changed
New commands (
brevo function/brevo fn)brevo function list— List all functions (supports--draftfor draft functions)brevo function get <id>— Get details of a specific functionbrevo function activate <id>— Activate a function (PATCHwithis_active: true)brevo function deactivate <id>— Deactivate a function (PATCHwithis_active: false)brevo function delete <id>— Delete a deployed function (--forceskips confirmation)App creation flow
brevo app createinteractive prompt (alongside OAuth and UI app)--json/ piped stdin) default to OAuth appbrevo_functiontemplate flag added forapp-config.jsonrenderingPreview gating
brevo-function-typeadded toFEATURE_STAGEas a preview featurepreview-definitions.tsso esbuild eliminates it from published builds__BREVO_PREVIEW__Other
fnalias added forbrevo function(viaaliasessupport onSubcommandGroupDefinition)src/services/function.ts) with list, draft list, get, activate, deactivate, deletescripts/smoke/function.ts) — opt-in viayarn smoke --suite=functionTest plan
yarn test)definitions.test.tsfunctionCommandGrouplist,list --draft,get, andget-not-foundagainst a real account🤖 Generated with Claude Code