Skip to content

fix(mongodb): harden backup info collection - #3279

Draft
weicao wants to merge 6 commits into
mainfrom
brooks/mongodb-backup-info-contract-r45
Draft

fix(mongodb): harden backup info collection#3279
weicao wants to merge 6 commits into
mainfrom
brooks/mongodb-backup-info-contract-r45

Conversation

@weicao

@weicao weicao commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Problem

MongoDB legacy backup-info collection masks failures from the MongoDB client,
timestamp conversion, and datasafed. It also accepts missing or malformed size
records, writes metadata directly to the final path, and lets datafile backup
continue after metadata generation fails.

Change

  • select mongosh when available and retain the legacy mongo fallback;
  • preserve producer return codes while keeping credentials quoted and out of
    diagnostics;
  • require a non-empty timestamp and exactly one canonical
    TotalSize: <decimal> datasafed record;
  • publish valid metadata through a sibling temporary file and guarded rename,
    preserving the previous destination on every failure;
  • stop the datafile action before archive work when backup-info collection
    fails, retaining its existing action-trap status/message/marker mapping; and
  • add a dual-shell contract suite for producer failures, empty and malformed
    values, duplicate records, JSON safety, atomic publication, cleanup, and the
    embedded action surface.

Evidence

  • focused ShellSpec: Bash 3.2 13/0, Bash 5.3 13/0;
  • full MongoDB ShellSpec: Bash 3.2 91/0, Bash 5.3 91/0;
  • dual syntax checks and ShellCheck warning severity pass;
  • Helm lint and default/custom helper-before-consumer renders pass;
  • strict fsck, diff-check, and clean worktree pass;
  • official datasafed v0.0.1-v0.2.4 and main format independently verified as
    TotalSize: %d;
  • fresh independent design review: DESIGN_CLEAR / BLOCKER_LIST0; and
  • fresh independent implementation review: APPROVE / BLOCKER_LIST0.

Boundaries

This PR contains static and container-local evidence only. It does not claim
Kubernetes runtime acceptance, package readiness, formal product N, merge,
deploy, or release readiness.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 232 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (8e745a4) to head (98a28bf).

Files with missing lines Patch % Lines
...godb/scripts-ut-spec/backup_info_collector_spec.sh 0.00% 232 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main   #3279    +/-   ##
======================================
  Coverage   0.00%   0.00%            
======================================
  Files        165     166     +1     
  Lines      25632   25864   +232     
======================================
- Misses     25632   25864   +232     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants