Repository navigation
Bring HubSpot companies and deals into Commerce - #147
Merged
Merged
Conversation
added 6 commits
October 22, 2026 16:34
…ipeline scope, admin setup
…onflicts, MCP contact identity
jameskurz-filecoin
marked this pull request as ready for review
October 22, 2026 21:36
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.
Implements the HubSpot → Commerce product spec as a read-only HubSpot integration: bring a HubSpot company or deal into Commerce as a staff partner through one reviewed handoff, keep its context and provenance, continue into Commerce forms, and browse HubSpot's pipeline inside Sales.
Runbook:
docs/operations/hubspot-handoff.md.What ships
packages/integrations/src/hubspot): typedHubSpotReaderover HubSpot's public API with a server-side private-app token (HUBSPOT_ACCESS_TOKEN, read scopes only), bounded reads, one retry on shortRetry-After, PDF-only downloads from HubSpot hosts via short-lived signed URLs, plus a deterministic fictional portal used by the demo and tests.packages/contracts/src/hubspot.ts): handoff input, plan, three-way drift classification and default decisions, exact per-currency pipeline totals, record-URL parsing. Partner contacts gain a stable ID, an optional chosen primary, and HubSpot source identity.001483): approved connection (one active), append-only typed links (unique per company/destination and per partner/portal), imports with immutable plan + selected-source snapshot keyed by operation ID, and per-document items whose resolved states are final. pgTAP and integration tests cover uniqueness, immutability, retries and concurrent handoffs./internal/hubspot→/internal/hubspot/review): search-first picker (names or pasted record URL; foreign-portal links explained), deal → company choice with nothing preselected, one review page with company details, people, sales context, documents and in-place More control, footer summary derived from the same plan the server commits, similar-partner inspection, exact-link resolution, stale-review detection by per-item digests, one transaction for partner + link + import + audit.Deliberate decisions
sales:readview,contract:writeimport,staff:managesettings) with the audience named and accepted at activation, instead of three new permissions.Connecting it on commerce.fil.one
crm.objects.{companies,deals,contacts,owners}.read,crm.schemas.{companies,deals,contacts}.read(+filesfor PDFs). Copy the token.production(andstaging): add secretHUBSPOT_ACCESS_TOKEN; then Actions → Deploy → Run workflow onmain./internal/owner/hubspot: approve pipelines, properties, notes/files, owner mapping and the audience → Activate connection.Adversarial review
Two independent reviews (backend/security and spec/UX) found 28 issues; fixed here: decisions recomputed when HubSpot or the partner changes under a review (no silent overwrite of a concurrent edit), server-side refusal of undecided both-changed fields and uninspected similar partners, stable IDs for hand-typed contacts so they match instead of duplicating, pipeline allowlist enforced in pipeline/search/review, partner version conflicts refresh in place, precise DB error mapping, idempotent concurrent attach, body-read timeouts, bounded stale cache, file-name limits, registration end-customer choice without retyping, accessibility (scroll padding, focus targets, panel anchor), copy and plurals.
🤖 Generated with Claude Code