Repository navigation
refactor(integrations): connections know their integration, ready for a second one - #648
Merged
Merged
Conversation
… a second one Every connection path assumed Postgres. A handle is now unique within its integration and every lookup names the integration. Schema snapshots record their integration. Deletion protection, the call log's query text and the portal log labels work for any integration, and the CLI and SDK name connections as <integration>/<handle>. The migration only adds: the per-company handle key and the snapshot default stay for the release before this one, and #646 drops them. Older CLIs keep today's Postgres-only /connections responses. Part of #643. Closes #644. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Holding the per-company and per-integration handle keys together let concurrent connects fail on the key their ON CONFLICT didn't name. Handles stay unique per company until #646 swaps the key in one step. Connect uses a targetless ON CONFLICT, so it works with either key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood
added a commit
that referenced
this pull request
Oct 13, 2026
…when Patchy is out of date (#659) Release 10's What's new entry, written through `64458b2`. It ships as `patchy` `0.10.0`. **Changes** - Fixed: New pages and tools no longer get lost in a temporary folder (#658) - Fixed: Your agent hears when its copy of Patchy is out of date (#649, #654) - Improved: See a sample tool in your look before you approve it (#656) - Improved: Publishing the company look says who it's for (#655) **Behind the scenes** - Connections to your company's data now record what kind of service each one reaches (#648) **No line:** #642, a rename of the glossary docs. This is the first release with its own version number. After it deploys, global CLIs from earlier deploys (all `0.0.1`) are refused on file publish, `init` and `look publish` with the installer line. Patch repos are told to `pnpm patchy refresh`, as on any release. Made by Claude Opus 5.5 via Claude Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Patchy's connection code assumes Postgres throughout:
So the PostHog integration (#643) has nowhere to go. This PR is the groundwork. It adds no PostHog code and changes nothing for people using Postgres today.
What changes
<integration>/<handle>, such aspostgres/warehouse. The CLI takes that name:patchy list connections postgres/warehouse. A barewarehousestill works when only one connection has it. Text output prints the full name.GET /connections/:integration/:handle. Older CLIs keep working unchanged:GET /connectionsstays Postgres-only unless asked forintegrations=all.GET /connections/:handlestill answers as Postgres.<integration>.query.The typed per-integration credential and display variants wait for #646, where PostHog gives them a second case to shape them.
Migrations (hard to roll back).
0011_connections_per_integrationand0012_query_text_any_integrationonly add or widen, so the release before this one keeps working against the new schema during a rolling deploy or after a rollback:integrationcolumn, with a'postgres'default for that release's inserts.ON CONFLICT, so it works with either key. feat(integrations): PostHog connections and read-only HogQL for patches #646 swaps in the per-integration key, in one step, and drops the default.Shown working
apps/server/src/migrations.test.tsmigrates a database that already holds an encrypted connection, its snapshot, a declaring version and a logged query. After the upgrade:pnpm checkpasses.pnpm verifyrun was fully green. Each had a timeout in a test this change doesn't touch, under machine load: packed-CLI init with an empty cache, a PGlite metering test and a company-look publish test. Each passed on the other run or when rerun alone.Reviewed by GPT 6.1 Sol in Codex. Both of its findings are fixed:
ON CONFLICTdidn't name.Sol also suggested a concurrency test. I didn't add one: a serialized race passes with or without the bug, so it can't guard against it. With a single key and a targetless conflict, the race can't happen.
Closes #644. Part of #643.
Made by Claude Opus 5.5 via Claude Code in T3 Code