[LFXV2-1194] fix: soft delete, tombstone dedup, and lint fixes#10
Merged
[LFXV2-1194] fix: soft delete, tombstone dedup, and lint fixes#10
Conversation
- Detect soft deletes via _sdc_deleted_at field in KV PUT entries and route them through the same delete path as hard deletes - Replace hard mapping deletion with a tombstone marker (!del) to prevent duplicate delete events when KV deletes are redelivered - Refactor handleKVDelete into handleResourceDelete shared by both hard and soft delete paths; remove unused idMapper parameter from delete path - Add defer eventProcessorCancel() to fix context cancel leak in main Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
- Remove `|| exit 1` from Dockerfile HEALTHCHECK exec-form CMD (hadolint DL3025) - Fix gofmt alignment of EventConsumerName/EventStreamName in loadConfig (golangci-lint) - Remove defer eventProcessorCancel() inside conditional block to fix lostcancel (golangci-lint govet) - Add -r flag to both read calls in delete_survey_documents.sh (shellcheck SC2162) - Add revive.toml linter config and .mega-linter.yml Generated with [Claude Code](https://claude.ai/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR improves survey-service event processing around deletes (soft deletes and KV redelivery deduplication) and adds/updates linting configuration to address multiple static analysis findings.
Changes:
- Detect soft deletes via
_sdc_deleted_aton KV PUT entries and route them through the delete path. - Add a tombstone marker (
!del) in the mappings KV to deduplicate delete events on redelivery, and refactor delete handling into a shared helper. - Apply assorted lint/config fixes (shellcheck, hadolint, gofmt) and introduce
revive.toml+.mega-linter.yml.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/delete_survey_documents.sh | Adds read -r to satisfy shellcheck and avoid backslash escaping issues. |
| revive.toml | Adds revive configuration and disables specific rules for this repo. |
| cmd/survey-api/main.go | gofmt alignment in loadConfig. |
| cmd/survey-api/eventing/survey_response_event_handler.go | Tombstone-based delete dedup for survey responses. |
| cmd/survey-api/eventing/survey_event_handler.go | Tombstone-based delete dedup for surveys. |
| cmd/survey-api/eventing/kv_handler.go | Soft delete detection + shared delete handler + tombstone helpers. |
| Dockerfile | Fixes HEALTHCHECK exec-form per hadolint guidance. |
| .mega-linter.yml | Adds MegaLinter configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…yamllint config - Pin cgr.dev/chainguard/go and static images by SHA digest (hadolint DL3007) - Fix lostcancel govet: call eventProcessorCancel before return 1 in srv.Shutdown error path - Upgrade go.opentelemetry.io/otel to v1.40.0 (fixes GHSA-9h8m-3fm2-qjrq) - Add .yamllint config Generated with [Claude Code](https://claude.ai/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
…rect mega-linter config - Treat tombstoned survey mapping as not-found when checking parent exists for survey responses - Fix lostcancel: initialize eventProcessorCtx/Cancel unconditionally with defer to cover all return paths - Fix KUBERNETES_DIRECTORY and KUBERNETES_HELM_ARGUMENTS to point to charts/lfx-v2-survey-service - Fix revive.toml ignoreGeneratedHeader comment to accurately describe true/false behavior Generated with [Claude Code](https://claude.ai/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
- Remove redundant context.WithCancel reassignment inside if block; use
single context created upfront with defer to cover all return paths (lostcancel)
- Move YAML document separator inside {{- if }} block in serviceaccount.yaml
to fix helm lint parse error
- Upgrade go.opentelemetry.io/otel/sdk to v1.40.0 (fixes GHSA-9h8m-3fm2-qjrq)
Generated with [Claude Code](https://claude.ai/claude-code)
Signed-off-by: Andres Tobon <andrest2455@gmail.com>
- Add tombstone deduplication, soft delete support, and orphan prevention sections to event-processing.md deduplication documentation - Fix duplicate processing troubleshooting entry to reference tombstone marker - Add LOG_LEVEL and LOG_ADD_SOURCE env var descriptions to itx-proxy-implementation.md - Fix NewSurveyService parameter order in test example - Update LOC count to reflect event processing additions Generated with [Claude Code](https://claude.ai/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
Rules exported and unused-parameter no longer need to be disabled as the codebase already satisfies them. Generated with [Claude Code](https://claude.ai/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
mauriciozanettisalomao
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_sdc_deleted_atfield in KV PUT entries!del) to prevent duplicate delete events on KV message redeliveryhandleResourceDeleteremoving unusedidMapperparamlostcancelgovet lint: removedefer eventProcessorCancel()from conditional blockgofmtalignment ofEventConsumerName/EventStreamNameinloadConfig|| exit 1from Dockerfile exec-formHEALTHCHECK CMD-rflag to bothreadcalls inscripts/delete_survey_documents.shrevive.tomllinter config and.mega-linter.ymlTicket
LFXV2-1194
🤖 Generated with Claude Code