Skip to content

fix(operator): record latest bundle digest for OCI module sources - #6

Merged
ValgulNecron merged 1 commit into
mainfrom
fix/oci-module-digest
Jun 28, 2026
Merged

ValgulNecron merged 1 commit into
mainfrom
fix/oci-module-digest

Conversation

@ValgulNecron

Copy link
Copy Markdown
Collaborator

Bug 7 from BUG_REPORT.md

operator/internal/modsrc/oci.go copied the latest bundle's metadata into the catalog ModuleEntry but never assigned entry.Digest, even though bundle.Digest is already returned by Pull. Because module_controller.go skips reconciliation when entry.Digest == "", OCI modules:

  • never showed a latest digest in the catalog, and
  • could not detect content drift when a tag/version was reused.

Non-OCI sources (dir.go, upload.go) already populate the digest.

Fix

One line: entry.Digest = bundle.Digest after the metadata copy.

Test

Extended TestOCIFetcher_Index to assert the indexed entry carries the latest bundle's digest.

🤖 Generated with Claude Code

The OCI fetcher copied bundle metadata into the catalog entry but never
set entry.Digest, even though bundle.Digest is available from Pull. The
module controller skips reconciliation when entry.Digest == "", so OCI
modules never showed a digest and could not detect content drift behind
a reused tag/version. Assign it, matching dir and upload sources.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
@ValgulNecron
ValgulNecron merged commit 144ffaf into main Jun 28, 2026
61 of 66 checks passed
@ValgulNecron
ValgulNecron deleted the fix/oci-module-digest branch June 28, 2026 12:04
@ValgulNecron
ValgulNecron restored the fix/oci-module-digest branch June 28, 2026 12:15
@ValgulNecron
ValgulNecron deleted the fix/oci-module-digest branch June 30, 2026 14:26
ValgulNecron added a commit that referenced this pull request Aug 23, 2026
Fix two critical edge cases in the capture-sidecar:

1. ENOSPC from WritePacket reported as "error" instead of "disk_full" (Z2 #6):
   When a bufio flush inside WritePacket fails with ENOSPC, the error doesn't
   wrap ErrLimitReached, so it falls through to the default case and gets
   reported as a generic "error" reason. This hides the root cause from
   operators investigating truncated captures. Fixed by checking both the
   error chain and the writer's LimitReason field in the default case to
   properly distinguish disk-full from other failures.

   Added TestCaptureENOSPCDuringWritePacketReportsDiskFull to verify ENOSPC
   surfaces as disk_full reason in both the writer and the handler.

2. Process shutdown never finalizes in-flight captures (Z2 #7):
   On SIGTERM, baseCtx is cancelled, causing runCapture to return without
   calling finish(), leaving the PCAPNG writer unflushed and the file
   potentially truncated and unreadable (worst failure mode for a forensic
   tool). Fixed by:
   - Adding Server.FinalizeCurrentCapture() to safely finalize the current
     capture with a timeout, logging if the goroutine doesn't exit in time
   - Calling FinalizeCurrentCapture() in main.go after server.Shutdown()

   This ensures captures are always properly closed before process exit,
   regardless of whether shutdown is graceful or forced by the container
   orchestrator.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016EsywBB1qz8A6F68HPJpxv
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.

1 participant