Skip to content

fix(logs): print deployment log lines that become readable late - #291

Merged
SakshiKoli-CS merged 2 commits into
v2-devfrom
CL-8805
Nov 18, 2026
Merged

SakshiKoli-CS merged 2 commits into
v2-devfrom
CL-8805

Conversation

@SakshiKoli-CS

Copy link
Copy Markdown
Contributor

Fixes CL-8805: deployment logs skip lines that arrive late.

What

While the CLI follows a deployment, some log lines never print, though the web UI shows them. Most visible at the end of a deployment: ✓ Edge functions deployed successfully. and ✓ Build and hosting completed. are missing before ✓✓ Site is live.

Cause: logs become searchable out of timestamp order (the logs background-jobs service batches bulk writes every 2 s, and the deployment-logs index has two shards that refresh independently), and a deployment turns LIVE before its last lines are indexed. The CLI asked only for logs after its newest printed line − 1 ms and stopped reading at the first empty fetch after a terminal status, so a late, older line was never asked for again.

  • Look-back window. LogTail asks from 10 s (DEPLOYMENT_LOG_LOOKBACK_MS) before the newest printed line and skips lines it already printed, matched on timestamp, stage and message with a repeat count (identical lines in one millisecond still all print; nothing prints twice).
  • Settle after the end. After LIVE/FAILED the watcher makes logSettleMs / pollDelayMs more reads (10 s / 2 s = 5), a failed read simply followed by the next. It settles only when the watch saw the deployment in flight or its updatedAt is within the window, so logs:get on a long-finished deployment returns at once. waitUntilLive (rollback) reads no logs and never waits.
  • AGENTS.md describes the look-back and settle behaviour. .talismanrc: checksums refreshed for AGENTS.md and the edited test files (watcher, deployments:create, and the logs-get, deployments-create, projects-create, environments-create integration suites), as fix(deps): upgrade open to 11 and override papaparse to 5.7.1 to clear Snyk findings #289 did for its files. They flag only fake fixture ids and key/value fields; no secret.

User-visible: a late line prints just after the line that overtook it, and create/follow commands return ~10 s later after the deployment ends.

Tests

  • Unit (deployment.log-tail.test.ts, deployment.watcher.test.ts, deployment.follower.test.ts): the reported sequence, the look-back since, no reprint inside the window, late lines after LIVE, a retry after a failed settle read, no settle for a deployment that ended before the watch, settle for one that ended within the window, waitUntilLive not waiting.
  • Integration (deployments-create.test.ts): replays the reported sequence over the wire; with settling off, exactly the two reported lines go missing. Other integration timing stubs pass logSettleMs: 0 to keep their scope.
  • Full suite and lint green; snyk test --fail-on=all passes on top of fix(deps): upgrade open to 11 and override papaparse to 5.7.1 to clear Snyk findings #289.

Note: logs-get T47 (Ctrl-C) failed intermittently under full-suite load on this machine and passed in isolation (5/5) and in full integration runs. It counts real timers around a real 2 s sleep; this change touches only the log since value on its path (settle is off there).

Pending: live check on dev11 with an edge-functions project (CL-8805 acceptance criterion 6).

Follow-up, not in this PR: contentfly-deployment-agent sends Build and hosting completed. after starting the go-live job; sending it first would make the UI more reliable too.

#claude_code#
🤖 Generated with Claude Code

The deployment log follow dropped lines. Logs become searchable out of
timestamp order (the logs background-jobs service batches its bulk
writes every 2 s and the deployment-logs index has two shards that
refresh on their own), and a deployment turns LIVE before its last
lines are indexed. The CLI asked only for logs after its newest
printed line minus 1 ms and stopped reading at the first empty fetch
after a terminal status, so an older line indexed late was never
asked for again. Seen as "Edge functions deployed successfully." and
"Build and hosting completed." missing before "Site is live".

- LogTail asks from 10 s (DEPLOYMENT_LOG_LOOKBACK_MS) before the
  newest line and skips lines already printed, matched on timestamp,
  stage and message with a repeat count.
- After a terminal status the watcher makes logSettleMs / pollDelayMs
  more reads (10 s / 2 s = 5), a failed one followed by the next. It
  settles only when the watch saw the deployment in flight or its
  updatedAt is within the window, so logs:get on an old deployment
  returns at once; waitUntilLive passes logSettleMs: 0.
- Integration timing stubs pass logSettleMs: 0; a new integration test
  replays the reported sequence over the wire.

AGENTS.md follows. The .talismanrc checksums for AGENTS.md and the
edited test files (watcher, deployments:create, and the logs-get,
deployments-create, projects-create and environments-create
integration suites) are refreshed for these changes; they hold only
fixture ids and key/value fields, no secret.

Refs CL-8805.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Sakshi Koli <sakshi.koli@contentstack.com>
@SakshiKoli-CS
SakshiKoli-CS requested review from a team as code owners November 18, 2026 09:15
@snyk-io

snyk-io Bot commented Nov 18, 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

@SakshiKoli-CS SakshiKoli-CS changed the title fix(logs): print deployment log lines that become readable late (+Claude) fix(logs): print deployment log lines that become readable late Nov 18, 2026

@Harshi-Shah-CS Harshi-Shah-CS 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.

👍

@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

@SakshiKoli-CS
SakshiKoli-CS merged commit 1414118 into v2-dev Nov 18, 2026
7 checks passed
@SakshiKoli-CS
SakshiKoli-CS deleted the CL-8805 branch November 18, 2026 10:55
SakshiKoli-CS added a commit that referenced this pull request Nov 18, 2026
Bring in the CL-8805 deployment-logs fix (#291) that landed on v2-dev after
this branch was cut.

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

Co-Authored-By: Claude <noreply@anthropic.com>
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