Skip to content

Conversation

@fredli74
Copy link
Owner

Introduces hashbox-util for account/dataset/state management, sync for remote synchronization, Docker containerization, yearly retention, pkg refactor.

Major Changes:

  • hashbox-util: Commands for list/delete/move/purge/rebuild accounts/datasets/states.
  • Sync Feature: Local-remote sync with patterns, dry-run, threads, queue size.
  • Docker Support: Dockerfile, compose, DOCKER.md, .env.example, non-root users, health checks.
  • Package Refactor: Moved core/accountdb/storagedb/lockablefile to pkg/.

Improvements and Fixes:

  • Retention Improvements: Added -retainyearly option to policies.
  • Code refactors: AbortOn error handling, signal handling (SIGTERM), retention logic updates.
  • Added unit tests: For accountdb (transactions, readers, db files) and commands (list/show).
  • Dependency updates: Go 1.25.6, cmdparser version.
  • CI enhancements: Linting workflow with golangci-lint, CodeQL updates to v4/v6.
  • Gitignore: Added test ignores.
  • Docs: Docker setup instructions.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01faa76c7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +293 to +299
srcTxs := store.ReadTrnFile(srcAccH, srcDatasetName)
var dstTxs []accountdb.DbTx

dstPath := store.DatasetFilepath(dstAccH, dstDatasetName) + accountdb.DbFileExtensionTransaction
if _, err := os.Stat(dstPath); err == nil {
dstTxs = store.ReadTrnFile(dstAccH, dstDatasetName)
renameIfExists(dstPath, dstPath+".bak")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid duplicating transactions when moving onto itself

If moveDataset is invoked with the same account+dataset for source and destination (e.g., user typo or scripting bug), srcTxs and dstTxs read the same .trn file, and the merge loop writes every transaction twice into the new log. That duplicates adds/deletes and can corrupt the dataset history. A no‑op guard when srcAccH == dstAccH and srcDatasetName == dstDatasetName (or skipping the merge in that case) would prevent accidental duplication.

Useful? React with 👍 / 👎.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 69 out of 77 changed files in this pull request and generated 11 comments.

Comments suppressed due to low confidence (1)

pkg/core/go.mod:3

  • The go directive should be a language version (e.g. go 1.24), not a patch version (go 1.24.12). Using a patch version can break go tooling. If you need to pin a specific toolchain patch level, use a toolchain go1.24.12 directive instead.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Jan 30, 2026

@fredli74 I've opened a new pull request, #10, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 70 out of 78 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 56 to 58
core.Log(core.LogInfo, "%s - Connection closed", remoteID)
conn.Close()
core.AbortOnError(conn.Close())
}()
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core.AbortOnError(conn.Close()) can panic inside this deferred cleanup, and that panic is not covered by the earlier recover() (since it runs after the recover() call). A close error would therefore crash the whole server. Prefer ignoring the close error or logging it (without panicking), e.g. if err := conn.Close(); err != nil { core.Log(...) }.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI commented Jan 30, 2026

@fredli74 I've opened a new pull request, #11, to work on those changes. Once the pull request is ready, I'll request review from you.

@fredli74
Copy link
Owner Author

@copilot @codex lots of commits after PR was first opened. Please restart review.

Copy link
Contributor

Copilot AI commented Jan 30, 2026

@fredli74 I've opened a new pull request, #12, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c5788c1d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 33 to 36
if idx := strings.LastIndex(input, ":"); idx != -1 {
host = input[:idx]
p, err := strconv.Atoi(input[idx+1:])
core.AbortOnError(err, "invalid port %q: %v", input[idx+1:], err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Handle IPv6 host parsing without port

The host parser treats any colon as a host/port separator. For IPv6 literals without an explicit port (e.g., ::1 or [::1]), strings.LastIndex splits the address and attempts to parse the tail as a port, which triggers AbortOnError and makes hashbox-util ping/sync unusable with default ports on IPv6. Consider using net.SplitHostPort (with bracket handling) or only parsing a port when the suffix is numeric and the host is not an unbracketed IPv6 literal.

Useful? React with 👍 / 👎.

@fredli74 fredli74 merged commit deb4a1e into master Jan 30, 2026
18 checks passed
@fredli74 fredli74 deleted the dev-0.8 branch January 30, 2026 23:12
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