Skip to content

feat(integrations): patches read Attio records, list entries and members - #968

Merged
allisonmahmood merged 6 commits into
mainfrom
feat/attio-reads
Oct 28, 2026
Merged

allisonmahmood merged 6 commits into
mainfrom
feat/attio-reads

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed

An Attio connection gave a patch a workspace it couldn't read: the generated client was empty. Now a tier 1 page, or a tier 2 action through ctx.connections, reads the workspace's records, list entries and members through a client typed from the connection's snapshot: objects.<slug>.list/get/getMany, lists.<slug>.list/get and members.list(). Patchy builds every request from typed arguments, checks the workspace's current attributes on every call before decoding anything, and nothing can write to Attio. patchy dev reads the real workspace through the instance, by the snapshot the repo was generated from.

Closes #966. Part of #963. Stacked on #967 (#965, Attio connections); they ship in one release.

Look at

  • The parent's journey, published and in patchy dev, against Patchy's probe workspace. pnpm dev up attio now publishes two scenario patches over attio/crm. Deal desk (tier 1), as Priya, a member: Lead deals sorted by value, each company resolved in one getMany for the page; choosing an owner filters by owner, More deals follows cursor, and a deal opens with get and its pipeline entries by parent.

    Deal desk, published, as Priya

    Pipeline review (tier 2) in patchy dev: a read-only action pages every In Progress deal through ctx.connections (1,219 deals, three pages of 500, read through the instance's dev door), totals them by owner and resolves the five largest deals' companies.

    Pipeline review in patchy dev

    Probe data is synthetic ("Probe deal 0350", "Probe Co 0322"). The whole journey on a fresh instance at the head, from pnpm dev film --after-only (the base has no reads to film): Lead deals, then In Progress, the largest opened with its pipeline entry, the next page, then the tier 2 review (filmed at e5780a5, the same tree as the head before its rebase onto feat(integrations): Attio connections with a read-only workspace key #967's latest).

    attio-journey.mp4
  • Every row of integrations: Attio, so patches read a company's CRM #963's filter table is exact against Attio itself. AttioReads.live.ts reads every deal, person and company unfiltered, then sends each filter as Patchy builds it, pages it to its end, and compares the ids Attio answers with the same filter evaluated locally: text (case-insensitive eq, $in too, contains), number, rating, checkbox (false matches unset), currency, date, timestamp (full ISO only), select, multiselect (has / has any), status with emoji, phone, location, record references with one target, many and several targets, actor references, personal name, email, domain and interaction, each with null where the table allows it. Plus option-order and descending-value sorts with empties placed as the probe says, paging with heavy ties (every deal once), the journey, getMany with a duplicate and a missing id, and an unknown option title refused invalid_request with reason: "option".

    ✓ every row of the filter table, exactly > matches deals as evaluated here, for every type, empty included
    ✓ every row of the filter table, exactly > matches people and companies on names, emails, domains and interactions
    ✓ order, paging, gets and the journey > orders by option, amount and name with empties lowest, repeating and skipping nothing
    ✓ order, paging, gets and the journey > walks the parent's journey: deals by stage and owner, a deal, its companies, its pipeline
    ✓ order, paging, gets and the journey > reads a custom object while the workspace's plan keeps them
    Attio live run: 733 requests, 0 rate-limited and sat out.
    Test Files  1 passed (1)   Tests  5 passed (5)
    

    The offline tests carry correctness (the live tier is never required): Query.test.ts pins the exact request for every row, Values.test.ts every type decoded filled and empty with Attio's metadata dropped, and the schema check's refusals.

  • Nothing is decoded until the schema matches, and null is verified. Beside its query, each call reads the object's or list's attributes with show_archived=true and fails shape_mismatch naming a snapshot attribute that's gone, archived, renamed (renamedTo, by id), retyped or changed between single and multi, a reference whose targets lost a snapshot object, a reference value naming an unknown object slug, or an entry under another parent. null on a select, status or reference reads the current options or targets first and excludes them; every returned row is then checked empty, and one that isn't fails source_unavailable, never a wrong answer (Operations.test.ts).

  • Typed errors and the sentinel. invalid_request, invalid_query, shape_mismatch, not_found and access_denied carry Attio's own details, narrowed with isPatchyError(error, code, "attio"); Postgres, PostHog and Pidgeon details narrow as before (Generate.test.ts compiles a consumer of each). Runtime.test.ts runs the journey through the runtime wire and a tier 2 action in workerd, with a sentinel in a filter value, a record value, a member email, Attio's error message and a garbled answer: none reaches runtime_calls, a log line or a refusal, and nor does the key.

How it was verified

  • pnpm verify on the head, c42462d (rebased onto feat(integrations): Attio connections with a read-only workspace key #967's 54ef343): PASS format, lint, typecheck, synth, test (239 files, 2,499 tests), postgres-concurrency, cli-smoke, install, tier2-smoke, browser (81). An earlier run failed cli-smoke only: the packed patchy declarations named @patchy/api/attio-types, which a patch can't resolve, so the client now carries its own copy of the type table, held to the host's by Generate.test.ts.
  • CI's attio-live passes on the PR with the repo secret, running Attio.live.ts and AttioReads.live.ts.
  • pnpm test:attio (AttioReads.live.ts) against the probe workspace with the read key: 5 of 5 passed, as above. feat(integrations): Attio connections with a read-only workspace key #967's Attio.live.ts runs in the same tier.
  • Offline: the Attio files (Query, Values, Operations, Generate, Runtime tests, 70+ cases) cover the exact request per filter-table row; each refusal before upstream with zero requests (unknown slug, unsupported operator, refused null, over 100 values, date-only timestamp, foreign cursor, over 500 ids, ambiguous bare id, undeclared, public, cross-company); getMany with duplicates, missing ids and none (no request); every Attio refusal class (401, 403 with scope, 404, merge_in_progress, standard_object_disabled, unknown_filter_*, validation_type, malformed-query codes, 429 with Retry-After, 5xx, HTML 4xx/5xx, unreadable bodies); the 16 MiB raw and 8 MiB decoded bounds; a queued call whose viewer was deactivated or whose connection was disconnected sending nothing, busy and timeout.
  • The gateway allows Attio in actions, read-only ones included, refuses queries and mutations, and caps arguments at runtime.attio.bytes. The dev door decodes an older revision by its own snapshot after a Refresh, refuses a revision of another connection, and refuses a dev read without one. patchy dev's tier 2 test sends the declaration's revision to the door.
  • Not checked here: Attio's merge_in_progress and interaction values are docs-only (the probe workspace has none), so they're offline only.

Changes outside this PR's own files

  • scenarios/attio/scenario.json (feat(integrations): Attio connections with a read-only workspace key #965's): "patches": [] now lists the two patches, and scenarios/README.md says so.

  • devPreparation.ts: an Attio declaration needs no fixture and counts in generation's metadata, as PostHog's and Pidgeon's do. Without it patchy dev asked for fixtures/shared-crm.sql.

  • DevDoor.read takes args: unknown: the instance decodes them, and Attio's six dev reads share one generic sender.

  • skills/patchy/SKILL.md names Attio among the integrations dev reads live; skills-lock.json is refreshed.

  • Every integration summary that listed Postgres, PostHog and Pidgeon now names Attio where it's true (ae01484): docs/product.md (the tiers' connections, publish's accepted declarations at line 69, which is feat(integrations): Attio connections with a read-only workspace key #967's behaviour, what reads live in dev and has no fixture, what counts as a read), GLOSSARY-MAP.md, ADR-0004's dev-read paragraph, and patchy dev's missing-key refusal, since readsLive counts Attio.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Additive: six runtime operations, the @patchy/api/attio-types subpath, three registry limits (runtime.attio.bytes 256 KiB, attio.call.bytes 16 MiB, attio.call.concurrent 4), an optional revision on a dev read's connection, a project skill and two scenario patches. Existing patches, connections and commands behave as before.

Made by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, running in T3 Code.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:integrations Company connections and integration implementations area:ui Portal and first-party browser pages, shared rendering and styles size:xl Over 1,000 changed lines; review in multiple passes labels Oct 28, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review round 1 (GPT 6.1 Sol, xhigh, on 64bb0e6): 0 P0, 4 P1, 2 P2. Resolved in ad1b77f:

  1. P1, duplicate ids expand before the 8 MiB bound. Fixed: getMany sums each asked id's encoded row, duplicates included, and refuses too_large ("fewer ids") before building the answer. Test: one wide record asked 500 times.
  2. P1, parallel responses could each spend the whole 16 MiB budget. Already fixed on the base by feat(integrations): Attio connections with a read-only workspace key #967's d09bbf2 (Source.collect now debits the shared budget chunk by chunk); this branch is rebased onto it. Added a test: a 9 MiB query beside a 9 MiB schema check fails too_large with attio.call.bytes.
  3. P1, recent calls copied object/list before validation. Fixed: each operation records only the field it names (members none), and only a slug-shaped name; anything else records null.
  4. P1, unknown Attio codes reached invalid_query's details. Fixed: only codes Patchy knows are repeated; any other is "unknown".
  5. P2, empty getMany skipped the connection check. Fixed: it checks the connection's state, still sending nothing to Attio. Test: disconnected answers access_denied.
  6. P2, a reference with no snapshot targets typed a bare id. Fixed: IsOne refuses never; a compile test pins it (lists' parents get the same guard).

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review round 2 (GPT 6.1 Sol, xhigh, on ad1b77f): 0 P0, 0 P1, 3 P2; round 1's six fixes hold. All three fixed in e5780a5:

  1. P2, a reference with a non-UUID record id decoded, then failed the wire's encoding as a generic source_unavailable. Now it fails shape_mismatch naming the attribute (reason: "value"), with a test.
  2. P2, the scenario's Deal desk resolved companies for every accumulated deal, so the 21st page would ask getMany for 525 ids. It now resolves only the companies each page brings.
  3. P2, the Deal desk let an older request's answer overwrite a newer filter's. It now drops any answer but the newest request's.

No P0 or P1 remain, which ends the review rounds.

@allisonmahmood allisonmahmood added the one-way Rolling production back past this PR would break the release before it label Oct 28, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 58cf60ed971b0d78e35a4875a5cb5ec9224f719b (base 54ef343934ca84c0f64a8fdff022ea848d340300, feat/attio-connections), by GPT-6.1 Sol in the Codex harness through T3 Code. Independent of Claude Opus 5.5, the author. Fresh detached worktree; no scenario instance started for this documentation-only reassessment.

I read the previous acceptance (comment 6460726690 on ae014843d92a905c382abf6799510c0d7093d6d4) in full before replacing it. This verdict carries forward its summaries-delta checks and its retained full behavioral acceptance at c42462d. Those are earlier evidence, not fresh live runs on this head.

Done means — checked myself on this head

  • Confirmed the PR head, fetched base and exact parent. There is exactly one new commit over ae01484, changing only the source-principal sentence in docs/product.md: it adds “the admin's read-only Attio workspace key”. No code, dependency, schema or execution behavior changed. Read the PR body, feat(integrations): patches read Attio records, list entries and members #966, integrations: Attio, so patches read a company's CRM #963, conversation comments, reviews and inline comments; the review and inline lists are empty.
  • The added sentence matches the code. ConnectionPage.submit admits only admins to connection changes. SqlConnectionStore.attioConnect inspects the submitted key, then encrypts that key with its workspace id. attio/Source.ts's key check requires an active workspace token with the required read scopes and refuses every :read-write scope. Replace key goes through inspection too; a stored key found writable by a lifecycle check disconnects the connection.
  • Member calls do not substitute a personal Attio identity: Operations.perform checks the company viewer and active membership; Calls.current loads the declared company connection's stored credential; Calls.withWorkspace rechecks the caller and connection after waiting, then supplies that stored key to Source.send, which applies it as the bearer token. Every admitted active member uses the connection's workspace credential. The previous verdict's sole note is resolved.
  • Ran git grep over tracked Markdown integration summaries and checked paragraphs spanning lines. No current summary listing Postgres, PostHog and Pidgeon still omits Attio. ADR-0013's rejected-option history intentionally remains unchanged; the server skill's apparent single-line hit includes Attio on the next line.
  • pnpm install: passed. pnpm exec prettier --check docs/product.md: passed (All matched files use Prettier code style!). Checkout HEAD is the requested commit and git status --short is clean.

CI on this head: gh pr checks 968 finished with 22 passing checks and one failure. Attio-live, Pidgeon-live/suite, Chromium browser journeys, Clerk, Node 24/26 offline tests, both CLI smoke jobs, tier 2 smoke, all three installers, lint/typecheck/synth, image and rollback rehearsal passed. test (22) failed only the known Supervisor timeout documented below. The CI and Attio-live workflow records both identify 58cf60ed971b0d78e35a4875a5cb5ec9224f719b.

CI run · Attio-live run · Failed Node 22 job

test (22): Supervisor idle-sibling eviction case — Test timed out in 20000ms.
Test Files  1 failed | 238 passed (239)
     Tests  1 failed | 2498 passed (2499)

Done means and golden journeys — relied on earlier acceptance evidence

The previous verdict checked the summaries delta at ae01484 itself and carried forward full independent acceptance at c42462d. This new sentence changes none of those paths:

  • Parent's journey passed on tier 1 and tier 2, both published on a fresh local instance and in patchy dev, against the read-only probe workspace: stage/owner filters, descending value, paging, opening a deal, company getMany and pipeline entries. Published reads ran as Priya, a non-admin; Pipeline review returned 1,219 In Progress deals worth $56,274,383 in both environments.
  • All six reads passed through dev/published tier 1 doors and a typed read-only tier 2 acceptance action, including duplicate/missing/empty getMany, missing records, entry parent filtering/lookup and member shape.
  • Connection and skill lifecycle passed: read-only setup, offline write-scope refusal, disconnect/reconnect, and skill/client removal and restoration.
  • Earlier focused evidence covered isolation, authorization, dev revisions, bounds, action-only access, typed errors and sensitive-data sentinels (90 tests), connection lifecycle (32), and Query/Values (33). The ae01484 reassessment passed 29 tests across skill-lock, API Markdown, limits Markdown and CLI suites and all 23 CI checks.
Retained evidence from full acceptance at c42462d

Published tier 1:

Published Deal desk

Dev tier 1:

Deal desk in patchy dev

Published tier 2:

Published Pipeline review

Dev tier 2:

Pipeline review in patchy dev

Rollback answers: Still match the diff and existing one-way label. A revert leaves published patch versions calling attio.*, which the base cannot serve. The new documentation sentence adds no boundary; the previous verdict's rollback assessment and earlier rehearsal evidence carry forward.

Not run again

  • Fresh scenario/live-probe/browser journeys, local full pnpm verify, pnpm test:attio, connection setup and skill add/remove: relied on the earlier acceptance evidence above and current-head CI. No instance was started for the one-sentence documentation delta.
  • Live schema/write-scope mutation, merge-in-progress and interaction values: earlier acceptance used offline coverage where applicable and identified unavailable probe values; this delta does not affect them.
  • Production deployment/onboarding: feat(integrations): patches read Attio records, list entries and members #966 defers it to release. Production was untouched. The configured Attio key was not read, printed or posted.

Notes

  • Current-head test (22) is red: packages/execution/src/Supervisor.test.ts → “evicts an idle sibling during invocation admission without evicting the larger target” timed out after 20,000 ms; 2,498 tests passed and one failed. This matches the same test, timeout and Node version in open known-flake #665. The test and Supervisor implementation are unchanged from this PR's base; test (24) and test (26) passed on this head. This is reported as a known flake, not a failure caused by the documentation correction. I did not rerun CI or modify the test.

The PR's code, branch, body and labels were left unchanged; nothing was merged.

Base automatically changed from feat/attio-connections to main October 28, 2026 08:38
allisonmahmood and others added 6 commits October 28, 2026 09:38
An Attio connection's generated client was empty. Patches now read the
workspace through a client typed from the connection's snapshot, on a
tier 1 page and in tier 2 actions: `objects.<slug>.list/get/getMany`,
`lists.<slug>.list/get` and `members.list()`, as six runtime
operations (`attio.listRecords`, `getRecord`, `getManyRecords`,
`listEntries`, `getEntry`, `listMembers`).

Patchy builds every request from typed arguments and the snapshot, per
#963's filter table, and refuses before Attio sees anything what doesn't
fit. One type table (`@patchy/api/attio-types`) drives the client's
types, filter building and decoding. Every call reads the object's or
list's current attributes beside its query and fails `shape_mismatch`
naming a changed attribute before decoding anything; `null` is checked
on every row returned. Cursors bind the call; `getMany` sends one
chunked `$or` and answers in the order asked. Refusals carry Patchy's
own details, never a supplied value or Attio's words, and narrow with
`isPatchyError(error, code, "attio")`.

`patchy dev` reads the real workspace through the instance's dev door,
carrying the revision the repo was generated from. The `patchy-attio`
skill, the docs and the `attio` scenario's Deal desk and Pipeline
review patches follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ming @patchy/api

The package's declarations keep @patchy/api external, so the client
carries its own copy of Attio's type table; the generation test holds
it to @patchy/api/attio-types.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… unknown codes, empty getMany

- getMany counts each asked id's row, duplicates included, against the
  decoded bound before building the answer, so one large record asked 500
  times is refused, not expanded.
- Recent calls record only the object or list an operation names, shaped
  as a slug; members record none, and an email or a value is never kept.
- invalid_query repeats only Attio codes Patchy knows; any other is
  "unknown", so nothing else from Attio's body reaches a refusal.
- getMany with no ids still checks the connection, sending nothing.
- A reference with no targets in the snapshot takes no bare id in the
  generated types, as the host refuses one.
- A test holds a call's parallel requests to one 16 MiB raw budget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A reference whose record id isn't Attio's UUID fails shape_mismatch
  naming the attribute, not a generic source_unavailable at encoding.
- The scenario's Deal desk resolves only the companies each page brings,
  so paging never asks getMany for more than a page's, and drops an older
  request's answer when the filters changed meanwhile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/product.md, GLOSSARY-MAP.md and ADR-0004 named Postgres, PostHog
and Pidgeon where Attio now belongs: the tiers' connections, publish's
accepted declarations, what reads live in dev and has no fixture, what
counts as a read, and the handlers Integrations supplies. patchy dev's
refusal for a missing machine key names Attio too, as readsLive counts
it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood merged commit f30d8fe into main Oct 28, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the feat/attio-reads branch October 28, 2026 08:55
allisonmahmood added a commit that referenced this pull request Oct 28, 2026
## What changed

This PR adds release 21's What's new entry, written from `f30d8fe`. It
covers everything merged since release 20's `through` (`c5175bd`), and
sets the `patchy` release to `0.21.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`. With this release, patches can read a company's
Attio CRM through a read-only connection.

| Change | PRs |
| --- | --- |
| New: Patches can read your Attio CRM | #967, #968 |
| Behind the scenes: Patchy refuses an Attio key that can change
anything, and stops using a connected key that later gains that power |
#967 |

One merged PR gets no line: #962 is release 20's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`. "Integrations" is the sidebar's own
label. "Read-only key" matches the connect page's walkthrough.
- **Rollback safety, from the live commit `a4df431` (release 20) to
`f30d8fe`.** Both PRs in the range are labelled `one-way`:
- **#967 (connections).** Release 20 hides Attio connections, as #657
set up. But it can't decode a patch version that declares `kind:
"attio"`, so such a patch needs this release to serve.
- **#968 (reads).** Release 20 has no `attio.*` operations, so a patch
whose version calls them fails until we roll forward.
- Neither PR has a migration or infrastructure change.
`rollback-rehearsal` passed on both landed heads.

**Rollback line:** Rolling back past #967 would break any patch whose
current version declares or reads Attio, because release 20 can't read
an Attio declaration or serve its reads, so fix forward instead. Until a
published patch version declares Attio, rolling back to `a4df431`
(release 20) is safe.

## How it was verified

- **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and
`schemas.test.ts` pass (21 tests). Typecheck passes for core, api and
the CLI, and prettier passes on the changed files.
- **The stack.**
- #967 had four GPT 6.1 Sol review rounds, the last clean, and #968 had
two.
- Each got an acceptance verdict of PASS with notes on its accepted
head, and landed with all 23 checks passing, `attio-live` and
`rollback-rehearsal` included.
- #968's rebase onto main left its tree byte-identical to the accepted
head, and `main`'s tree at `f30d8fe` is identical to it.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`a4df431` (release 20). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Text and version numbers only. The `0.21.0` bump tells CLIs and patch
repos installed before this deploy to upgrade, as every release does.

- **What does a revert leave behind?** Nothing: no rows, no schema.
- **Does the release before it still work with that?** Yes.

Made by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, running in
T3 Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:integrations Company connections and integration implementations area:server Touches the server area area:ui Portal and first-party browser pages, shared rendering and styles one-way Rolling production back past this PR would break the release before it size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(integrations): patches read Attio records, list entries and members

1 participant