Repository navigation
fix(environments): skip env:update when flags match the current settings - #296
SakshiKoli-CS wants to merge 5 commits into
Conversation
…ings launch:env:update sent a PUT whenever any flag was passed, even when every value equalled what the environment already had: it reported success and moved updatedAt. hasChanges() only checked that a flag was given and never compared with the environment it had just read. The updater now drops each flag whose value matches the current setting (toggles and response mode compared in their flag form) before deciding; with nothing left it prints "No changes were entered", exits 0 and sends nothing, and asks no disable confirmation for a setting already off. --password-protection enable is always kept, since re-enabling rotates the credentials. The interactive response-mode prompt defaults to the current mode when the API reports it. The REST GET environment does not return isStreamingEnabled yet, so --res-mode is still always sent until management-service exposes it. .talismanrc checksums refreshed for the three edited files. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
dhruv-parekh-cs
left a comment
There was a problem hiding this comment.
Reviewed the whole PR: 0 high, 0 medium, 2 low (inline). Neither blocks approval.
— 🤖 launch-pr-review-agent (Claude)
Generated by Claude Code
Brings in #295, which removed the environment description from env:create, env:update and env:get. The unchanged-value filter no longer compares a description, and its test case drops the description flag. Refreshes the talisman checksum of environment.update.test.ts and the generated README. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The v2-dev merge changed files that already have reviewed .talismanrc entries (CL-8827's env:create/update/get and failure files, plus this fix's environment files). Only their checksums are refreshed; no new entries or detectors are added. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
- toggleOf and responseModeOf treat null like undefined, so a setting the API reports as null no longer drops the user's flag; null cases added for cache priming, auto deploy, cs-auth and response mode. - Remove the code comment on currentValuesOf (AGENTS.md: no code comments); the rotation test already pins that behaviour. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
dhruv-parekh-cs
left a comment
There was a problem hiding this comment.
Re-review since 8dc67c6 (merge of v2-dev after CL-8827, talisman refresh): 0 high, 0 medium, 0 low new.
Still open from the earlier review (both low, neither blocks approval):
- Low
src/environments/environment.update.ts:91:toggleOf/responseModeOfcheck only=== undefined, so anullfrom the API still counts as a known current value. - Low
src/environments/environment.update.ts:82: the code comment AGENTS.md forbids is still there.
— 🤖 launch-pr-review-agent (Claude)
Generated by Claude Code
|
/ship 2b summary — Fixed: null treated as an unknown current value (+ null test cases); removed the code comment on currentValuesOf (both in 81ed2c2). Resolved: both launch-pr-review-agent threads. Left for human: none. General comments: Snyk and GitHub Actions scan-status posts only (no action requested). Also merged v2-dev after #295 (CL-8827) dropped --description and refreshed the affected talisman checksums. Next: needs a human approval to merge. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
dhruv-parekh-cs
left a comment
There was a problem hiding this comment.
Re-review since a907f11 (null is not a known current value): 0 high, 0 medium, 1 low (inline).
Both lows from the earlier review are fixed at this head: toggleOf/responseModeOf now treat null as unknown, and the code comment is gone. 1 low open in total, so this doesn't block approval.
— 🤖 launch-pr-review-agent (Claude)
Generated by Claude Code
| const kept = { ...request }; | ||
|
|
||
| for (const field of Object.keys(current) as (keyof EnvironmentChanges)[]) { | ||
| if (current[field] !== undefined && kept[field] === current[field]) { |
There was a problem hiding this comment.
Nit (optional): users can no longer re-apply a setting to re-run what the server does when it is set. Only --password-protection enable is exempt from this filter. But management-service also emits a background job when isContentstackAuthenticationEnabled is written (updateContentstackAuthentication in environment.service.ts), and it re-runs the cache-priming handler when isCachePrimingEnabled is written. So --cs-auth enable on an environment that already reports it as enabled was a way to re-push edge/KV config after drift. It now prints "No changes were entered" and sends nothing.
Fix: confirm with the service owners that re-sending these toggles has no side effect anyone relies on. If it does, exempt csAuth: 'enable' the same way passwordProtection: 'enable' is exempted.
— 🤖 Claude review (Opus 5.5, high effort)
Generated by Claude Code
tejas-contentstack
left a comment
There was a problem hiding this comment.
High-effort review found 6 findings, so this isn't an approval. 1 is a bug that was already there before this PR: the interactive Response mode prompt defaults to buffered while isStreamingEnabled is unknown. The other 5 are nits: re-applying --cs-auth/--cache-priming is now skipped, passwordProtection can be absent from the response, the Environment type doesn't allow the null values the code now handles, the no-changes message doesn't say which flags were skipped, and an unchanged --server-cmd now skips the framework check. None of them blocks the PR. Details are in the inline comments. All checks pass, and the PR is not a draft.
— 🤖 Claude review (Opus 5.5, high effort), requested by tejas
Generated by Claude Code
…n Environment - When flags were passed and every one matches the current settings, env:update now prints "Environment not updated: --cs-auth, --cache-priming already match the current settings." instead of "No changes were entered"; the interactive checklist keeps the old line. - Environment declares the toggles and isStreamingEnabled as boolean | null and serverCommand as string | null, matching the wire. The compiler then surfaced env:get showing "disabled" for a null toggle; it now shows "-". #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
04691ce
dhruv-parekh-cs
left a comment
There was a problem hiding this comment.
Re-review since 81ed2c2 (name matching flags, allow null in Environment): 0 high, 0 medium, 0 low new.
Still open from an earlier review (low, doesn't block approval; left as is by decision with the author):
- Low
src/environments/environment.inputs.ts:36/environment.update.prompt.ts:180: the interactive toggle prompt has no default when the API reportsnull, and the prompt test has nonullcase.
1 low open in total, so this is approved.
— 🤖 launch-pr-review-agent (Claude)
Generated by Claude Code
Jira: CL-8833
What
launch:env:updatesent aPUTwhenever any flag was passed, even when every value equalled the environment's current setting. It reported "✔ Environment updated successfully." and movedupdatedAt.hasChanges()only checked that a flag was given; it never compared with the environment it had already read.enable/disable,streaming/buffered).--password-protection enableis always kept, because enabling it again rotates the credentials.toggleOf/responseModeOfnow live inenvironment.inputs.ts, so the updater no longer imports runtime helpers from the prompt module.Known limitation / follow-up: the REST
GETenvironment response does not exposeisStreamingEnabledyet (management-service REST DTO has no@Exposefor it), so--res-modeis still always sent. The CLI compares it automatically once the API returns it.Overlap: #295 (CL-8827) drops
--descriptionfrom the same files. Whichever merges second needs a small rebase (removedescriptionfromcurrentValuesOfand its tests).Tests
--frameworkdropped while--server-cmdis checked against the current framework; response-mode prompt default.PUT.npm test: 3883/3883 passed;tscand eslint clean.#claude_code#
🤖 Generated with Claude Code