Skip to content

fix: merge watch config contexts without duplicates and reject blank names - #618

Open
aryarathoree wants to merge 1 commit into
microcks:masterfrom
aryarathoree:fix/watch-config-upsert-context-merge
Open

aryarathoree wants to merge 1 commit into
microcks:masterfrom
aryarathoree:fix/watch-config-upsert-context-merge

Conversation

@aryarathoree

Copy link
Copy Markdown
Contributor

Fixes #610

Summary

This PR addresses the watch configuration context-handling bugs in WatchConfig.UpsertEntry:

  1. Context Deduplication & Preservation: Merges incoming contexts with existing contexts without duplicates when re-upserting a watched file, preventing existing contexts from being deleted when updating a file from one context.
  2. Context Validation: Validates that entry.Context is non-empty and contains no blank/whitespace-only context names, returning descriptive errors to callers.
  3. Caller Handling: Propagates errors from UpsertEntry in cmd/import.go.
  4. Regression Tests: Adds test coverage in pkg/config/localconfig_test.go and pkg/config/config_test.go covering empty contexts, blank context names, context merging on re-upsert, and deduplication.

Co-authored-by: https://github.com/aniket866

Merge contexts without duplicates in WatchConfig.UpsertEntry to prevent existing contexts from being deleted when re-upserting a watched file. Validate that context lists are non-empty and reject blank context names, propagating errors to callers.

Fixes microcks#610

Co-authored-by: aniket866 <iamaniketkumarmaner@gmail.com>

This branch was successfully deployed

1 active deployment
Build — 5b0adb45 Deployed Nov 4, 2026 by aryarathoree via build-verify-package #866
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.

WatchConfig.UpsertEntry silently deletes existing contexts when re-upserting a watched file

1 participant