Skip to content

fix(site): drop --deployment from site:open and never treat the preview screenshot as a URL - #297

Merged
Harshi-Shah-CS merged 3 commits into
v2-devfrom
CL-8789
Nov 19, 2026
Merged

Harshi-Shah-CS merged 3 commits into
v2-devfrom
CL-8789

Conversation

@Harshi-Shah-CS

Copy link
Copy Markdown
Contributor

Jira: CL-8789

What

A deployment's previewUrl is the screenshot the platform takes after it goes live (a .png on images.contentstack.io), not a URL for the site. The CLI was treating it as one.

  • launch:site:open opens the environment's live site only. --deployment is removed (agreed with Dhruv on CL-8789). It used to open the screenshot, and the API has no per-deployment site URL to open instead. Passing it now fails as an unknown flag with exit 2, before any request.

  • The screenshot never shows up as a URL. deploymentUrlOf used to fall back to previewUrl when deploymentUrl was empty, so the image could reach:

    • the default site:open
    • the deploy follower's Deployment URL: line
    • the URL row in deployments:view

    It now reads deploymentUrl alone. When that is empty, site:open and every command that announces the site fall back to the environment's domains: projects:create, environments:create, and now deployments:create, which reads the environment only in that case, so its normal path sends no extra request. deployments:view shows -.

  • One URL normalizer. core/url withScheme is now shared by the deployment URL, the domain fallback and the domain prompt. It trims, checks for a real scheme, and skips whitespace-only values. A bare host such as http-api-ab12.contentstackapps.com now gets https://; before, the startsWith('http') check left it without a scheme.

  • previewUrlOf is deleted, Deployment.previewUrl gets a doc comment saying it is the screenshot, and the README is regenerated (only the site:open section changes).

Tests

  • Updated to the new behavior: the tests that expected the screenshot fallback (presenter, siteUrlOf, deploy follower) now expect the domain, or no URL.
  • Deleted: the --deployment cases, 10 unit and 4 integration.
  • Added: the integration case that refuses --domain as an unknown flag now also covers --deployment (exit 2, nothing sent, no browser).
  • Also added:
    • deployments:create reads the environment and announces its domains only when the LIVE deployment carries no URL.
    • A bare host starting with http gets a scheme.
    • Whitespace-only URLs and domains are treated as absent.
  • Results: npm test passes (196 suites, 3853 tests), and lint and tsc are clean. Branch coverage is 100% on open.ts, core/url.ts, site.url.ts and site.prompt.ts.

Follow-ups (separate PRs)

  • The workspace manual-test harness 88-site-open.sh still has its --deployment cases.
  • product-wiki's launch-cli-v2-commands-reference.md still lists --deployment for site:open.

#claude_code#
🤖 Generated with Claude Code

…ew screenshot as a URL

A deployment's previewUrl is the screenshot the platform takes after it goes
live (a .png on images.contentstack.io), not a site URL. site:open --deployment
opened that image, and deploymentUrlOf fell back to it whenever deploymentUrl
was empty, so the default site:open, the deploy follower's "Deployment URL:"
line and the deployments:view URL row could show it too.

- site:open opens the environment's live site only: --deployment is removed
  (agreed with Dhruv on CL-8789) and is now refused as an unknown flag, exit 2.
- deploymentUrlOf reads deploymentUrl alone. When it is empty, site:open and
  every announcing command (projects:create, environments:create and now
  deployments:create, which reads the environment only in that case) fall
  back to the environment's domains; deployments:view shows "-".
- One URL normalizer, core/url withScheme, shared by the deployment url, the
  domain fallback and the domain prompt: it trims, recognises a real scheme
  (a bare host like "http-api-ab12.contentstackapps.com" now gets https://)
  and skips whitespace-only values.
- previewUrlOf is deleted, Deployment.previewUrl is documented as the
  screenshot, and the README is regenerated.

- .talismanrc: refreshed the checksums of create.test.ts, deployment.create.test.ts,
  deployment.presenter.test.ts and README.md (false positives on "key",
  "secrets" and "Password" in test code and the regenerated command docs).

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Harshi-Shah-CS
Harshi-Shah-CS requested review from a team as code owners November 19, 2026 11:02
@snyk-io

snyk-io Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 2 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Brings in CL-8827 (#295). README.md merged cleanly.

- .talismanrc: refreshed the checksums of README.md (merged file) and of the
  files CL-8827 changed whose v2-dev checksums were stale:
  environment.update.test.ts, env/get.test.ts, env/update.test.ts,
  env/update.ts, core/failure.test.ts, environment.inputs.ts,
  environment.presenter(.test).ts, environment.update.prompt(.test).ts,
  environment.update.ts and environments/types.ts. Every finding is a false
  positive on "password", "key", "secret" or "pass" in flag names, field
  names, prompts and test titles; no credential values.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Comment thread src/deployments/deployment.create.ts Resolved
Comment thread src/deployments/deployment.create.ts Resolved
Comment thread src/core/url.ts Resolved

@tejas-contentstack tejas-contentstack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A high-effort review found 4 issues (1 important, 3 nits), each posted as an inline comment. Not approving because of these findings.

  • Important: deployment.create.ts:137. The new environments.get lookup that fetches fallback domains runs after LIVE without error handling. If that one request fails, a deployment that is already live gets reported as a failed deployments:create.
  • Nit: deployment.create.ts:129. projects:create and environments:create still use the domain snapshot taken before the build, so the three commands fall back to domains in different ways.
  • Nit: deployment.presenter.ts:26. withScheme lets any scheme through, such as file:// or ftp://, to the browser opener.
  • Nit: core/url.ts:9. Stripping trailing slashes changes some URLs, and a value of / becomes a bare https://.

— 🤖 Claude review (Opus 5.5, high effort), requested by tejas


Generated by Claude Code

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 2 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

… web URLs

Review follow-ups on #297:

- deployments:create reads the environment's domains only when the LIVE
  deployment carries no url; a failure of that read no longer fails the
  command, it just announces no url. A live deployment is never reported as
  a failed create.
- core/url webUrlOf replaces withScheme. It keeps http(s) URLs as given and
  gives a bare host https://, keeps a path or query exactly (no trailing
  slash stripped from "https://host/app/" or "?next=/"), drops trailing
  slashes only from a bare host, and returns nothing for an empty,
  slash-only, scheme-only or non-web (file://, ftp://) value. The deployment
  url, the domain fallback and the domain prompt all use it.

- .talismanrc: refreshed the checksum of deployment.create.test.ts (false
  positive on "key" in existing test code).

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 2 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@Harshi-Shah-CS

Copy link
Copy Markdown
Contributor Author

/ship 2b summary — Fixed in 2467b7b: (1) the post-LIVE environments.get domain lookup in deployments:create is best-effort, so a live deployment is never reported as a failed create; (3) only http/https URLs reach the browser opener (core/url webUrlOf); (4) a path or query is kept exactly, and slash-only or scheme-only values give no URL. Resolved: those three threads. Disputed / not-worth-it: (2) re-reading the environment after LIVE in projects:create and environments:create, which predates this PR and is out of CL-8789's scope; reasoning is on the thread, left open. General comments: the Snyk and security-scan posts are status reports with nothing to address. Branch synced with v2-dev (merge 90ff0b5). Next: waiting for the bot review of 2467b7b to settle, then re-review and merge once approved and green.

@Harshi-Shah-CS
Harshi-Shah-CS merged commit 9a13dd1 into v2-dev Nov 19, 2026
7 checks passed
@Harshi-Shah-CS
Harshi-Shah-CS deleted the CL-8789 branch November 19, 2026 11:30
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.

3 participants