Skip to content

fix: mark only listed dead-lettered units and give the full revive statement - #5534

Merged
themarolt merged 1 commit into
mainfrom
fix/issue-1238-dead-letter-alert-overflow
Dec 6, 2026
Merged

themarolt merged 1 commit into
mainfrom
fix/issue-1238-dead-letter-alert-overflow

Conversation

@themarolt

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #5533, from its review comments. The dead-letter alert marked every new unit as alerted even when the Slack message cut it off past 20 lines, so units beyond the cap were never named. Its revive instruction also left the failure count at the threshold, so a revived unit went straight back to dead-letter on its next failure.

Changes

  • Only the units the message lists are marked as alerted; units past the line or size cap are named on the next hourly run.
  • Each listed unit shows its id, and the alert gives the full revive statement (status, failure count, error fields, nextRunAt, lock), matching reviveDeadLetteredSyncUnits.
  • countFittingLines is split out of capLines so both share the cap logic.
  • Removed two comments that restated the code.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Performance improvement
  • Chore / dependency update
  • Documentation

Related issue

Refs linuxfoundation/lfx-cdp-insights-ops#1238

@themarolt
themarolt requested review from a team and lfx-one as code owners December 6, 2026 19:34
Copilot AI balanced review requested due to automatic review settings December 6, 2026 19:34
@cursor

cursor Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Cron/Slack alerting bug fix with no auth or data-path changes; behavior is covered by new unit tests.

Overview
Fixes dead-letter Slack alerts so units truncated past the 20-line or character cap are not silently marked as alerted—they surface on the next hourly run instead. Alert state now uses countFittingLines (extracted from capLines in octolens mapping health) so only units actually shown in the message get Redis “alerted” keys; alerted counts match that listed set.

Alert content adds each sync unit’s id in the bullet list and replaces vague revive guidance with a full UPDATE integration.sync_units … snippet that resets consecutiveFailures, clears error fields, sets nextRunAt and unlocks—aligned with reviveDeadLetteredSyncUnits so a manual revive does not dead-letter again on the first failure. Tests cover the overflow case (22 units → 20 + “… and 2 more”, then a second alert for the remainder).

Reviewed by Cursor Bugbot for commit 6affa05. Bugbot is set up for automated code reviews on this repo. Configure here.

@lfx-one

lfx-one commented Dec 6, 2026 •

Copy link
Copy Markdown

@themarolt I'm starting review 1 of this pull request now (started 2026-12-06 19:34 UTC using review agent v0.1.37). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by re-review, to start another. For help with the review agent, see https://github.com/linuxfoundation/lfx-review-agent/issues.


Hi Uros Marolt, thanks for the follow-up fix.

Summary

This pull request makes the dead-letter alert mark only the units its Slack message lists as alerted, and it gives the full revive statement with each unit's id. The change is small and well tested, and I found no concerns.

Decision

✅ Approved

Details

Overall impression: The change fixes a real gap: units cut off by the 20-line or size cap were marked as alerted without being named. Extracting countFittingLines from capLines keeps the line count and the displayed text on the same cap logic. The revive SQL resets the failure count, error fields, nextRunAt and the lock, so a revived unit doesn't dead-letter again on its next failure. The new test covers 22 units, with 20 alerted and 2 named on the next run. The DCO check passed on 6affa05.

Documentation reminder: changed dead-letter Slack alert content. Please check product pages and external docs; the author and maintainers own those updates.

Rule files: read AGENTS.md; skipped none (the other rule files, CONTRIBUTING.md and .claude/rules/*, were not needed for this small change)

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

@lfx-one lfx-one 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.

The change correctly marks only the units the Slack message actually lists, and countFittingLines and capLines share the same cap logic. I found no blocking, security or privacy issues. The new test covers the overflow case.

Documentation

This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:

  • dead-letter Slack alert content (each unit now shows its id, and the alert gives a full revive statement)

@greptile-apps

greptile-apps Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] This PR appears safe to merge.

Summary

Fixes dead-letter alerts so only listed units are remembered as alerted. Adds unit IDs and a full recovery statement that clears the failure count.

  • Units left out of dead-letter alerts get named on a later run.
  • Dead-letter alerts identify each unit and show the full revive steps.
  • The dead-letter code no longer repeats behavior in comments.

Reviews (1) · Last reviewed commit: "fix: mark only listed dead-lettered unit..." · Reviewed by Greptile

Copilot AI 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.

🟡 Changes recommended

The tests lack character-cap regression coverage verifying that units omitted by the size budget remain unmarked in Redis and are listed on subsequent runs.

1 open issue
What changed in this PR

This follow-up to #5533 improves connector dead-letter alerts so omitted units remain eligible for later notifications and operators receive complete revival instructions.

Changes:

  • Mark only units actually listed in Slack as alerted.
  • Include unit IDs and SQL that resets failure state.
  • Share cap-counting logic and test deferred notifications.
File Description
services/​libs/​data-access-layer/​src/​connectors/​syncUnits.ts Removes a redundant comment; no behavior change.
services/​apps/​cron_service/​src/​jobs/​syncUnitDeadLetter.ts Tracks listed units and supplies complete revival SQL.
services/​apps/​cron_service/​src/​jobs/​syncUnitDeadLetter.test.ts Tests unit IDs, failure reset instructions, and overflow retries.
services/​apps/​cron_service/​src/​jobs/​octolensMappingHealth.ts Extracts shared line-counting logic.

Review effort: Balanced

@themarolt
themarolt merged commit beb170d into main Dec 6, 2026
15 checks passed
@themarolt
themarolt deleted the fix/issue-1238-dead-letter-alert-overflow branch December 6, 2026 19:43
@themarolt themarolt mentioned this pull request Dec 6, 2026
1 of 6 tasks
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