Repository navigation
✨ Customers: import hub-consented fields with hub provenance - #19247
Conversation
Phase 3 of src/docs/design/customers-hub-consent.md (#19088). A third profile Source, hub, sits between auto and manual. An opt-in import posts salted hashes of confirmed customers' GitHub logins to the hub match endpoint (#19162). It applies only the real name, organization and country a person consented to share, and it never creates a person or overwrites a manual field. A cleared reply or the 72h staleness expiry hands a hub field back to automatic, and a forgotten login is never asked about. customers.hub_import.enabled (default off), HIVE_CUSTOMERS_HUB_IMPORT_ENABLED and a Settings, Features switch beside Customer avatars gate the import. The import also needs a hub registration. Hub-side provisioning of the match key is #19246. Closes #19163 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending - fixed the outbound-site inventory entry for the new hub match sender and merged v5 in. Sweep will merge when green. 🐝 Hive Agent: Review findings from I read the import logic ( Verified:
One low-severity finding (not a blocker): when more than 800 confirmed logins exist ( Open question, not verified: how the hub orders Decision for the maintainer: the PR body says hub-hosted spokes have no match key until #19246 lands, so this ships inert for them. Please confirm that landing the consumer before the provisioning is intended. Review findings from Delta at 781c5a3 is mainly a merge of main (hub heartbeat/docs/changelog), no scope creep from this PR; the prosefilter outbound-site entry for Previous finding "only first 800 sorted hashes are ever asked": still present — see |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
UI render evidenceRender evidence captured. Built from
These are fixture renders, not live data: the page was built from the PR head and filled with synthetic data from |
There was a problem hiding this comment.
Correctness review at 970528e. Provenance precedence, sanitising, the identity and tombstone re-check, expiry and truncation resume look right. One in-scope finding, inline: the 4-request cap with a fixed hash order means customers beyond the first 800 are never asked about (#19163 scopes 2 and 3). Tests not run.
-- hive: agent=adjudicator backend=claude model=claude-sonnet-5-5 claude=2.1.328
| hashes := make([]string, 0, len(byHash)) | ||
| for hash := range byHash { | ||
| hashes = append(hashes, hash) | ||
| } |
There was a problem hiding this comment.
Starvation with more than 800 candidates: hashes are sorted here and only the first 4x200 are sent per pass, always the same ones. Customers whose hashes sort later are never imported or cleared, and their existing hub values expire at 72h. Rotate the start offset or order by least-recently-asked, and add a test with more than 800 candidates.
Mutation testinggremlins found 18 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.
18 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
ℹ️ 7 mutant(s) on added lines were SKIPPED because gremlins v0.6.0 only honours the first
Verdict: |
…nd-site test Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Delta only merges unrelated hub heartbeat and docs changes. The prior correctness finding is still present: hub_import.go:363-368 sorts hashes and caps requests, so customers whose hash sorts late are never asked, and their hub fields can then age out via staleness expiry. Rotate the starting offset between runs or order by oldest refresh.
-- hive: agent=adjudicator backend=claude model=claude-sonnet-5-5 claude=2.1.328
Phase 3 of the decided Customers hub consent design (
src/docs/design/customers-hub-consent.md, #19088). This is the first spoke code. Phases 1 and 2 let a person consent per hive and let the hub answer a match request. Nothing used that answer yet. This PR adds the consumer, and it is off by default.Why it is shaped this way
hubprovenance sits betweenautoandmanual. A value the person stated about themselves beats public GitHub profile text, sohuboutranksauto. A value someone typed on this hive is final, somanualis never overwritten. The GitHub profile fetch, the location-derived country and the affiliation suggestion all leave ahubfield alone. Editing it on the profile makes itmanual, and export carries the provenance as stored.match_hash, the three values andclearedare read. Each value is stripped of control and format characters (including bidi and zero-width marks), whitespace-collapsed and capped toMaxProfileFieldLen. A country must be a known ISO code. An entry for a hash the hive did not ask about is ignored.clearedentry empties only thehub-provenance fields it names, and each one returns to automatic. Ahubvalue not refreshed for 72h is cleared the same way, so a hive that loses its hub link does not keep a withdrawn value. Expiry runs on every pass, even with the switch off, because it makes no request./api/customers/matchsends{hive_id, hashes}with the per-hive heartbeat bearer, never follows a redirect and sends no cookie. The hashes are HMAC-SHA256 underderivePerHiveKey(master, "hive-customer-match-v1", hive_id). Batches hold at most 200 hashes, a pass sends at most 4 requests (under the hub's 6/min limit), and a pass followstruncated. A parity test inpkg/hubpins the spoke's key and hash to the hub's.customers.hub_import.enabledset (orHIVE_CUSTOMERS_HUB_IMPORT_ENABLED, or the new Settings, Features switch beside Customer avatars, with a help mark and an env-override line) and a hub registration. With either missing, a pass makes zero requests. The person's consent on the hub still decides what arrives.audit:line with the person id and field names only. A pass logs counts only.Match key
The spoke reads
HIVE_CUSTOMER_MATCH_KEY, or derives the key fromHIVE_HUB_SECRETand the hive id. Hub-hosted spokes do not hold the master. Until the hub injects the key, their import has no key and asks nothing, so it is safe but inert. The hub-side provisioning (and thebyo-case) is split into #19246.Tests
pkg/customers/hub_import_test.gocovers each acceptance bullet:manualis never overwrittenhuboverwritesautoclearedand staleness both revert to automaticIt also covers batching and truncation, and the accept-time single-person pull.
cmd/hivetests cover the HTTP matcher and "off means no request" end to end. Dashboard tests pin the switch markup, its round trip and the "from the hub" mark. Tests were not run locally (per AGENTS.md). CI is the verdict.Closes #19163
🤖 Generated with Claude Code
-- hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.328 requested_by=@clubanderson