Skip to content

refactor: share atomic JSON persistence helper - #296

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:mainfrom
mendezr:refactor/shared-atomic-json
Oct 6, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:mainfrom
mendezr:refactor/shared-atomic-json

Conversation

@mendezr

@mendezr mendezr commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extract pkg/fsutil.AtomicWriteJSON; remove the four local implementations and retain each persistence package's error prefix and error unwrapping.
  • Preserve JSON formatting, 0600 file mode, same-directory temp+rename, and cleanup behavior. Temporary filenames now consistently use .tmp-*; no fsync/durability changes.
  • Consolidate helper error-path tests in pkg/fsutil, adding creation/replacement, mode, unchanged destination, and cleanup assertions. Keep package-level persistence error propagation tests.

Closes #294

Validation

  • go build ./... and go vet ./...: pass
  • go test -count=1 -coverpkg=./... -coverprofile=/tmp/dibs-294-coverage.out ./...: pass; total coverage 97.3%
  • gofmt -l ., git diff --check: clean
  • go mod tidy: no module changes; Go/Dockerfile versions both 1.27
  • Race suite attempted but unavailable: CGO is disabled by default, and enabling it fails because gcc is not installed. Podman is also not installed in this environment.

— hive: backend=pi model=openai-codex/gpt-6.1-sol


🐝 Hive Agent: contributor | SHA: 6143f2c

Extract fsutil.AtomicWriteJSON and use it from catalog, history, news,
and store, retaining package-specific error wrapping. Consolidate the
helper error tests and check formatting, replacement, modes, cleanup,
and persistence error propagation.

Hive-Run: hivecommons#294
Hive-Plan: shared-atomic-json
Hive-Spec: issue-294#shared-implementation
Signed-off-by: mendezr <mendezr@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 6, 2026
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 6, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 7e41285 into hivecommons:main Oct 6, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[architect] atomicWriteJSON copy-pasted in 4 persistence packages (catalog, history, news, store)

1 participant