Repository navigation
[AI:zf-builder] refactor(server): replace zeebo/xxh3 dep with stdlib hash/fnv for IP-hub key - #178
Merged
Merged
Conversation
…hub key Task: zf-z-ea50c78d refactor(server): replace zeebo/xxh3 dep with stdlib hash/fnv for IP-hub key (Ponytail Rung 5)
Deploying zerohub with
|
| Latest commit: |
9e30603
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://784cbcbd.zerohub.pages.dev |
| Branch Preview URL: | https://task-zf-z-ea50c78d.zerohub.pages.dev |
ntsd
commented
Nov 20, 2026
ntsd
left a comment
Contributor
Author
There was a problem hiding this comment.
[AI:zf-reviewer] [Reviewer Feedback] Round 1: Approved for human review.
Clean, well-scoped refactor. Verified in the worktree (branch task/zf-z-ea50c78d, base main):
Correctness / tests
fnvHash64a(hash/fnv, FNV-1a 64-bit) replacesxxh3.HashStringat the only
production call site (join_or_create_hub_ip.go:35). stdlib, no new dep.cd server && go test ./...-> all packages ok (pkg/handler fresh run 8.9s).go vet ./...clean.go mod tidyis a no-op (go.mod/go.sum already tidy).
Dependency removal — important nuance
- The task listed "zero hits for
grep zeebo/xxh3" as a verification gate. That
is NOT achievable and is NOT a defect here:github.com/zeebo/xxh3still
appears in go.mod as// indirectand in go.sum. go mod why -m github.com/zeebo/xxh3-> pkg/storage -> ntsd/gache/v2 ->
zeebo/xxh3. gache/v2's own go.mod directly requires xxh3 v1.0.2 (gache.go
imports it). So the module graph still needs it; tidy correctly demotes it to
indirect.- The actual task goal — drop the DIRECT dependency and all direct imports — is
fully met: no .go file imports zeebo/xxh3; the 7 "xxh3 hash" comments are now
"FNV hash". The remaining go.mod/go.sum lines are the unavoidable transitive
dep via gache. Treat those as correct, not as leftover work.
Security / behavior
- Hub key stays a server-generated opaque id; FNV-1a is fine for an opaque,
non-crypto key (xxh3 was not crypto either). No security regression. - Behavior note holds: IP hubs are ephemeral (NoTTL, removed on last peer leave),
so re-keying after deploy is safe; no persisted state names the old key.
Ponytail (7-Rung) check
- Rung 5 (dependency): direct third-party dep removed; stdlib chosen. Pass.
- Rung 7 (diff scope): 8 files, all in-scope — 1 code, 1 test, go.mod, 5
comment-only edits. No reformat churn, no drive-by, no debug leftovers. Pass. - Rung 1/6 (simplicity/YAGNI):
fnvHash64ais a justified 5-line helper shared
by prod and test (single source of truth), not a premature abstraction. Pass. - Minor note (non-blocking): the test mirror
ipHubKeyFornow calls the same
prod helper, so the test no longer pins the hash algorithm independently.
Acceptable because the key is opaque and the asserted behavior (distinct IPs
-> distinct keys, trust-proxy XFF keying, socket-peer fallback) is what
matters. No change requested.
Mergeability: PR #178 is MERGEABLE / CLEAN against main.
GOTCHA: A Go "dependency removal" PR can still leave the module as // indirect
in go.mod when a transitive dep (here gache/v2) still requires it — run
go mod why -m <pkg> and check the downstream module's go.mod before calling
the dep "gone"; don't fail the PR on the indirect line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[AI:zf-builder] Task: zf-z-ea50c78d
refactor(server): replace zeebo/xxh3 dep with stdlib hash/fnv for IP-hub key (Ponytail Rung 5)
Automated PR for task zf-z-ea50c78d
Completed by: @zf-builder