Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(github_pull_requests): serve pull request changes and share them with agent sessions (#7114)

dev-rb40e0929d11da
diff --git a/.sqlx/query-21f4995934d45c58fd61fca238288734e89c3da223e731e8164f59596066d4f8.json b/.sqlx/query-008531336fd08593c5fe8378b856a0c3fe08c65270dded3fd3a1a53e706c8983.json
similarity index 77%
rename from .sqlx/query-21f4995934d45c58fd61fca238288734e89c3da223e731e8164f59596066d4f8.json
rename to .sqlx/query-008531336fd08593c5fe8378b856a0c3fe08c65270dded3fd3a1a53e706c8983.json
index 74de792c8d..6c848f78f3 100644
--- a/.sqlx/query-21f4995934d45c58fd61fca238288734e89c3da223e731e8164f59596066d4f8.json
+++ b/.sqlx/query-008531336fd08593c5fe8378b856a0c3fe08c65270dded3fd3a1a53e706c8983.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n github_key,\n repository_id,\n number,\n owner,\n repo,\n title,\n status,\n draft,\n author_github_user_id,\n author_login,\n requested_reviewer_github_user_ids,\n participant_github_user_ids,\n github_updated_at,\n assignees,\n labels,\n reviews,\n review_decision\n FROM github_pull_request\n WHERE github_key = $1\n ",
+ "query": "\n SELECT\n github_key,\n repository_id,\n number,\n owner,\n repo,\n title,\n status,\n draft,\n author_github_user_id,\n author_login,\n requested_reviewer_github_user_ids,\n participant_github_user_ids,\n github_updated_at,\n assignees,\n labels,\n reviews,\n review_decision,\n base_ref,\n base_sha,\n head_ref,\n head_sha\n FROM github_pull_request\n WHERE github_key = $1\n ",
"describe": {
"columns": [
{
@@ -87,6 +87,26 @@
"ordinal": 16,
"name": "review_decision",
"type_info": "Text"
+ },
+ {
+ "ordinal": 17,
+ "name": "base_ref",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 18,
+ "name": "base_sha",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 19,
+ "name": "head_ref",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 20,
+ "name": "head_sha",
+ "type_info": "Text"
}
],
"parameters": {
@@ -111,8 +131,12 @@
false,
false,
false,
+ true,
+ true,
+ true,
+ true,
true
]
},
- "hash": "21f4995934d45c58fd61fca238288734e89c3da223e731e8164f59596066d4f8"
+ "hash": "008531336fd08593c5fe8378b856a0c3fe08c65270dded3fd3a1a53e706c8983"
}
diff --git a/.sqlx/query-7a4f738dda70046cbfa4e15075519b3115c85886226c6d419d2dc77be84dce2b.json b/.sqlx/query-3850e97e55874949d78f9b242819dc9bc1479de6b1d8a3488801dc494eedebe2.json
similarity index 75%
rename from .sqlx/query-7a4f738dda70046cbfa4e15075519b3115c85886226c6d419d2dc77be84dce2b.json
rename to .sqlx/query-3850e97e55874949d78f9b242819dc9bc1479de6b1d8a3488801dc494eedebe2.json
index 8c41252ada..f6e71ce6df 100644
--- a/.sqlx/query-7a4f738dda70046cbfa4e15075519b3115c85886226c6d419d2dc77be84dce2b.json
+++ b/.sqlx/query-3850e97e55874949d78f9b242819dc9bc1479de6b1d8a3488801dc494eedebe2.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT github_key, repository_id, number, owner, repo, title, status,\n draft, author_github_user_id, author_login,\n requested_reviewer_github_user_ids, participant_github_user_ids,\n github_updated_at, assignees, labels, reviews\n FROM github_pull_request WHERE github_key = $1 FOR UPDATE",
+ "query": "SELECT github_key, repository_id, number, owner, repo, title, status,\n draft, author_github_user_id, author_login,\n requested_reviewer_github_user_ids, participant_github_user_ids,\n github_updated_at, assignees, labels, reviews,\n base_ref, base_sha, head_ref, head_sha\n FROM github_pull_request WHERE github_key = $1 FOR UPDATE",
"describe": {
"columns": [
{
@@ -82,6 +82,26 @@
"ordinal": 15,
"name": "reviews",
"type_info": "Jsonb"
+ },
+ {
+ "ordinal": 16,
+ "name": "base_ref",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 17,
+ "name": "base_sha",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 18,
+ "name": "head_ref",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 19,
+ "name": "head_sha",
+ "type_info": "Text"
}
],
"parameters": {
@@ -105,8 +125,12 @@
true,
false,
false,
- false
+ false,
+ true,
+ true,
+ true,
+ true
]
},
- "hash": "7a4f738dda70046cbfa4e15075519b3115c85886226c6d419d2dc77be84dce2b"
+ "hash": "3850e97e55874949d78f9b242819dc9bc1479de6b1d8a3488801dc494eedebe2"
}
diff --git a/.sqlx/query-4cc8e9f875c58a30df475c97230a3621f63ab0d1c5551d9f88a4886d37df928a.json b/.sqlx/query-4cc8e9f875c58a30df475c97230a3621f63ab0d1c5551d9f88a4886d37df928a.json
deleted file mode 100644
index f3bc336012..0000000000
--- a/.sqlx/query-4cc8e9f875c58a30df475c97230a3621f63ab0d1c5551d9f88a4886d37df928a.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n WITH previous AS (\n SELECT patch_blob_key FROM agent_session_changes WHERE agent_session_id = $1\n )\n INSERT INTO agent_session_changes (\n agent_session_id, changeset_id, source, repository,\n base_ref, base_sha, head_ref, head_sha,\n files, additions, deletions, patch_blob_key, patch_bytes, truncated,\n captured_at, attempt_started_at, attempt_finished_at, attempt_outcome, attempt_error\n )\n VALUES (\n $1, $2, $3, $4,\n $5, $6, $7, $8,\n $9, $10, $11, $12, $13, $14,\n $15, $16, $16, 'captured', NULL\n )\n ON CONFLICT (agent_session_id) DO UPDATE SET\n changeset_id = EXCLUDED.changeset_id,\n source = EXCLUDED.source,\n repository = EXCLUDED.repository,\n base_ref = EXCLUDED.base_ref,\n base_sha = EXCLUDED.base_sha,\n head_ref = EXCLUDED.head_ref,\n head_sha = EXCLUDED.head_sha,\n files = EXCLUDED.files,\n additions = EXCLUDED.additions,\n deletions = EXCLUDED.deletions,\n patch_blob_key = EXCLUDED.patch_blob_key,\n patch_bytes = EXCLUDED.patch_bytes,\n truncated = EXCLUDED.truncated,\n captured_at = EXCLUDED.captured_at,\n attempt_finished_at = EXCLUDED.attempt_finished_at,\n attempt_outcome = 'captured',\n attempt_error = NULL,\n updated_at = now()\n RETURNING (SELECT patch_blob_key FROM previous) AS \"superseded?\"\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "superseded?",
- "type_info": "Text"
- }
- ],
- "parameters": {
- "Left": [
- "Uuid",
- "Uuid",
- "Text",
- "Text",
- "Text",
- "Text",
- "Text",
- "Text",
- "Jsonb",
- "Int4",
- "Int4",
- "Text",
- "Int8",
- "Bool",
- "Timestamptz",
- "Timestamptz"
- ]
- },
- "nullable": [
- null
- ]
- },
- "hash": "4cc8e9f875c58a30df475c97230a3621f63ab0d1c5551d9f88a4886d37df928a"
-}
diff --git a/.sqlx/query-93508ec59d3377e42341f4f08c06d20dcbcffd24d25f1dc9d20ad4b78ae13831.json b/.sqlx/query-93508ec59d3377e42341f4f08c06d20dcbcffd24d25f1dc9d20ad4b78ae13831.json
new file mode 100644
index 0000000000..ddc6ee359c
--- /dev/null
+++ b/.sqlx/query-93508ec59d3377e42341f4f08c06d20dcbcffd24d25f1dc9d20ad4b78ae13831.json
@@ -0,0 +1,28 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n INSERT INTO github_pull_request_changeset (\n id,\n github_key,\n repository,\n number,\n base_ref,\n base_sha,\n head_ref,\n head_sha,\n files,\n additions,\n deletions,\n patch_blob_key,\n patch_bytes,\n truncated,\n captured_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9::jsonb, $10, $11, $12, $13, $14, $15)\n ON CONFLICT (id) DO NOTHING\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text",
+ "Text",
+ "Int8",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Jsonb",
+ "Int4",
+ "Int4",
+ "Text",
+ "Int8",
+ "Bool",
+ "Timestamptz"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "93508ec59d3377e42341f4f08c06d20dcbcffd24d25f1dc9d20ad4b78ae13831"
+}
diff --git a/.sqlx/query-9e628fd58364433abb4cbbca479e09767b12d4ef659cc82b0a5d160a55bb47ad.json b/.sqlx/query-9e628fd58364433abb4cbbca479e09767b12d4ef659cc82b0a5d160a55bb47ad.json
new file mode 100644
index 0000000000..7f6be38485
--- /dev/null
+++ b/.sqlx/query-9e628fd58364433abb4cbbca479e09767b12d4ef659cc82b0a5d160a55bb47ad.json
@@ -0,0 +1,38 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n WITH previous AS (\n SELECT patch_blob_key FROM agent_session_changes WHERE agent_session_id = $1\n )\n INSERT INTO agent_session_changes (\n agent_session_id, changeset_id, source, repository,\n base_ref, base_sha, head_ref, head_sha,\n files, additions, deletions, patch_blob_key, pull_request_changeset_id,\n patch_bytes, truncated,\n captured_at, attempt_started_at, attempt_finished_at, attempt_outcome, attempt_error\n )\n VALUES (\n $1, $2, $3, $4,\n $5, $6, $7, $8,\n $9, $10, $11, $12, $17,\n $13, $14,\n $15, $16, $16, 'captured', NULL\n )\n ON CONFLICT (agent_session_id) DO UPDATE SET\n changeset_id = EXCLUDED.changeset_id,\n source = EXCLUDED.source,\n repository = EXCLUDED.repository,\n base_ref = EXCLUDED.base_ref,\n base_sha = EXCLUDED.base_sha,\n head_ref = EXCLUDED.head_ref,\n head_sha = EXCLUDED.head_sha,\n files = EXCLUDED.files,\n additions = EXCLUDED.additions,\n deletions = EXCLUDED.deletions,\n patch_blob_key = EXCLUDED.patch_blob_key,\n pull_request_changeset_id = EXCLUDED.pull_request_changeset_id,\n patch_bytes = EXCLUDED.patch_bytes,\n truncated = EXCLUDED.truncated,\n captured_at = EXCLUDED.captured_at,\n attempt_finished_at = EXCLUDED.attempt_finished_at,\n attempt_outcome = 'captured',\n attempt_error = NULL,\n updated_at = now()\n RETURNING (SELECT patch_blob_key FROM previous) AS \"superseded?\"\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "superseded?",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Uuid",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Jsonb",
+ "Int4",
+ "Int4",
+ "Text",
+ "Int8",
+ "Bool",
+ "Timestamptz",
+ "Timestamptz",
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "9e628fd58364433abb4cbbca479e09767b12d4ef659cc82b0a5d160a55bb47ad"
+}
diff --git a/.sqlx/query-c0c47c173e1c2c214749c8cbab5f3811848d06b660fc45db51efaccc847cd04b.json b/.sqlx/query-c0c47c173e1c2c214749c8cbab5f3811848d06b660fc45db51efaccc847cd04b.json
new file mode 100644
index 0000000000..c85d738de5
--- /dev/null
+++ b/.sqlx/query-c0c47c173e1c2c214749c8cbab5f3811848d06b660fc45db51efaccc847cd04b.json
@@ -0,0 +1,28 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT patch_blob_key, pull_request_changeset_id\n FROM agent_session_changes\n WHERE agent_session_id = $1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "patch_blob_key",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "pull_request_changeset_id",
+ "type_info": "Uuid"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ true,
+ true
+ ]
+ },
+ "hash": "c0c47c173e1c2c214749c8cbab5f3811848d06b660fc45db51efaccc847cd04b"
+}
diff --git a/.sqlx/query-36b056b1d74f20890ead60b884ac428583a1608344356dbc7d2f6e50eede6102.json b/.sqlx/query-f6463f4357b449385b69b086138a56d4a009b8573f6d9fccb44c376205bc5510.json
similarity index 65%
rename from .sqlx/query-36b056b1d74f20890ead60b884ac428583a1608344356dbc7d2f6e50eede6102.json
rename to .sqlx/query-f6463f4357b449385b69b086138a56d4a009b8573f6d9fccb44c376205bc5510.json
index 9dbc58dbbd..3cee2c4195 100644
--- a/.sqlx/query-36b056b1d74f20890ead60b884ac428583a1608344356dbc7d2f6e50eede6102.json
+++ b/.sqlx/query-f6463f4357b449385b69b086138a56d4a009b8573f6d9fccb44c376205bc5510.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n INSERT INTO github_pull_request (\n github_key,\n repository_id,\n number,\n owner,\n repo,\n title,\n status,\n draft,\n author_github_user_id,\n author_login,\n requested_reviewer_github_user_ids,\n participant_github_user_ids,\n github_updated_at,\n assignees,\n labels,\n reviews,\n review_decision\n )\n VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13,\n $14::jsonb, $15::jsonb, $16::jsonb, $17\n )\n ON CONFLICT (github_key) DO UPDATE SET\n repository_id = COALESCE(EXCLUDED.repository_id, github_pull_request.repository_id),\n number = EXCLUDED.number,\n owner = EXCLUDED.owner,\n repo = EXCLUDED.repo,\n title = EXCLUDED.title,\n status = EXCLUDED.status,\n draft = EXCLUDED.draft,\n author_github_user_id = EXCLUDED.author_github_user_id,\n author_login = EXCLUDED.author_login,\n requested_reviewer_github_user_ids = EXCLUDED.requested_reviewer_github_user_ids,\n participant_github_user_ids = EXCLUDED.participant_github_user_ids,\n github_updated_at = EXCLUDED.github_updated_at,\n assignees = EXCLUDED.assignees,\n labels = EXCLUDED.labels,\n reviews = EXCLUDED.reviews,\n review_decision = EXCLUDED.review_decision,\n updated_at = NOW()\n ",
+ "query": "\n INSERT INTO github_pull_request (\n github_key,\n repository_id,\n number,\n owner,\n repo,\n title,\n status,\n draft,\n author_github_user_id,\n author_login,\n requested_reviewer_github_user_ids,\n participant_github_user_ids,\n github_updated_at,\n assignees,\n labels,\n reviews,\n review_decision,\n base_ref,\n base_sha,\n head_ref,\n head_sha\n )\n VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13,\n $14::jsonb, $15::jsonb, $16::jsonb, $17, $18, $19, $20, $21\n )\n ON CONFLICT (github_key) DO UPDATE SET\n repository_id = COALESCE(EXCLUDED.repository_id, github_pull_request.repository_id),\n number = EXCLUDED.number,\n owner = EXCLUDED.owner,\n repo = EXCLUDED.repo,\n title = EXCLUDED.title,\n status = EXCLUDED.status,\n draft = EXCLUDED.draft,\n author_github_user_id = EXCLUDED.author_github_user_id,\n author_login = EXCLUDED.author_login,\n requested_reviewer_github_user_ids = EXCLUDED.requested_reviewer_github_user_ids,\n participant_github_user_ids = EXCLUDED.participant_github_user_ids,\n github_updated_at = EXCLUDED.github_updated_at,\n assignees = EXCLUDED.assignees,\n labels = EXCLUDED.labels,\n reviews = EXCLUDED.reviews,\n review_decision = EXCLUDED.review_decision,\n base_ref = CASE WHEN $22::bool THEN EXCLUDED.base_ref ELSE github_pull_request.base_ref END,\n base_sha = CASE WHEN $22::bool THEN EXCLUDED.base_sha ELSE github_pull_request.base_sha END,\n head_ref = CASE WHEN $23::bool THEN EXCLUDED.head_ref ELSE github_pull_request.head_ref END,\n head_sha = CASE WHEN $23::bool THEN EXCLUDED.head_sha ELSE github_pull_request.head_sha END,\n updated_at = NOW()\n ",
"describe": {
"columns": [],
"parameters": {
@@ -21,10 +21,16 @@
"Jsonb",
"Jsonb",
"Jsonb",
- "Text"
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Bool",
+ "Bool"
]
},
"nullable": []
},
- "hash": "36b056b1d74f20890ead60b884ac428583a1608344356dbc7d2f6e50eede6102"
+ "hash": "f6463f4357b449385b69b086138a56d4a009b8573f6d9fccb44c376205bc5510"
}
diff --git a/.sqlx/query-f6e93b9fd77ff4c1a3e2b17ed3e7a5bd987b60039a457007a936d0a91bb1b2b1.json b/.sqlx/query-f6e93b9fd77ff4c1a3e2b17ed3e7a5bd987b60039a457007a936d0a91bb1b2b1.json
new file mode 100644
index 0000000000..1981d3f899
--- /dev/null
+++ b/.sqlx/query-f6e93b9fd77ff4c1a3e2b17ed3e7a5bd987b60039a457007a936d0a91bb1b2b1.json
@@ -0,0 +1,106 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT\n id,\n github_key,\n repository,\n number,\n base_ref,\n base_sha,\n head_ref,\n head_sha,\n files,\n additions,\n deletions,\n patch_blob_key,\n patch_bytes,\n truncated,\n captured_at\n FROM github_pull_request_changeset\n WHERE id = $1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "github_key",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "repository",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "number",
+ "type_info": "Int8"
+ },
+ {
+ "ordinal": 4,
+ "name": "base_ref",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 5,
+ "name": "base_sha",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 6,
+ "name": "head_ref",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 7,
+ "name": "head_sha",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 8,
+ "name": "files",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 9,
+ "name": "additions",
+ "type_info": "Int4"
+ },
+ {
+ "ordinal": 10,
+ "name": "deletions",
+ "type_info": "Int4"
+ },
+ {
+ "ordinal": 11,
+ "name": "patch_blob_key",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 12,
+ "name": "patch_bytes",
+ "type_info": "Int8"
+ },
+ {
+ "ordinal": 13,
+ "name": "truncated",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 14,
+ "name": "captured_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ true,
+ false,
+ true,
+ false,
+ false,
+ false,
+ false,
+ true,
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "f6e93b9fd77ff4c1a3e2b17ed3e7a5bd987b60039a457007a936d0a91bb1b2b1"
+}
diff --git a/Cargo.lock b/Cargo.lock
index ad0740a768..b4af896e7b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -428,6 +428,7 @@ dependencies = [
"entity_registry_db_utils",
"futures",
"github",
+ "github_pull_requests",
"harness_id",
"harnesses",
"initiative",
@@ -8156,6 +8157,7 @@ name = "github_pull_requests"
version = "0.1.0"
dependencies = [
"anyhow",
+ "aws-sdk-s3",
"axum",
"chrono",
"entity_access",
diff --git a/apps/web/src/lib/core/component/AI/util/message.test.ts b/apps/web/src/lib/core/component/AI/util/message.test.ts
index e1e00c776b..51ff80728b 100644
--- a/apps/web/src/lib/core/component/AI/util/message.test.ts
+++ b/apps/web/src/lib/core/component/AI/util/message.test.ts
@@ -50,14 +50,49 @@ function buildToolCallHeavyItems(count: number): ChatStream[] {
return items;
}
-/* Mirrors how ChatMessages.tsx's generatingMessage() actually calls this:
- once per stream update, on the whole array received so far. */
-function simulateTicks(items: ChatStream[]): number {
- const start = performance.now();
+/* Mirrors generatingMessage(): rebuild the whole message on every update.
+ Count iteration and native array copies instead of elapsed time so CI load
+ cannot affect the result. Build tick inputs before counting their conversion. */
+function countTickArrayWork(items: ChatStream[]): number {
+ const ticks: ChatStream[][] = [];
for (let i = 1; i <= items.length; i++) {
- asChatMessage(items.slice(0, i));
+ ticks.push(items.slice(0, i));
+ }
+
+ const iterate = Array.prototype[Symbol.iterator];
+ const concat = Array.prototype.concat;
+ const slice = Array.prototype.slice;
+ let work = 0;
+ // Mock wrappers themselves iterate argument arrays, so use direct overrides.
+ Array.prototype[Symbol.iterator] = function (this: unknown[]) {
+ work += this.length;
+ return iterate.call(this);
+ };
+ Array.prototype.concat = function (this: unknown[], ...values: unknown[]) {
+ const result = concat.apply(this, values);
+ work += result.length;
+ return result;
+ };
+ Array.prototype.slice = function (
+ this: unknown[],
+ start?: number,
+ end?: number
+ ) {
+ const result = slice.call(this, start, end);
+ work += result.length;
+ return result;
+ };
+
+ try {
+ for (let i = 0; i < ticks.length; i++) {
+ asChatMessage(ticks[i]);
+ }
+ return work;
+ } finally {
+ Array.prototype[Symbol.iterator] = iterate;
+ Array.prototype.concat = concat;
+ Array.prototype.slice = slice;
}
- return performance.now() - start;
}
describe('asChatMessage', () => {
@@ -93,11 +128,10 @@ describe('asChatMessage', () => {
whole stream once per incoming chunk, that O(n^2) per call becomes
O(n^3) over the life of a "did a bunch of tool calls" turn — this is
what made those responses stay slow even after the bufferedStream fix. */
- const smallTime = simulateTicks(buildToolCallHeavyItems(300));
- const largeTime = simulateTicks(buildToolCallHeavyItems(600));
+ const smallWork = countTickArrayWork(buildToolCallHeavyItems(60));
+ const largeWork = countTickArrayWork(buildToolCallHeavyItems(120));
- /* Doubling input: linear is ~2x, quadratic ~4x, cubic (the bug) ~8x.
- 5x sits clearly between quadratic and cubic. */
- expect(largeTime).toBeLessThan(smallTime * 5 + 20);
+ // Doubling input: quadratic work is ~4x; cubic accumulator copying is ~8x.
+ expect(largeWork).toBeLessThanOrEqual(smallWork * 5);
});
});
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/changedFileDto.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changedFileDto.ts
new file mode 100644
index 0000000000..90a0e83427
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changedFileDto.ts
@@ -0,0 +1,37 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+import type { ChangedFileDtoPreviousPath } from './changedFileDtoPreviousPath';
+import type { FileChangeKindDto } from './fileChangeKindDto';
+
+/**
+ * One changed file.
+
+Clients deserialize this, so both derives are used.
+ */
+export interface ChangedFileDto {
+ /**
+ * Lines added.
+ * @minimum 0
+ */
+ additions: number;
+ /** The diff carries no text for this file. */
+ binary: boolean;
+ /**
+ * Lines removed.
+ * @minimum 0
+ */
+ deletions: number;
+ /** What happened to the file. */
+ kind: FileChangeKindDto;
+ /** The file's hunks were left out of the patch to fit the size budget. */
+ patchOmitted: boolean;
+ /** The file's path after the change, or before it for a deletion. */
+ path: string;
+ /** Where a renamed file came from. */
+ previousPath?: ChangedFileDtoPreviousPath;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/changedFileDtoPreviousPath.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changedFileDtoPreviousPath.ts
new file mode 100644
index 0000000000..ad952a0cca
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changedFileDtoPreviousPath.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Where a renamed file came from.
+ */
+export type ChangedFileDtoPreviousPath = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetDto.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetDto.ts
new file mode 100644
index 0000000000..2e8c3b32b6
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetDto.ts
@@ -0,0 +1,51 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+import type { ChangedFileDto } from './changedFileDto';
+import type { ChangesetDtoRepository } from './changesetDtoRepository';
+import type { ChangesetSourceDto } from './changesetSourceDto';
+import type { GitRefDto } from './gitRefDto';
+
+/**
+ * One changeset: the files a patch touches and what happened to each.
+
+Clients deserialize this, so both derives are used.
+ */
+export interface ChangesetDto {
+ /**
+ * Lines added across all files.
+ * @minimum 0
+ */
+ additions: number;
+ /** The side the work started from. */
+ base: GitRefDto;
+ /** When the diff was taken. */
+ capturedAt: string;
+ /**
+ * Lines removed across all files.
+ * @minimum 0
+ */
+ deletions: number;
+ /** Every changed file, in patch order. */
+ files: ChangedFileDto[];
+ /** The side carrying the work. */
+ head: GitRefDto;
+ /** The changeset's id; a different id means different changes. */
+ id: string;
+ /**
+ * Size of the patch the matching patch route serves; zero when nothing
+changed.
+ * @minimum 0
+ */
+ patchBytes: number;
+ /** `https://github.com/owner/name`, when known. */
+ repository?: ChangesetDtoRepository;
+ /** Where the diff was read from. */
+ source: ChangesetSourceDto;
+ /** Some files' hunks were left out of the patch. */
+ truncated: boolean;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetDtoRepository.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetDtoRepository.ts
new file mode 100644
index 0000000000..d5b78c88e0
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetDtoRepository.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * `https://github.com/owner/name`, when known.
+ */
+export type ChangesetDtoRepository = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetSourceDto.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetSourceDto.ts
new file mode 100644
index 0000000000..285177756b
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/changesetSourceDto.ts
@@ -0,0 +1,17 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * The source of a changeset's diff, on the wire.
+ */
+export type ChangesetSourceDto =
+ (typeof ChangesetSourceDto)[keyof typeof ChangesetSourceDto];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const ChangesetSourceDto = {
+ github_pull_request: 'github_pull_request',
+} as const;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/fileChangeKindDto.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/fileChangeKindDto.ts
new file mode 100644
index 0000000000..35a2a66979
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/fileChangeKindDto.ts
@@ -0,0 +1,20 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * What happened to a file, on the wire.
+ */
+export type FileChangeKindDto =
+ (typeof FileChangeKindDto)[keyof typeof FileChangeKindDto];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const FileChangeKindDto = {
+ added: 'added',
+ modified: 'modified',
+ deleted: 'deleted',
+ renamed: 'renamed',
+} as const;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/getGithubPullRequestChangesPatchParams.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/getGithubPullRequestChangesPatchParams.ts
new file mode 100644
index 0000000000..590034236f
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/getGithubPullRequestChangesPatchParams.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type GetGithubPullRequestChangesPatchParams = {
+ /**
+ * The changeset whose patch to read
+ */
+ changeset: string;
+};
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDto.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDto.ts
new file mode 100644
index 0000000000..a379d4bdc8
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDto.ts
@@ -0,0 +1,18 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { GitRefDtoName } from './gitRefDtoName';
+import type { GitRefDtoSha } from './gitRefDtoSha';
+
+/**
+ * One end of the compared range.
+ */
+export interface GitRefDto {
+ /** The branch name, when known. */
+ name?: GitRefDtoName;
+ /** The commit, when known. */
+ sha?: GitRefDtoSha;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDtoName.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDtoName.ts
new file mode 100644
index 0000000000..faf20575a1
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDtoName.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * The branch name, when known.
+ */
+export type GitRefDtoName = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDtoSha.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDtoSha.ts
new file mode 100644
index 0000000000..5de6f5417f
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/gitRefDtoSha.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * The commit, when known.
+ */
+export type GitRefDtoSha = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesPatchResponse.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesPatchResponse.ts
new file mode 100644
index 0000000000..0a694793a0
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesPatchResponse.ts
@@ -0,0 +1,16 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Response body for `GET /github_pull_requests/{id}/changes/patch`.
+
+Clients deserialize this, so both derives are used.
+ */
+export interface GithubPullRequestChangesPatchResponse {
+ /** The git-style unified diff of the changeset. */
+ patch: string;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponse.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponse.ts
new file mode 100644
index 0000000000..e27da8f787
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponse.ts
@@ -0,0 +1,19 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { GithubPullRequestChangesResponseChangeset } from './githubPullRequestChangesResponseChangeset';
+import type { GithubPullRequestChangesResponseError } from './githubPullRequestChangesResponseError';
+
+/**
+ * Response body for `GET /github_pull_requests/{id}/changes`.
+
+Clients deserialize this, so both derives are used.
+ */
+export interface GithubPullRequestChangesResponse {
+ changeset?: GithubPullRequestChangesResponseChangeset;
+ /** Why there are no changes, in a sentence the user can act on. */
+ error?: GithubPullRequestChangesResponseError;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponseChangeset.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponseChangeset.ts
new file mode 100644
index 0000000000..987555429d
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponseChangeset.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ChangesetDto } from './changesetDto';
+
+export type GithubPullRequestChangesResponseChangeset = null | ChangesetDto;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponseError.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponseError.ts
new file mode 100644
index 0000000000..89998287b9
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/githubPullRequestChangesResponseError.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Why there are no changes, in a sentence the user can act on.
+ */
+export type GithubPullRequestChangesResponseError = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
index 4ca8f50580..5dcabb979e 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
@@ -298,6 +298,11 @@ export * from './cellValueOneOfThree';
export * from './cellValueOneOfThreeType';
export * from './cellValueOneOfType';
export * from './cellWrite';
+export * from './changedFileDto';
+export * from './changedFileDtoPreviousPath';
+export * from './changesetDto';
+export * from './changesetDtoRepository';
+export * from './changesetSourceDto';
export * from './channel';
export * from './channelFilters';
export * from './channelFiltersImportance';
@@ -811,6 +816,7 @@ export * from './favoriteEntityRefEntityType';
export * from './favoriteEntityType';
export * from './favoriteFileType';
export * from './favoritesList';
+export * from './fileChangeKindDto';
export * from './fileSystemNodeWithIds';
export * from './fileSystemNodeWithIdsOneOf';
export * from './fileSystemNodeWithIdsOneOfThree';
@@ -892,6 +898,7 @@ export * from './getDocumentsResponse';
export * from './getDocumentsResponseData';
export * from './getDocumentsResponseMessage';
export * from './getDocumentUserAccessLevelResponse';
+export * from './getGithubPullRequestChangesPatchParams';
export * from './getInstructionsDocumentResponse';
export * from './getItemsSoupParams';
export * from './getLocationHandlerParams';
@@ -915,6 +922,10 @@ export * from './githubLabelFacet';
export * from './githubLabelFacetColor';
export * from './githubPullRequest';
export * from './githubPullRequestAdditions';
+export * from './githubPullRequestChangesPatchResponse';
+export * from './githubPullRequestChangesResponse';
+export * from './githubPullRequestChangesResponseChangeset';
+export * from './githubPullRequestChangesResponseError';
export * from './githubPullRequestCheckRun';
export * from './githubPullRequestCheckRunCompletedAt';
export * from './githubPullRequestCheckRunConclusion';
@@ -952,6 +963,9 @@ export * from './githubPullRequestUserLogin';
export * from './githubRepositoryFacet';
export * from './githubUserFacet';
export * from './githubUserFacetLogin';
+export * from './gitRefDto';
+export * from './gitRefDtoName';
+export * from './gitRefDtoSha';
export * from './groupedInitialParams';
export * from './groupedInitialParamsPerGroupLimit';
export * from './groupedInitialParamsSortMethod';
@@ -1691,9 +1705,11 @@ export * from './storedGithubPullRequest';
export * from './storedGithubPullRequestAdditions';
export * from './storedGithubPullRequestAuthorGithubUserId';
export * from './storedGithubPullRequestAuthorLogin';
+export * from './storedGithubPullRequestBase';
export * from './storedGithubPullRequestDeletions';
export * from './storedGithubPullRequestDescription';
export * from './storedGithubPullRequestGithubUpdatedAt';
+export * from './storedGithubPullRequestHead';
export * from './storedGithubPullRequestReviewDecision';
export * from './storedGithubPullRequestStatus';
export * from './storedGithubPullRequestTitle';
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequest.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequest.ts
index 825ae7b8f7..8487a21560 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequest.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequest.ts
@@ -13,9 +13,11 @@ import type { GithubPullRequestUser } from './githubPullRequestUser';
import type { StoredGithubPullRequestAdditions } from './storedGithubPullRequestAdditions';
import type { StoredGithubPullRequestAuthorGithubUserId } from './storedGithubPullRequestAuthorGithubUserId';
import type { StoredGithubPullRequestAuthorLogin } from './storedGithubPullRequestAuthorLogin';
+import type { StoredGithubPullRequestBase } from './storedGithubPullRequestBase';
import type { StoredGithubPullRequestDeletions } from './storedGithubPullRequestDeletions';
import type { StoredGithubPullRequestDescription } from './storedGithubPullRequestDescription';
import type { StoredGithubPullRequestGithubUpdatedAt } from './storedGithubPullRequestGithubUpdatedAt';
+import type { StoredGithubPullRequestHead } from './storedGithubPullRequestHead';
import type { StoredGithubPullRequestReviewDecision } from './storedGithubPullRequestReviewDecision';
import type { StoredGithubPullRequestStatus } from './storedGithubPullRequestStatus';
import type { StoredGithubPullRequestTitle } from './storedGithubPullRequestTitle';
@@ -35,6 +37,7 @@ export interface StoredGithubPullRequest {
authorGithubUserId?: StoredGithubPullRequestAuthorGithubUserId;
/** The author's GitHub login when the pull request was last synced. */
authorLogin?: StoredGithubPullRequestAuthorLogin;
+ base?: StoredGithubPullRequestBase;
/** The latest check runs on the pull request's head commit. */
checks: GithubPullRequestCheckRun[];
/** Comments from the pull request's conversation, reviews, and review threads.
@@ -54,6 +57,7 @@ convert it to a decimal string before comparing it with `authorGithubUserId`. */
githubKey: string;
/** When GitHub last updated the pull request. */
githubUpdatedAt?: StoredGithubPullRequestGithubUpdatedAt;
+ head?: StoredGithubPullRequestHead;
/** The caller's record for the pull request. */
id: string;
/** The pull request's labels. */
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequestBase.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequestBase.ts
new file mode 100644
index 0000000000..280915e8e9
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequestBase.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { GitRefDto } from './gitRefDto';
+
+export type StoredGithubPullRequestBase = null | GitRefDto;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequestHead.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequestHead.ts
new file mode 100644
index 0000000000..0d319a6398
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/storedGithubPullRequestHead.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { GitRefDto } from './gitRefDto';
+
+export type StoredGithubPullRequestHead = null | GitRefDto;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
index a7013fc71c..59632005d3 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
@@ -13519,6 +13519,20 @@ export const getGithubPullRequestResponse = zod
.describe(
"The author's GitHub login when the pull request was last synced."
),
+ base: zod
+ .union([
+ zod.null(),
+ zod
+ .object({
+ name: zod
+ .string()
+ .nullish()
+ .describe('The branch name, when known.'),
+ sha: zod.string().nullish().describe('The commit, when known.'),
+ })
+ .describe('One end of the compared range.'),
+ ])
+ .optional(),
checks: zod
.array(
zod
@@ -13663,6 +13677,20 @@ export const getGithubPullRequestResponse = zod
.datetime({})
.nullish()
.describe('When GitHub last updated the pull request.'),
+ head: zod
+ .union([
+ zod.null(),
+ zod
+ .object({
+ name: zod
+ .string()
+ .nullish()
+ .describe('The branch name, when known.'),
+ sha: zod.string().nullish().describe('The commit, when known.'),
+ })
+ .describe('One end of the compared range.'),
+ ])
+ .optional(),
id: zod.uuid().describe("The caller's record for the pull request."),
labels: zod
.array(
@@ -13749,6 +13777,163 @@ export const getGithubPullRequestResponse = zod
"A GitHub pull request as Macro stores it, read through one of the caller's records."
);
+/**
+ * @summary Get the changes of the pull request behind a foreign entity record the caller can view.
+ */
+export const getGithubPullRequestChangesParams = zod.object({
+ id: zod
+ .uuid()
+ .describe("The caller's foreign entity record for the pull request"),
+});
+
+export const getGithubPullRequestChangesResponseChangesetAdditionsMin = 0;
+
+export const getGithubPullRequestChangesResponseChangesetDeletionsMin = 0;
+
+export const getGithubPullRequestChangesResponseChangesetFilesItemAdditionsMin = 0;
+
+export const getGithubPullRequestChangesResponseChangesetFilesItemDeletionsMin = 0;
+
+export const getGithubPullRequestChangesResponseChangesetPatchBytesMin = 0;
+
+export const getGithubPullRequestChangesResponse = zod
+ .object({
+ changeset: zod
+ .union([
+ zod.null(),
+ zod
+ .object({
+ additions: zod
+ .number()
+ .min(getGithubPullRequestChangesResponseChangesetAdditionsMin)
+ .describe('Lines added across all files.'),
+ base: zod
+ .object({
+ name: zod
+ .string()
+ .nullish()
+ .describe('The branch name, when known.'),
+ sha: zod.string().nullish().describe('The commit, when known.'),
+ })
+ .describe('One end of the compared range.'),
+ capturedAt: zod.iso
+ .datetime({})
+ .describe('When the diff was taken.'),
+ deletions: zod
+ .number()
+ .min(getGithubPullRequestChangesResponseChangesetDeletionsMin)
+ .describe('Lines removed across all files.'),
+ files: zod
+ .array(
+ zod
+ .object({
+ additions: zod
+ .number()
+ .min(
+ getGithubPullRequestChangesResponseChangesetFilesItemAdditionsMin
+ )
+ .describe('Lines added.'),
+ binary: zod
+ .boolean()
+ .describe('The diff carries no text for this file.'),
+ deletions: zod
+ .number()
+ .min(
+ getGithubPullRequestChangesResponseChangesetFilesItemDeletionsMin
+ )
+ .describe('Lines removed.'),
+ kind: zod
+ .enum(['added', 'modified', 'deleted', 'renamed'])
+ .describe('What happened to a file, on the wire.'),
+ patchOmitted: zod
+ .boolean()
+ .describe(
+ "The file's hunks were left out of the patch to fit the size budget."
+ ),
+ path: zod
+ .string()
+ .describe(
+ "The file's path after the change, or before it for a deletion."
+ ),
+ previousPath: zod
+ .string()
+ .nullish()
+ .describe('Where a renamed file came from.'),
+ })
+ .describe(
+ 'One changed file.\n\nClients deserialize this, so both derives are used.'
+ )
+ )
+ .describe('Every changed file, in patch order.'),
+ head: zod
+ .object({
+ name: zod
+ .string()
+ .nullish()
+ .describe('The branch name, when known.'),
+ sha: zod.string().nullish().describe('The commit, when known.'),
+ })
+ .describe('One end of the compared range.'),
+ id: zod
+ .uuid()
+ .describe(
+ "The changeset's id; a different id means different changes."
+ ),
+ patchBytes: zod
+ .number()
+ .min(getGithubPullRequestChangesResponseChangesetPatchBytesMin)
+ .describe(
+ 'Size of the patch the matching patch route serves; zero when nothing\nchanged.'
+ ),
+ repository: zod
+ .string()
+ .nullish()
+ .describe('`https:\/\/github.com\/owner\/name`, when known.'),
+ source: zod
+ .enum(['github_pull_request'])
+ .describe("The source of a changeset's diff, on the wire."),
+ truncated: zod
+ .boolean()
+ .describe("Some files' hunks were left out of the patch."),
+ })
+ .describe(
+ 'One changeset: the files a patch touches and what happened to each.\n\nClients deserialize this, so both derives are used.'
+ ),
+ ])
+ .optional(),
+ error: zod
+ .string()
+ .nullish()
+ .describe('Why there are no changes, in a sentence the user can act on.'),
+ })
+ .describe(
+ 'Response body for `GET \/github_pull_requests\/{id}\/changes`.\n\nClients deserialize this, so both derives are used.'
+ );
+
+/**
+ * @summary Get the patch of changes of the pull request behind a foreign entity record the caller can
+view.
+ */
+export const getGithubPullRequestChangesPatchParams = zod.object({
+ id: zod
+ .uuid()
+ .describe("The caller's foreign entity record for the pull request"),
+});
+
+export const getGithubPullRequestChangesPatchQueryParams = zod.object({
+ changeset: zod.uuid().describe('The changeset whose patch to read'),
+});
+
+export const getGithubPullRequestChangesPatchResponse = zod
+ .object({
+ patch: zod
+ .string()
+ .describe('The git-style unified diff of the changeset.'),
+ })
+ .describe(
+ 'Response body for `GET \/github_pull_requests\/{id}\/changes\/patch`.\n\nClients deserialize this, so both derives are used.'
+ );
+
/**
* Unauthenticated by design: the daemon has no credential yet - obtaining one
is the point. The pairing releases nothing until a signed-in user approves
diff --git a/apps/web/src/lib/service-clients/service-storage/openapi.json b/apps/web/src/lib/service-clients/service-storage/openapi.json
index 8d9118827a..c7119e0c3e 100644
--- a/apps/web/src/lib/service-clients/service-storage/openapi.json
+++ b/apps/web/src/lib/service-clients/service-storage/openapi.json
@@ -10778,6 +10778,148 @@
}
}
},
+ "/github_pull_requests/{id}/changes": {
+ "get": {
+ "tags": ["github_pull_requests"],
+ "summary": "Get the changes of the pull request behind a foreign entity record the caller can view.",
+ "operationId": "get_github_pull_request_changes",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The caller's foreign entity record for the pull request",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "uuid"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GithubPullRequestChangesResponse"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/github_pull_requests/{id}/changes/patch": {
+ "get": {
+ "tags": ["github_pull_requests"],
+ "summary": "Get the patch of changes of the pull request behind a foreign entity record the caller can\nview.",
+ "operationId": "get_github_pull_request_changes_patch",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The caller's foreign entity record for the pull request",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "uuid"
+ }
+ },
+ {
+ "name": "changeset",
+ "in": "query",
+ "description": "The changeset whose patch to read",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "uuid"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GithubPullRequestChangesPatchResponse"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "409": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/harness-pairings": {
"post": {
"tags": ["harnesses"],
@@ -19381,6 +19523,130 @@
}
}
},
+ "ChangedFileDto": {
+ "type": "object",
+ "description": "One changed file.\n\nClients deserialize this, so both derives are used.",
+ "required": [
+ "path",
+ "kind",
+ "additions",
+ "deletions",
+ "binary",
+ "patchOmitted"
+ ],
+ "properties": {
+ "additions": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Lines added.",
+ "minimum": 0
+ },
+ "binary": {
+ "type": "boolean",
+ "description": "The diff carries no text for this file."
+ },
+ "deletions": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Lines removed.",
+ "minimum": 0
+ },
+ "kind": {
+ "$ref": "#/components/schemas/FileChangeKindDto",
+ "description": "What happened to the file."
+ },
+ "patchOmitted": {
+ "type": "boolean",
+ "description": "The file's hunks were left out of the patch to fit the size budget."
+ },
+ "path": {
+ "type": "string",
+ "description": "The file's path after the change, or before it for a deletion."
+ },
+ "previousPath": {
+ "type": ["string", "null"],
+ "description": "Where a renamed file came from."
+ }
+ }
+ },
+ "ChangesetDto": {
+ "type": "object",
+ "description": "One changeset: the files a patch touches and what happened to each.\n\nClients deserialize this, so both derives are used.",
+ "required": [
+ "id",
+ "source",
+ "base",
+ "head",
+ "files",
+ "additions",
+ "deletions",
+ "patchBytes",
+ "truncated",
+ "capturedAt"
+ ],
+ "properties": {
+ "additions": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Lines added across all files.",
+ "minimum": 0
+ },
+ "base": {
+ "$ref": "#/components/schemas/GitRefDto",
+ "description": "The side the work started from."
+ },
+ "capturedAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the diff was taken."
+ },
+ "deletions": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Lines removed across all files.",
+ "minimum": 0
+ },
+ "files": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ChangedFileDto"
+ },
+ "description": "Every changed file, in patch order."
+ },
+ "head": {
+ "$ref": "#/components/schemas/GitRefDto",
+ "description": "The side carrying the work."
+ },
+ "id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The changeset's id; a different id means different changes."
+ },
+ "patchBytes": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Size of the patch the matching patch route serves; zero when nothing\nchanged.",
+ "minimum": 0
+ },
+ "repository": {
+ "type": ["string", "null"],
+ "description": "`https://github.com/owner/name`, when known."
+ },
+ "source": {
+ "$ref": "#/components/schemas/ChangesetSourceDto",
+ "description": "Where the diff was read from."
+ },
+ "truncated": {
+ "type": "boolean",
+ "description": "Some files' hunks were left out of the patch."
+ }
+ }
+ },
+ "ChangesetSourceDto": {
+ "type": "string",
+ "description": "The source of a changeset's diff, on the wire.",
+ "enum": ["github_pull_request"]
+ },
"Channel": {
"type": "object",
"description": "Channel metadata in soup payloads.",
@@ -25205,6 +25471,11 @@
}
}
},
+ "FileChangeKindDto": {
+ "type": "string",
+ "description": "What happened to a file, on the wire.",
+ "enum": ["added", "modified", "deleted", "renamed"]
+ },
"FileSystemNodeWithIds": {
"oneOf": [
{
@@ -26574,6 +26845,20 @@
}
}
},
+ "GitRefDto": {
+ "type": "object",
+ "description": "One end of the compared range.",
+ "properties": {
+ "name": {
+ "type": ["string", "null"],
+ "description": "The branch name, when known."
+ },
+ "sha": {
+ "type": ["string", "null"],
+ "description": "The commit, when known."
+ }
+ }
+ },
"GithubLabelFacet": {
"type": "object",
"description": "A label among the visible GitHub pull requests. Labels with the same name in different\nrepositories count together.",
@@ -26673,6 +26958,38 @@
}
}
},
+ "GithubPullRequestChangesPatchResponse": {
+ "type": "object",
+ "description": "Response body for `GET /github_pull_requests/{id}/changes/patch`.\n\nClients deserialize this, so both derives are used.",
+ "required": ["patch"],
+ "properties": {
+ "patch": {
+ "type": "string",
+ "description": "The git-style unified diff of the changeset."
+ }
+ }
+ },
+ "GithubPullRequestChangesResponse": {
+ "type": "object",
+ "description": "Response body for `GET /github_pull_requests/{id}/changes`.\n\nClients deserialize this, so both derives are used.",
+ "properties": {
+ "changeset": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/ChangesetDto",
+ "description": "The changes at the pull request's current base and head; absent when GitHub could not\nprovide them."
+ }
+ ]
+ },
+ "error": {
+ "type": ["string", "null"],
+ "description": "Why there are no changes, in a sentence the user can act on."
+ }
+ }
+ },
"GithubPullRequestCheckRun": {
"type": "object",
"description": "A check run associated with a GitHub pull request.",
@@ -35016,6 +35333,17 @@
"type": ["string", "null"],
"description": "The author's GitHub login when the pull request was last synced."
},
+ "base": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/GitRefDto",
+ "description": "The branch and commit the pull request merges into, when known."
+ }
+ ]
+ },
"checks": {
"type": "array",
"items": {
@@ -35053,6 +35381,17 @@
"format": "date-time",
"description": "When GitHub last updated the pull request."
},
+ "head": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/GitRefDto",
+ "description": "The branch and commit carrying the pull request's changes, when known."
+ }
+ ]
+ },
"id": {
"type": "string",
"format": "uuid",
diff --git a/crates/agent_changes/src/domain/model.rs b/crates/agent_changes/src/domain/model.rs
index cdb6337f16..1534d830cf 100644
--- a/crates/agent_changes/src/domain/model.rs
+++ b/crates/agent_changes/src/domain/model.rs
@@ -12,7 +12,9 @@ use serde::{Deserialize, Serialize};
pub use agent_session::domain::model::AgentSessionId;
pub use git_patch::{ChangedFile, ChangesetRange, FileChangeKind, GitRef};
-pub use github_pull_requests::domain::models::{PullRequestRef, RepositorySlug};
+pub use github_pull_requests::domain::models::{
+ GithubPullRequestChangeset, PullRequestRef, RepositorySlug,
+};
/// A captured branch together with the repository it belongs to.
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -34,9 +36,11 @@ impl CapturedBranch {
}
}
-/// Identity of one capture. Minted per capture (UUIDv7), so the patch blob's
-/// key changes every time and a reader never sees half of a newer capture
-/// under an older summary.
+/// Identity of one capture. Minted per capture (UUIDv7) for a patch stored
+/// under the session, so the patch blob's key changes every time and a reader
+/// never sees half of a newer capture under an older summary. A capture that
+/// shares a pull request changeset takes that changeset's id, which names the
+/// same base and head wherever it appears.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ChangesetId(Uuid);
@@ -79,20 +83,26 @@ pub enum ChangesetSource {
GithubPullRequest,
}
-/// What an extractor hands back: the raw patch plus the range it covers. The
-/// service derives every per-file fact from the patch, so no extractor has to
-/// count lines or classify files itself.
+/// What an extractor hands back.
#[derive(Debug, Clone, PartialEq, Eq)]
-pub struct ExtractedChangeset {
- /// Where it came from.
- pub source: ChangesetSource,
- /// What was compared.
- pub range: ChangesetRange,
- /// A git-style unified diff, possibly empty when nothing changed.
- pub patch: String,
- /// The extractor already cut the patch down to a size budget of its
- /// own, so files past its cut are missing from `patch` entirely.
- pub truncated: bool,
+pub enum ExtractedChangeset {
+ /// A raw patch plus the range it covers, stored under the session. The
+ /// service derives every per-file fact from the patch, so no extractor
+ /// has to count lines or classify files itself.
+ Patch {
+ /// Where it came from.
+ source: ChangesetSource,
+ /// What was compared.
+ range: ChangesetRange,
+ /// A git-style unified diff, possibly empty when nothing changed.
+ patch: String,
+ /// The extractor already cut the patch down to a size budget of its
+ /// own, so files past its cut are missing from `patch` entirely.
+ truncated: bool,
+ },
+ /// A pull request's changes as stored for every reader of the same base
+ /// and head. The session points at them rather than storing a copy.
+ PullRequest(GithubPullRequestChangeset),
}
/// One capture of a session's changes, as stored and served.
diff --git a/crates/agent_changes/src/domain/ports.rs b/crates/agent_changes/src/domain/ports.rs
index 0914adf327..14ab5f96b3 100644
--- a/crates/agent_changes/src/domain/ports.rs
+++ b/crates/agent_changes/src/domain/ports.rs
@@ -5,6 +5,7 @@ use std::future::Future;
use std::pin::Pin;
use agent_session::domain::model::AgentSession;
+use macro_uuid::Uuid;
use super::error::ExtractError;
use super::model::{
@@ -31,14 +32,22 @@ pub trait SessionBranchReader: Send + Sync + 'static {
fn working_branches<'a>(&'a self, sessions: &'a [AgentSessionId]) -> SessionBranchesFuture<'a>;
}
-/// Reads the linked GitHub pull request for a session. The service derives
-/// per-file facts from the raw patch.
+/// Reads the linked GitHub pull request for a session.
pub trait ChangesetExtractor: Send + Sync + 'static {
/// The current diff for `session`, or why there is none.
fn extract(
&self,
session: &AgentSession,
) -> impl Future<Output = Result<ExtractedChangeset, ExtractError>> + Send;
+
+ /// The patch of the pull request changeset `changeset` that an earlier
+ /// extraction for `session` handed back, or `None` when it can no longer
+ /// be read, for example because the pull request moved past it.
+ fn pull_request_patch(
+ &self,
+ session: &AgentSession,
+ changeset: Uuid,
+ ) -> impl Future<Output = Result<Option<String>, rootcause::Report>> + Send;
}
/// Where a stored patch lives in the blob store.
@@ -74,6 +83,16 @@ impl std::fmt::Display for PatchBlobKey {
}
}
+/// Where a session's current patch is read from.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum PatchLocation {
+ /// A patch stored under the session in the blob store.
+ Blob(PatchBlobKey),
+ /// The patch of a pull request changeset, shared with every reader of the
+ /// same base and head and never deleted on the session's behalf.
+ PullRequest(Uuid),
+}
+
/// The summary row: one per session, replaced on every capture.
pub trait ChangesetRepo: Send + Sync + 'static {
/// Note that a capture started at `started_at`. Creates the session's
@@ -85,13 +104,13 @@ pub trait ChangesetRepo: Send + Sync + 'static {
) -> impl Future<Output = Result<(), rootcause::Report>> + Send;
/// Replace the session's changeset with `changeset`, whose patch (if any)
- /// is stored under `patch_key`, and close the running attempt as
- /// captured. Returns the key of the patch this one superseded, so the
- /// caller can delete the orphaned blob.
+ /// is read from `patch`, and close the running attempt as captured.
+ /// Returns the key of the session blob this one superseded, so the caller
+ /// can delete it.
fn record_changeset(
&self,
changeset: &Changeset,
- patch_key: Option<&PatchBlobKey>,
+ patch: Option<&PatchLocation>,
finished_at: DateTime<Utc>,
) -> impl Future<Output = Result<Option<PatchBlobKey>, rootcause::Report>> + Send;
@@ -112,11 +131,11 @@ pub trait ChangesetRepo: Send + Sync + 'static {
session: AgentSessionId,
) -> impl Future<Output = Result<SessionChanges, rootcause::Report>> + Send;
- /// Where the session's current patch is stored, if it has one.
- fn patch_key(
+ /// Where the session's current patch is read from, if it has one.
+ fn patch_location(
&self,
session: AgentSessionId,
- ) -> impl Future<Output = Result<Option<PatchBlobKey>, rootcause::Report>> + Send;
+ ) -> impl Future<Output = Result<Option<PatchLocation>, rootcause::Report>> + Send;
}
/// The patch bodies, kept out of the database because a patch can be
diff --git a/crates/agent_changes/src/domain/pull_request.rs b/crates/agent_changes/src/domain/pull_request.rs
index 9ab3fbf10d..4b3ba287fc 100644
--- a/crates/agent_changes/src/domain/pull_request.rs
+++ b/crates/agent_changes/src/domain/pull_request.rs
@@ -2,29 +2,35 @@
use agent_session::domain::model::AgentSession;
-use github_pull_requests::domain::models::GithubPullRequestDiffError;
-use github_pull_requests::domain::ports::GithubPullRequestDiffReader;
+use github_pull_requests::domain::models::{
+ GithubPullRequestChangesError, GithubPullRequestDiffError,
+};
+use github_pull_requests::domain::ports::GithubPullRequestChangesets;
+use macro_uuid::Uuid;
use super::error::ExtractError;
-use super::model::{ChangesetSource, ExtractedChangeset, PullRequestRef};
+use super::model::{ExtractedChangeset, PullRequestRef};
use super::ports::ChangesetExtractor;
#[cfg(test)]
mod test;
-/// Extracts only the diff of a session's linked GitHub pull request.
-pub struct PullRequestChanges<Reader> {
- reader: Reader,
+/// Extracts only the diff of a session's linked GitHub pull request, shared
+/// with every other reader of the same base and head.
+pub struct PullRequestChanges<Changesets> {
+ changesets: Changesets,
}
-impl<Reader> PullRequestChanges<Reader> {
- /// Read pull requests through `reader`.
- pub fn new(reader: Reader) -> Self {
- Self { reader }
+impl<Changesets> PullRequestChanges<Changesets> {
+ /// Read pull request changes through `changesets`.
+ pub fn new(changesets: Changesets) -> Self {
+ Self { changesets }
}
}
-impl<Reader: GithubPullRequestDiffReader> ChangesetExtractor for PullRequestChanges<Reader> {
+impl<Changesets: GithubPullRequestChangesets> ChangesetExtractor
+ for PullRequestChanges<Changesets>
+{
async fn extract(&self, session: &AgentSession) -> Result<ExtractedChangeset, ExtractError> {
let url = session.pull_request_url.as_deref().ok_or_else(|| {
ExtractError::NotReady(
@@ -39,17 +45,50 @@ impl<Reader: GithubPullRequestDiffReader> ChangesetExtractor for PullRequestChan
let owner = session
.owner_user()
.map_err(|error| ExtractError::Failed(rootcause::report!(error).into()))?;
- let diff = self.reader.read(owner, &pull_request).await.map_err(|error| match error {
- GithubPullRequestDiffError::NotFound => ExtractError::NotReady("The linked pull request is not available on GitHub.".to_owned()),
- GithubPullRequestDiffError::TooLarge => ExtractError::NotReady("This pull request is too large to load here. Review it on GitHub.".to_owned()),
- GithubPullRequestDiffError::Unavailable => ExtractError::NotReady("Macro's GitHub App cannot read this pull request. Check its repository access.".to_owned()),
- GithubPullRequestDiffError::Other(error) => ExtractError::Failed(rootcause::report!("{error:#}")),
- })?;
- Ok(ExtractedChangeset {
- source: ChangesetSource::GithubPullRequest,
- range: diff.range,
- patch: diff.patch,
- truncated: false,
- })
+ let changeset = self
+ .changesets
+ .capture(owner, &pull_request)
+ .await
+ .map_err(extract_error)?;
+ Ok(ExtractedChangeset::PullRequest(changeset))
+ }
+
+ async fn pull_request_patch(
+ &self,
+ session: &AgentSession,
+ changeset: Uuid,
+ ) -> Result<Option<String>, rootcause::Report> {
+ let owner = session
+ .owner_user()
+ .map_err(|error| rootcause::report!(error))?;
+ match self.changesets.patch(owner, changeset).await {
+ Ok(patch) => Ok(Some(patch)),
+ Err(GithubPullRequestChangesError::NotFound | GithubPullRequestChangesError::Moved) => {
+ Ok(None)
+ }
+ Err(GithubPullRequestChangesError::Diff(error)) if error.user_message().is_some() => {
+ Ok(None)
+ }
+ Err(error) => Err(rootcause::report!("{error}")),
+ }
+ }
+}
+
+fn extract_error(error: GithubPullRequestChangesError) -> ExtractError {
+ let not_ready = |reason: &str| ExtractError::NotReady(reason.to_owned());
+ match error {
+ GithubPullRequestChangesError::Diff(GithubPullRequestDiffError::NotFound) => {
+ not_ready("The linked pull request is not available on GitHub.")
+ }
+ GithubPullRequestChangesError::Diff(GithubPullRequestDiffError::TooLarge) => {
+ not_ready("This pull request is too large to load here. Review it on GitHub.")
+ }
+ GithubPullRequestChangesError::Diff(GithubPullRequestDiffError::Unavailable) => not_ready(
+ "Macro's GitHub App cannot read this pull request. Check its repository access.",
+ ),
+ GithubPullRequestChangesError::Diff(GithubPullRequestDiffError::Other(error)) => {
+ ExtractError::Failed(rootcause::report!("{error:#}"))
+ }
+ error => ExtractError::Failed(rootcause::report!("{error}")),
}
}
diff --git a/crates/agent_changes/src/domain/pull_request/test.rs b/crates/agent_changes/src/domain/pull_request/test.rs
index d200fe852f..c0f4c485ad 100644
--- a/crates/agent_changes/src/domain/pull_request/test.rs
+++ b/crates/agent_changes/src/domain/pull_request/test.rs
@@ -1,44 +1,78 @@
use super::*;
-use crate::domain::model::{ChangesetRange, GitRef};
+use crate::domain::model::{ChangesetRange, GitRef, GithubPullRequestChangeset};
use agent_session::domain::model::AgentSessionId;
use agent_session::testing::test_agent_session;
-use github_pull_requests::domain::models::GithubPullRequestDiff;
+use chrono::Utc;
use macro_user_id::user_id::MacroUserIdStr;
use std::sync::Mutex;
#[derive(Default)]
-struct Reader {
+struct Changesets {
calls: Mutex<Vec<(String, PullRequestRef)>>,
- error: Option<fn() -> GithubPullRequestDiffError>,
+ capture_error: Option<fn() -> GithubPullRequestChangesError>,
+ patch_error: Option<fn() -> GithubPullRequestChangesError>,
}
-impl GithubPullRequestDiffReader for Reader {
- async fn read(
+impl GithubPullRequestChangesets for Changesets {
+ async fn changeset(
+ &self,
+ _id: Uuid,
+ ) -> Result<Option<GithubPullRequestChangeset>, GithubPullRequestChangesError> {
+ Ok(None)
+ }
+
+ async fn capture(
&self,
user: &MacroUserIdStr<'static>,
pr: &PullRequestRef,
- ) -> Result<GithubPullRequestDiff, GithubPullRequestDiffError> {
+ ) -> Result<GithubPullRequestChangeset, GithubPullRequestChangesError> {
self.calls
.lock()
.unwrap()
.push((user.to_string(), pr.clone()));
- if let Some(error) = self.error {
+ if let Some(error) = self.capture_error {
return Err(error());
}
- Ok(GithubPullRequestDiff {
- patch: "PR diff".to_owned(),
+ Ok(GithubPullRequestChangeset {
+ id: Uuid::nil(),
+ github_key: "github:1:42".to_owned(),
+ pull_request: pr.clone(),
range: ChangesetRange {
repository: Some(pr.repository.https_url()),
base: GitRef::named("release"),
head: GitRef::named("fork-fix"),
},
+ files: Vec::new(),
+ additions: 0,
+ deletions: 0,
+ patch_bytes: 0,
+ truncated: false,
+ patch_key: None,
+ captured_at: Utc::now(),
})
}
+
+ async fn patch(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ id: Uuid,
+ ) -> Result<String, GithubPullRequestChangesError> {
+ if let Some(error) = self.patch_error {
+ return Err(error());
+ }
+ Ok(format!("patch {id} for {user}"))
+ }
+}
+
+fn linked_session() -> AgentSession {
+ let mut session = test_agent_session(AgentSessionId::TEST_A);
+ session.pull_request_url = Some("https://github.com/o/r/pull/1".to_owned());
+ session
}
#[tokio::test]
async fn every_harness_reads_the_linked_pr_with_the_session_owners_access() {
- let extractor = PullRequestChanges::new(Reader::default());
+ let extractor = PullRequestChanges::new(Changesets::default());
for harness in [
"cursor",
"macrod",
@@ -51,15 +85,16 @@ async fn every_harness_reads_the_linked_pr_with_the_session_owners_access() {
session.harness = harness.to_owned();
session.pull_request_url = Some("https://github.com/upstream/repo/pull/42".to_owned());
session.repo_url = Some("https://github.com/other/repo".to_owned());
- let changes = extractor.extract(&session).await.unwrap();
- assert_eq!(changes.source, ChangesetSource::GithubPullRequest);
- assert_eq!(changes.patch, "PR diff");
+ let ExtractedChangeset::PullRequest(changes) = extractor.extract(&session).await.unwrap()
+ else {
+ panic!("expected the pull request's shared changeset");
+ };
assert_eq!(
changes.range.repository.as_deref(),
Some("https://github.com/upstream/repo")
);
assert_eq!(changes.range.base.name.as_deref(), Some("release"));
- let calls = extractor.reader.calls.lock().unwrap();
+ let calls = extractor.changesets.calls.lock().unwrap();
let (user, pr) = calls.last().unwrap();
assert_eq!(user, &session.owner_id.to_string());
assert_eq!(pr.number.get(), 42);
@@ -68,7 +103,7 @@ async fn every_harness_reads_the_linked_pr_with_the_session_owners_access() {
#[tokio::test]
async fn missing_or_invalid_pr_never_falls_back_to_a_branch_or_runtime() {
- let extractor = PullRequestChanges::new(Reader::default());
+ let extractor = PullRequestChanges::new(Changesets::default());
for url in [
None,
Some("https://github.com/o/r/tree/work"),
@@ -81,26 +116,73 @@ async fn missing_or_invalid_pr_never_falls_back_to_a_branch_or_runtime() {
Err(ExtractError::NotReady(_))
));
}
- assert!(extractor.reader.calls.lock().unwrap().is_empty());
+ assert!(extractor.changesets.calls.lock().unwrap().is_empty());
}
#[tokio::test]
async fn inaccessible_and_oversized_prs_remain_unavailable_without_a_fallback() {
for error in [
- || GithubPullRequestDiffError::NotFound,
- || GithubPullRequestDiffError::Unavailable,
- || GithubPullRequestDiffError::TooLarge,
+ || GithubPullRequestChangesError::Diff(GithubPullRequestDiffError::NotFound),
+ || GithubPullRequestChangesError::Diff(GithubPullRequestDiffError::Unavailable),
+ || GithubPullRequestChangesError::Diff(GithubPullRequestDiffError::TooLarge),
] {
- let extractor = PullRequestChanges::new(Reader {
- error: Some(error),
- ..Reader::default()
+ let extractor = PullRequestChanges::new(Changesets {
+ capture_error: Some(error),
+ ..Changesets::default()
});
- let mut session = test_agent_session(AgentSessionId::TEST_A);
- session.pull_request_url = Some("https://github.com/o/r/pull/1".to_owned());
assert!(matches!(
- extractor.extract(&session).await,
+ extractor.extract(&linked_session()).await,
Err(ExtractError::NotReady(_))
));
- assert_eq!(extractor.reader.calls.lock().unwrap().len(), 1);
+ assert_eq!(extractor.changesets.calls.lock().unwrap().len(), 1);
+ }
+}
+
+#[tokio::test]
+async fn a_storage_failure_is_a_failed_capture() {
+ let extractor = PullRequestChanges::new(Changesets {
+ capture_error: Some(|| {
+ GithubPullRequestChangesError::Storage(anyhow::anyhow!("database unavailable"))
+ }),
+ ..Changesets::default()
+ });
+ assert!(matches!(
+ extractor.extract(&linked_session()).await,
+ Err(ExtractError::Failed(_))
+ ));
+}
+
+#[tokio::test]
+async fn the_shared_patch_is_read_with_the_session_owners_access() {
+ let extractor = PullRequestChanges::new(Changesets::default());
+ let session = linked_session();
+ let patch = extractor
+ .pull_request_patch(&session, Uuid::nil())
+ .await
+ .unwrap();
+ assert_eq!(
+ patch,
+ Some(format!("patch {} for {}", Uuid::nil(), session.owner_id))
+ );
+}
+
+#[tokio::test]
+async fn a_shared_patch_the_pull_request_moved_past_is_gone() {
+ for error in [
+ || GithubPullRequestChangesError::Moved,
+ || GithubPullRequestChangesError::NotFound,
+ || GithubPullRequestChangesError::Diff(GithubPullRequestDiffError::Unavailable),
+ ] {
+ let extractor = PullRequestChanges::new(Changesets {
+ patch_error: Some(error),
+ ..Changesets::default()
+ });
+ assert_eq!(
+ extractor
+ .pull_request_patch(&linked_session(), Uuid::nil())
+ .await
+ .unwrap(),
+ None
+ );
}
}
diff --git a/crates/agent_changes/src/domain/service.rs b/crates/agent_changes/src/domain/service.rs
index cbe75df72d..041ae76385 100644
--- a/crates/agent_changes/src/domain/service.rs
+++ b/crates/agent_changes/src/domain/service.rs
@@ -1,8 +1,9 @@
//! Capturing, storing, and serving a session's changes.
//!
-//! One capture is one round trip through the extractor: read the patch, read
-//! the facts out of it, store the patch, replace the summary, tell the
-//! viewers. Captures run after every turn - the moment a session has
+//! One capture is one round trip through the extractor: read the changes,
+//! store a raw patch under the session or point at the pull request changeset
+//! every reader of the same base and head shares, replace the summary, tell
+//! the viewers. Captures run after every turn - the moment a session has
//! something new to show - and on demand from the pane. A session never has
//! two captures running at once: a request that lands mid-capture is folded
//! into a rerun, so the stored changeset always reflects a state at least as
@@ -23,9 +24,14 @@ use macro_uuid::Uuid;
use tracing::Instrument as _;
use super::error::{ChangesError, ExtractError, Result};
-use super::model::{AgentSessionId, AttemptOutcome, Changeset, ChangesetId, SessionChanges};
+use super::model::{
+ AgentSessionId, AttemptOutcome, Changeset, ChangesetId, ChangesetSource, ExtractedChangeset,
+ SessionChanges,
+};
use super::patch::{self, MAX_FILE_PATCH_BYTES, MAX_PATCH_BYTES};
-use super::ports::{ChangesetBlobStore, ChangesetExtractor, ChangesetRepo, PatchBlobKey};
+use super::ports::{
+ ChangesetBlobStore, ChangesetExtractor, ChangesetRepo, PatchBlobKey, PatchLocation,
+};
#[cfg(test)]
mod test;
@@ -141,17 +147,24 @@ where
/// The stored patch for the session the receipt names.
async fn read_patch(&self, access: &EntityAccessReceipt<ViewAccessLevel>) -> Result<String> {
let session = session_of(access)?;
- let key = self
+ let location = self
.inner
.repo
- .patch_key(session)
+ .patch_location(session)
.await
.map_err(ChangesError::Storage)?
.ok_or(ChangesError::NoChangeset)?;
- self.inner
- .blobs
- .get_patch(&key)
- .await
+ let patch = match location {
+ PatchLocation::Blob(key) => self.inner.blobs.get_patch(&key).await,
+ PatchLocation::PullRequest(changeset) => {
+ let row = self.inner.sessions.get(session).await?;
+ self.inner
+ .extractor
+ .pull_request_patch(&row, changeset)
+ .await
+ }
+ };
+ patch
.map_err(ChangesError::Storage)?
.ok_or(ChangesError::PatchMissing)
}
@@ -278,42 +291,68 @@ where
async fn store(
&self,
row: &AgentSession,
- extracted: super::model::ExtractedChangeset,
+ extracted: ExtractedChangeset,
) -> Result<CaptureOutcome> {
let session = row.id;
- let parsed = patch::parse_git_patch(&extracted.patch);
- let budgeted = patch::budget_patch(parsed, MAX_PATCH_BYTES, MAX_FILE_PATCH_BYTES);
- let (additions, deletions) = patch::totals(&budgeted.files);
- let id = ChangesetId::new();
- let key = (!budgeted.patch.is_empty()).then(|| PatchBlobKey::for_changeset(session, id));
- if let Some(key) = &key
- && let Err(error) = self.inner.blobs.put_patch(key, &budgeted.patch).await
- {
- let _ = self
- .fail(
+ let (changeset, location) = match extracted {
+ ExtractedChangeset::Patch {
+ source,
+ range,
+ patch,
+ truncated,
+ } => {
+ let parsed = patch::parse_git_patch(&patch);
+ let budgeted = patch::budget_patch(parsed, MAX_PATCH_BYTES, MAX_FILE_PATCH_BYTES);
+ let (additions, deletions) = patch::totals(&budgeted.files);
+ let id = ChangesetId::new();
+ let key =
+ (!budgeted.patch.is_empty()).then(|| PatchBlobKey::for_changeset(session, id));
+ if let Some(key) = &key
+ && let Err(error) = self.inner.blobs.put_patch(key, &budgeted.patch).await
+ {
+ let _ = self
+ .fail(
+ session,
+ AttemptOutcome::Failed,
+ "Storing the changes failed.".to_owned(),
+ )
+ .await;
+ return Err(ChangesError::Storage(error));
+ }
+ let changeset = Changeset {
+ id,
session,
- AttemptOutcome::Failed,
- "Storing the changes failed.".to_owned(),
- )
- .await;
- return Err(ChangesError::Storage(error));
- }
- let changeset = Changeset {
- id,
- session,
- source: extracted.source,
- range: extracted.range,
- patch_bytes: budgeted.patch.len() as u64,
- files: budgeted.files,
- additions,
- deletions,
- truncated: budgeted.truncated || extracted.truncated,
- captured_at: Utc::now(),
+ source,
+ range,
+ patch_bytes: budgeted.patch.len() as u64,
+ files: budgeted.files,
+ additions,
+ deletions,
+ truncated: budgeted.truncated || truncated,
+ captured_at: Utc::now(),
+ };
+ (changeset, key.map(PatchLocation::Blob))
+ }
+ ExtractedChangeset::PullRequest(shared) => {
+ let changeset = Changeset {
+ id: ChangesetId::from_uuid(shared.id),
+ session,
+ source: ChangesetSource::GithubPullRequest,
+ range: shared.range,
+ files: shared.files,
+ additions: shared.additions,
+ deletions: shared.deletions,
+ patch_bytes: shared.patch_bytes,
+ truncated: shared.truncated,
+ captured_at: Utc::now(),
+ };
+ (changeset, Some(PatchLocation::PullRequest(shared.id)))
+ }
};
let superseded = match self
.inner
.repo
- .record_changeset(&changeset, key.as_ref(), Utc::now())
+ .record_changeset(&changeset, location.as_ref(), Utc::now())
.await
{
Ok(superseded) => superseded,
@@ -331,7 +370,7 @@ where
// The old patch is unreachable now that the row points elsewhere;
// deleting it is tidiness, not correctness, so a failure only logs.
if let Some(old) = superseded
- && key.as_ref() != Some(&old)
+ && !matches!(&location, Some(PatchLocation::Blob(key)) if *key == old)
&& let Err(error) = self.inner.blobs.delete_patch(&old).await
{
tracing::warn!(error = ?error, %session, key = %old, "could not delete a superseded patch");
@@ -339,8 +378,8 @@ where
tracing::info!(
%session,
files = changeset.files.len(),
- additions,
- deletions,
+ additions = changeset.additions,
+ deletions = changeset.deletions,
truncated = changeset.truncated,
source = %changeset.source,
"captured session changes"
diff --git a/crates/agent_changes/src/domain/service/test.rs b/crates/agent_changes/src/domain/service/test.rs
index ddd0d00372..a644895690 100644
--- a/crates/agent_changes/src/domain/service/test.rs
+++ b/crates/agent_changes/src/domain/service/test.rs
@@ -1,5 +1,8 @@
use super::*;
-use crate::domain::model::{ChangesetRange, ChangesetSource, ExtractedChangeset, GitRef};
+use crate::domain::model::{
+ ChangedFile, ChangesetRange, ChangesetSource, ExtractedChangeset, FileChangeKind, GitRef,
+ GithubPullRequestChangeset, PullRequestRef,
+};
use crate::testing::{MemoryBlobStore, MemoryChangesetRepo, ScriptedExtractor};
use agent_session::testing::{InMemoryAgentSessionRepo, RecordingRealtime, test_agent_session};
@@ -25,7 +28,7 @@ type TestService = AgentChangesService<
>;
fn extracted(patch: &str) -> ExtractedChangeset {
- ExtractedChangeset {
+ ExtractedChangeset::Patch {
source: ChangesetSource::GithubPullRequest,
range: ChangesetRange {
repository: Some("https://github.com/example/example".to_owned()),
@@ -37,6 +40,41 @@ fn extracted(patch: &str) -> ExtractedChangeset {
}
}
+fn shared(id: Uuid) -> ExtractedChangeset {
+ ExtractedChangeset::PullRequest(GithubPullRequestChangeset {
+ id,
+ github_key: "github:1:7".to_owned(),
+ pull_request: PullRequestRef::parse("https://github.com/example/example/pull/7")
+ .expect("a pull request url"),
+ range: ChangesetRange {
+ repository: Some("https://github.com/example/example".to_owned()),
+ base: GitRef {
+ name: Some("main".to_owned()),
+ sha: Some("aaa".to_owned()),
+ },
+ head: GitRef {
+ name: Some("agent/work".to_owned()),
+ sha: Some("bbb".to_owned()),
+ },
+ },
+ files: vec![ChangedFile {
+ path: "src/lib.rs".to_owned(),
+ previous_path: None,
+ kind: FileChangeKind::Modified,
+ additions: 1,
+ deletions: 0,
+ binary: false,
+ patch_omitted: false,
+ }],
+ additions: 1,
+ deletions: 0,
+ patch_bytes: PATCH.len() as u64,
+ truncated: false,
+ patch_key: Some("pull-requests/example/example/7/aaa...bbb.patch".to_owned()),
+ captured_at: Utc::now(),
+ })
+}
+
fn service(extractor: ScriptedExtractor) -> (TestService, MemoryChangesetRepo, MemoryBlobStore) {
let sessions = InMemoryAgentSessionRepo::new();
sessions.insert_session(test_agent_session(SESSION));
@@ -123,6 +161,48 @@ async fn a_new_capture_replaces_the_summary_and_drops_the_old_patch() {
);
}
+#[tokio::test]
+async fn a_pull_request_capture_shares_its_changeset_instead_of_storing_a_copy() {
+ let id = macro_uuid::generate_uuid_v7();
+ let extractor = ScriptedExtractor::returning(shared(id));
+ extractor.set_pull_request_patch(id, PATCH);
+ let (service, _repo, blobs) = service(extractor);
+
+ let CaptureOutcome::Captured(changeset) = service.capture(SESSION).await.unwrap() else {
+ panic!("expected a capture");
+ };
+ assert_eq!(changeset.id.as_uuid(), id);
+ assert_eq!(changeset.session, SESSION);
+ assert_eq!(changeset.files.len(), 1);
+ assert_eq!(changeset.range.head.sha.as_deref(), Some("bbb"));
+ assert!(blobs.keys().is_empty(), "the session stores no patch");
+ assert_eq!(service.patch(&view_access()).await.unwrap(), PATCH);
+}
+
+#[tokio::test]
+async fn sharing_a_pull_request_changeset_drops_the_sessions_own_patch() {
+ let extractor = ScriptedExtractor::returning(extracted(PATCH));
+ let (service, _repo, blobs) = service(extractor.clone());
+ service.capture(SESSION).await.unwrap();
+ assert_eq!(blobs.keys().len(), 1);
+
+ extractor.set(shared(macro_uuid::generate_uuid_v7()));
+ service.capture(SESSION).await.unwrap();
+ assert!(blobs.keys().is_empty());
+}
+
+#[tokio::test]
+async fn a_shared_patch_that_can_no_longer_be_read_is_missing() {
+ let (service, _repo, _blobs) = service(ScriptedExtractor::returning(shared(
+ macro_uuid::generate_uuid_v7(),
+ )));
+ service.capture(SESSION).await.unwrap();
+ assert!(matches!(
+ service.patch(&view_access()).await,
+ Err(ChangesError::PatchMissing)
+ ));
+}
+
#[tokio::test]
async fn an_empty_patch_is_a_changeset_with_nothing_in_it() {
let (service, _repo, blobs) = service(ScriptedExtractor::returning(extracted("")));
diff --git a/crates/agent_changes/src/outbound/postgres.rs b/crates/agent_changes/src/outbound/postgres.rs
index 67d9f5fe05..7ddbda3c5e 100644
--- a/crates/agent_changes/src/outbound/postgres.rs
+++ b/crates/agent_changes/src/outbound/postgres.rs
@@ -10,7 +10,7 @@ use crate::domain::model::{
ChangesetRange, ChangesetSource, GitRef, SessionChanges,
};
use crate::domain::ports::{
- ChangesetRepo, PatchBlobKey, SessionBranchReader, SessionBranchesFuture,
+ ChangesetRepo, PatchBlobKey, PatchLocation, SessionBranchReader, SessionBranchesFuture,
};
#[cfg(test)]
@@ -162,18 +162,23 @@ impl ChangesetRepo for PgChangesetRepo {
}
#[tracing::instrument(
- skip(self, changeset, patch_key),
+ skip(self, changeset, patch),
err,
fields(agent.session.id = %changeset.session, changeset.id = %changeset.id)
)]
async fn record_changeset(
&self,
changeset: &Changeset,
- patch_key: Option<&PatchBlobKey>,
+ patch: Option<&PatchLocation>,
finished_at: DateTime<Utc>,
) -> Result<Option<PatchBlobKey>, rootcause::Report> {
let files = serde_json::to_value(&changeset.files)
.map_err(|error| rootcause::report!("serialize changed files: {error}"))?;
+ let (patch_blob_key, pull_request_changeset_id) = match patch {
+ Some(PatchLocation::Blob(key)) => (Some(key.as_str()), None),
+ Some(PatchLocation::PullRequest(id)) => (None, Some(*id)),
+ None => (None, None),
+ };
// The CTE reads the row as it was before this statement, which is
// what makes "the key this capture superseded" one round trip.
let superseded = sqlx::query_scalar!(
@@ -184,13 +189,15 @@ impl ChangesetRepo for PgChangesetRepo {
INSERT INTO agent_session_changes (
agent_session_id, changeset_id, source, repository,
base_ref, base_sha, head_ref, head_sha,
- files, additions, deletions, patch_blob_key, patch_bytes, truncated,
+ files, additions, deletions, patch_blob_key, pull_request_changeset_id,
+ patch_bytes, truncated,
captured_at, attempt_started_at, attempt_finished_at, attempt_outcome, attempt_error
)
VALUES (
$1, $2, $3, $4,
$5, $6, $7, $8,
- $9, $10, $11, $12, $13, $14,
+ $9, $10, $11, $12, $17,
+ $13, $14,
$15, $16, $16, 'captured', NULL
)
ON CONFLICT (agent_session_id) DO UPDATE SET
@@ -205,6 +212,7 @@ impl ChangesetRepo for PgChangesetRepo {
additions = EXCLUDED.additions,
deletions = EXCLUDED.deletions,
patch_blob_key = EXCLUDED.patch_blob_key,
+ pull_request_changeset_id = EXCLUDED.pull_request_changeset_id,
patch_bytes = EXCLUDED.patch_bytes,
truncated = EXCLUDED.truncated,
captured_at = EXCLUDED.captured_at,
@@ -225,11 +233,12 @@ impl ChangesetRepo for PgChangesetRepo {
files,
i32::try_from(changeset.additions).unwrap_or(i32::MAX),
i32::try_from(changeset.deletions).unwrap_or(i32::MAX),
- patch_key.map(PatchBlobKey::as_str),
+ patch_blob_key,
i64::try_from(changeset.patch_bytes).unwrap_or(i64::MAX),
changeset.truncated,
changeset.captured_at,
finished_at,
+ pull_request_changeset_id,
)
.fetch_one(&self.pool)
.await
@@ -291,17 +300,27 @@ impl ChangesetRepo for PgChangesetRepo {
}
#[tracing::instrument(skip(self), err, fields(agent.session.id = %session))]
- async fn patch_key(
+ async fn patch_location(
&self,
session: AgentSessionId,
- ) -> Result<Option<PatchBlobKey>, rootcause::Report> {
- let key = sqlx::query_scalar!(
- r#"SELECT patch_blob_key FROM agent_session_changes WHERE agent_session_id = $1"#,
+ ) -> Result<Option<PatchLocation>, rootcause::Report> {
+ let row = sqlx::query!(
+ r#"
+ SELECT patch_blob_key, pull_request_changeset_id
+ FROM agent_session_changes
+ WHERE agent_session_id = $1
+ "#,
session.as_uuid(),
)
.fetch_optional(&self.pool)
.await
.map_err(|error| rootcause::report!(error))?;
- Ok(key.flatten().map(PatchBlobKey::from_stored))
+ Ok(row.and_then(
+ |row| match (row.patch_blob_key, row.pull_request_changeset_id) {
+ (Some(key), _) => Some(PatchLocation::Blob(PatchBlobKey::from_stored(key))),
+ (None, Some(id)) => Some(PatchLocation::PullRequest(id)),
+ (None, None) => None,
+ },
+ ))
}
}
diff --git a/crates/agent_changes/src/outbound/postgres/test.rs b/crates/agent_changes/src/outbound/postgres/test.rs
index c03acef3e7..b5ac38261a 100644
--- a/crates/agent_changes/src/outbound/postgres/test.rs
+++ b/crates/agent_changes/src/outbound/postgres/test.rs
@@ -96,7 +96,7 @@ async fn a_session_without_captures_reads_as_empty(pool: PgPool) {
let repo = PgChangesetRepo::new(pool.clone());
let session = seed_session(&pool).await;
assert_eq!(repo.get(session).await.unwrap(), SessionChanges::default());
- assert!(repo.patch_key(session).await.unwrap().is_none());
+ assert!(repo.patch_location(session).await.unwrap().is_none());
}
#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
@@ -183,7 +183,11 @@ async fn a_captured_changeset_round_trips_and_reports_what_it_superseded(pool: P
let first = changeset(session);
let first_key = PatchBlobKey::for_changeset(session, first.id);
let superseded = repo
- .record_changeset(&first, Some(&first_key), Utc::now())
+ .record_changeset(
+ &first,
+ Some(&PatchLocation::Blob(first_key.clone())),
+ Utc::now(),
+ )
.await
.unwrap();
assert!(superseded.is_none(), "nothing came before");
@@ -203,8 +207,8 @@ async fn a_captured_changeset_round_trips_and_reports_what_it_superseded(pool: P
Some(AttemptOutcome::Captured)
);
assert_eq!(
- repo.patch_key(session).await.unwrap(),
- Some(first_key.clone())
+ repo.patch_location(session).await.unwrap(),
+ Some(PatchLocation::Blob(first_key.clone()))
);
let mut second = changeset(session);
@@ -219,7 +223,7 @@ async fn a_captured_changeset_round_trips_and_reports_what_it_superseded(pool: P
Some(first_key),
"the old patch is reported for cleanup"
);
- assert!(repo.patch_key(session).await.unwrap().is_none());
+ assert!(repo.patch_location(session).await.unwrap().is_none());
assert!(
repo.get(session)
.await
@@ -231,6 +235,59 @@ async fn a_captured_changeset_round_trips_and_reports_what_it_superseded(pool: P
);
}
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn a_shared_pull_request_changeset_replaces_the_sessions_own_patch(pool: PgPool) {
+ let repo = PgChangesetRepo::new(pool.clone());
+ let session = seed_session(&pool).await;
+ let first = changeset(session);
+ let first_key = PatchBlobKey::for_changeset(session, first.id);
+ repo.record_changeset(
+ &first,
+ Some(&PatchLocation::Blob(first_key.clone())),
+ Utc::now(),
+ )
+ .await
+ .unwrap();
+
+ let shared = macro_uuid::generate_uuid_v7();
+ sqlx::query!(
+ r#"
+ INSERT INTO github_pull_request_changeset (
+ id, github_key, repository, number, base_sha, head_sha, captured_at
+ )
+ VALUES ($1, 'github:1:7', 'https://github.com/example/example', 7, 'aaa', 'bbb', now())
+ "#,
+ shared,
+ )
+ .execute(&pool)
+ .await
+ .expect("insert github_pull_request_changeset");
+ let mut second = changeset(session);
+ second.id = ChangesetId::from_uuid(shared);
+ let superseded = repo
+ .record_changeset(
+ &second,
+ Some(&PatchLocation::PullRequest(shared)),
+ Utc::now(),
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(
+ superseded,
+ Some(first_key),
+ "the session's own patch is reported for cleanup"
+ );
+ assert_eq!(
+ repo.patch_location(session).await.unwrap(),
+ Some(PatchLocation::PullRequest(shared))
+ );
+ assert_eq!(
+ repo.get(session).await.unwrap().changeset.map(|c| c.id),
+ Some(second.id)
+ );
+}
+
#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
async fn a_failed_attempt_keeps_the_previous_changeset(pool: PgPool) {
let repo = PgChangesetRepo::new(pool.clone());
diff --git a/crates/agent_changes/src/testing.rs b/crates/agent_changes/src/testing.rs
index 611c762eb8..78d0a7858c 100644
--- a/crates/agent_changes/src/testing.rs
+++ b/crates/agent_changes/src/testing.rs
@@ -6,12 +6,15 @@ use std::sync::{Arc, Mutex};
use agent_session::domain::model::AgentSession;
use chrono::{DateTime, Utc};
+use macro_uuid::Uuid;
use crate::domain::error::ExtractError;
use crate::domain::model::{
AgentSessionId, AttemptOutcome, CaptureAttempt, Changeset, ExtractedChangeset, SessionChanges,
};
-use crate::domain::ports::{ChangesetBlobStore, ChangesetExtractor, ChangesetRepo, PatchBlobKey};
+use crate::domain::ports::{
+ ChangesetBlobStore, ChangesetExtractor, ChangesetRepo, PatchBlobKey, PatchLocation,
+};
/// An extractor that answers with whatever it was last told to, and counts
/// how often it was asked.
@@ -24,6 +27,7 @@ pub struct ScriptedExtractor {
struct ScriptedState {
answer: Option<Result<ExtractedChangeset, String>>,
not_ready: Option<String>,
+ pull_request_patches: HashMap<Uuid, String>,
calls: usize,
}
@@ -57,6 +61,15 @@ impl ScriptedExtractor {
self.state.lock().expect("scripted state").answer = Some(Ok(changeset));
}
+ /// Serve `patch` as the patch of the pull request changeset `changeset`.
+ pub fn set_pull_request_patch(&self, changeset: Uuid, patch: &str) {
+ self.state
+ .lock()
+ .expect("scripted state")
+ .pull_request_patches
+ .insert(changeset, patch.to_owned());
+ }
+
/// How many extractions were asked for.
#[must_use]
pub fn calls(&self) -> usize {
@@ -79,12 +92,21 @@ impl ChangesetExtractor for ScriptedExtractor {
))),
}
}
+
+ async fn pull_request_patch(
+ &self,
+ _session: &AgentSession,
+ changeset: Uuid,
+ ) -> Result<Option<String>, rootcause::Report> {
+ let state = self.state.lock().expect("scripted state");
+ Ok(state.pull_request_patches.get(&changeset).cloned())
+ }
}
#[derive(Default)]
struct MemoryRow {
changeset: Option<Changeset>,
- patch_key: Option<PatchBlobKey>,
+ patch: Option<PatchLocation>,
attempt: Option<CaptureAttempt>,
}
@@ -121,14 +143,17 @@ impl ChangesetRepo for MemoryChangesetRepo {
async fn record_changeset(
&self,
changeset: &Changeset,
- patch_key: Option<&PatchBlobKey>,
+ patch: Option<&PatchLocation>,
finished_at: DateTime<Utc>,
) -> Result<Option<PatchBlobKey>, rootcause::Report> {
let mut rows = self.rows.lock().expect("rows");
let row = rows.entry(changeset.session).or_default();
- let superseded = row.patch_key.take();
+ let superseded = match row.patch.take() {
+ Some(PatchLocation::Blob(key)) => Some(key),
+ Some(PatchLocation::PullRequest(_)) | None => None,
+ };
row.changeset = Some(changeset.clone());
- row.patch_key = patch_key.cloned();
+ row.patch = patch.cloned();
if let Some(attempt) = row.attempt.as_mut() {
attempt.finished_at = Some(finished_at);
attempt.outcome = Some(AttemptOutcome::Captured);
@@ -165,12 +190,12 @@ impl ChangesetRepo for MemoryChangesetRepo {
.unwrap_or_default())
}
- async fn patch_key(
+ async fn patch_location(
&self,
session: AgentSessionId,
- ) -> Result<Option<PatchBlobKey>, rootcause::Report> {
+ ) -> Result<Option<PatchLocation>, rootcause::Report> {
let rows = self.rows.lock().expect("rows");
- Ok(rows.get(&session).and_then(|row| row.patch_key.clone()))
+ Ok(rows.get(&session).and_then(|row| row.patch.clone()))
}
}
diff --git a/crates/github/src/domain/models.rs b/crates/github/src/domain/models.rs
index 60e04aa9f1..cfcde54f0b 100644
--- a/crates/github/src/domain/models.rs
+++ b/crates/github/src/domain/models.rs
@@ -16,7 +16,7 @@ pub use app_jwt::AppJwt;
pub(crate) use app_jwt::app_jwt;
pub use github_pull_requests::domain::models::{
EnrichGithubPullRequestsProxyRequest, EnrichGithubPullRequestsResponse,
- EnrichedGithubPullRequest, GITHUB_PULL_REQUEST_FOREIGN_ENTITY_SOURCE, GithubKey,
+ EnrichedGithubPullRequest, GITHUB_PULL_REQUEST_FOREIGN_ENTITY_SOURCE, GitRef, GithubKey,
GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestDetails,
GithubPullRequestLabel, GithubPullRequestRef, GithubPullRequestReview,
GithubPullRequestReviewState, GithubPullRequestStatus, GithubPullRequestUser, latest_reviews,
diff --git a/crates/github/src/domain/service/link_test.rs b/crates/github/src/domain/service/link_test.rs
index 57d39bfcc6..9ded90c69c 100644
--- a/crates/github/src/domain/service/link_test.rs
+++ b/crates/github/src/domain/service/link_test.rs
@@ -231,6 +231,8 @@ fn default_pull_request_details() -> GithubPullRequestDetails {
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
}
}
diff --git a/crates/github/src/domain/service/sync.rs b/crates/github/src/domain/service/sync.rs
index 6e925b9688..3266ec823d 100644
--- a/crates/github/src/domain/service/sync.rs
+++ b/crates/github/src/domain/service/sync.rs
@@ -13,7 +13,7 @@ mod realtime;
use crate::domain::{
models::{
- EnrichedGithubPullRequest, GithubAppInstallationSource, GithubError,
+ EnrichedGithubPullRequest, GitRef, GithubAppInstallationSource, GithubError,
GithubInstallationAccessToken, GithubInstallationSetupAction, GithubKey,
GithubPullRequestDetails, GithubPullRequestLabel, GithubPullRequestReview,
GithubPullRequestReviewState, GithubPullRequestStatus, GithubPullRequestUser,
@@ -295,9 +295,24 @@ impl<
.map(|labels| labels.iter().filter_map(Self::label_from_payload).collect()),
reviews: Self::review_from_payload(event.payload.get("review"))
.map(|review| vec![review]),
+ base: pull_request.and_then(|pr| Self::git_ref_from_payload(pr.get("base")?)),
+ head: pull_request.and_then(|pr| Self::git_ref_from_payload(pr.get("head")?)),
})
}
+ /// A pull request payload's `base` or `head`: the branch and the commit it points at.
+ fn git_ref_from_payload(branch: &serde_json::Value) -> Option<GitRef> {
+ let name = branch
+ .get("ref")
+ .and_then(|value| value.as_str())
+ .map(str::to_string);
+ let sha = branch
+ .get("sha")
+ .and_then(|value| value.as_str())
+ .map(str::to_string);
+ (name.is_some() || sha.is_some()).then_some(GitRef { name, sha })
+ }
+
fn user_from_payload(user: &serde_json::Value) -> Option<GithubPullRequestUser> {
Some(GithubPullRequestUser {
github_user_id: user.get("id")?.as_u64()?.to_string(),
@@ -451,6 +466,8 @@ impl<
.chain(fallback.into_iter().flatten()),
)),
},
+ base: details.base.or(fallback.base),
+ head: details.head.or(fallback.head),
}
}
diff --git a/crates/github/src/domain/service/sync/test.rs b/crates/github/src/domain/service/sync/test.rs
index 39412ad0af..5ac9a2619b 100644
--- a/crates/github/src/domain/service/sync/test.rs
+++ b/crates/github/src/domain/service/sync/test.rs
@@ -3,7 +3,7 @@ use std::sync::{Arc, Mutex};
use crate::domain::{
models::{
- EnrichedGithubPullRequest, GITHUB_PULL_REQUEST_FOREIGN_ENTITY_SOURCE,
+ EnrichedGithubPullRequest, GITHUB_PULL_REQUEST_FOREIGN_ENTITY_SOURCE, GitRef,
GithubAppInstallationSource, GithubAuthenticatedUser, GithubError,
GithubInstallationAccessToken, GithubKey, GithubPullRequestCheckRun,
GithubPullRequestComment, GithubPullRequestDetails, GithubPullRequestStatus,
@@ -1360,6 +1360,11 @@ fn expected_pull_request_metadata(
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: Some(GitRef {
+ name: Some("feature/some-branch".to_string()),
+ sha: None,
+ }),
})
.unwrap()
}
@@ -1544,6 +1549,8 @@ fn backfilled_pull_request(title: &str) -> EnrichedGithubPullRequest {
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
}
}
@@ -1574,6 +1581,12 @@ fn expected_pull_request_metadata_from_details(
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ // The fixture's webhook supplies the head even when live details omit it.
+ head: Some(GitRef {
+ name: Some("feature/some-branch".to_string()),
+ sha: None,
+ }),
})
.unwrap()
}
@@ -1637,6 +1650,8 @@ fn pull_request_details(
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
}
}
diff --git a/crates/github/src/outbound/pull_request_metadata.rs b/crates/github/src/outbound/pull_request_metadata.rs
index 57236e90df..51a6669cf4 100644
--- a/crates/github/src/outbound/pull_request_metadata.rs
+++ b/crates/github/src/outbound/pull_request_metadata.rs
@@ -8,10 +8,10 @@ use std::time::Duration;
use serde::de::DeserializeOwned;
use crate::domain::models::{
- EnrichedGithubPullRequest, GithubKey, GithubPullRequestCheckRun, GithubPullRequestComment,
- GithubPullRequestDetails, GithubPullRequestLabel, GithubPullRequestReview,
- GithubPullRequestReviewState, GithubPullRequestStatus, GithubPullRequestUser, GithubRepository,
- latest_reviews,
+ EnrichedGithubPullRequest, GitRef, GithubKey, GithubPullRequestCheckRun,
+ GithubPullRequestComment, GithubPullRequestDetails, GithubPullRequestLabel,
+ GithubPullRequestReview, GithubPullRequestReviewState, GithubPullRequestStatus,
+ GithubPullRequestUser, GithubRepository, latest_reviews,
};
const GITHUB_API_BASE_URL: &str = "https://api.github.com";
@@ -76,6 +76,8 @@ pub(crate) async fn fetch_pull_request_metadata(
assignees: Some(pull_request_users(&pull_request.assignees)),
labels: Some(pull_request_labels(&pull_request.labels)),
reviews,
+ base: pull_request.base.git_ref(),
+ head: Some(pull_request.head.git_ref()),
})
}
@@ -201,6 +203,8 @@ struct GithubOpenPullRequestResponse {
#[serde(default)]
base: GithubPullRequestBaseResponse,
#[serde(default)]
+ head: Option<GithubPullRequestHeadResponse>,
+ #[serde(default)]
draft: Option<bool>,
#[serde(default)]
updated_at: Option<chrono::DateTime<chrono::Utc>>,
@@ -263,18 +267,40 @@ fn structural_participant_ids(
#[derive(Debug, serde::Deserialize)]
struct GithubPullRequestHeadResponse {
+ #[serde(default, rename = "ref")]
+ name: Option<String>,
sha: String,
}
+impl GithubPullRequestHeadResponse {
+ fn git_ref(&self) -> GitRef {
+ GitRef {
+ name: self.name.clone(),
+ sha: Some(self.sha.clone()),
+ }
+ }
+}
+
#[derive(Debug, Default, serde::Deserialize)]
struct GithubPullRequestBaseResponse {
repo: Option<GithubRepositoryIdResponse>,
+ #[serde(default, rename = "ref")]
+ name: Option<String>,
+ #[serde(default)]
+ sha: Option<String>,
}
impl GithubPullRequestBaseResponse {
fn repository_id(&self) -> Option<u64> {
self.repo.as_ref().map(|repo| repo.id)
}
+
+ fn git_ref(&self) -> Option<GitRef> {
+ (self.name.is_some() || self.sha.is_some()).then(|| GitRef {
+ name: self.name.clone(),
+ sha: self.sha.clone(),
+ })
+ }
}
#[derive(Debug, serde::Deserialize)]
@@ -710,6 +736,11 @@ impl GithubOpenPullRequestResponse {
assignees: Some(pull_request_users(&self.assignees)),
labels: Some(pull_request_labels(&self.labels)),
reviews: None,
+ base: self.base.git_ref(),
+ head: self
+ .head
+ .as_ref()
+ .map(GithubPullRequestHeadResponse::git_ref),
}
}
}
diff --git a/crates/github_pull_requests/Cargo.toml b/crates/github_pull_requests/Cargo.toml
index 05d30157ec..8455040853 100644
--- a/crates/github_pull_requests/Cargo.toml
+++ b/crates/github_pull_requests/Cargo.toml
@@ -21,11 +21,14 @@ outbound = [
"ports",
]
ports = ["dep:entity_access", "dep:item_filters", "foreign_entity/ports"]
-schema = ["dep:utoipa"]
+# Pull request patches in S3.
+s3 = ["dep:aws-sdk-s3", "outbound"]
+schema = ["dep:utoipa", "git_patch/schema"]
service = ["ports"]
[dependencies]
anyhow = { workspace = true }
+aws-sdk-s3 = { workspace = true, optional = true }
axum = { workspace = true, optional = true }
chrono = { workspace = true }
entity_access = { path = "../entity_access", optional = true, default-features = false, features = ["ports"] }
diff --git a/crates/github_pull_requests/src/domain/models.rs b/crates/github_pull_requests/src/domain/models.rs
index fbd83f2db0..661f206610 100644
--- a/crates/github_pull_requests/src/domain/models.rs
+++ b/crates/github_pull_requests/src/domain/models.rs
@@ -3,13 +3,19 @@
#[cfg(test)]
mod test;
+mod changes;
mod diff;
mod key;
mod pull_request;
use chrono::{DateTime, Utc};
use foreign_entity::domain::models::{ForeignEntity, ForeignEntityError, SourceId};
+use git_patch::wire::GitRefDto;
+pub use changes::{
+ GithubPullRequestChangesError, GithubPullRequestChangeset, changeset_id, changeset_patch_key,
+ github_key_of,
+};
pub use diff::{
ChangesetRange, GitRef, GithubPullRequestDiff, GithubPullRequestDiffError, PullRequestRef,
RepositorySlug,
@@ -93,6 +99,10 @@ pub struct GithubPullRequestRow {
pub reviews: Vec<GithubPullRequestReview>,
/// Where the review stands, derived from `reviews` and the outstanding review requests.
pub review_decision: Option<GithubPullRequestReviewDecision>,
+ /// The branch and commit the pull request merges into, when known.
+ pub base: Option<GitRef>,
+ /// The branch and commit carrying the pull request's changes, when known.
+ pub head: Option<GitRef>,
}
impl GithubPullRequestRow {
@@ -132,6 +142,8 @@ impl GithubPullRequestRow {
requested_reviewer_github_user_ids: pull_request
.requested_reviewer_github_user_ids
.unwrap_or_default(),
+ base: pull_request.base,
+ head: pull_request.head,
})
}
}
@@ -173,6 +185,10 @@ pub struct GithubPullRequestWrite {
pub labels: Option<Vec<GithubPullRequestLabel>>,
/// Reviews, if supplied.
pub reviews: Option<Vec<GithubPullRequestReview>>,
+ /// Base ref, if supplied; its name and SHA form one update.
+ pub base: Option<GitRef>,
+ /// Head ref, if supplied; its name and SHA form one update.
+ pub head: Option<GitRef>,
}
impl GithubPullRequestWrite {
@@ -207,6 +223,8 @@ impl GithubPullRequestWrite {
assignees: pull_request.assignees.clone(),
labels: pull_request.labels.clone(),
reviews: pull_request.reviews.clone(),
+ base: pull_request.base.clone(),
+ head: pull_request.head.clone(),
})
}
@@ -238,6 +256,8 @@ impl GithubPullRequestWrite {
labels: Vec::new(),
reviews: Vec::new(),
review_decision: None,
+ base: None,
+ head: None,
});
row.repository_id = self.repository_id.or(row.repository_id);
row.number = self.number;
@@ -261,6 +281,12 @@ impl GithubPullRequestWrite {
if let Some(labels) = &self.labels {
row.labels = labels.clone();
}
+ if let Some(base) = &self.base {
+ row.base = Some(base.clone());
+ }
+ if let Some(head) = &self.head {
+ row.head = Some(head.clone());
+ }
row.participant_github_user_ids = row
.participant_github_user_ids
.into_iter()
@@ -303,6 +329,8 @@ impl From<&GithubPullRequestRow> for GithubPullRequestWrite {
assignees: Some(row.assignees.clone()),
labels: Some(row.labels.clone()),
reviews: Some(row.reviews.clone()),
+ base: row.base.clone(),
+ head: row.head.clone(),
}
}
}
@@ -377,6 +405,12 @@ pub struct StoredGithubPullRequest {
/// When GitHub last updated the pull request.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub github_updated_at: Option<DateTime<Utc>>,
+ /// The branch and commit the pull request merges into, when known.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub base: Option<GitRefDto>,
+ /// The branch and commit carrying the pull request's changes, when known.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub head: Option<GitRefDto>,
}
impl StoredGithubPullRequest {
@@ -420,6 +454,8 @@ impl StoredGithubPullRequest {
comments: pull_request.comments.unwrap_or_default(),
checks: pull_request.checks.unwrap_or_default(),
github_updated_at: row.github_updated_at,
+ base: row.base.map(Into::into),
+ head: row.head.map(Into::into),
})
}
}
diff --git a/crates/github_pull_requests/src/domain/models/changes.rs b/crates/github_pull_requests/src/domain/models/changes.rs
new file mode 100644
index 0000000000..2d2c60a215
--- /dev/null
+++ b/crates/github_pull_requests/src/domain/models/changes.rs
@@ -0,0 +1,101 @@
+//! A pull request's changes at one base and head.
+
+use chrono::{DateTime, Utc};
+use git_patch::ChangedFile;
+use uuid::Uuid;
+
+use super::{
+ ChangesetRange, GithubKey, GithubPullRequestDiffError, GithubPullRequestError, PullRequestRef,
+};
+
+#[cfg(test)]
+mod test;
+
+/// A pull request's changes between one base commit and one head commit: every changed file,
+/// and where the patch is stored.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct GithubPullRequestChangeset {
+ /// Derived from the pull request and both commits by [`changeset_id`].
+ pub id: Uuid,
+ /// The pull request's `owner/repo/pull/number` key when the changes were read.
+ pub github_key: String,
+ /// The pull request the changes belong to.
+ pub pull_request: PullRequestRef,
+ /// The commits compared.
+ pub range: ChangesetRange,
+ /// Every changed file, in patch order.
+ pub files: Vec<ChangedFile>,
+ /// Lines added across all files.
+ pub additions: u32,
+ /// Lines removed across all files.
+ pub deletions: u32,
+ /// Size of the stored patch. Zero when nothing changed.
+ pub patch_bytes: u64,
+ /// Some files' hunks were left out of the stored patch to fit the size budget.
+ pub truncated: bool,
+ /// Where the patch is stored; `None` when nothing changed.
+ pub patch_key: Option<String>,
+ /// When the changes were read from GitHub.
+ pub captured_at: DateTime<Utc>,
+}
+
+/// The id of a pull request's changes between `base_sha` and `head_sha`. The same pull request
+/// and commits always give the same id, so a range is stored once whoever reads it.
+#[must_use]
+pub fn changeset_id(pull_request: &PullRequestRef, base_sha: &str, head_sha: &str) -> Uuid {
+ let name = format!(
+ "{}/pull/{}/changes/{base_sha}...{head_sha}",
+ pull_request.repository.https_url().to_ascii_lowercase(),
+ pull_request.number,
+ );
+ Uuid::new_v5(&Uuid::NAMESPACE_URL, name.as_bytes())
+}
+
+/// Where the patch of a pull request's changes between `base_sha` and `head_sha` is stored.
+#[must_use]
+pub fn changeset_patch_key(
+ pull_request: &PullRequestRef,
+ base_sha: &str,
+ head_sha: &str,
+) -> String {
+ format!(
+ "pull-requests/{}/{}/{}/{base_sha}...{head_sha}.patch",
+ pull_request.repository.owner.to_ascii_lowercase(),
+ pull_request.repository.name.to_ascii_lowercase(),
+ pull_request.number,
+ )
+}
+
+/// The `owner/repo/pull/number` key of `pull_request`.
+#[must_use]
+pub fn github_key_of(pull_request: &PullRequestRef) -> String {
+ GithubKey::new(
+ &pull_request.repository.owner,
+ &pull_request.repository.name,
+ pull_request.number.get(),
+ )
+ .to_string()
+}
+
+/// Why a pull request's changes could not be served.
+#[derive(Debug, thiserror::Error)]
+pub enum GithubPullRequestChangesError {
+ /// The record is not a pull request the caller can see, or the changes are not its.
+ #[error("pull request changes not found")]
+ NotFound,
+ /// Reading changes needs an authenticated user, whose GitHub access the diff is read with.
+ #[error("reading pull request changes needs an authenticated user")]
+ Unauthorized,
+ /// GitHub could not provide the diff.
+ #[error(transparent)]
+ Diff(#[from] GithubPullRequestDiffError),
+ /// The pull request moved past the requested changes, and their stored patch expired.
+ #[error("the pull request has changed since these changes were read")]
+ Moved,
+ /// Reading the pull request failed.
+ #[error(transparent)]
+ PullRequest(#[from] GithubPullRequestError),
+ /// Storing or reading changes failed.
+ #[error("pull request changes storage failed: {0}")]
+ Storage(anyhow::Error),
+}
diff --git a/crates/github_pull_requests/src/domain/models/changes/test.rs b/crates/github_pull_requests/src/domain/models/changes/test.rs
new file mode 100644
index 0000000000..612d33dc95
--- /dev/null
+++ b/crates/github_pull_requests/src/domain/models/changes/test.rs
@@ -0,0 +1,35 @@
+use std::num::NonZeroU64;
+
+use super::*;
+use crate::domain::models::RepositorySlug;
+
+fn pull_request(owner: &str) -> PullRequestRef {
+ PullRequestRef {
+ repository: RepositorySlug {
+ owner: owner.to_string(),
+ name: "App".to_string(),
+ },
+ number: NonZeroU64::new(7).unwrap(),
+ }
+}
+
+#[test]
+fn the_same_pull_request_and_commits_give_the_same_id_whatever_the_case() {
+ assert_eq!(
+ changeset_id(&pull_request("Macro"), "base", "head"),
+ changeset_id(&pull_request("macro"), "base", "head"),
+ );
+ assert_ne!(
+ changeset_id(&pull_request("macro"), "base", "head"),
+ changeset_id(&pull_request("macro"), "base", "new-head"),
+ );
+}
+
+#[test]
+fn patch_keys_name_the_pull_request_and_both_commits() {
+ assert_eq!(
+ changeset_patch_key(&pull_request("Macro"), "base", "head"),
+ "pull-requests/macro/app/7/base...head.patch"
+ );
+ assert_eq!(github_key_of(&pull_request("Macro")), "Macro/App/pull/7");
+}
diff --git a/crates/github_pull_requests/src/domain/models/diff.rs b/crates/github_pull_requests/src/domain/models/diff.rs
index 965fef11ea..44bf892afa 100644
--- a/crates/github_pull_requests/src/domain/models/diff.rs
+++ b/crates/github_pull_requests/src/domain/models/diff.rs
@@ -130,3 +130,21 @@ pub enum GithubPullRequestDiffError {
#[error(transparent)]
Other(anyhow::Error),
}
+
+impl GithubPullRequestDiffError {
+ /// What a user can do about GitHub refusing the diff, in a sentence; `None` for failures
+ /// that are not theirs to fix.
+ #[must_use]
+ pub fn user_message(&self) -> Option<&'static str> {
+ match self {
+ Self::NotFound => Some("This pull request is not available on GitHub."),
+ Self::TooLarge => {
+ Some("This pull request is too large to load here. Review it on GitHub.")
+ }
+ Self::Unavailable => Some(
+ "Macro's GitHub App cannot read this pull request. Check its repository access.",
+ ),
+ Self::Other(_) => None,
+ }
+ }
+}
diff --git a/crates/github_pull_requests/src/domain/models/pull_request.rs b/crates/github_pull_requests/src/domain/models/pull_request.rs
index 64e2faf04c..837a054cf5 100644
--- a/crates/github_pull_requests/src/domain/models/pull_request.rs
+++ b/crates/github_pull_requests/src/domain/models/pull_request.rs
@@ -4,6 +4,8 @@ use std::fmt;
use serde::{Deserialize, Serialize};
+use super::GitRef;
+
/// Foreign entity source used for GitHub pull request records.
pub const GITHUB_PULL_REQUEST_FOREIGN_ENTITY_SOURCE: &str = "github_pull_request";
@@ -387,6 +389,14 @@ pub struct GithubPullRequestDetails {
deserialize_with = "deserialize_optional_array"
)]
pub reviews: Option<Vec<GithubPullRequestReview>>,
+ /// The branch and commit the pull request merges into, when available.
+ #[cfg_attr(feature = "schema", schema(ignore))]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub base: Option<GitRef>,
+ /// The branch and commit carrying the pull request's changes, when available.
+ #[cfg_attr(feature = "schema", schema(ignore))]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub head: Option<GitRef>,
}
impl GithubPullRequestDetails {
@@ -468,6 +478,14 @@ pub struct EnrichedGithubPullRequest {
/// reviewer, so a write that knows one review keeps the others.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reviews: Option<Vec<GithubPullRequestReview>>,
+ /// The branch and commit the pull request merges into, when known.
+ #[cfg_attr(feature = "schema", schema(ignore))]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub base: Option<GitRef>,
+ /// The branch and commit carrying the pull request's changes, when known.
+ #[cfg_attr(feature = "schema", schema(ignore))]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub head: Option<GitRef>,
}
impl EnrichedGithubPullRequest {
@@ -497,6 +515,8 @@ impl EnrichedGithubPullRequest {
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
}
}
@@ -531,6 +551,8 @@ impl EnrichedGithubPullRequest {
assignees: details.assignees,
labels: details.labels,
reviews: details.reviews,
+ base: details.base,
+ head: details.head,
}
}
@@ -539,8 +561,9 @@ impl EnrichedGithubPullRequest {
/// Partial refreshes may omit `comments` or `checks`. When an omitted field exists as an array in
/// `existing_metadata`, the existing array is copied forward so richer metadata is not discarded.
/// The same applies to `authorLogin`, `authorId`, `description`, `repositoryId`, `draft`,
- /// `requestedReviewerGithubUserIds`, `githubUpdatedAt`, `assignees`, and `labels`, which
- /// fallback write paths (such as comment webhooks without a `pull_request` payload) omit.
+ /// `requestedReviewerGithubUserIds`, `githubUpdatedAt`, `assignees`, `labels`, `base`, and
+ /// `head`, which fallback write paths (such as comment webhooks without a `pull_request`
+ /// payload) omit.
/// `reviews` merges per reviewer, keeping each reviewer's most recently submitted review.
pub fn foreign_entity_metadata(
&self,
@@ -576,6 +599,8 @@ impl EnrichedGithubPullRequest {
"githubUpdatedAt",
"assignees",
"labels",
+ "base",
+ "head",
] {
if metadata_object.contains_key(field) {
continue;
diff --git a/crates/github_pull_requests/src/domain/models/test.rs b/crates/github_pull_requests/src/domain/models/test.rs
index 7565a7c4f8..b2312fef26 100644
--- a/crates/github_pull_requests/src/domain/models/test.rs
+++ b/crates/github_pull_requests/src/domain/models/test.rs
@@ -1,3 +1,4 @@
+mod sparse;
use super::*;
#[test]
@@ -41,6 +42,8 @@ fn pull_request_details(
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
}
}
@@ -179,6 +182,8 @@ fn pull_request_response_serializes_with_camel_case_fields() {
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
}],
};
@@ -315,6 +320,8 @@ fn pull_request_enrichment_copies_details_fields() {
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
};
let enriched = EnrichedGithubPullRequest::from_details(reference.clone(), details);
@@ -373,6 +380,8 @@ fn pull_request_foreign_entity_metadata_serializes_enriched_pull_request() {
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
};
let enriched = EnrichedGithubPullRequest::from_details(reference, details);
@@ -501,6 +510,8 @@ fn pull_request_foreign_entity_metadata_keeps_fresh_arrays() {
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
};
let enriched = EnrichedGithubPullRequest::from_details(pull_request_reference(), details);
let existing_metadata = serde_json::json!({
@@ -835,69 +846,6 @@ fn stored_comments_do_not_hide_incoming_review_decisions() {
}
}
-#[test]
-fn sparse_typed_updates_keep_omissions_and_replace_supplied_empty_values() {
- use super::GithubPullRequestWrite;
- let original = GithubPullRequestRow {
- draft: true,
- assignees: vec![GithubPullRequestUser {
- github_user_id: "7".into(),
- login: None,
- }],
- labels: vec![GithubPullRequestLabel {
- name: "bug".into(),
- color: None,
- }],
- reviews: vec![GithubPullRequestReview {
- reviewer_github_user_id: "8".into(),
- reviewer_login: None,
- state: GithubPullRequestReviewState::Approved,
- submitted_at: None,
- }],
- ..GithubPullRequestRow::from_metadata(&serde_json::json!({
- "githubKey":"macro/app/pull/7", "owner":"macro", "repo":"app", "number":7,
- "url":"https://github.com/macro/app/pull/7", "displayName":"PR",
- "requestedReviewerGithubUserIds":["8"], "participantGithubUserIds":["7"]
- }))
- .unwrap()
- };
- let sparse = GithubPullRequestWrite::from_metadata(&serde_json::json!({
- "githubKey":"macro/app/pull/7", "owner":"macro", "repo":"app", "number":7,
- "url":"https://github.com/macro/app/pull/7", "displayName":"PR", "status":"closed",
- "participantGithubUserIds":["9"],
- "reviews":[{"reviewerGithubUserId":"8", "state":"commented"}]
- }))
- .unwrap();
- let merged = sparse.merge(Some(original));
- assert!(merged.draft);
- assert_eq!(merged.assignees.len(), 1);
- assert_eq!(merged.labels.len(), 1);
- assert_eq!(merged.participant_github_user_ids, vec!["7", "9"]);
- assert_eq!(
- merged.reviews[0].state,
- GithubPullRequestReviewState::Approved
- );
- assert_eq!(
- merged.review_decision,
- Some(GithubPullRequestReviewDecision::Approved)
- );
- let supplied = GithubPullRequestWrite {
- draft: Some(false),
- assignees: Some(vec![]),
- labels: Some(vec![]),
- requested_reviewer_github_user_ids: Some(vec![]),
- ..sparse
- };
- let merged = supplied.merge(Some(merged));
- assert!(!merged.draft);
- assert!(merged.assignees.is_empty());
- assert!(merged.labels.is_empty());
- assert!(merged.requested_reviewer_github_user_ids.is_empty());
- assert_eq!(
- merged.review_decision,
- Some(GithubPullRequestReviewDecision::Approved)
- );
-}
fn stored_record(pull_request: &EnrichedGithubPullRequest) -> ForeignEntity {
ForeignEntity {
id: uuid::Uuid::nil(),
@@ -933,51 +881,6 @@ fn stored_response_falls_back_to_record_status_without_overriding_a_known_row_st
);
}
-#[test]
-fn existing_typed_row_ignores_the_entire_fallback() {
- use super::GithubPullRequestWrite;
- let base = GithubPullRequestWrite::from_metadata(&serde_json::json!({
- "githubKey":"macro/app/pull/7", "owner":"macro", "repo":"app", "number":7,
- "url":"https://github.com/macro/app/pull/7", "displayName":"PR",
- "title":"existing", "participantGithubUserIds":["7"],
- "reviews":[{"reviewerGithubUserId":"8", "state":"approved"}]
- }))
- .unwrap();
- let existing = GithubPullRequestWrite {
- title: Some("existing".into()),
- ..base.clone()
- }
- .merge(None);
- let fallback = GithubPullRequestWrite {
- title: Some("fallback".into()),
- status: Some(GithubPullRequestStatus::Closed),
- participant_github_user_ids: Some(vec!["9".into()]),
- reviews: Some(vec![review(
- "10",
- GithubPullRequestReviewState::ChangesRequested,
- 1,
- )]),
- ..base.clone()
- }
- .merge(None);
- let incoming = GithubPullRequestWrite {
- title: None,
- status: None,
- participant_github_user_ids: None,
- reviews: None,
- initial_row: Some(fallback),
- ..base
- };
- let merged = incoming.merge(Some(existing.clone()));
- assert_eq!(merged, existing);
- assert_eq!(merged.participant_github_user_ids, vec!["7"]);
- assert_eq!(merged.reviews.len(), 1);
- assert_eq!(
- merged.review_decision,
- Some(GithubPullRequestReviewDecision::Approved)
- );
-}
-
#[test]
fn stored_response_url_follows_the_row_repository_identity() {
let record = stored_record(&EnrichedGithubPullRequest::from_reference(
@@ -999,39 +902,6 @@ fn stored_response_url_follows_the_row_repository_identity() {
);
}
-#[test]
-fn mismatched_fallback_key_or_number_is_rejected() {
- use super::GithubPullRequestWrite;
- let write = GithubPullRequestWrite::from_metadata(&serde_json::json!({
- "githubKey":"macro/app/pull/7", "owner":"macro", "repo":"app", "number":7,
- "url":"https://github.com/macro/app/pull/7", "displayName":"PR"
- }))
- .unwrap();
- let fallback = GithubPullRequestWrite {
- title: Some("wrong row".into()),
- ..write.clone()
- }
- .merge(None);
- for invalid in [
- GithubPullRequestRow {
- github_key: "other/app/pull/7".into(),
- ..fallback.clone()
- },
- GithubPullRequestRow {
- number: 8,
- ..fallback.clone()
- },
- ] {
- let merged = GithubPullRequestWrite {
- initial_row: Some(invalid),
- ..write.clone()
- }
- .merge(None);
- assert_eq!(merged, write.merge(None));
- assert_eq!(merged.title, None);
- }
-}
-
#[test]
fn stored_response_without_a_row_uses_the_record_identity_and_status() {
let mut pull_request = EnrichedGithubPullRequest::from_reference(pull_request_reference());
@@ -1055,3 +925,30 @@ fn stored_comment_author_ids_intentionally_remain_json_integers() {
assert_eq!(wire["authorGithubUserId"], "583231");
assert_eq!(wire["comments"][0]["authorId"], serde_json::json!(583231));
}
+#[test]
+fn stored_refs_carry_forward_when_a_write_omits_them() {
+ let mut stored = EnrichedGithubPullRequest::from_reference(pull_request_reference());
+ stored.base = Some(GitRef {
+ name: Some("main".to_string()),
+ sha: Some("base-sha".to_string()),
+ });
+ stored.head = Some(GitRef {
+ name: Some("feature".to_string()),
+ sha: Some("head-sha".to_string()),
+ });
+ let existing = stored.foreign_entity_metadata(None).unwrap();
+
+ let merged = EnrichedGithubPullRequest::from_reference(pull_request_reference())
+ .foreign_entity_metadata(Some(&existing))
+ .unwrap();
+ let row = GithubPullRequestRow::from_metadata(&merged).unwrap();
+
+ assert_eq!(
+ row.base.and_then(|base| base.sha).as_deref(),
+ Some("base-sha")
+ );
+ assert_eq!(
+ row.head.and_then(|head| head.name).as_deref(),
+ Some("feature")
+ );
+}
diff --git a/crates/github_pull_requests/src/domain/models/test/sparse.rs b/crates/github_pull_requests/src/domain/models/test/sparse.rs
new file mode 100644
index 0000000000..0eb79f5376
--- /dev/null
+++ b/crates/github_pull_requests/src/domain/models/test/sparse.rs
@@ -0,0 +1,194 @@
+use super::*;
+
+#[test]
+fn sparse_typed_updates_keep_omissions_and_replace_supplied_empty_values() {
+ let original = GithubPullRequestRow {
+ draft: true,
+ assignees: vec![GithubPullRequestUser {
+ github_user_id: "7".into(),
+ login: None,
+ }],
+ labels: vec![GithubPullRequestLabel {
+ name: "bug".into(),
+ color: None,
+ }],
+ reviews: vec![GithubPullRequestReview {
+ reviewer_github_user_id: "8".into(),
+ reviewer_login: None,
+ state: GithubPullRequestReviewState::Approved,
+ submitted_at: None,
+ }],
+ ..GithubPullRequestRow::from_metadata(&serde_json::json!({
+ "githubKey":"macro/app/pull/7", "owner":"macro", "repo":"app", "number":7,
+ "url":"https://github.com/macro/app/pull/7", "displayName":"PR",
+ "requestedReviewerGithubUserIds":["8"], "participantGithubUserIds":["7"]
+ }))
+ .unwrap()
+ };
+ let sparse = GithubPullRequestWrite::from_metadata(&serde_json::json!({
+ "githubKey":"macro/app/pull/7", "owner":"macro", "repo":"app", "number":7,
+ "url":"https://github.com/macro/app/pull/7", "displayName":"PR", "status":"closed",
+ "participantGithubUserIds":["9"],
+ "reviews":[{"reviewerGithubUserId":"8", "state":"commented"}]
+ }))
+ .unwrap();
+ let merged = sparse.merge(Some(original));
+ assert!(merged.draft);
+ assert_eq!(merged.assignees.len(), 1);
+ assert_eq!(merged.labels.len(), 1);
+ assert_eq!(merged.participant_github_user_ids, vec!["7", "9"]);
+ assert_eq!(
+ merged.reviews[0].state,
+ GithubPullRequestReviewState::Approved
+ );
+ assert_eq!(
+ merged.review_decision,
+ Some(GithubPullRequestReviewDecision::Approved)
+ );
+ let supplied = GithubPullRequestWrite {
+ draft: Some(false),
+ assignees: Some(vec![]),
+ labels: Some(vec![]),
+ requested_reviewer_github_user_ids: Some(vec![]),
+ ..sparse
+ };
+ let merged = supplied.merge(Some(merged));
+ assert!(!merged.draft);
+ assert!(merged.assignees.is_empty());
+ assert!(merged.labels.is_empty());
+ assert!(merged.requested_reviewer_github_user_ids.is_empty());
+ assert_eq!(
+ merged.review_decision,
+ Some(GithubPullRequestReviewDecision::Approved)
+ );
+}
+
+#[test]
+fn existing_typed_row_ignores_the_entire_fallback() {
+ let base = GithubPullRequestWrite::from_metadata(&serde_json::json!({
+ "githubKey":"macro/app/pull/7", "owner":"macro", "repo":"app", "number":7,
+ "url":"https://github.com/macro/app/pull/7", "displayName":"PR",
+ "participantGithubUserIds":["7"],
+ "reviews":[{"reviewerGithubUserId":"8", "state":"approved"}]
+ }))
+ .unwrap();
+ let existing = GithubPullRequestWrite {
+ title: Some("existing".into()),
+ ..base.clone()
+ }
+ .merge(None);
+ let fallback = GithubPullRequestWrite {
+ title: Some("fallback".into()),
+ status: Some(GithubPullRequestStatus::Closed),
+ participant_github_user_ids: Some(vec!["9".into()]),
+ reviews: Some(vec![review(
+ "10",
+ GithubPullRequestReviewState::ChangesRequested,
+ 1,
+ )]),
+ ..base.clone()
+ }
+ .merge(None);
+ let incoming = GithubPullRequestWrite {
+ title: None,
+ status: None,
+ participant_github_user_ids: None,
+ reviews: None,
+ initial_row: Some(fallback),
+ ..base
+ };
+ let merged = incoming.merge(Some(existing.clone()));
+ assert_eq!(merged, existing);
+ assert_eq!(merged.participant_github_user_ids, vec!["7"]);
+ assert_eq!(merged.reviews.len(), 1);
+ assert_eq!(
+ merged.review_decision,
+ Some(GithubPullRequestReviewDecision::Approved)
+ );
+}
+
+#[test]
+fn mismatched_fallback_key_or_number_is_rejected() {
+ let write = GithubPullRequestWrite::from_metadata(&serde_json::json!({
+ "githubKey":"macro/app/pull/7", "owner":"macro", "repo":"app", "number":7,
+ "url":"https://github.com/macro/app/pull/7", "displayName":"PR"
+ }))
+ .unwrap();
+ let fallback = GithubPullRequestWrite {
+ title: Some("wrong row".into()),
+ ..write.clone()
+ }
+ .merge(None);
+ for invalid in [
+ GithubPullRequestRow {
+ github_key: "other/app/pull/7".into(),
+ ..fallback.clone()
+ },
+ GithubPullRequestRow {
+ number: 8,
+ ..fallback.clone()
+ },
+ ] {
+ let merged = GithubPullRequestWrite {
+ initial_row: Some(invalid),
+ ..write.clone()
+ }
+ .merge(None);
+ assert_eq!(merged, write.merge(None));
+ assert_eq!(merged.title, None);
+ }
+}
+
+#[test]
+fn sparse_git_refs_replace_pairs_and_omitted_refs_keep_both_components() {
+ let mut reference = EnrichedGithubPullRequest::from_reference(pull_request_reference());
+ reference.base = Some(GitRef {
+ name: Some("main".into()),
+ sha: Some("base-sha".into()),
+ });
+ reference.head = Some(GitRef {
+ name: Some("feature".into()),
+ sha: Some("head-sha".into()),
+ });
+ let original = GithubPullRequestWrite::from_enriched(&reference)
+ .unwrap()
+ .merge(None);
+
+ for partial in [
+ Some(GitRef {
+ name: Some("new-branch".into()),
+ sha: None,
+ }),
+ Some(GitRef {
+ name: None,
+ sha: Some("new-sha".into()),
+ }),
+ Some(GitRef {
+ name: None,
+ sha: None,
+ }),
+ None,
+ ] {
+ for update_base in [true, false] {
+ let mut sparse = EnrichedGithubPullRequest::from_reference(pull_request_reference());
+ if update_base {
+ sparse.base = partial.clone();
+ } else {
+ sparse.head = partial.clone();
+ }
+ let mut write = GithubPullRequestWrite::from_enriched(&sparse).unwrap();
+ let actual = write.merge(Some(original.clone()));
+ let mut expected = original.clone();
+ if let Some(partial) = &partial {
+ if update_base {
+ expected.base = Some(partial.clone());
+ } else {
+ expected.head = Some(partial.clone());
+ }
+ }
+ assert_eq!(actual, expected);
+ write.initial_row = Some(original.clone());
+ assert_eq!(write.merge(None), expected);
+ }
+ }
+}
diff --git a/crates/github_pull_requests/src/domain/ports.rs b/crates/github_pull_requests/src/domain/ports.rs
index 7d34032d7f..0bfb1ed802 100644
--- a/crates/github_pull_requests/src/domain/ports.rs
+++ b/crates/github_pull_requests/src/domain/ports.rs
@@ -11,10 +11,11 @@ use item_filters::ast::{LiteralTree, github_pull_request::GithubPullRequestLiter
use macro_user_id::user_id::MacroUserIdStr;
use super::models::{
- EnrichedGithubPullRequest, GithubPullRequestDiff, GithubPullRequestDiffError,
- GithubPullRequestError, GithubPullRequestFacets, GithubPullRequestRow,
- GithubPullRequestSortDirection, GithubPullRequestWrite, GithubRepositoryIdentity,
- PullRequestRef, StoredGithubPullRequest, UpsertGithubPullRequest, UpsertedGithubPullRequest,
+ EnrichedGithubPullRequest, GithubPullRequestChangesError, GithubPullRequestChangeset,
+ GithubPullRequestDiff, GithubPullRequestDiffError, GithubPullRequestError,
+ GithubPullRequestFacets, GithubPullRequestRow, GithubPullRequestSortDirection,
+ GithubPullRequestWrite, GithubRepositoryIdentity, PullRequestRef, StoredGithubPullRequest,
+ UpsertGithubPullRequest, UpsertedGithubPullRequest,
};
/// Stores GitHub pull requests as foreign entity records, one record per user or team the pull
@@ -72,6 +73,7 @@ pub trait GithubPullRequestRepository: Send + Sync + 'static {
/// Atomically merge supplied typed columns with the shared row. Omitted fields retain
/// stored values. Concurrent creation and updates for the same key serialize before reading.
+ /// A provided base/head ref replaces its name and SHA together, including missing components.
fn upsert_row(
&self,
row: &GithubPullRequestWrite,
@@ -155,6 +157,90 @@ pub trait GithubPullRequestDiffReader: Send + Sync + 'static {
) -> impl Future<Output = Result<GithubPullRequestDiff, GithubPullRequestDiffError>> + Send;
}
+/// Stores the summary of each pull request changeset.
+pub trait GithubPullRequestChangesetRepository: Send + Sync + 'static {
+ /// Error type returned by repository operations.
+ type Err: Into<anyhow::Error> + Send + std::fmt::Debug;
+
+ /// The changeset stored under `id`, if any.
+ fn get_changeset(
+ &self,
+ id: uuid::Uuid,
+ ) -> impl Future<Output = Result<Option<GithubPullRequestChangeset>, Self::Err>> + Send;
+
+ /// Store `changeset`, unless a changeset with its id is already stored.
+ fn insert_changeset(
+ &self,
+ changeset: &GithubPullRequestChangeset,
+ ) -> impl Future<Output = Result<(), Self::Err>> + Send;
+}
+
+/// Stores pull request patches, which can be megabytes and are read whole or not at all.
+pub trait GithubPullRequestPatchStore: Send + Sync + 'static {
+ /// Error type returned by store operations.
+ type Err: Into<anyhow::Error> + Send + std::fmt::Debug;
+
+ /// The patch under `key`, or `None` when nothing is stored there, for example because it
+ /// expired.
+ fn get_patch(
+ &self,
+ key: &str,
+ ) -> impl Future<Output = Result<Option<String>, Self::Err>> + Send;
+
+ /// Store `patch` under `key`, replacing whatever was there.
+ fn put_patch(
+ &self,
+ key: &str,
+ patch: &str,
+ ) -> impl Future<Output = Result<(), Self::Err>> + Send;
+}
+
+/// Pull request changesets for callers that authorized their own access, such as agent
+/// sessions linked to a pull request. The diff is read with `user`'s GitHub repository access.
+pub trait GithubPullRequestChangesets: Send + Sync + 'static {
+ /// The changeset stored under `id`, if any.
+ fn changeset(
+ &self,
+ id: uuid::Uuid,
+ ) -> impl Future<
+ Output = Result<Option<GithubPullRequestChangeset>, GithubPullRequestChangesError>,
+ > + Send;
+
+ /// Read the pull request's current diff and store it, once per base and head.
+ fn capture(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ pull_request: &PullRequestRef,
+ ) -> impl Future<Output = Result<GithubPullRequestChangeset, GithubPullRequestChangesError>> + Send;
+
+ /// The patch of the changeset under `id`, read again from GitHub when the stored copy
+ /// expired. [`GithubPullRequestChangesError::Moved`] when the pull request no longer has
+ /// that base and head.
+ fn patch(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ id: uuid::Uuid,
+ ) -> impl Future<Output = Result<String, GithubPullRequestChangesError>> + Send;
+}
+
+/// A pull request's changes, for callers with view access to one of its records.
+pub trait GithubPullRequestChanges: Send + Sync + 'static {
+ /// The changes of the pull request behind the record `receipt` grants view access to, at its
+ /// current base and head.
+ fn changes(
+ &self,
+ receipt: EntityAccessReceipt<ViewAccessLevel>,
+ ) -> impl Future<Output = Result<GithubPullRequestChangeset, GithubPullRequestChangesError>> + Send;
+
+ /// The patch of the changeset `changeset`, which must belong to the pull request behind the
+ /// record `receipt` grants view access to.
+ fn patch(
+ &self,
+ receipt: EntityAccessReceipt<ViewAccessLevel>,
+ changeset: uuid::Uuid,
+ ) -> impl Future<Output = Result<String, GithubPullRequestChangesError>> + Send;
+}
+
/// Aggregate views over the GitHub pull requests a caller can see.
pub trait GithubPullRequestFacetService: Send + Sync + 'static {
/// Repositories and authors among the pull requests visible to `user`, plus those visible
diff --git a/crates/github_pull_requests/src/domain/service.rs b/crates/github_pull_requests/src/domain/service.rs
index a3024e0a5b..1138430926 100644
--- a/crates/github_pull_requests/src/domain/service.rs
+++ b/crates/github_pull_requests/src/domain/service.rs
@@ -3,6 +3,10 @@
#[cfg(test)]
mod test;
+mod changes;
+
+pub use changes::{GithubPullRequestChangesServiceImpl, GithubPullRequestChangesetStore};
+
use entity_access::domain::models::{
EntityAccessReceipt, EntityType, MemberTeamRole, ViewAccessLevel,
};
diff --git a/crates/github_pull_requests/src/domain/service/changes.rs b/crates/github_pull_requests/src/domain/service/changes.rs
new file mode 100644
index 0000000000..3e312e3d82
--- /dev/null
+++ b/crates/github_pull_requests/src/domain/service/changes.rs
@@ -0,0 +1,285 @@
+//! Serving a pull request's changes: read once from GitHub per base and head, then from storage.
+//!
+//! A changeset's id and patch key are derived from the pull request and both commits, so every
+//! user, team, and agent session reading the same range shares one stored copy. The patch
+//! object may expire; reading it again re-reads the diff, as long as the pull request still has
+//! that base and head.
+
+use std::num::NonZeroU64;
+
+use chrono::Utc;
+use entity_access::domain::models::{EntityAccessReceipt, ViewAccessLevel};
+use git_patch::{
+ BudgetedPatch, MAX_FILE_PATCH_BYTES, MAX_PATCH_BYTES, budget_patch, parse_git_patch, totals,
+};
+use macro_user_id::user_id::MacroUserIdStr;
+use uuid::Uuid;
+
+use crate::domain::{
+ models::{
+ ChangesetRange, GithubPullRequestChangesError, GithubPullRequestChangeset,
+ GithubPullRequestDiff, GithubPullRequestDiffError, PullRequestRef, RepositorySlug,
+ StoredGithubPullRequest, changeset_id, changeset_patch_key, github_key_of,
+ },
+ ports::{
+ GithubPullRequestChanges, GithubPullRequestChangesetRepository,
+ GithubPullRequestChangesets, GithubPullRequestDiffReader, GithubPullRequestPatchStore,
+ GithubPullRequestService,
+ },
+};
+
+#[cfg(test)]
+mod test;
+
+/// Stores pull request changesets: the summary in `changesets`, the patch in `patches`, read
+/// from GitHub through `reader` once per base and head.
+pub struct GithubPullRequestChangesetStore<Reader, Changesets, Patches> {
+ reader: Reader,
+ changesets: Changesets,
+ patches: Patches,
+}
+
+impl<Reader, Changesets, Patches> GithubPullRequestChangesetStore<Reader, Changesets, Patches>
+where
+ Reader: GithubPullRequestDiffReader,
+ Changesets: GithubPullRequestChangesetRepository,
+ Patches: GithubPullRequestPatchStore,
+{
+ /// Build the store from its ports.
+ pub fn new(reader: Reader, changesets: Changesets, patches: Patches) -> Self {
+ Self {
+ reader,
+ changesets,
+ patches,
+ }
+ }
+
+ async fn stored(
+ &self,
+ id: Uuid,
+ ) -> Result<Option<GithubPullRequestChangeset>, GithubPullRequestChangesError> {
+ self.changesets
+ .get_changeset(id)
+ .await
+ .map_err(|error| GithubPullRequestChangesError::Storage(error.into()))
+ }
+
+ /// Store the changes `diff` holds, unless their range is already stored.
+ async fn store(
+ &self,
+ pull_request: &PullRequestRef,
+ diff: GithubPullRequestDiff,
+ ) -> Result<GithubPullRequestChangeset, GithubPullRequestChangesError> {
+ let (base_sha, head_sha) = range_commits(&diff.range)?;
+ let id = changeset_id(pull_request, base_sha, head_sha);
+ if let Some(existing) = self.stored(id).await? {
+ return Ok(existing);
+ }
+
+ let budgeted = budget(&diff.patch);
+ let (additions, deletions) = totals(&budgeted.files);
+ let patch_key = (!budgeted.patch.is_empty())
+ .then(|| changeset_patch_key(pull_request, base_sha, head_sha));
+ if let Some(key) = &patch_key {
+ self.patches
+ .put_patch(key, &budgeted.patch)
+ .await
+ .map_err(|error| GithubPullRequestChangesError::Storage(error.into()))?;
+ }
+ let changeset = GithubPullRequestChangeset {
+ id,
+ github_key: github_key_of(pull_request),
+ pull_request: pull_request.clone(),
+ range: diff.range,
+ files: budgeted.files,
+ additions,
+ deletions,
+ patch_bytes: budgeted.patch.len() as u64,
+ truncated: budgeted.truncated,
+ patch_key,
+ captured_at: Utc::now(),
+ };
+ self.changesets
+ .insert_changeset(&changeset)
+ .await
+ .map_err(|error| GithubPullRequestChangesError::Storage(error.into()))?;
+ Ok(changeset)
+ }
+}
+
+impl<Reader, Changesets, Patches> GithubPullRequestChangesets
+ for GithubPullRequestChangesetStore<Reader, Changesets, Patches>
+where
+ Reader: GithubPullRequestDiffReader,
+ Changesets: GithubPullRequestChangesetRepository,
+ Patches: GithubPullRequestPatchStore,
+{
+ async fn changeset(
+ &self,
+ id: Uuid,
+ ) -> Result<Option<GithubPullRequestChangeset>, GithubPullRequestChangesError> {
+ self.stored(id).await
+ }
+
+ #[tracing::instrument(
+ err,
+ skip(self, user, pull_request),
+ fields(repository = %pull_request.repository, number = %pull_request.number)
+ )]
+ async fn capture(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ pull_request: &PullRequestRef,
+ ) -> Result<GithubPullRequestChangeset, GithubPullRequestChangesError> {
+ let diff = self.reader.read(user, pull_request).await?;
+ self.store(pull_request, diff).await
+ }
+
+ #[tracing::instrument(err, skip(self, user))]
+ async fn patch(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ id: Uuid,
+ ) -> Result<String, GithubPullRequestChangesError> {
+ let changeset = self
+ .stored(id)
+ .await?
+ .ok_or(GithubPullRequestChangesError::NotFound)?;
+ let Some(key) = changeset.patch_key.as_deref() else {
+ return Ok(String::new());
+ };
+ if let Some(patch) = self
+ .patches
+ .get_patch(key)
+ .await
+ .map_err(|error| GithubPullRequestChangesError::Storage(error.into()))?
+ {
+ return Ok(patch);
+ }
+
+ // The stored copy expired: GitHub still has it only while the pull request has the same
+ // base and head.
+ let diff = self.reader.read(user, &changeset.pull_request).await?;
+ let (base_sha, head_sha) = range_commits(&diff.range)?;
+ if changeset_id(&changeset.pull_request, base_sha, head_sha) != id {
+ return Err(GithubPullRequestChangesError::Moved);
+ }
+ let budgeted = budget(&diff.patch);
+ self.patches
+ .put_patch(key, &budgeted.patch)
+ .await
+ .map_err(|error| GithubPullRequestChangesError::Storage(error.into()))?;
+ Ok(budgeted.patch)
+ }
+}
+
+/// Serves a pull request's changes to callers holding view access to one of its records.
+pub struct GithubPullRequestChangesServiceImpl<PullRequests, Changesets> {
+ pull_requests: PullRequests,
+ changesets: Changesets,
+}
+
+impl<PullRequests, Changesets> GithubPullRequestChangesServiceImpl<PullRequests, Changesets>
+where
+ PullRequests: GithubPullRequestService,
+ Changesets: GithubPullRequestChangesets,
+{
+ /// Resolve records through `pull_requests` and read changes through `changesets`.
+ pub fn new(pull_requests: PullRequests, changesets: Changesets) -> Self {
+ Self {
+ pull_requests,
+ changesets,
+ }
+ }
+}
+
+impl<PullRequests, Changesets> GithubPullRequestChanges
+ for GithubPullRequestChangesServiceImpl<PullRequests, Changesets>
+where
+ PullRequests: GithubPullRequestService,
+ Changesets: GithubPullRequestChangesets,
+{
+ #[tracing::instrument(err, skip(self, receipt))]
+ async fn changes(
+ &self,
+ receipt: EntityAccessReceipt<ViewAccessLevel>,
+ ) -> Result<GithubPullRequestChangeset, GithubPullRequestChangesError> {
+ let user = authenticated_user(&receipt)?;
+ let stored = self.pull_requests.get_pull_request(receipt).await?;
+ let pull_request = pull_request_ref(&stored)?;
+
+ // Webhooks keep the row's base and head current, so a stored range answers without
+ // asking GitHub.
+ let base_sha = stored.base.as_ref().and_then(|base| base.sha.as_deref());
+ let head_sha = stored.head.as_ref().and_then(|head| head.sha.as_deref());
+ if let (Some(base_sha), Some(head_sha)) = (base_sha, head_sha)
+ && let Some(changeset) = self
+ .changesets
+ .changeset(changeset_id(&pull_request, base_sha, head_sha))
+ .await?
+ {
+ return Ok(changeset);
+ }
+
+ self.changesets.capture(&user, &pull_request).await
+ }
+
+ #[tracing::instrument(err, skip(self, receipt))]
+ async fn patch(
+ &self,
+ receipt: EntityAccessReceipt<ViewAccessLevel>,
+ changeset: Uuid,
+ ) -> Result<String, GithubPullRequestChangesError> {
+ let user = authenticated_user(&receipt)?;
+ let stored = self.pull_requests.get_pull_request(receipt).await?;
+ let changes = self
+ .changesets
+ .changeset(changeset)
+ .await?
+ .ok_or(GithubPullRequestChangesError::NotFound)?;
+ if !changes.github_key.eq_ignore_ascii_case(&stored.github_key) {
+ return Err(GithubPullRequestChangesError::NotFound);
+ }
+ self.changesets.patch(&user, changeset).await
+ }
+}
+
+fn budget(patch: &str) -> BudgetedPatch {
+ budget_patch(
+ parse_git_patch(patch),
+ MAX_PATCH_BYTES,
+ MAX_FILE_PATCH_BYTES,
+ )
+}
+
+/// The base and head commits of `range`; GitHub always reports both for a pull request.
+fn range_commits(range: &ChangesetRange) -> Result<(&str, &str), GithubPullRequestChangesError> {
+ match (range.base.sha.as_deref(), range.head.sha.as_deref()) {
+ (Some(base), Some(head)) => Ok((base, head)),
+ _ => Err(GithubPullRequestDiffError::Other(anyhow::anyhow!(
+ "GitHub reported no base or head commit"
+ ))
+ .into()),
+ }
+}
+
+fn authenticated_user(
+ receipt: &EntityAccessReceipt<ViewAccessLevel>,
+) -> Result<MacroUserIdStr<'static>, GithubPullRequestChangesError> {
+ receipt
+ .get_authenticated_user()
+ .cloned()
+ .map_err(|_| GithubPullRequestChangesError::Unauthorized)
+}
+
+fn pull_request_ref(
+ stored: &StoredGithubPullRequest,
+) -> Result<PullRequestRef, GithubPullRequestChangesError> {
+ let number = u64::try_from(stored.number)
+ .ok()
+ .and_then(NonZeroU64::new)
+ .ok_or(GithubPullRequestChangesError::NotFound)?;
+ let repository = RepositorySlug::parse(&format!("{}/{}", stored.owner, stored.repo))
+ .ok_or(GithubPullRequestChangesError::NotFound)?;
+ Ok(PullRequestRef { repository, number })
+}
diff --git a/crates/github_pull_requests/src/domain/service/changes/test.rs b/crates/github_pull_requests/src/domain/service/changes/test.rs
new file mode 100644
index 0000000000..2c910c6fb8
--- /dev/null
+++ b/crates/github_pull_requests/src/domain/service/changes/test.rs
@@ -0,0 +1,351 @@
+use std::collections::HashMap;
+use std::convert::Infallible;
+use std::num::NonZeroU64;
+use std::sync::{Arc, Mutex};
+
+use entity_access::domain::models::EntityType;
+use foreign_entity::domain::models::ForeignEntity;
+use git_patch::wire::GitRefDto;
+
+use super::*;
+use crate::domain::models::{
+ EnrichedGithubPullRequest, GitRef, GithubPullRequestError, UpsertGithubPullRequest,
+ UpsertedGithubPullRequest,
+};
+
+const USER: &str = "macro|[email protected]";
+const PATCH: &str = "diff --git a/a.rs b/a.rs\n--- a/a.rs\n+++ b/a.rs\n@@ -1 +1 @@\n-old\n+new\n";
+
+#[derive(Default)]
+struct StubReader {
+ head: Mutex<String>,
+ patch: Mutex<String>,
+ calls: Mutex<usize>,
+}
+
+impl StubReader {
+ fn answering(head: &str, patch: &str) -> Arc<Self> {
+ let reader = Arc::new(Self::default());
+ reader.answer(head, patch);
+ reader
+ }
+
+ fn answer(&self, head: &str, patch: &str) {
+ *self.head.lock().unwrap() = head.to_string();
+ *self.patch.lock().unwrap() = patch.to_string();
+ }
+
+ fn calls(&self) -> usize {
+ *self.calls.lock().unwrap()
+ }
+}
+
+impl GithubPullRequestDiffReader for Arc<StubReader> {
+ async fn read(
+ &self,
+ _user: &MacroUserIdStr<'static>,
+ pull_request: &PullRequestRef,
+ ) -> Result<GithubPullRequestDiff, GithubPullRequestDiffError> {
+ *self.calls.lock().unwrap() += 1;
+ Ok(GithubPullRequestDiff {
+ patch: self.patch.lock().unwrap().clone(),
+ range: ChangesetRange {
+ repository: Some(pull_request.repository.https_url()),
+ base: GitRef {
+ name: Some("main".to_string()),
+ sha: Some("base-sha".to_string()),
+ },
+ head: GitRef {
+ name: Some("feature".to_string()),
+ sha: Some(self.head.lock().unwrap().clone()),
+ },
+ },
+ })
+ }
+}
+
+#[derive(Clone, Default)]
+struct MemoryChangesets(Arc<Mutex<HashMap<Uuid, GithubPullRequestChangeset>>>);
+
+impl GithubPullRequestChangesetRepository for MemoryChangesets {
+ type Err = Infallible;
+
+ async fn get_changeset(
+ &self,
+ id: Uuid,
+ ) -> Result<Option<GithubPullRequestChangeset>, Self::Err> {
+ Ok(self.0.lock().unwrap().get(&id).cloned())
+ }
+
+ async fn insert_changeset(
+ &self,
+ changeset: &GithubPullRequestChangeset,
+ ) -> Result<(), Self::Err> {
+ self.0
+ .lock()
+ .unwrap()
+ .entry(changeset.id)
+ .or_insert_with(|| changeset.clone());
+ Ok(())
+ }
+}
+
+#[derive(Clone, Default)]
+struct MemoryPatches {
+ patches: Arc<Mutex<HashMap<String, String>>>,
+ puts: Arc<Mutex<usize>>,
+}
+
+impl MemoryPatches {
+ fn puts(&self) -> usize {
+ *self.puts.lock().unwrap()
+ }
+
+ fn expire_all(&self) {
+ self.patches.lock().unwrap().clear();
+ }
+}
+
+impl GithubPullRequestPatchStore for MemoryPatches {
+ type Err = Infallible;
+
+ async fn get_patch(&self, key: &str) -> Result<Option<String>, Self::Err> {
+ Ok(self.patches.lock().unwrap().get(key).cloned())
+ }
+
+ async fn put_patch(&self, key: &str, patch: &str) -> Result<(), Self::Err> {
+ *self.puts.lock().unwrap() += 1;
+ self.patches
+ .lock()
+ .unwrap()
+ .insert(key.to_string(), patch.to_string());
+ Ok(())
+ }
+}
+
+type Store = GithubPullRequestChangesetStore<Arc<StubReader>, MemoryChangesets, MemoryPatches>;
+
+fn store(reader: &Arc<StubReader>, patches: &MemoryPatches) -> Store {
+ GithubPullRequestChangesetStore::new(
+ reader.clone(),
+ MemoryChangesets::default(),
+ patches.clone(),
+ )
+}
+
+fn user() -> MacroUserIdStr<'static> {
+ MacroUserIdStr::parse_from_str(USER).unwrap()
+}
+
+fn pull_request() -> PullRequestRef {
+ PullRequestRef {
+ repository: RepositorySlug {
+ owner: "macro".to_string(),
+ name: "app".to_string(),
+ },
+ number: NonZeroU64::new(7).unwrap(),
+ }
+}
+
+#[tokio::test]
+async fn a_range_is_stored_once_however_often_it_is_captured() {
+ let reader = StubReader::answering("head-1", PATCH);
+ let patches = MemoryPatches::default();
+ let store = store(&reader, &patches);
+
+ let first = store.capture(&user(), &pull_request()).await.unwrap();
+ let second = store.capture(&user(), &pull_request()).await.unwrap();
+
+ assert_eq!(first.id, second.id);
+ assert_eq!(
+ first.id,
+ changeset_id(&pull_request(), "base-sha", "head-1")
+ );
+ assert_eq!(first.files.len(), 1);
+ assert_eq!((first.additions, first.deletions), (1, 1));
+ assert_eq!(patches.puts(), 1);
+}
+
+#[tokio::test]
+async fn a_stored_patch_is_served_without_asking_github() {
+ let reader = StubReader::answering("head-1", PATCH);
+ let patches = MemoryPatches::default();
+ let store = store(&reader, &patches);
+ let changeset = store.capture(&user(), &pull_request()).await.unwrap();
+
+ let patch = store.patch(&user(), changeset.id).await.unwrap();
+
+ assert_eq!(patch.trim_end(), PATCH.trim_end());
+ assert_eq!(reader.calls(), 1);
+}
+
+#[tokio::test]
+async fn an_expired_patch_is_read_again_while_the_range_is_unchanged() {
+ let reader = StubReader::answering("head-1", PATCH);
+ let patches = MemoryPatches::default();
+ let store = store(&reader, &patches);
+ let changeset = store.capture(&user(), &pull_request()).await.unwrap();
+ patches.expire_all();
+
+ let patch = store.patch(&user(), changeset.id).await.unwrap();
+
+ assert_eq!(patch.trim_end(), PATCH.trim_end());
+ assert_eq!(reader.calls(), 2);
+ assert_eq!(patches.puts(), 2);
+}
+
+#[tokio::test]
+async fn an_expired_patch_of_a_moved_pull_request_is_reported_as_moved() {
+ let reader = StubReader::answering("head-1", PATCH);
+ let patches = MemoryPatches::default();
+ let store = store(&reader, &patches);
+ let changeset = store.capture(&user(), &pull_request()).await.unwrap();
+ patches.expire_all();
+ reader.answer("head-2", PATCH);
+
+ let result = store.patch(&user(), changeset.id).await;
+
+ assert!(matches!(result, Err(GithubPullRequestChangesError::Moved)));
+}
+
+#[tokio::test]
+async fn an_empty_diff_stores_no_patch() {
+ let reader = StubReader::answering("head-1", "");
+ let patches = MemoryPatches::default();
+ let store = store(&reader, &patches);
+
+ let changeset = store.capture(&user(), &pull_request()).await.unwrap();
+
+ assert_eq!(changeset.patch_key, None);
+ assert_eq!(store.patch(&user(), changeset.id).await.unwrap(), "");
+ assert_eq!(patches.puts(), 0);
+}
+
+struct StubPullRequests {
+ stored: StoredGithubPullRequest,
+}
+
+impl GithubPullRequestService for StubPullRequests {
+ async fn upsert_pull_request(
+ &self,
+ _upsert: UpsertGithubPullRequest,
+ ) -> Result<UpsertedGithubPullRequest, GithubPullRequestError> {
+ unreachable!("changes never write pull requests")
+ }
+
+ async fn refresh_pull_request(
+ &self,
+ _pull_request: &EnrichedGithubPullRequest,
+ ) -> Result<Vec<ForeignEntity>, GithubPullRequestError> {
+ unreachable!("changes never write pull requests")
+ }
+
+ async fn get_pull_request(
+ &self,
+ _receipt: EntityAccessReceipt<ViewAccessLevel>,
+ ) -> Result<StoredGithubPullRequest, GithubPullRequestError> {
+ Ok(self.stored.clone())
+ }
+}
+
+fn stored_pull_request(github_key: &str, head_sha: Option<&str>) -> StoredGithubPullRequest {
+ StoredGithubPullRequest {
+ id: Uuid::new_v4(),
+ github_key: github_key.to_string(),
+ owner: "macro".to_string(),
+ repo: "app".to_string(),
+ number: 7,
+ url: "https://github.com/macro/app/pull/7".to_string(),
+ title: None,
+ status: None,
+ draft: false,
+ author_login: None,
+ author_github_user_id: None,
+ description: None,
+ additions: None,
+ deletions: None,
+ assignees: Vec::new(),
+ labels: Vec::new(),
+ requested_reviewer_github_user_ids: Vec::new(),
+ reviews: Vec::new(),
+ review_decision: None,
+ comments: Vec::new(),
+ checks: Vec::new(),
+ github_updated_at: None,
+ base: Some(GitRefDto {
+ name: Some("main".to_string()),
+ sha: Some("base-sha".to_string()),
+ }),
+ head: head_sha.map(|sha| GitRefDto {
+ name: Some("feature".to_string()),
+ sha: Some(sha.to_string()),
+ }),
+ }
+}
+
+fn receipt() -> EntityAccessReceipt<ViewAccessLevel> {
+ EntityAccessReceipt::<ViewAccessLevel>::dangerously_assert_authenticated_user(
+ user(),
+ &Uuid::new_v4().to_string(),
+ EntityType::ForeignEntity,
+ )
+}
+
+#[tokio::test]
+async fn changes_at_the_rows_commits_are_served_without_asking_github() {
+ let reader = StubReader::answering("head-1", PATCH);
+ let patches = MemoryPatches::default();
+ let store = store(&reader, &patches);
+ store.capture(&user(), &pull_request()).await.unwrap();
+ let service = GithubPullRequestChangesServiceImpl::new(
+ StubPullRequests {
+ stored: stored_pull_request("macro/app/pull/7", Some("head-1")),
+ },
+ store,
+ );
+
+ let changeset = service.changes(receipt()).await.unwrap();
+
+ assert_eq!(
+ changeset.id,
+ changeset_id(&pull_request(), "base-sha", "head-1")
+ );
+ assert_eq!(reader.calls(), 1);
+}
+
+#[tokio::test]
+async fn changes_without_known_commits_are_read_from_github() {
+ let reader = StubReader::answering("head-1", PATCH);
+ let patches = MemoryPatches::default();
+ let service = GithubPullRequestChangesServiceImpl::new(
+ StubPullRequests {
+ stored: stored_pull_request("macro/app/pull/7", None),
+ },
+ store(&reader, &patches),
+ );
+
+ service.changes(receipt()).await.unwrap();
+
+ assert_eq!(reader.calls(), 1);
+}
+
+#[tokio::test]
+async fn a_patch_of_another_pull_requests_changes_is_not_found() {
+ let reader = StubReader::answering("head-1", PATCH);
+ let patches = MemoryPatches::default();
+ let store = store(&reader, &patches);
+ let changeset = store.capture(&user(), &pull_request()).await.unwrap();
+ let service = GithubPullRequestChangesServiceImpl::new(
+ StubPullRequests {
+ stored: stored_pull_request("macro/app/pull/8", Some("head-1")),
+ },
+ store,
+ );
+
+ let result = service.patch(receipt(), changeset.id).await;
+
+ assert!(matches!(
+ result,
+ Err(GithubPullRequestChangesError::NotFound)
+ ));
+}
diff --git a/crates/github_pull_requests/src/domain/service/test.rs b/crates/github_pull_requests/src/domain/service/test.rs
index 42071640a2..f87b3e045d 100644
--- a/crates/github_pull_requests/src/domain/service/test.rs
+++ b/crates/github_pull_requests/src/domain/service/test.rs
@@ -342,6 +342,8 @@ fn pull_request(status: GithubPullRequestStatus) -> EnrichedGithubPullRequest {
assignees: None,
labels: None,
reviews: None,
+ base: None,
+ head: None,
}
}
@@ -619,6 +621,8 @@ async fn upsert_writes_the_row_from_the_merged_metadata() {
labels: Vec::new(),
reviews: Vec::new(),
review_decision: Some(GithubPullRequestReviewDecision::ReviewRequired),
+ base: None,
+ head: None,
}]
);
}
diff --git a/crates/github_pull_requests/src/inbound.rs b/crates/github_pull_requests/src/inbound.rs
index 2d2a9eb7ed..1e07a81ced 100644
--- a/crates/github_pull_requests/src/inbound.rs
+++ b/crates/github_pull_requests/src/inbound.rs
@@ -1,3 +1,4 @@
//! Inbound adapters for GitHub pull request APIs.
pub mod axum_router;
+pub mod changes_router;
diff --git a/crates/github_pull_requests/src/inbound/changes_router.rs b/crates/github_pull_requests/src/inbound/changes_router.rs
new file mode 100644
index 0000000000..19eac83210
--- /dev/null
+++ b/crates/github_pull_requests/src/inbound/changes_router.rs
@@ -0,0 +1,279 @@
+//! Axum routes serving a GitHub pull request's changes, merged beside the pull request routes.
+//!
+//! Both routes resolve view access to the caller's foreign entity record before the handler
+//! runs, the same check as `GET /foreign_entity/{id}`. The diff is read with the caller's own
+//! GitHub repository access.
+
+use std::sync::Arc;
+
+use axum::{
+ Json, Router,
+ extract::{FromRef, Query, State},
+ http::StatusCode,
+ response::{IntoResponse, Response},
+ routing::get,
+};
+use entity_access::{
+ domain::{models::ViewAccessLevel, ports::EntityAccessService},
+ inbound::axum_extractors::ForeignEntityAccessLevelExtractor,
+};
+pub use git_patch::wire::{
+ ChangedFileDto, ChangesetDto, ChangesetSourceDto, FileChangeKindDto, GitRefDto,
+};
+use macro_authorization::{MacroAuthorizationService, MacroAuthorizationState};
+use model_error_response::ErrorResponse;
+use serde::{Deserialize, Serialize};
+use uuid::Uuid;
+
+use crate::domain::{
+ models::{GithubPullRequestChangesError, GithubPullRequestChangeset},
+ ports::GithubPullRequestChanges,
+};
+
+/// Router state for the pull request changes routes.
+pub struct GithubPullRequestChangesRouterState<S, AccessSvc, Auth> {
+ service: Arc<S>,
+ access_service: Arc<AccessSvc>,
+ authorization_state: MacroAuthorizationState<Auth>,
+}
+
+impl<S, AccessSvc, Auth> Clone for GithubPullRequestChangesRouterState<S, AccessSvc, Auth> {
+ fn clone(&self) -> Self {
+ Self {
+ service: self.service.clone(),
+ access_service: self.access_service.clone(),
+ authorization_state: self.authorization_state.clone(),
+ }
+ }
+}
+
+impl<S, AccessSvc, Auth> GithubPullRequestChangesRouterState<S, AccessSvc, Auth>
+where
+ S: GithubPullRequestChanges,
+ AccessSvc: EntityAccessService,
+{
+ /// Create router state from shared service references and authorization state.
+ pub fn new(
+ service: Arc<S>,
+ access_service: Arc<AccessSvc>,
+ authorization_state: MacroAuthorizationState<Auth>,
+ ) -> Self {
+ Self {
+ service,
+ access_service,
+ authorization_state,
+ }
+ }
+}
+
+impl<S, AccessSvc, Auth> FromRef<GithubPullRequestChangesRouterState<S, AccessSvc, Auth>>
+ for Arc<AccessSvc>
+{
+ fn from_ref(state: &GithubPullRequestChangesRouterState<S, AccessSvc, Auth>) -> Self {
+ state.access_service.clone()
+ }
+}
+
+impl<S, AccessSvc, Auth> FromRef<GithubPullRequestChangesRouterState<S, AccessSvc, Auth>>
+ for MacroAuthorizationState<Auth>
+{
+ fn from_ref(state: &GithubPullRequestChangesRouterState<S, AccessSvc, Auth>) -> Self {
+ state.authorization_state.clone()
+ }
+}
+
+/// Build the pull request changes router.
+///
+/// Routes:
+/// - `GET /{id}/changes` — the changes at the pull request's current base and head.
+/// - `GET /{id}/changes/patch?changeset=` — the patch of those changes.
+pub fn github_pull_request_changes_router<S, AccessSvc, Auth, T>(
+ state: GithubPullRequestChangesRouterState<S, AccessSvc, Auth>,
+) -> Router<T>
+where
+ S: GithubPullRequestChanges,
+ AccessSvc: EntityAccessService,
+ Auth: MacroAuthorizationService,
+ T: Send + Sync + 'static,
+{
+ Router::new()
+ .route(
+ "/{id}/changes",
+ get(get_github_pull_request_changes_handler::<S, AccessSvc, Auth>),
+ )
+ .route(
+ "/{id}/changes/patch",
+ get(get_github_pull_request_changes_patch_handler::<S, AccessSvc, Auth>),
+ )
+ .with_state(state)
+}
+
+/// Response body for `GET /github_pull_requests/{id}/changes`.
+///
+/// Clients deserialize this, so both derives are used.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct GithubPullRequestChangesResponse {
+ /// The changes at the pull request's current base and head; absent when GitHub could not
+ /// provide them.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub changeset: Option<ChangesetDto>,
+ /// Why there are no changes, in a sentence the user can act on.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub error: Option<String>,
+}
+
+/// Response body for `GET /github_pull_requests/{id}/changes/patch`.
+///
+/// Clients deserialize this, so both derives are used.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, utoipa::ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct GithubPullRequestChangesPatchResponse {
+ /// The git-style unified diff of the changeset.
+ pub patch: String,
+}
+
+/// Query for `GET /github_pull_requests/{id}/changes/patch`.
+#[derive(Debug, Deserialize)]
+pub struct ChangesPatchQuery {
+ /// The changeset whose patch to read.
+ pub changeset: Uuid,
+}
+
+/// Get the changes of the pull request behind a foreign entity record the caller can view.
+#[utoipa::path(
+ get,
+ tag = "github_pull_requests",
+ operation_id = "get_github_pull_request_changes",
+ path = "/github_pull_requests/{id}/changes",
+ params(
+ ("id" = uuid::Uuid, Path, description = "The caller's foreign entity record for the pull request")
+ ),
+ responses(
+ (status = 200, body = GithubPullRequestChangesResponse),
+ (status = 401, body = ErrorResponse),
+ (status = 404, body = ErrorResponse),
+ (status = 500, body = ErrorResponse),
+ )
+)]
+#[tracing::instrument(err, skip_all)]
+pub async fn get_github_pull_request_changes_handler<S, AccessSvc, Auth>(
+ State(state): State<GithubPullRequestChangesRouterState<S, AccessSvc, Auth>>,
+ access: ForeignEntityAccessLevelExtractor<ViewAccessLevel, AccessSvc, Auth>,
+) -> Result<Json<GithubPullRequestChangesResponse>, GithubPullRequestChangesError>
+where
+ S: GithubPullRequestChanges,
+ AccessSvc: EntityAccessService,
+ Auth: MacroAuthorizationService,
+{
+ match state.service.changes(access.entity_access_receipt).await {
+ Ok(changeset) => Ok(Json(GithubPullRequestChangesResponse {
+ changeset: Some(changeset_dto(changeset)),
+ error: None,
+ })),
+ Err(GithubPullRequestChangesError::Diff(error)) => match error.user_message() {
+ Some(message) => Ok(Json(GithubPullRequestChangesResponse {
+ changeset: None,
+ error: Some(message.to_string()),
+ })),
+ None => Err(GithubPullRequestChangesError::Diff(error)),
+ },
+ Err(error) => Err(error),
+ }
+}
+
+/// Get the patch of changes of the pull request behind a foreign entity record the caller can
+/// view.
+#[utoipa::path(
+ get,
+ tag = "github_pull_requests",
+ operation_id = "get_github_pull_request_changes_patch",
+ path = "/github_pull_requests/{id}/changes/patch",
+ params(
+ ("id" = uuid::Uuid, Path, description = "The caller's foreign entity record for the pull request"),
+ ("changeset" = uuid::Uuid, Query, description = "The changeset whose patch to read")
+ ),
+ responses(
+ (status = 200, body = GithubPullRequestChangesPatchResponse),
+ (status = 401, body = ErrorResponse),
+ (status = 404, body = ErrorResponse),
+ (status = 409, body = ErrorResponse),
+ (status = 500, body = ErrorResponse),
+ )
+)]
+#[tracing::instrument(err, skip_all)]
+pub async fn get_github_pull_request_changes_patch_handler<S, AccessSvc, Auth>(
+ State(state): State<GithubPullRequestChangesRouterState<S, AccessSvc, Auth>>,
+ access: ForeignEntityAccessLevelExtractor<ViewAccessLevel, AccessSvc, Auth>,
+ Query(query): Query<ChangesPatchQuery>,
+) -> Result<Json<GithubPullRequestChangesPatchResponse>, GithubPullRequestChangesError>
+where
+ S: GithubPullRequestChanges,
+ AccessSvc: EntityAccessService,
+ Auth: MacroAuthorizationService,
+{
+ let patch = state
+ .service
+ .patch(access.entity_access_receipt, query.changeset)
+ .await?;
+ Ok(Json(GithubPullRequestChangesPatchResponse { patch }))
+}
+
+fn changeset_dto(changeset: GithubPullRequestChangeset) -> ChangesetDto {
+ ChangesetDto {
+ id: changeset.id,
+ source: ChangesetSourceDto::GithubPullRequest,
+ repository: changeset.range.repository,
+ base: changeset.range.base.into(),
+ head: changeset.range.head.into(),
+ files: changeset.files.into_iter().map(Into::into).collect(),
+ additions: changeset.additions,
+ deletions: changeset.deletions,
+ patch_bytes: changeset.patch_bytes,
+ truncated: changeset.truncated,
+ captured_at: changeset.captured_at,
+ }
+}
+
+impl IntoResponse for GithubPullRequestChangesError {
+ fn into_response(self) -> Response {
+ let error = match self {
+ GithubPullRequestChangesError::PullRequest(error) => return error.into_response(),
+ error => error,
+ };
+ let (status_code, message) = match &error {
+ GithubPullRequestChangesError::NotFound => (
+ StatusCode::NOT_FOUND,
+ "pull request changes not found".to_string(),
+ ),
+ GithubPullRequestChangesError::Unauthorized => {
+ (StatusCode::UNAUTHORIZED, error.to_string())
+ }
+ GithubPullRequestChangesError::Moved => (StatusCode::CONFLICT, error.to_string()),
+ GithubPullRequestChangesError::Diff(diff) => match diff.user_message() {
+ Some(message) => (StatusCode::CONFLICT, message.to_string()),
+ None => (
+ StatusCode::INTERNAL_SERVER_ERROR,
+ "internal server error".to_string(),
+ ),
+ },
+ GithubPullRequestChangesError::PullRequest(_)
+ | GithubPullRequestChangesError::Storage(_) => (
+ StatusCode::INTERNAL_SERVER_ERROR,
+ "internal server error".to_string(),
+ ),
+ };
+
+ if status_code.is_server_error() {
+ tracing::error!(error=?error, "internal server error");
+ }
+
+ (
+ status_code,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
+ }
+}
diff --git a/crates/github_pull_requests/src/outbound.rs b/crates/github_pull_requests/src/outbound.rs
index 9cdfba4f20..82f6a9d296 100644
--- a/crates/github_pull_requests/src/outbound.rs
+++ b/crates/github_pull_requests/src/outbound.rs
@@ -1,3 +1,5 @@
//! Outbound adapters for GitHub pull request storage.
pub mod pg_github_pull_request_repo;
+#[cfg(feature = "s3")]
+pub mod s3_patch_store;
diff --git a/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo.rs b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo.rs
index 264a73dfa3..f4816ea657 100644
--- a/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo.rs
+++ b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo.rs
@@ -1,5 +1,6 @@
//! PostgreSQL storage for the typed columns of GitHub pull requests.
+mod changesets;
mod facets;
mod index;
mod listing;
@@ -9,7 +10,7 @@ mod test;
use sqlx::PgPool;
use crate::domain::{
- models::{GithubPullRequestRow, GithubPullRequestStatus, GithubPullRequestWrite},
+ models::{GitRef, GithubPullRequestRow, GithubPullRequestStatus, GithubPullRequestWrite},
ports::GithubPullRequestRepository,
};
@@ -62,7 +63,8 @@ impl GithubPullRequestRepository for PgGithubPullRequestRepo {
r#"SELECT github_key, repository_id, number, owner, repo, title, status,
draft, author_github_user_id, author_login,
requested_reviewer_github_user_ids, participant_github_user_ids,
- github_updated_at, assignees, labels, reviews
+ github_updated_at, assignees, labels, reviews,
+ base_ref, base_sha, head_ref, head_sha
FROM github_pull_request WHERE github_key = $1 FOR UPDATE"#,
update.github_key,
)
@@ -110,6 +112,18 @@ impl GithubPullRequestRepository for PgGithubPullRequestRepo {
.map_err(|error| sqlx::Error::Decode(error.into()))?,
reviews,
review_decision,
+ base: (stored.base_ref.is_some() || stored.base_sha.is_some()).then_some(
+ GitRef {
+ name: stored.base_ref,
+ sha: stored.base_sha,
+ },
+ ),
+ head: (stored.head_ref.is_some() || stored.head_sha.is_some()).then_some(
+ GitRef {
+ name: stored.head_ref,
+ sha: stored.head_sha,
+ },
+ ),
})
})
.transpose()?;
@@ -139,11 +153,15 @@ impl GithubPullRequestRepository for PgGithubPullRequestRepo {
assignees,
labels,
reviews,
- review_decision
+ review_decision,
+ base_ref,
+ base_sha,
+ head_ref,
+ head_sha
)
VALUES (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13,
- $14::jsonb, $15::jsonb, $16::jsonb, $17
+ $14::jsonb, $15::jsonb, $16::jsonb, $17, $18, $19, $20, $21
)
ON CONFLICT (github_key) DO UPDATE SET
repository_id = COALESCE(EXCLUDED.repository_id, github_pull_request.repository_id),
@@ -162,6 +180,10 @@ impl GithubPullRequestRepository for PgGithubPullRequestRepo {
labels = EXCLUDED.labels,
reviews = EXCLUDED.reviews,
review_decision = EXCLUDED.review_decision,
+ base_ref = CASE WHEN $22::bool THEN EXCLUDED.base_ref ELSE github_pull_request.base_ref END,
+ base_sha = CASE WHEN $22::bool THEN EXCLUDED.base_sha ELSE github_pull_request.base_sha END,
+ head_ref = CASE WHEN $23::bool THEN EXCLUDED.head_ref ELSE github_pull_request.head_ref END,
+ head_sha = CASE WHEN $23::bool THEN EXCLUDED.head_sha ELSE github_pull_request.head_sha END,
updated_at = NOW()
"#,
row.github_key,
@@ -181,6 +203,12 @@ impl GithubPullRequestRepository for PgGithubPullRequestRepo {
labels,
reviews,
row.review_decision.map(|decision| decision.as_str()),
+ row.base.as_ref().and_then(|base| base.name.as_deref()),
+ row.base.as_ref().and_then(|base| base.sha.as_deref()),
+ row.head.as_ref().and_then(|head| head.name.as_deref()),
+ row.head.as_ref().and_then(|head| head.sha.as_deref()),
+ row.base.is_some(),
+ row.head.is_some(),
)
.execute(&mut *tx)
.await?;
@@ -237,7 +265,11 @@ impl GithubPullRequestRepository for PgGithubPullRequestRepo {
assignees,
labels,
reviews,
- review_decision
+ review_decision,
+ base_ref,
+ base_sha,
+ head_ref,
+ head_sha
FROM github_pull_request
WHERE github_key = $1
"#,
@@ -273,10 +305,16 @@ impl GithubPullRequestRepository for PgGithubPullRequestRepo {
.review_decision
.map(|decision| decode(serde_json::Value::String(decision)))
.transpose()?,
+ base: git_ref(row.base_ref, row.base_sha),
+ head: git_ref(row.head_ref, row.head_sha),
}))
}
}
+fn git_ref(name: Option<String>, sha: Option<String>) -> Option<GitRef> {
+ (name.is_some() || sha.is_some()).then_some(GitRef { name, sha })
+}
+
fn decode<T: serde::de::DeserializeOwned>(value: serde_json::Value) -> Result<T, sqlx::Error> {
serde_json::from_value(value).map_err(|error| sqlx::Error::Decode(error.into()))
}
diff --git a/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/changesets.rs b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/changesets.rs
new file mode 100644
index 0000000000..513c25f6d1
--- /dev/null
+++ b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/changesets.rs
@@ -0,0 +1,170 @@
+//! Pull request changeset summaries in `github_pull_request_changeset`.
+
+#[cfg(test)]
+mod test;
+
+use std::num::NonZeroU64;
+
+use chrono::{DateTime, Utc};
+use git_patch::ChangedFile;
+use uuid::Uuid;
+
+use super::PgGithubPullRequestRepo;
+use crate::domain::{
+ models::{ChangesetRange, GitRef, GithubPullRequestChangeset, PullRequestRef, RepositorySlug},
+ ports::GithubPullRequestChangesetRepository,
+};
+
+/// The row as stored, kept apart from the domain type so a column rename touches one mapping.
+struct ChangesetRow {
+ id: Uuid,
+ github_key: String,
+ repository: String,
+ number: i64,
+ base_ref: Option<String>,
+ base_sha: String,
+ head_ref: Option<String>,
+ head_sha: String,
+ files: serde_json::Value,
+ additions: i32,
+ deletions: i32,
+ patch_blob_key: Option<String>,
+ patch_bytes: i64,
+ truncated: bool,
+ captured_at: DateTime<Utc>,
+}
+
+impl ChangesetRow {
+ fn into_changeset(self) -> Result<GithubPullRequestChangeset, sqlx::Error> {
+ let decode_error = |message: String| sqlx::Error::Decode(message.into());
+ let repository = RepositorySlug::parse(&self.repository)
+ .ok_or_else(|| decode_error(format!("stored repository {}", self.repository)))?;
+ let number = u64::try_from(self.number)
+ .ok()
+ .and_then(NonZeroU64::new)
+ .ok_or_else(|| decode_error(format!("stored pull request number {}", self.number)))?;
+ let files: Vec<ChangedFile> = serde_json::from_value(self.files)
+ .map_err(|error| decode_error(format!("stored changed files: {error}")))?;
+ Ok(GithubPullRequestChangeset {
+ id: self.id,
+ github_key: self.github_key,
+ range: ChangesetRange {
+ repository: Some(repository.https_url()),
+ base: GitRef {
+ name: self.base_ref,
+ sha: Some(self.base_sha),
+ },
+ head: GitRef {
+ name: self.head_ref,
+ sha: Some(self.head_sha),
+ },
+ },
+ pull_request: PullRequestRef { repository, number },
+ files,
+ additions: u32::try_from(self.additions).unwrap_or(u32::MAX),
+ deletions: u32::try_from(self.deletions).unwrap_or(u32::MAX),
+ patch_bytes: u64::try_from(self.patch_bytes).unwrap_or(0),
+ truncated: self.truncated,
+ patch_key: self.patch_blob_key,
+ captured_at: self.captured_at,
+ })
+ }
+}
+
+impl GithubPullRequestChangesetRepository for PgGithubPullRequestRepo {
+ type Err = sqlx::Error;
+
+ #[tracing::instrument(err, skip(self))]
+ async fn get_changeset(
+ &self,
+ id: Uuid,
+ ) -> Result<Option<GithubPullRequestChangeset>, Self::Err> {
+ let row = sqlx::query_as!(
+ ChangesetRow,
+ r#"
+ SELECT
+ id,
+ github_key,
+ repository,
+ number,
+ base_ref,
+ base_sha,
+ head_ref,
+ head_sha,
+ files,
+ additions,
+ deletions,
+ patch_blob_key,
+ patch_bytes,
+ truncated,
+ captured_at
+ FROM github_pull_request_changeset
+ WHERE id = $1
+ "#,
+ id,
+ )
+ .fetch_optional(&self.pool)
+ .await?;
+
+ row.map(ChangesetRow::into_changeset).transpose()
+ }
+
+ #[tracing::instrument(err, skip(self, changeset), fields(changeset.id = %changeset.id))]
+ async fn insert_changeset(
+ &self,
+ changeset: &GithubPullRequestChangeset,
+ ) -> Result<(), Self::Err> {
+ let files = serde_json::to_value(&changeset.files)
+ .map_err(|error| sqlx::Error::Encode(error.into()))?;
+ let (Some(base_sha), Some(head_sha)) = (
+ changeset.range.base.sha.as_deref(),
+ changeset.range.head.sha.as_deref(),
+ ) else {
+ return Err(sqlx::Error::Encode(
+ "a pull request changeset needs its base and head commits".into(),
+ ));
+ };
+ sqlx::query!(
+ r#"
+ INSERT INTO github_pull_request_changeset (
+ id,
+ github_key,
+ repository,
+ number,
+ base_ref,
+ base_sha,
+ head_ref,
+ head_sha,
+ files,
+ additions,
+ deletions,
+ patch_blob_key,
+ patch_bytes,
+ truncated,
+ captured_at
+ )
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9::jsonb, $10, $11, $12, $13, $14, $15)
+ ON CONFLICT (id) DO NOTHING
+ "#,
+ changeset.id,
+ changeset.github_key,
+ changeset.pull_request.repository.https_url(),
+ i64::try_from(changeset.pull_request.number.get()).unwrap_or(i64::MAX),
+ changeset.range.base.name.as_deref(),
+ base_sha,
+ changeset.range.head.name.as_deref(),
+ head_sha,
+ files,
+ i32::try_from(changeset.additions).unwrap_or(i32::MAX),
+ i32::try_from(changeset.deletions).unwrap_or(i32::MAX),
+ changeset.patch_key.as_deref(),
+ i64::try_from(changeset.patch_bytes).unwrap_or(i64::MAX),
+ changeset.truncated,
+ changeset.captured_at,
+ )
+ .execute(&self.pool)
+ .await?;
+
+ Ok(())
+ }
+}
diff --git a/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/changesets/test.rs b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/changesets/test.rs
new file mode 100644
index 0000000000..cc173ea18c
--- /dev/null
+++ b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/changesets/test.rs
@@ -0,0 +1,70 @@
+use git_patch::FileChangeKind;
+use macro_db_migrator::MACRO_DB_MIGRATIONS;
+use sqlx::PgPool;
+
+use super::*;
+
+fn changeset(head_sha: &str) -> GithubPullRequestChangeset {
+ let pull_request = PullRequestRef {
+ repository: RepositorySlug {
+ owner: "macro".to_string(),
+ name: "app".to_string(),
+ },
+ number: NonZeroU64::new(7).unwrap(),
+ };
+ GithubPullRequestChangeset {
+ id: crate::domain::models::changeset_id(&pull_request, "base-sha", head_sha),
+ github_key: "macro/app/pull/7".to_string(),
+ range: ChangesetRange {
+ repository: Some(pull_request.repository.https_url()),
+ base: GitRef {
+ name: Some("main".to_string()),
+ sha: Some("base-sha".to_string()),
+ },
+ head: GitRef {
+ name: Some("feature".to_string()),
+ sha: Some(head_sha.to_string()),
+ },
+ },
+ pull_request,
+ files: vec![ChangedFile {
+ path: "a.rs".to_string(),
+ previous_path: None,
+ kind: FileChangeKind::Modified,
+ additions: 1,
+ deletions: 1,
+ binary: false,
+ patch_omitted: false,
+ }],
+ additions: 1,
+ deletions: 1,
+ patch_bytes: 42,
+ truncated: false,
+ patch_key: Some(format!(
+ "pull-requests/macro/app/7/base-sha...{head_sha}.patch"
+ )),
+ captured_at: chrono::DateTime::parse_from_rfc3339("2026-09-27T12:00:00Z")
+ .unwrap()
+ .with_timezone(&Utc),
+ }
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn a_changeset_reads_back_as_stored_and_is_stored_once(pool: PgPool) {
+ let repo = PgGithubPullRequestRepo::new(pool);
+ let stored = changeset("head-1");
+
+ repo.insert_changeset(&stored).await.unwrap();
+ repo.insert_changeset(&GithubPullRequestChangeset {
+ truncated: true,
+ ..stored.clone()
+ })
+ .await
+ .unwrap();
+
+ assert_eq!(repo.get_changeset(stored.id).await.unwrap(), Some(stored));
+ assert_eq!(
+ repo.get_changeset(changeset("head-2").id).await.unwrap(),
+ None
+ );
+}
diff --git a/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/facets/test.rs b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/facets/test.rs
index 218c3f58e3..d65521ccc7 100644
--- a/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/facets/test.rs
+++ b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/facets/test.rs
@@ -58,6 +58,8 @@ fn row(github_key: &str, repository_id: Option<i64>, number: i64) -> GithubPullR
labels: Vec::new(),
reviews: Vec::new(),
review_decision: None,
+ base: None,
+ head: None,
}
}
diff --git a/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/test.rs b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/test.rs
index ada40a654a..e14f9af4c2 100644
--- a/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/test.rs
+++ b/crates/github_pull_requests/src/outbound/pg_github_pull_request_repo/test.rs
@@ -4,7 +4,7 @@ use sqlx::PgPool;
use super::PgGithubPullRequestRepo;
use crate::domain::{
models::{
- GithubPullRequestLabel, GithubPullRequestReview, GithubPullRequestReviewDecision,
+ GitRef, GithubPullRequestLabel, GithubPullRequestReview, GithubPullRequestReviewDecision,
GithubPullRequestReviewState, GithubPullRequestRow, GithubPullRequestStatus,
GithubPullRequestUser,
},
@@ -47,6 +47,8 @@ fn row(github_key: &str, repository_id: Option<i64>) -> GithubPullRequestRow {
labels: Vec::new(),
reviews: Vec::new(),
review_decision: Some(GithubPullRequestReviewDecision::ReviewRequired),
+ base: None,
+ head: None,
}
}
@@ -313,6 +315,14 @@ async fn lookup_reads_back_the_stored_row(pool: PgPool) {
submitted_at: None,
}],
review_decision: Some(GithubPullRequestReviewDecision::ChangesRequested),
+ base: Some(GitRef {
+ name: Some("main".to_string()),
+ sha: Some("base-sha".to_string()),
+ }),
+ head: Some(GitRef {
+ name: Some("feature".to_string()),
+ sha: Some("head-sha".to_string()),
+ }),
..row("macro/app/pull/7", Some(99))
};
repo.upsert_row(&(&stored).into())
@@ -328,3 +338,62 @@ async fn lookup_reads_back_the_stored_row(pool: PgPool) {
None
);
}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn partial_git_refs_replace_name_and_sha_together(pool: PgPool) {
+ let repo = PgGithubPullRequestRepo::new(pool);
+ let original = GithubPullRequestRow {
+ base: Some(GitRef {
+ name: Some("main".to_string()),
+ sha: Some("old-base-sha".to_string()),
+ }),
+ head: Some(GitRef {
+ name: Some("feature".to_string()),
+ sha: Some("old-head-sha".to_string()),
+ }),
+ ..row("macro/app/pull/7", Some(99))
+ };
+ for partial in [
+ Some(GitRef {
+ name: Some("new-branch".to_string()),
+ sha: None,
+ }),
+ Some(GitRef {
+ name: None,
+ sha: Some("new-sha".to_string()),
+ }),
+ Some(GitRef {
+ name: None,
+ sha: None,
+ }),
+ None,
+ ] {
+ for update_base in [true, false] {
+ repo.upsert_row(&(&original).into()).await.unwrap();
+ let mut incoming = row("macro/app/pull/7", Some(99));
+ let mut expected = original.clone();
+ let expected_ref = match &partial {
+ Some(git_ref) if git_ref.name.is_some() || git_ref.sha.is_some() => {
+ Some(git_ref.clone())
+ }
+ Some(_) => None,
+ None if update_base => original.base.clone(),
+ None => original.head.clone(),
+ };
+ if update_base {
+ incoming.base = partial.clone();
+ expected.base = expected_ref;
+ } else {
+ incoming.head = partial.clone();
+ expected.head = expected_ref;
+ }
+ repo.upsert_row(&(&incoming).into()).await.unwrap();
+
+ assert_eq!(
+ repo.pull_request_row("macro/app/pull/7").await.unwrap(),
+ Some(expected),
+ "update_base={update_base}, partial={partial:?}",
+ );
+ }
+ }
+}
diff --git a/crates/github_pull_requests/src/outbound/s3_patch_store.rs b/crates/github_pull_requests/src/outbound/s3_patch_store.rs
new file mode 100644
index 0000000000..cd7d5df163
--- /dev/null
+++ b/crates/github_pull_requests/src/outbound/s3_patch_store.rs
@@ -0,0 +1,71 @@
+//! Pull request patches in S3, one object per base and head under `pull-requests/`. Keys are
+//! minted by the domain; this adapter only moves bytes. Patches are UTF-8 text of at most a few
+//! megabytes, so they are read whole.
+
+use aws_sdk_s3::primitives::ByteStream;
+
+use crate::domain::ports::GithubPullRequestPatchStore;
+
+/// S3-backed [`GithubPullRequestPatchStore`].
+#[derive(Clone)]
+pub struct S3GithubPullRequestPatchStore {
+ client: aws_sdk_s3::Client,
+ bucket: String,
+}
+
+impl S3GithubPullRequestPatchStore {
+ /// Store patches in `bucket` through `client`.
+ #[must_use]
+ pub fn new(client: aws_sdk_s3::Client, bucket: String) -> Self {
+ Self { client, bucket }
+ }
+}
+
+impl GithubPullRequestPatchStore for S3GithubPullRequestPatchStore {
+ type Err = anyhow::Error;
+
+ #[tracing::instrument(skip(self, patch), err, fields(bytes = patch.len()))]
+ async fn put_patch(&self, key: &str, patch: &str) -> Result<(), Self::Err> {
+ self.client
+ .put_object()
+ .bucket(&self.bucket)
+ .key(key)
+ .content_type("text/x-diff; charset=utf-8")
+ .body(ByteStream::from(patch.as_bytes().to_vec()))
+ .send()
+ .await
+ .map_err(|error| anyhow::anyhow!("put patch {key}: {error:?}"))?;
+ Ok(())
+ }
+
+ #[tracing::instrument(skip(self), err)]
+ async fn get_patch(&self, key: &str) -> Result<Option<String>, Self::Err> {
+ let response = match self
+ .client
+ .get_object()
+ .bucket(&self.bucket)
+ .key(key)
+ .send()
+ .await
+ {
+ Ok(response) => response,
+ Err(error)
+ if error
+ .as_service_error()
+ .is_some_and(|service_error| service_error.is_no_such_key()) =>
+ {
+ return Ok(None);
+ }
+ Err(error) => return Err(anyhow::anyhow!("get patch {key}: {error:?}")),
+ };
+ let bytes = response
+ .body
+ .collect()
+ .await
+ .map_err(|error| anyhow::anyhow!("read patch {key}: {error:?}"))?
+ .into_bytes();
+ String::from_utf8(bytes.to_vec())
+ .map(Some)
+ .map_err(|error| anyhow::anyhow!("patch {key} is not UTF-8: {error}"))
+ }
+}
diff --git a/crates/macro_db_client/migrations/20260927202202_github_pull_request_base_head.sql b/crates/macro_db_client/migrations/20260927202202_github_pull_request_base_head.sql
new file mode 100644
index 0000000000..f00229be2c
--- /dev/null
+++ b/crates/macro_db_client/migrations/20260927202202_github_pull_request_base_head.sql
@@ -0,0 +1,7 @@
+-- The branches and commits a GitHub pull request compares, kept current by pull request
+-- webhooks, so its changes can be looked up by base and head without asking GitHub.
+ALTER TABLE github_pull_request
+ ADD COLUMN base_ref TEXT,
+ ADD COLUMN base_sha TEXT,
+ ADD COLUMN head_ref TEXT,
+ ADD COLUMN head_sha TEXT;
diff --git a/crates/macro_db_client/migrations/20260927202507_github_pull_request_changeset.sql b/crates/macro_db_client/migrations/20260927202507_github_pull_request_changeset.sql
new file mode 100644
index 0000000000..598a1d0265
--- /dev/null
+++ b/crates/macro_db_client/migrations/20260927202507_github_pull_request_changeset.sql
@@ -0,0 +1,27 @@
+-- A GitHub pull request's changes at one base and head: the per-file summary a review
+-- shows first, and where the patch is stored in S3. The id is derived from the repository,
+-- number, and both commits, so the same range is stored once however many users, teams, or
+-- agent sessions read it. The patch object may expire; it is re-read from GitHub on demand.
+CREATE TABLE github_pull_request_changeset (
+ id UUID PRIMARY KEY,
+ github_key TEXT NOT NULL,
+ -- `https://github.com/owner/name`
+ repository TEXT NOT NULL,
+ number BIGINT NOT NULL,
+ base_ref TEXT,
+ base_sha TEXT NOT NULL,
+ head_ref TEXT,
+ head_sha TEXT NOT NULL,
+ -- git_patch::ChangedFile, one per changed file, in patch order.
+ files JSONB NOT NULL DEFAULT '[]'::jsonb,
+ additions INTEGER NOT NULL DEFAULT 0,
+ deletions INTEGER NOT NULL DEFAULT 0,
+ -- NULL when nothing changed.
+ patch_blob_key TEXT,
+ patch_bytes BIGINT NOT NULL DEFAULT 0,
+ truncated BOOLEAN NOT NULL DEFAULT false,
+ captured_at TIMESTAMPTZ NOT NULL
+);
+
+CREATE INDEX idx_github_pull_request_changeset_github_key
+ ON github_pull_request_changeset (github_key);
diff --git a/crates/macro_db_client/migrations/20260927203933_agent_session_changes_pull_request_changeset.sql b/crates/macro_db_client/migrations/20260927203933_agent_session_changes_pull_request_changeset.sql
new file mode 100644
index 0000000000..e3ba1c4291
--- /dev/null
+++ b/crates/macro_db_client/migrations/20260927203933_agent_session_changes_pull_request_changeset.sql
@@ -0,0 +1,9 @@
+-- A session's changes can be a pull request changeset shared with every other
+-- reader of the same base and head, instead of a patch stored under the
+-- session. At most one of the two says where the session's patch is.
+ALTER TABLE agent_session_changes
+ ADD COLUMN pull_request_changeset_id UUID
+ REFERENCES github_pull_request_changeset(id) ON DELETE SET NULL,
+ ADD CONSTRAINT agent_session_changes_one_patch_location CHECK (
+ patch_blob_key IS NULL OR pull_request_changeset_id IS NULL
+ );
diff --git a/docker/docker-compose.local-e2e.yml b/docker/docker-compose.local-e2e.yml
index 4aa0638a77..978040bf5c 100644
--- a/docker/docker-compose.local-e2e.yml
+++ b/docker/docker-compose.local-e2e.yml
@@ -22,6 +22,7 @@ x-local-e2e-env: &local-e2e-env
STATIC_STORAGE_BUCKET: static-file-storage
UPLOAD_STAGING_BUCKET: bulk-upload-staging
AGENT_SESSION_CHANGES_BUCKET: agent-session-changes
+ GITHUB_PULL_REQUEST_PATCH_BUCKET: github-pull-request-patches
BULK_UPLOAD_REQUESTS_TABLE: bulk-upload
CONNECTION_GATEWAY_TABLE: connection-gateway-table
diff --git a/infra/stacks/agent-harness-service/index.ts b/infra/stacks/agent-harness-service/index.ts
index 8a1cfb397e..f867d5e3aa 100644
--- a/infra/stacks/agent-harness-service/index.ts
+++ b/infra/stacks/agent-harness-service/index.ts
@@ -89,6 +89,21 @@ const cloudStorageClusterName = cloudStorageStack
.getOutput('cloudStorageClusterName')
.apply((value) => value as string);
+// Pull request patches are shared with cloud-storage-service, which owns the
+// bucket; a session capture reuses the patch a pull request viewer stored.
+const cloudStorageServiceStack = new pulumi.StackReference(
+ 'cloud-storage-service-stack',
+ { name: `macro-inc/cloud-storage-service/${stack}` }
+);
+
+const githubPullRequestPatchBucketArn = cloudStorageServiceStack
+ .getOutput('githubPullRequestPatchBucketArn')
+ .apply((value) => value as string);
+
+const githubPullRequestPatchBucketName = cloudStorageServiceStack
+ .getOutput('githubPullRequestPatchBucketName')
+ .apply((value) => value as string);
+
// ── Service ──────────────────────────────────────────────────────────────────
const vpc = get_coparse_api_vpc();
@@ -110,7 +125,11 @@ const service = new AgentHarnessService(`agent-harness-service-${stack}`, {
...aiTools.secretArns,
],
queueArns: [...aiTools.queueArns],
- bucketArns: [...aiTools.bucketArns, sessionChangesBucket.arn],
+ bucketArns: [
+ ...aiTools.bucketArns,
+ sessionChangesBucket.arn,
+ githubPullRequestPatchBucketArn,
+ ],
containerEnvVars: [
{
name: 'CODEX_OAUTH_KMS_KEY_ID',
@@ -124,6 +143,10 @@ const service = new AgentHarnessService(`agent-harness-service-${stack}`, {
name: 'AGENT_SESSION_CHANGES_BUCKET',
value: sessionChangesBucket.bucket,
},
+ {
+ name: 'GITHUB_PULL_REQUEST_PATCH_BUCKET',
+ value: githubPullRequestPatchBucketName,
+ },
// Datadog
{
name: 'DD_SERVICE',
diff --git a/infra/stacks/cloud-storage-service/cloud-storage-service.ts b/infra/stacks/cloud-storage-service/cloud-storage-service.ts
index 9e497bbbbf..2765b15504 100644
--- a/infra/stacks/cloud-storage-service/cloud-storage-service.ts
+++ b/infra/stacks/cloud-storage-service/cloud-storage-service.ts
@@ -36,6 +36,7 @@ type CreateCloudStorageServiceServiceArgs = {
platform: { family: string; architecture: 'amd64' | 'arm64' };
documentStorageBucketArn: pulumi.Output<string> | string;
docxUploadBucketArn: pulumi.Output<string> | string;
+ githubPullRequestPatchBucketArn: pulumi.Output<string> | string;
serviceContainerPort: number;
containerEnvVars?: { name: string; value: pulumi.Output<string> | string }[];
healthCheckPath: string;
@@ -64,6 +65,7 @@ export class CloudStorageService extends pulumi.ComponentResource {
platform,
documentStorageBucketArn,
docxUploadBucketArn,
+ githubPullRequestPatchBucketArn,
serviceContainerPort,
healthCheckPath,
containerEnvVars,
@@ -107,6 +109,8 @@ export class CloudStorageService extends pulumi.ComponentResource {
pulumi.interpolate`${documentStorageBucketArn}/*`,
docxUploadBucketArn,
pulumi.interpolate`${docxUploadBucketArn}/*`,
+ githubPullRequestPatchBucketArn,
+ pulumi.interpolate`${githubPullRequestPatchBucketArn}/*`,
],
Effect: 'Allow',
},
diff --git a/infra/stacks/cloud-storage-service/index.ts b/infra/stacks/cloud-storage-service/index.ts
index 3b17063b2a..45bad7ffbb 100644
--- a/infra/stacks/cloud-storage-service/index.ts
+++ b/infra/stacks/cloud-storage-service/index.ts
@@ -238,6 +238,29 @@ export const slackImportWorkerSgId = slackImportWorker?.serviceSg.id;
export const docxUploadBucketArn = docxUploadBucket.arn;
export const docxUploadBucketName = docxUploadBucket.id;
+// ── GitHub pull request patches ──────────────────────────────────────────────
+// One patch per pull request base and head, under `pull-requests/`, shared by
+// every user, team, and agent session that reads those changes. A patch can be
+// read again from GitHub, so expiring it only costs a re-read.
+const githubPullRequestPatchBucket = createBucket({
+ id: `macro-github-pull-request-patches-${stack}`,
+ bucketName: `macro-github-pull-request-patches-${stack}`,
+ transferAcceleration: false,
+ enableVersioning: false,
+ lifecycleRules: [
+ {
+ id: 'expire-patches',
+ enabled: true,
+ expiration: { days: 90 },
+ },
+ ],
+ tags,
+});
+
+export const githubPullRequestPatchBucketArn = githubPullRequestPatchBucket.arn;
+export const githubPullRequestPatchBucketName =
+ githubPullRequestPatchBucket.bucket;
+
const deleteDocumentHandler = new DeleteDocumentHandler(
`delete-document-handler-${stack}`,
{
@@ -342,6 +365,7 @@ const cloudStorageService = new CloudStorageService(
},
documentStorageBucketArn,
docxUploadBucketArn,
+ githubPullRequestPatchBucketArn: githubPullRequestPatchBucket.arn,
serviceContainerPort: 8080,
healthCheckPath: '/health',
secretKeyArns: [
@@ -359,6 +383,10 @@ const cloudStorageService = new CloudStorageService(
callRecordingCrudPolicyArn,
snsPlatformArns: [snsApnsVoipPlatformArn],
containerEnvVars: [
+ {
+ name: 'GITHUB_PULL_REQUEST_PATCH_BUCKET',
+ value: githubPullRequestPatchBucket.bucket,
+ },
// OpenTelemetry / Datadog tracing configuration
{
name: 'DD_SERVICE',
diff --git a/packages/sdk/generated/storage/index.ts b/packages/sdk/generated/storage/index.ts
index 0e5ffe0565..8d75ffdb4a 100644
--- a/packages/sdk/generated/storage/index.ts
+++ b/packages/sdk/generated/storage/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { type Options, Sdk } from './sdk.gen';
-export type { AccessLevel, ActiveCallsResponse, ActiveCallSummary, ActiveMeeting, ActiveMeetingsResponse, ActivityType, AddFavoriteData, AddFavoriteError, AddFavoriteErrors, AddFavoriteRequest, AddFavoriteResponse, AddFavoriteResponses, AddParticipantsData, AddParticipantsError, AddParticipantsErrors, AddParticipantsRequest, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerError, AddPinHandlerErrors, AddPinHandlerResponse, AddPinHandlerResponses, AddPinRequest, Agent, AgentActionId, AgentChannelScope, AgentMcpServer, AgentMcpServers, AgentPullRequestState, AgentSessionFilters, AgentSessionLifecycleEvent, Anchor, AnchorId, AnchorResponse, AnnotationIncrementalUpdate, ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelDetail, ApiChannelListMessage, ApiChannelListPage, ApiChannelListParticipant, ApiChannelListType, ApiChannelParticipant, ApiChannelWithLatest, ApiEntityFilterAst, ApiGroupByField, ApiGroupMeta, ApiParticipantListRole, ApiParticipantRole, ApiPropertyEntityType, ApplyDatabaseOpsData, ApplyDatabaseOpsError, ApplyDatabaseOpsErrors, ApplyDatabaseOpsResponse, ApplyDatabaseOpsResponses, ApplyOpsRequest, ApplyOpsResponse, ApproveHarnessPairingData, ApproveHarnessPairingError, ApproveHarnessPairingErrors, ApproveHarnessPairingResponse, ApproveHarnessPairingResponses, ApprovePairingRequest, AssignInitiativeTasksData, AssignInitiativeTasksError, AssignInitiativeTasksErrors, AssignInitiativeTasksResponse, AssignInitiativeTasksResponses, AssignTasksRequest, AssignTasksResponse, AssignTasksResult, AssignTaskStatus, AttachmentChange, AttendeeResponseStatus, Awareness, AwarenessRelay, BasicDocument, BasicDocumentSubType, BomPart, Bot, BotChannel, BotChannelType, BotId, BotKind, BotOwner, BotOwnerProfile, BotSenderProfile, BotToken, BranchNameResponse, BTreeMap, BulkWakeupRequest, BulkWakeupResponse, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponse, BulkWakeupSyncServiceDocumentsResponses, CalendarAttendee, CalendarEvent, CalendarEventFilters, CalendarEventSourceContent, CalendarMentionEvent, CalendarMentionPreviewItem, CalendarMentionPreviewKind, CalendarMentionPreviewRequest, CalendarMentionPreviewRequestItem, CalendarMentionPreviewResponse, CalendarOccurrence, CalendarOccurrenceItem, CalendarOccurrenceResponse, CalendarSyncStatus, CallActiveResponse, CallFilters, CallRecord, CallRecordGuest, CallRecordParticipant, CallRecordPreview, CallRecordPreviewData, CallRecordTranscriptSegment, CallStatus, CallTokenResponse, CallWebhookData, CallWebhookError, CallWebhookErrors, CallWebhookResponses, CancelSlackImportData, CancelSlackImportErrors, CancelSlackImportResponse, CancelSlackImportResponses, CardPosition, CastVerdict, CellValue, CellWrite, Channel, ChannelCreatedMetadata, ChannelDeletedMetadata, ChannelFilters, ChannelJoinCodeResponse, ChannelLabel, ChannelLabelRule, ChannelLabelsList, ChannelMessage, ChannelParticipant, ChannelParticipantAddedMetadata, ChannelParticipantRemovedMetadata, ChannelPreview, ChannelPreviewData, ChannelSender, ChannelSharePermission, ChannelThreadFilters, ChannelTopicEvent, ChannelType, ChannelUpdatedMetadata, ChannelWebhookRequest, ChannelWebhookResponse, ChannelWithParticipants, Chat, ChatFilters, CheckActiveCallData, CheckActiveCallError, CheckActiveCallErrors, CheckActiveCallResponse, CheckActiveCallResponses, ClaimedPairing, ClaimHarnessPairingData, ClaimHarnessPairingError, ClaimHarnessPairingErrors, ClaimHarnessPairingResponse, ClaimHarnessPairingResponses, ClaimPairingRequest, ClientOptions, CloudStorageItemType, CollabSurfaceResponse, CollabSurfaceTokenResponse, Column, ColumnCast, ColumnChange, ColumnChangeKind, ColumnConfig, ColumnConversion, ColumnConversionRequest, ColumnDetail, ColumnKind, ColumnResult, CommandFailure, CommandRejectedMetadata, CommittedChange, CompleteSlackImportUploadsData, CompleteSlackImportUploadsErrors, CompleteSlackImportUploadsResponse, CompleteSlackImportUploadsResponses, CompleteUploads, ConferenceProvider, Conjunction, ConversationId, ConversationKind, ConversationMetadata, ConversationProgress, ConversationSeal, ConversationStatus, ConvertDatabaseColumnData, ConvertDatabaseColumnError, ConvertDatabaseColumnErrors, ConvertDatabaseColumnResponse, ConvertDatabaseColumnResponses, ConvertedCell, CopyDocumentData, CopyDocumentError, CopyDocumentErrors, CopyDocumentQueryParams, CopyDocumentRequest, CopyDocumentResponse, CopyDocumentResponse2, CopyDocumentResponses, CountedReaction, CreateAgentData, CreateAgentError, CreateAgentErrors, CreateAgentRequest, CreateAgentResponse, CreateAgentResponses, CreateAnchorData, CreateAnchorError, CreateAnchorErrors, CreateAnchorResponse, CreateAnchorResponses, CreateBotRequest, CreateBulkDocumentResponse, CreateBulkDocumentResponseData, CreateChannelData, CreateChannelError, CreateChannelErrors, CreateChannelLabelData, CreateChannelLabelError, CreateChannelLabelErrors, CreateChannelLabelRequest, CreateChannelLabelResponse, CreateChannelLabelResponses, CreateChannelRequest, CreateChannelResponse, CreateChannelResponse2, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotError, CreateChannelScopedBotErrors, CreateChannelScopedBotRequest, CreateChannelScopedBotResponse, CreateChannelScopedBotResponse2, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenError, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponse, CreateCollabSurfaceTokenResponses, CreateCrmCompanyData, CreateCrmCompanyError, CreateCrmCompanyErrors, CreateCrmCompanyRequest, CreateCrmCompanyResponse, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactError, CreateCrmContactErrors, CreateCrmContactRequest, CreateCrmContactResponse, CreateCrmContactResponses, CreateDatabaseData, CreateDatabaseError, CreateDatabaseErrors, CreateDatabaseRequest, CreateDatabaseResponse, CreateDatabaseResponses, CreateDocumentData, CreateDocumentError, CreateDocumentErrors, CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData, CreateDocumentResponses, CreatedPairing, CreatedUserApiKey, CreateEntityMentionData, CreateEntityMentionError, CreateEntityMentionErrors, CreateEntityMentionRequest, CreateEntityMentionResponse, CreateEntityMentionResponse2, CreateEntityMentionResponses, CreateHarnessPairingData, CreateHarnessPairingError, CreateHarnessPairingErrors, CreateHarnessPairingResponse, CreateHarnessPairingResponses, CreateImport, CreateInitiativeData, CreateInitiativeError, CreateInitiativeErrors, CreateInitiativeRequest, CreateInitiativeResponse, CreateInitiativeResponses, CreateInstructionsDocumentResponse, CreateInstructionsHandlerData, CreateInstructionsHandlerError, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponse, CreateInstructionsHandlerResponses, CreateMarkdownDocumentRequest, CreateMarkdownDocumentResponse, CreateMarkdownHandlerData, CreateMarkdownHandlerError, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponse, CreateMarkdownHandlerResponses, CreateMeetingRequest, CreatePairingRequest, CreateProjectHandlerData, CreateProjectHandlerError, CreateProjectHandlerErrors, CreateProjectHandlerResponse, CreateProjectHandlerResponses, CreateProjectRequest, CreateProjectResponse, CreateReminderData, CreateReminderError, CreateReminderErrors, CreateReminderRequest, CreateReminderResponse, CreateReminderResponses, CreateSkillHandlerData, CreateSkillHandlerError, CreateSkillHandlerErrors, CreateSkillHandlerResponse, CreateSkillHandlerResponses, CreateSkillRequest, CreateSkillResponse, CreateSlackImportData, CreateSlackImportErrors, CreateSlackImportResponse, CreateSlackImportResponses, CreateSnippetHandlerData, CreateSnippetHandlerError, CreateSnippetHandlerErrors, CreateSnippetHandlerResponse, CreateSnippetHandlerResponses, CreateSnippetRequest, CreateSnippetResponse, CreateTaskHandlerData, CreateTaskHandlerError, CreateTaskHandlerErrors, CreateTaskHandlerResponse, CreateTaskHandlerResponses, CreateTaskRequest, CreateTaskResponse, CreateToken, CreateUnthreadedAnchorRequest, CreateUnthreadedAnchorResponse, CreateUnthreadedPdfAnchorRequest, CreateUserApiKeyData, CreateUserApiKeyError, CreateUserApiKeyErrors, CreateUserApiKeyRequest, CreateUserApiKeyResponse, CreateUserApiKeyResponses, CreateViewHandlerData, CreateViewHandlerError, CreateViewHandlerErrors, CreateViewHandlerResponse, CreateViewHandlerResponses, CreateViewRequest, CreateWebhookData, CreateWebhookError, CreateWebhookErrors, CreateWebhookRequest, CreateWebhookResponse, CreateWebhookResponse2, CreateWebhookResponses, CrmCompanyFilters, CrmCompanyResponse, CrmContactResponse, CrmDomainResponse, CrmPermissionRole, CrmStageInput, CrmStageResponse, CrmStagesResponse, CrmTeamSettingsResponse, CustomSpeakerAssignment, Database, DatabaseDetail, DatabaseOp, DatabaseView, DataType, DateOperator, DeleteAnchorData, DeleteAnchorError, DeleteAnchorErrors, DeleteAnchorResponse, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordError, DeleteCallRecordErrors, DeleteCallRecordResponse, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelError, DeleteChannelErrors, DeleteChannelLabelData, DeleteChannelLabelError, DeleteChannelLabelErrors, DeleteChannelLabelResponse, DeleteChannelLabelResponses, DeleteChannelResponse, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceError, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponse, DeleteCollabSurfaceResponses, DeleteDocumentData, DeleteDocumentError, DeleteDocumentErrors, DeleteDocumentResponse, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionError, DeleteEntityMentionErrors, DeleteEntityMentionResponse, DeleteEntityMentionResponse2, DeleteEntityMentionResponses, DeleteHarnessData, DeleteHarnessError, DeleteHarnessErrors, DeleteHarnessResponse, DeleteHarnessResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerError, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponse, DeleteHistoryHandlerResponses, DeleteInitiativeData, DeleteInitiativeError, DeleteInitiativeErrors, DeleteInitiativeResponse, DeleteInitiativeResponses, DeleteProjectHandlerData, DeleteProjectHandlerError, DeleteProjectHandlerErrors, DeleteProjectHandlerResponse, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderError, DeleteReminderErrors, DeleteReminderResponse, DeleteReminderResponses, DeleteSelfHarnessData, DeleteSelfHarnessError, DeleteSelfHarnessErrors, DeleteSelfHarnessResponse, DeleteSelfHarnessResponses, DeleteUnthreadedAnchorRequest, DeleteUnthreadedAnchorResponse, DeleteUnthreadedPdfAnchorRequest, DeleteUserApiKeyData, DeleteUserApiKeyError, DeleteUserApiKeyErrors, DeleteUserApiKeyResponse, DeleteUserApiKeyResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationError, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponse, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerError, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookError, DeleteWebhookErrors, DeleteWebhookResponse, DeleteWebhookResponses, DescriptionDocumentId, DocumentBasic, DocumentContent, DocumentContentLocation, DocumentContentState, DocumentContentUploadedMetadata, DocumentCopiedMetadata, DocumentCreatedMetadata, DocumentDeletedMetadata, DocumentFilters, DocumentId, DocumentInteractionMetadata, DocumentMetadata, DocumentMetadataWithContent, DocumentPermissionsToken, DocumentPermissionsTokenRequest, DocumentPermissionsTokenResponse, DocumentPreview, DocumentPreviewData, DocumentPreviewDataSubType, DocumentPurgedMetadata, DocumentResponse, DocumentResponseMetadata, DocumentResponseMetadataWithContent, DocumentStorageServiceApiVersion, DocumentSubType, DocumentSyncContentUpdatedMetadata, DocumentSyncEditor, DocumentTeamShareResponse, DocumentTopicEvent, DocumentUpdatedMetadata, EditAnchorData, EditAnchorError, EditAnchorErrors, EditAnchorRequest, EditAnchorResponse, EditAnchorResponse2, EditAnchorResponses, EditCallRecordData, EditCallRecordError, EditCallRecordErrors, EditCallRecordRequest, EditCallRecordResponse, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptError, EditCallTranscriptErrors, EditCallTranscriptRequest, EditCallTranscriptResponse, EditCallTranscriptResponses, EditDocumentData, EditDocumentError, EditDocumentErrors, EditDocumentResponse, EditDocumentResponse2, EditDocumentResponses, EditDocumentServiceArgs, EditPdfAnchorRequest, EditPdfPlaceableCommentAnchorRequest, EditProjectV2Data, EditProjectV2Error, EditProjectV2Errors, EditProjectV2Response, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Error, EditThreadV2Errors, EditThreadV2Response, EditThreadV2Responses, EmailFilters, EmailFollowup, EmailFollowupCommand, EmailFollowupResponse, EmailReminderCondition, EmailReminderPage, EmailReminderSummary, EmptyResponse, EnsureCollabSurfaceData, EnsureCollabSurfaceError, EnsureCollabSurfaceErrors, EnsureCollabSurfaceRequest, EnsureCollabSurfaceResponse, EnsureCollabSurfaceResponses, EnsureStarterHandlerData, EnsureStarterHandlerErrors, EnsureStarterHandlerResponse, EnsureStarterHandlerResponses, EntityFilters, EntityKind, EntityMessageCreateData, EntityMessageCreateResponse, EntityMessageCreateResponses, EntityMessageDeleteMessageData, EntityMessageDeleteMessageResponse, EntityMessageDeleteMessageResponses, EntityMessageDeleteThreadData, EntityMessageDeleteThreadResponse, EntityMessageDeleteThreadResponses, EntityMessageEditData, EntityMessageEditResponse, EntityMessageEditResponses, EntityMessageGetMessageData, EntityMessageGetMessageResponse, EntityMessageGetMessageResponses, EntityMessageGetThreadData, EntityMessageGetThreadResponse, EntityMessageGetThreadResponses, EntityMessageLegacyData, EntityMessageLegacyResponse, EntityMessageLegacyResponses, EntityMessagePatchThreadData, EntityMessagePatchThreadResponse, EntityMessagePatchThreadResponses, EntityMessageReactData, EntityMessageReactResponse, EntityMessageReactResponses, EntityMessageTypingData, EntityMessageTypingResponse, EntityMessageTypingResponses, EntityPermission, EntityPermissionResponse, EntityRef, EntityReference, EntityType, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, ExcludedDefaultView, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerError, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExcludeDefaultViewRequest, ExportDocumentData, ExportDocumentError, ExportDocumentErrors, ExportDocumentResponse, ExportDocumentResponse2, ExportDocumentResponses, Favorite, FavoriteEntityRef, FavoritesList, FileSystemNodeWithIds, FileType, FileTypeUpdate, FilterCondition, FilterGroup, FilterNode, FilterTest, FinalizeSlackImportData, FinalizeSlackImportErrors, FinalizeSlackImportResponse, FinalizeSlackImportResponses, FolderItem, FollowupState, ForeignEntity, ForeignEntityFilters, GenericErrorResponse, GenericResponse, GenericSuccessResponse, GetActiveCallsData, GetActiveCallsError, GetActiveCallsErrors, GetActiveCallsResponse, GetActiveCallsResponses, GetActivityData, GetActivityError, GetActivityErrors, GetActivityResponse, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesError, GetAttachmentReferencesErrors, GetAttachmentReferencesResponse, GetAttachmentReferencesResponse2, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewError, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewRequest, GetBatchCallRecordPreviewResponse, GetBatchCallRecordPreviewResponse2, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewError, GetBatchChannelPreviewErrors, GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse, GetBatchChannelPreviewResponse2, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerError, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponse, GetBatchPreviewHandlerResponses, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchProjectPreviewData, GetBatchProjectPreviewError, GetBatchProjectPreviewErrors, GetBatchProjectPreviewRequest, GetBatchProjectPreviewResponse, GetBatchProjectPreviewResponse2, GetBatchProjectPreviewResponses, GetBotOwnerProfilesData, GetBotOwnerProfilesError, GetBotOwnerProfilesErrors, GetBotOwnerProfilesResponse, GetBotOwnerProfilesResponses, GetCallRecordData, GetCallRecordError, GetCallRecordErrors, GetCallRecordResponse, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsError, GetChannelAttachmentsErrors, GetChannelAttachmentsResponse, GetChannelAttachmentsResponses, GetChannelData, GetChannelError, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkError, GetChannelJoinLinkErrors, GetChannelJoinLinkResponse, GetChannelJoinLinkResponses, GetChannelParticipantsData, GetChannelParticipantsError, GetChannelParticipantsErrors, GetChannelParticipantsResponse, GetChannelParticipantsResponses, GetChannelResponse, GetChannelResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceError, GetCollabSurfaceErrors, GetCollabSurfaceResponse, GetCollabSurfaceResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContactByEmailData, GetContactByEmailError, GetContactByEmailErrors, GetContactByEmailResponse, GetContactByEmailResponse2, GetContactByEmailResponses, GetContactData, GetContactError, GetContactErrors, GetContactResponse, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsError, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponse, GetCrmTeamSettingsResponses, GetDatabaseData, GetDatabaseError, GetDatabaseErrors, GetDatabasePermissionsData, GetDatabasePermissionsError, GetDatabasePermissionsErrors, GetDatabasePermissionsResponse, GetDatabasePermissionsResponses, GetDatabaseQueryData, GetDatabaseQueryError, GetDatabaseQueryErrors, GetDatabaseQueryResponse, GetDatabaseQueryResponses, GetDatabaseResponse, GetDatabaseResponses, GetDatabaseRowHistoryData, GetDatabaseRowHistoryError, GetDatabaseRowHistoryErrors, GetDatabaseRowHistoryResponse, GetDatabaseRowHistoryResponses, GetDatabaseTableChangesData, GetDatabaseTableChangesError, GetDatabaseTableChangesErrors, GetDatabaseTableChangesResponse, GetDatabaseTableChangesResponses, GetDatabaseViewPositionsData, GetDatabaseViewPositionsError, GetDatabaseViewPositionsErrors, GetDatabaseViewPositionsResponse, GetDatabaseViewPositionsResponses, GetDocumentAnchorsData, GetDocumentAnchorsError, GetDocumentAnchorsErrors, GetDocumentAnchorsResponse, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameError, GetDocumentBranchNameErrors, GetDocumentBranchNameResponse, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugError, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponse, GetDocumentByTeamSlugResponses, GetDocumentData, GetDocumentError, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsError, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponse, GetDocumentGithubPullRequestsResponses, GetDocumentKeyResponse, GetDocumentKeyResponseData, GetDocumentListHandlerData, GetDocumentListHandlerError, GetDocumentListHandlerErrors, GetDocumentListHandlerResponse, GetDocumentListHandlerResponses, GetDocumentListResult, GetDocumentLocationV3Data, GetDocumentLocationV3Error, GetDocumentLocationV3Errors, GetDocumentLocationV3Response, GetDocumentLocationV3Responses, GetDocumentPermissionsResponseDataV2, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenError, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponse, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Error, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Response, GetDocumentPermissionsV2Responses, GetDocumentProcessingResult, GetDocumentProcessingResultData, GetDocumentProcessingResultError, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponse, GetDocumentProcessingResultResponse2, GetDocumentProcessingResultResponses, GetDocumentResponse, GetDocumentResponse2, GetDocumentResponseData, GetDocumentResponses, GetDocumentSearchResponse, GetDocumentShortIdData, GetDocumentShortIdError, GetDocumentShortIdErrors, GetDocumentShortIdResponse, GetDocumentShortIdResponses, GetDocumentsResponse, GetDocumentTeamShareData, GetDocumentTeamShareError, GetDocumentTeamShareErrors, GetDocumentTeamShareResponse, GetDocumentTeamShareResponses, GetDocumentUserAccessLevelResponse, GetDocumentVersionData, GetDocumentVersionError, GetDocumentVersionErrors, GetDocumentVersionResponse, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerError, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponse, GetDocumentViewsHandlerResponses, GetEmailFollowupData, GetEmailFollowupError, GetEmailFollowupErrors, GetEmailFollowupResponse, GetEmailFollowupResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponse, GetEntityPermissionResponses, GetForeignEntityBySourceData, GetForeignEntityBySourceError, GetForeignEntityBySourceErrors, GetForeignEntityBySourceResponse, GetForeignEntityBySourceResponses, GetForeignEntityData, GetForeignEntityError, GetForeignEntityErrors, GetForeignEntityResponse, GetForeignEntityResponses, GetGithubPullRequestData, GetGithubPullRequestError, GetGithubPullRequestErrors, GetGithubPullRequestFacetsData, GetGithubPullRequestFacetsError, GetGithubPullRequestFacetsErrors, GetGithubPullRequestFacetsResponse, GetGithubPullRequestFacetsResponses, GetGithubPullRequestResponse, GetGithubPullRequestResponses, GetHarnessPairingData, GetHarnessPairingError, GetHarnessPairingErrors, GetHarnessPairingResponse, GetHarnessPairingResponses, GetHistoryHandlerData, GetHistoryHandlerError, GetHistoryHandlerErrors, GetHistoryHandlerResponse, GetHistoryHandlerResponses, GetInitiativeData, GetInitiativeError, GetInitiativeErrors, GetInitiativeResponse, GetInitiativeResponses, GetInstructionsDocumentResponse, GetInstructionsHandlerData, GetInstructionsHandlerError, GetInstructionsHandlerErrors, GetInstructionsHandlerResponse, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupError, GetItemsSoupErrors, GetItemsSoupResponse, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerError, GetLocationHandlerErrors, GetLocationHandlerResponse, GetLocationHandlerResponses, GetOrCreateAction, GetOrCreateCallData, GetOrCreateCallError, GetOrCreateCallErrors, GetOrCreateCallResponse, GetOrCreateCallResponses, GetOrCreateChannelResponse, GetOrCreateDmData, GetOrCreateDmError, GetOrCreateDmErrors, GetOrCreateDmRequest, GetOrCreateDmResponse, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateError, GetOrCreatePrivateErrors, GetOrCreatePrivateRequest, GetOrCreatePrivateResponse, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerError, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponse, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerError, GetPinsHandlerErrors, GetPinsHandlerResponse, GetPinsHandlerResponses, GetPinsResponse, GetProjectContentHandlerData, GetProjectContentHandlerError, GetProjectContentHandlerErrors, GetProjectContentHandlerResponse, GetProjectContentHandlerResponses, GetProjectContentResponse, GetProjectHandlerData, GetProjectHandlerError, GetProjectHandlerErrors, GetProjectHandlerResponse, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Error, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Response, GetProjectPermissionsV2Responses, GetProjectResponse, GetProjectResponseData, GetProjectsHandlerData, GetProjectsHandlerError, GetProjectsHandlerErrors, GetProjectsHandlerResponse, GetProjectsHandlerResponses, GetProjectsResponse, GetProjectUserAccessLevelData, GetProjectUserAccessLevelError, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponse, GetProjectUserAccessLevelResponses, GetReminderData, GetReminderError, GetReminderErrors, GetReminderResponse, GetReminderResponses, GetRingStatusData, GetRingStatusError, GetRingStatusErrors, GetRingStatusResponse, GetRingStatusResponses, GetSelfBotData, GetSelfBotError, GetSelfBotErrors, GetSelfBotResponse, GetSelfBotResponses, GetSelfHarnessData, GetSelfHarnessError, GetSelfHarnessErrors, GetSelfHarnessResponse, GetSelfHarnessResponses, GetSlackImportData, GetSlackImportErrors, GetSlackImportResponse, GetSlackImportResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerError, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponse, GetSystemSkillsHandlerResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerError, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponse, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationError, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponse, GetUserDocumentViewLocationResponses, GetUserHistoryResponse, GetViewsHandlerData, GetViewsHandlerError, GetViewsHandlerErrors, GetViewsHandlerResponse, GetViewsHandlerResponses, GetWebhookData, GetWebhookError, GetWebhookErrors, GetWebhookResponse, GetWebhookResponses, GithubLabelFacet, GithubPullRequest, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestFacets, GithubPullRequestLabel, GithubPullRequestReview, GithubPullRequestReviewDecision, GithubPullRequestReviewState, GithubPullRequestsResponse, GithubPullRequestUser, GithubRepositoryFacet, GithubUserFacet, GroupedInitialParams, GroupedPageParams, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage, GroupedSoupSort, GuestId, GuestJoinRequest, HandlerData, HandlerError, HandlerErrors, HandlerResponse, HandlerResponses, Harness, HarnessAgent, HarnessId, HarnessOwner, HarnessSession, HashMap, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HighlightType, ImportCounters, ImportDatabaseTableData, ImportDatabaseTableError, ImportDatabaseTableErrors, ImportDatabaseTableResponse, ImportDatabaseTableResponses, ImportedAuthor, ImportError, ImportLimits, ImportPage, ImportProgress, ImportTable, ImportWarning, InferColumnTypeOutcome, InferColumnTypeRequest, InferDatabaseColumnTypeData, InferDatabaseColumnTypeError, InferDatabaseColumnTypeErrors, InferDatabaseColumnTypeResponse, InferDatabaseColumnTypeResponses, InFlightTurnSummary, IngestTranscriptData, IngestTranscriptError, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsError, InitializeUserDocumentsErrors, InitializeUserDocumentsResponse, InitializeUserDocumentsResponses, InitialPropertyValue, InitiativeDetail, InitiativeFilters, InitiativeId, InitiativeList, InitiativeSummary, InputReceivedMetadata, InstallSyncData, InstallSyncErrors, InteractionReason, InviteMeetingRequest, InviteMeetingUsersRequest, Item, ItemWithUserAccessLevel, JobId, JobProcessingResultHandlerData, JobProcessingResultHandlerError, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponse, JobProcessingResultHandlerResponses, JobStatus, JoinChannelByCodeData, JoinChannelByCodeError, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelError, JoinChannelErrors, JoinChannelResponses, KeySegment, Lane, LaneKey, LatestMessage, LeaveCallResponse, LeaveChannelData, LeaveChannelError, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallError, LeaveOrEndCallErrors, LeaveOrEndCallResponse, LeaveOrEndCallResponses, LinkShare, ListAgentsData, ListAgentsError, ListAgentsErrors, ListAgentsResponse, ListAgentsResponses, ListBotChannelsData, ListBotChannelsError, ListBotChannelsErrors, ListBotChannelsResponse, ListBotChannelsResponses, ListChannelLabelsData, ListChannelLabelsError, ListChannelLabelsErrors, ListChannelLabelsResponse, ListChannelLabelsResponses, ListCompanyContactsData, ListCompanyContactsError, ListCompanyContactsErrors, ListCompanyContactsResponse, ListCompanyContactsResponses, ListDatabaseColumnCastsData, ListDatabaseColumnCastsError, ListDatabaseColumnCastsErrors, ListDatabaseColumnCastsResponse, ListDatabaseColumnCastsResponses, ListDatabasesData, ListDatabasesError, ListDatabasesErrors, ListDatabasesResponse, ListDatabasesResponses, ListedDatabase, ListEmailRemindersData, ListEmailRemindersError, ListEmailRemindersErrors, ListEmailRemindersResponse, ListEmailRemindersResponses, ListFavoritesData, ListFavoritesError, ListFavoritesErrors, ListFavoritesResponse, ListFavoritesResponses, ListHarnessAgentsData, ListHarnessAgentsError, ListHarnessAgentsErrors, ListHarnessAgentsResponse, ListHarnessAgentsResponses, ListHarnessesData, ListHarnessesError, ListHarnessesErrors, ListHarnessesResponse, ListHarnessesResponses, ListHarnessSessionsData, ListHarnessSessionsError, ListHarnessSessionsErrors, ListHarnessSessionsResponse, ListHarnessSessionsResponses, ListInitiativesData, ListInitiativesError, ListInitiativesErrors, ListInitiativesResponse, ListInitiativesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponse, ListOccurrencesResponses, ListReminderCollectionData, ListReminderCollectionError, ListReminderCollectionErrors, ListReminderCollectionResponse, ListReminderCollectionResponses, ListRemindersData, ListRemindersError, ListRemindersErrors, ListRemindersResponse, ListRemindersResponses, ListSlackImportsData, ListSlackImportsResponse, ListSlackImportsResponses, ListTeamOutOfOfficeData, ListTeamOutOfOfficeErrors, ListTeamOutOfOfficeResponse, ListTeamOutOfOfficeResponses, ListUserApiKeysData, ListUserApiKeysError, ListUserApiKeysErrors, ListUserApiKeysResponse, ListUserApiKeysResponses, ListWebhooksData, ListWebhooksError, ListWebhooksErrors, ListWebhooksResponse, ListWebhooksResponse2, ListWebhooksResponses, LocationResponseData, LocationResponseV3, MacroUserIdStr, Meeting, MeetingCancelData, MeetingCancelError, MeetingCancelErrors, MeetingCancelPreparationData, MeetingCancelPreparationError, MeetingCancelPreparationErrors, MeetingCancelPreparationResponse, MeetingCancelPreparationResponses, MeetingCancelResponse, MeetingCancelResponses, MeetingCreateData, MeetingCreateError, MeetingCreateErrors, MeetingCreateResponse, MeetingCreateResponses, MeetingGuestJoinData, MeetingGuestJoinError, MeetingGuestJoinErrors, MeetingGuestJoinResponse, MeetingGuestJoinResponses, MeetingGuestParticipantsData, MeetingGuestParticipantsError, MeetingGuestParticipantsErrors, MeetingGuestParticipantsResponse, MeetingGuestParticipantsResponses, MeetingInviteData, MeetingInviteError, MeetingInviteErrors, MeetingInvitePermissions, MeetingInvitePermissionsData, MeetingInvitePermissionsError, MeetingInvitePermissionsErrors, MeetingInvitePermissionsResponse, MeetingInvitePermissionsResponses, MeetingInviteResponse, MeetingInviteResponses, MeetingInviteUsersData, MeetingInviteUsersError, MeetingInviteUsersErrors, MeetingInviteUsersResponse, MeetingInviteUsersResponses, MeetingJoinData, MeetingJoinError, MeetingJoinErrors, MeetingJoinResponse, MeetingJoinResponses, MeetingLeaveData, MeetingLeaveError, MeetingLeaveErrors, MeetingLeaveResponse, MeetingLeaveResponses, MeetingListActiveData, MeetingListActiveError, MeetingListActiveErrors, MeetingListActiveResponse, MeetingListActiveResponses, MeetingListData, MeetingListError, MeetingListErrors, MeetingListResponse, MeetingListResponses, MeetingLookupData, MeetingLookupError, MeetingLookupErrors, MeetingLookupResponse, MeetingLookupResponses, MeetingParticipant, MeetingParticipants, MeetingParticipantsData, MeetingParticipantsError, MeetingParticipantsErrors, MeetingParticipantsResponse, MeetingParticipantsResponses, MeetingPreparation, MeetingPrepareData, MeetingPrepareError, MeetingPrepareErrors, MeetingPrepareResponse, MeetingPrepareResponses, MeetingShareData, MeetingShareError, MeetingShareErrors, MeetingShareResponse, MeetingShareResponses, MeetingsResponse, MeetingToken, MeetingUpdateData, MeetingUpdateError, MeetingUpdateErrors, MeetingUpdateResponse, MeetingUpdateResponses, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponse, MentionPreviewsResponses, Message, MessageAttachment, MessageAttachmentCreatedMetadata, MessageAttachmentRemovedMetadata, MessageChange, MessageCursor, MessageDeletedMetadata, MessageDirection, MessageEvent, MessageEventAttachment, MessageListItem, MessageMentionedMetadata, MessagePage, MessageParent, MessagePatch, MessagePatchedMetadata, MessagePostedMetadata, MessageThread, MessageThreadPreview, MessageTimelineData, MessageTimelineQuery, MessageTimelineResponse, MessageTimelineResponses, MessageTopicEvent, NewAttachment, NewColumn, NewOption, NewThreadAnchor, NewView, NotificationFilters, NotificationState, NumberOperator, OpRefusalResponse, OpResult, OptionRef, PairingDetails, Params, ParticipantRole, PatchBotRequest, PatchChannelData, PatchChannelError, PatchChannelErrors, PatchChannelRequest, PatchChannelResponse, PatchChannelResponses, PatchMessageNotificationPolicy, PatchProjectRequestV2, PatchThreadRequestV2, PatchViewHandlerData, PatchViewHandlerError, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookError, PatchWebhookErrors, PatchWebhookRequest, PatchWebhookResponse, PatchWebhookResponses, PdfAnchor, PdfAnchorId, PdfHighlightAnchor, PdfHighlightAnchorRequest, PdfHighlightRect, PdfHighlightRectAnchorRequest, PdfPlaceableCommentAnchor, PendingClaimResponse, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentError, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponse, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectError, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponse, PermanentlyDeleteProjectResponses, PinnedItem, PinRequest, PostActivityData, PostActivityError, PostActivityErrors, PostActivityRequest, PostActivityResponse, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookError, PostChannelBotWebhookErrors, PostChannelBotWebhookResponse, PostChannelBotWebhookResponses, PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest, PostGroupedSoupAstRequest, PostItemsSoupAstData, PostItemsSoupAstError, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedError, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponse, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponse, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupError, PostItemsSoupErrors, PostItemsSoupResponse, PostItemsSoupResponses, PostMessage, PostMessageNotificationPolicy, PostSoupAstRequest, PostSoupRequest, PresaveDocumentHandlerData, PresaveDocumentHandlerError, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponse, PresaveDocumentHandlerResponses, PreSaveDocumentRequest, PreSaveDocumentResponse, PreSaveDocumentResponseData, PresenceOperator, PresignedUrl, PreviewSmartTagData, PreviewSmartTagError, PreviewSmartTagErrors, PreviewSmartTagResponse, PreviewSmartTagResponses, Project, ProjectDeleteResponseData, ProjectDocumentStatus, ProjectFilters, ProjectPreview, ProjectPreviewData, PropertyDefinition, PropertyDefinitionWithOptions, PropertyFilter, PropertyInput, PropertyOption, PropertyOptionValue, PropertyOwner, PropertyValue, PutCrmTeamSettingsData, PutCrmTeamSettingsError, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponse, PutCrmTeamSettingsResponses, PutCrmTeamStagesData, PutCrmTeamStagesError, PutCrmTeamStagesErrors, PutCrmTeamStagesResponse, PutCrmTeamStagesResponses, QueryDefinition, ReactionInput, RecentlyDeletedData, RecentlyDeletedError, RecentlyDeletedErrors, RecentlyDeletedResponse, RecentlyDeletedResponseData, RecentlyDeletedResponses, RegisterSlackImportUploadsData, RegisterSlackImportUploadsErrors, RegisterSlackImportUploadsResponse, RegisterSlackImportUploadsResponses, RegisterUploads, Reminder, ReminderCollectionPage, ReminderCollectionRow, ReminderFilters, ReminderReference, ReminderSchedule, RemindersList, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotError, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponse, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityError, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsError, RemoveParticipantsErrors, RemoveParticipantsRequest, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerError, RemovePinHandlerErrors, RemovePinHandlerResponse, RemovePinHandlerResponses, RenameChannelLabelData, RenameChannelLabelError, RenameChannelLabelErrors, RenameChannelLabelRequest, RenameChannelLabelResponse, RenameChannelLabelResponses, ReorderFavoritesData, ReorderFavoritesError, ReorderFavoritesErrors, ReorderFavoritesRequest, ReorderFavoritesResponses, ReorderPinRequest, ReorderPinsHandlerData, ReorderPinsHandlerError, ReorderPinsHandlerErrors, ReorderPinsHandlerResponse, ReorderPinsHandlerResponses, ReplaceCrmStagesRequest, RequestedHarnessScope, RequestedLayout, ResetCrmTeamStagesData, ResetCrmTeamStagesError, ResetCrmTeamStagesErrors, ResetCrmTeamStagesResponse, ResetCrmTeamStagesResponses, RevertDeleteDocumentData, RevertDeleteDocumentError, RevertDeleteDocumentErrors, RevertDeleteDocumentResponse, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectError, RevertDeleteProjectErrors, RevertDeleteProjectResponse, RevertDeleteProjectResponses, RingStatus, RingStatusResponse, RowChange, RowChangeKind, RowChanges, RowHistoryEntry, RowHistoryResponse, RowsChange, RowsResult, S3ObjectInfo, SaveBomPart, SaveDatabaseQueryData, SaveDatabaseQueryError, SaveDatabaseQueryErrors, SaveDatabaseQueryResponse, SaveDatabaseQueryResponses, SaveDocumentHandlerData, SaveDocumentHandlerError, SaveDocumentHandlerErrors, SaveDocumentHandlerResponse, SaveDocumentHandlerResponses, SaveDocumentRequest, SaveDocumentResponse, SaveDocumentResponseData, SavedQuery, SaveQueryRequest, SearchContactsData, SearchContactsError, SearchContactsErrors, SearchContactsResponse, SearchContactsResponse2, SearchContactsResponses, SearchState, SessionDeletedMetadata, SessionIdentity, SessionMentionedMetadata, SessionOpenedMetadata, SessionRenamedMetadata, SessionSettledMetadata, SessionStoppedMetadata, SetChannelLabelData, SetChannelLabelError, SetChannelLabelErrors, SetChannelLabelRequest, SetChannelLabelResponse, SetChannelLabelResponses, SetChannelPictureData, SetChannelPictureError, SetChannelPictureErrors, SetChannelPictureRequest, SetChannelPictureResponse, SetChannelPictureResponses, SetCompanyHiddenData, SetCompanyHiddenError, SetCompanyHiddenErrors, SetCompanyHiddenRequest, SetCompanyHiddenResponse, SetCompanyHiddenResponses, SetCompanyNameRequest, SetContactHiddenData, SetContactHiddenError, SetContactHiddenErrors, SetContactHiddenRequest, SetContactHiddenResponse, SetContactHiddenResponses, SetContactNameRequest, SetCrmCompanyNameData, SetCrmCompanyNameError, SetCrmCompanyNameErrors, SetCrmCompanyNameResponse, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameError, SetCrmContactNameErrors, SetCrmContactNameResponse, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareError, SetDocumentTeamShareErrors, SetDocumentTeamShareRequest, SetDocumentTeamShareResponse, SetDocumentTeamShareResponses, SetEmailFollowupData, SetEmailFollowupError, SetEmailFollowupErrors, SetEmailFollowupResponse, SetEmailFollowupResponses, SetEmailSyncData, SetEmailSyncError, SetEmailSyncErrors, SetEmailSyncRequest, SetEmailSyncResponse, SetEmailSyncResponses, SetOperator, SetPropertyValue, Sha256Digest, ShareDatabaseAwarenessData, ShareDatabaseAwarenessError, ShareDatabaseAwarenessErrors, ShareDatabaseAwarenessResponse, ShareDatabaseAwarenessResponses, SharedEmailFilter, SharePermissionV2, ShortIdResponse, SimpleMention, SimpleSaveData, SimpleSaveError, SimpleSaveErrors, SimpleSaveResponse, SimpleSaveResponses, SkippedCell, SlackCompleteRequest, SlackCreateRequest, SlackRegisterRequest, SlackTimestamp, SlackUserId, SmartTagChannelMatch, SmartTagPreview, SortDirection, SortKey, SoupAgentSessionSoupPropertiesField, SoupApiItem, SoupApiSort, SoupApiSortDirection, SoupAttachment, SoupCalendarEventSoupPropertiesField, SoupCalendarEventTime, SoupCallRecordGuest, SoupCallRecordParticipant, SoupCallRecordSoupPropertiesField, SoupChannel, SoupChannelThread, SoupChatSoupPropertiesField, SoupContact, SoupCountedReaction, SoupCrmCompanySoupPropertiesField, SoupCrmDomain, SoupDatabaseRowSoupPropertiesField, SoupDocumentSoupPropertiesField, SoupDocumentSubType, SoupEmailThreadPreview, SoupEnrichedEmailThreadPreviewSoupPropertiesField, SoupForeignEntity, SoupInitiativeSoupPropertiesField, SoupItem, SoupLabel, SoupLabelListVisibility, SoupLabelType, SoupMessageAttachment, SoupMessageListVisibility, SoupMessageSender, SoupMessageSenderType, SoupPage, SoupProjectSoupPropertiesField, SoupPropertiesField, SoupProperty, SoupReminderReference, SoupReminderSchedule, SoupReminderSoupPropertiesField, SoupThreadInfo, SoupThreadReply, SourceBinding, SourceId, SourceIdentity, StarterDatabase, StarterDocumentsResponse, StoredGithubPullRequest, StreamEventsData, StreamEventsError, StreamEventsErrors, StreamEventsResponse, StreamEventsResponses, String, SuccessResponse, SurfaceState, SyncServiceVersionId, SystemSkillSummary, Table, TableChange, TableChanged, TableChanges, TableDetail, TableResult, TableVersion, TagFilterMode, TakenId, TaskFilters, TeamOutOfOfficeItem, TeamOutOfOfficeResponse, TeamRole, TextOperator, ThreadAnchor, ThreadOrigin, ThreadPatch, ThreadState, ToggleShareWithTeamData, ToggleShareWithTeamError, ToggleShareWithTeamErrors, ToggleShareWithTeamResponse, ToggleShareWithTeamResponses, TouchedColumn, TouchedRow, TranscribeDictationData, TranscribeDictationError, TranscribeDictationErrors, TranscribeDictationResponse, TranscribeDictationResponses, TranscribeResponse, TranscriptSegmentRequest, TurnEndedMetadata, TurnStartedMetadata, TurnSummary, TypedSuccessResponse, TypedSuccessResponseGetDocumentResponseData, TypingInput, UnassignInitiativeTaskData, UnassignInitiativeTaskError, UnassignInitiativeTaskErrors, UnassignInitiativeTaskResponse, UnassignInitiativeTaskResponses, UndoChangeResponse, UndoDatabaseChangeData, UndoDatabaseChangeError, UndoDatabaseChangeErrors, UndoDatabaseChangeResponse, UndoDatabaseChangeResponses, UndoOutcome, UndoRefusal, UpdateAgentData, UpdateAgentError, UpdateAgentErrors, UpdateAgentRequest, UpdateAgentResponse, UpdateAgentResponses, UpdateChannelSharePermission, UpdateCrmTeamSettingsRequest, UpdateDatabasePermissionsData, UpdateDatabasePermissionsError, UpdateDatabasePermissionsErrors, UpdateDatabasePermissionsResponse, UpdateDatabasePermissionsResponses, UpdateInitiativeData, UpdateInitiativeError, UpdateInitiativeErrors, UpdateInitiativeRequest, UpdateInitiativeResponse, UpdateInitiativeResponses, UpdateMeetingRequest, UpdateOperation, UpdateReminderData, UpdateReminderError, UpdateReminderErrors, UpdateReminderRequest, UpdateReminderResponse, UpdateReminderResponses, UpdateSharePermissionRequestV2, UploadDescriptor, UploadDocumentStatus, UploadExtractFolderHandlerData, UploadExtractFolderHandlerError, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponse, UploadExtractFolderHandlerResponses, UploadExtractFolderRequest, UploadFolderHandlerData, UploadFolderHandlerError, UploadFolderHandlerErrors, UploadFolderHandlerResponse, UploadFolderHandlerResponses, UploadFolderRequest, UploadGrant, UploadId, UpsertHistoryHandlerData, UpsertHistoryHandlerError, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponse, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationError, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationRequest, UpsertUserDocumentViewLocationResponse, UpsertUserDocumentViewLocationResponses, UserApiKeyId, UserApiKeyInfo, UserApiKeysList, UserDocumentsResponse, UserDocumentViewLocation, UserDocumentViewLocationResponse, UserPinsResponse, UserViewsResponse, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenError, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponse, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookError, ValidateWebhookErrors, ValidateWebhookResponse, ValidateWebhookResponse2, ValidateWebhookResponses, Vec, VersionedTable, View, ViewChange, ViewColumn, ViewLayout, ViewPatch, ViewPosition, ViewPositionsResponse, ViewQuery, ViewResult, ViewsResponse, WaitingForInputMetadata, Webhook, WebhookEvent, WebhookFilter, WebhookScope, WebhookStatus, WebhookValidationTestEvent, WithCallId, WithChannelId, WithDocumentId, WithProjectId } from './types.gen';
+export type { AccessLevel, ActiveCallsResponse, ActiveCallSummary, ActiveMeeting, ActiveMeetingsResponse, ActivityType, AddFavoriteData, AddFavoriteError, AddFavoriteErrors, AddFavoriteRequest, AddFavoriteResponse, AddFavoriteResponses, AddParticipantsData, AddParticipantsError, AddParticipantsErrors, AddParticipantsRequest, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerError, AddPinHandlerErrors, AddPinHandlerResponse, AddPinHandlerResponses, AddPinRequest, Agent, AgentActionId, AgentChannelScope, AgentMcpServer, AgentMcpServers, AgentPullRequestState, AgentSessionFilters, AgentSessionLifecycleEvent, Anchor, AnchorId, AnchorResponse, AnnotationIncrementalUpdate, ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelDetail, ApiChannelListMessage, ApiChannelListPage, ApiChannelListParticipant, ApiChannelListType, ApiChannelParticipant, ApiChannelWithLatest, ApiEntityFilterAst, ApiGroupByField, ApiGroupMeta, ApiParticipantListRole, ApiParticipantRole, ApiPropertyEntityType, ApplyDatabaseOpsData, ApplyDatabaseOpsError, ApplyDatabaseOpsErrors, ApplyDatabaseOpsResponse, ApplyDatabaseOpsResponses, ApplyOpsRequest, ApplyOpsResponse, ApproveHarnessPairingData, ApproveHarnessPairingError, ApproveHarnessPairingErrors, ApproveHarnessPairingResponse, ApproveHarnessPairingResponses, ApprovePairingRequest, AssignInitiativeTasksData, AssignInitiativeTasksError, AssignInitiativeTasksErrors, AssignInitiativeTasksResponse, AssignInitiativeTasksResponses, AssignTasksRequest, AssignTasksResponse, AssignTasksResult, AssignTaskStatus, AttachmentChange, AttendeeResponseStatus, Awareness, AwarenessRelay, BasicDocument, BasicDocumentSubType, BomPart, Bot, BotChannel, BotChannelType, BotId, BotKind, BotOwner, BotOwnerProfile, BotSenderProfile, BotToken, BranchNameResponse, BTreeMap, BulkWakeupRequest, BulkWakeupResponse, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponse, BulkWakeupSyncServiceDocumentsResponses, CalendarAttendee, CalendarEvent, CalendarEventFilters, CalendarEventSourceContent, CalendarMentionEvent, CalendarMentionPreviewItem, CalendarMentionPreviewKind, CalendarMentionPreviewRequest, CalendarMentionPreviewRequestItem, CalendarMentionPreviewResponse, CalendarOccurrence, CalendarOccurrenceItem, CalendarOccurrenceResponse, CalendarSyncStatus, CallActiveResponse, CallFilters, CallRecord, CallRecordGuest, CallRecordParticipant, CallRecordPreview, CallRecordPreviewData, CallRecordTranscriptSegment, CallStatus, CallTokenResponse, CallWebhookData, CallWebhookError, CallWebhookErrors, CallWebhookResponses, CancelSlackImportData, CancelSlackImportErrors, CancelSlackImportResponse, CancelSlackImportResponses, CardPosition, CastVerdict, CellValue, CellWrite, ChangedFileDto, ChangesetDto, ChangesetSourceDto, Channel, ChannelCreatedMetadata, ChannelDeletedMetadata, ChannelFilters, ChannelJoinCodeResponse, ChannelLabel, ChannelLabelRule, ChannelLabelsList, ChannelMessage, ChannelParticipant, ChannelParticipantAddedMetadata, ChannelParticipantRemovedMetadata, ChannelPreview, ChannelPreviewData, ChannelSender, ChannelSharePermission, ChannelThreadFilters, ChannelTopicEvent, ChannelType, ChannelUpdatedMetadata, ChannelWebhookRequest, ChannelWebhookResponse, ChannelWithParticipants, Chat, ChatFilters, CheckActiveCallData, CheckActiveCallError, CheckActiveCallErrors, CheckActiveCallResponse, CheckActiveCallResponses, ClaimedPairing, ClaimHarnessPairingData, ClaimHarnessPairingError, ClaimHarnessPairingErrors, ClaimHarnessPairingResponse, ClaimHarnessPairingResponses, ClaimPairingRequest, ClientOptions, CloudStorageItemType, CollabSurfaceResponse, CollabSurfaceTokenResponse, Column, ColumnCast, ColumnChange, ColumnChangeKind, ColumnConfig, ColumnConversion, ColumnConversionRequest, ColumnDetail, ColumnKind, ColumnResult, CommandFailure, CommandRejectedMetadata, CommittedChange, CompleteSlackImportUploadsData, CompleteSlackImportUploadsErrors, CompleteSlackImportUploadsResponse, CompleteSlackImportUploadsResponses, CompleteUploads, ConferenceProvider, Conjunction, ConversationId, ConversationKind, ConversationMetadata, ConversationProgress, ConversationSeal, ConversationStatus, ConvertDatabaseColumnData, ConvertDatabaseColumnError, ConvertDatabaseColumnErrors, ConvertDatabaseColumnResponse, ConvertDatabaseColumnResponses, ConvertedCell, CopyDocumentData, CopyDocumentError, CopyDocumentErrors, CopyDocumentQueryParams, CopyDocumentRequest, CopyDocumentResponse, CopyDocumentResponse2, CopyDocumentResponses, CountedReaction, CreateAgentData, CreateAgentError, CreateAgentErrors, CreateAgentRequest, CreateAgentResponse, CreateAgentResponses, CreateAnchorData, CreateAnchorError, CreateAnchorErrors, CreateAnchorResponse, CreateAnchorResponses, CreateBotRequest, CreateBulkDocumentResponse, CreateBulkDocumentResponseData, CreateChannelData, CreateChannelError, CreateChannelErrors, CreateChannelLabelData, CreateChannelLabelError, CreateChannelLabelErrors, CreateChannelLabelRequest, CreateChannelLabelResponse, CreateChannelLabelResponses, CreateChannelRequest, CreateChannelResponse, CreateChannelResponse2, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotError, CreateChannelScopedBotErrors, CreateChannelScopedBotRequest, CreateChannelScopedBotResponse, CreateChannelScopedBotResponse2, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenError, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponse, CreateCollabSurfaceTokenResponses, CreateCrmCompanyData, CreateCrmCompanyError, CreateCrmCompanyErrors, CreateCrmCompanyRequest, CreateCrmCompanyResponse, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactError, CreateCrmContactErrors, CreateCrmContactRequest, CreateCrmContactResponse, CreateCrmContactResponses, CreateDatabaseData, CreateDatabaseError, CreateDatabaseErrors, CreateDatabaseRequest, CreateDatabaseResponse, CreateDatabaseResponses, CreateDocumentData, CreateDocumentError, CreateDocumentErrors, CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData, CreateDocumentResponses, CreatedPairing, CreatedUserApiKey, CreateEntityMentionData, CreateEntityMentionError, CreateEntityMentionErrors, CreateEntityMentionRequest, CreateEntityMentionResponse, CreateEntityMentionResponse2, CreateEntityMentionResponses, CreateHarnessPairingData, CreateHarnessPairingError, CreateHarnessPairingErrors, CreateHarnessPairingResponse, CreateHarnessPairingResponses, CreateImport, CreateInitiativeData, CreateInitiativeError, CreateInitiativeErrors, CreateInitiativeRequest, CreateInitiativeResponse, CreateInitiativeResponses, CreateInstructionsDocumentResponse, CreateInstructionsHandlerData, CreateInstructionsHandlerError, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponse, CreateInstructionsHandlerResponses, CreateMarkdownDocumentRequest, CreateMarkdownDocumentResponse, CreateMarkdownHandlerData, CreateMarkdownHandlerError, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponse, CreateMarkdownHandlerResponses, CreateMeetingRequest, CreatePairingRequest, CreateProjectHandlerData, CreateProjectHandlerError, CreateProjectHandlerErrors, CreateProjectHandlerResponse, CreateProjectHandlerResponses, CreateProjectRequest, CreateProjectResponse, CreateReminderData, CreateReminderError, CreateReminderErrors, CreateReminderRequest, CreateReminderResponse, CreateReminderResponses, CreateSkillHandlerData, CreateSkillHandlerError, CreateSkillHandlerErrors, CreateSkillHandlerResponse, CreateSkillHandlerResponses, CreateSkillRequest, CreateSkillResponse, CreateSlackImportData, CreateSlackImportErrors, CreateSlackImportResponse, CreateSlackImportResponses, CreateSnippetHandlerData, CreateSnippetHandlerError, CreateSnippetHandlerErrors, CreateSnippetHandlerResponse, CreateSnippetHandlerResponses, CreateSnippetRequest, CreateSnippetResponse, CreateTaskHandlerData, CreateTaskHandlerError, CreateTaskHandlerErrors, CreateTaskHandlerResponse, CreateTaskHandlerResponses, CreateTaskRequest, CreateTaskResponse, CreateToken, CreateUnthreadedAnchorRequest, CreateUnthreadedAnchorResponse, CreateUnthreadedPdfAnchorRequest, CreateUserApiKeyData, CreateUserApiKeyError, CreateUserApiKeyErrors, CreateUserApiKeyRequest, CreateUserApiKeyResponse, CreateUserApiKeyResponses, CreateViewHandlerData, CreateViewHandlerError, CreateViewHandlerErrors, CreateViewHandlerResponse, CreateViewHandlerResponses, CreateViewRequest, CreateWebhookData, CreateWebhookError, CreateWebhookErrors, CreateWebhookRequest, CreateWebhookResponse, CreateWebhookResponse2, CreateWebhookResponses, CrmCompanyFilters, CrmCompanyResponse, CrmContactResponse, CrmDomainResponse, CrmPermissionRole, CrmStageInput, CrmStageResponse, CrmStagesResponse, CrmTeamSettingsResponse, CustomSpeakerAssignment, Database, DatabaseDetail, DatabaseOp, DatabaseView, DataType, DateOperator, DeleteAnchorData, DeleteAnchorError, DeleteAnchorErrors, DeleteAnchorResponse, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordError, DeleteCallRecordErrors, DeleteCallRecordResponse, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelError, DeleteChannelErrors, DeleteChannelLabelData, DeleteChannelLabelError, DeleteChannelLabelErrors, DeleteChannelLabelResponse, DeleteChannelLabelResponses, DeleteChannelResponse, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceError, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponse, DeleteCollabSurfaceResponses, DeleteDocumentData, DeleteDocumentError, DeleteDocumentErrors, DeleteDocumentResponse, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionError, DeleteEntityMentionErrors, DeleteEntityMentionResponse, DeleteEntityMentionResponse2, DeleteEntityMentionResponses, DeleteHarnessData, DeleteHarnessError, DeleteHarnessErrors, DeleteHarnessResponse, DeleteHarnessResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerError, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponse, DeleteHistoryHandlerResponses, DeleteInitiativeData, DeleteInitiativeError, DeleteInitiativeErrors, DeleteInitiativeResponse, DeleteInitiativeResponses, DeleteProjectHandlerData, DeleteProjectHandlerError, DeleteProjectHandlerErrors, DeleteProjectHandlerResponse, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderError, DeleteReminderErrors, DeleteReminderResponse, DeleteReminderResponses, DeleteSelfHarnessData, DeleteSelfHarnessError, DeleteSelfHarnessErrors, DeleteSelfHarnessResponse, DeleteSelfHarnessResponses, DeleteUnthreadedAnchorRequest, DeleteUnthreadedAnchorResponse, DeleteUnthreadedPdfAnchorRequest, DeleteUserApiKeyData, DeleteUserApiKeyError, DeleteUserApiKeyErrors, DeleteUserApiKeyResponse, DeleteUserApiKeyResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationError, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponse, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerError, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookError, DeleteWebhookErrors, DeleteWebhookResponse, DeleteWebhookResponses, DescriptionDocumentId, DocumentBasic, DocumentContent, DocumentContentLocation, DocumentContentState, DocumentContentUploadedMetadata, DocumentCopiedMetadata, DocumentCreatedMetadata, DocumentDeletedMetadata, DocumentFilters, DocumentId, DocumentInteractionMetadata, DocumentMetadata, DocumentMetadataWithContent, DocumentPermissionsToken, DocumentPermissionsTokenRequest, DocumentPermissionsTokenResponse, DocumentPreview, DocumentPreviewData, DocumentPreviewDataSubType, DocumentPurgedMetadata, DocumentResponse, DocumentResponseMetadata, DocumentResponseMetadataWithContent, DocumentStorageServiceApiVersion, DocumentSubType, DocumentSyncContentUpdatedMetadata, DocumentSyncEditor, DocumentTeamShareResponse, DocumentTopicEvent, DocumentUpdatedMetadata, EditAnchorData, EditAnchorError, EditAnchorErrors, EditAnchorRequest, EditAnchorResponse, EditAnchorResponse2, EditAnchorResponses, EditCallRecordData, EditCallRecordError, EditCallRecordErrors, EditCallRecordRequest, EditCallRecordResponse, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptError, EditCallTranscriptErrors, EditCallTranscriptRequest, EditCallTranscriptResponse, EditCallTranscriptResponses, EditDocumentData, EditDocumentError, EditDocumentErrors, EditDocumentResponse, EditDocumentResponse2, EditDocumentResponses, EditDocumentServiceArgs, EditPdfAnchorRequest, EditPdfPlaceableCommentAnchorRequest, EditProjectV2Data, EditProjectV2Error, EditProjectV2Errors, EditProjectV2Response, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Error, EditThreadV2Errors, EditThreadV2Response, EditThreadV2Responses, EmailFilters, EmailFollowup, EmailFollowupCommand, EmailFollowupResponse, EmailReminderCondition, EmailReminderPage, EmailReminderSummary, EmptyResponse, EnsureCollabSurfaceData, EnsureCollabSurfaceError, EnsureCollabSurfaceErrors, EnsureCollabSurfaceRequest, EnsureCollabSurfaceResponse, EnsureCollabSurfaceResponses, EnsureStarterHandlerData, EnsureStarterHandlerErrors, EnsureStarterHandlerResponse, EnsureStarterHandlerResponses, EntityFilters, EntityKind, EntityMessageCreateData, EntityMessageCreateResponse, EntityMessageCreateResponses, EntityMessageDeleteMessageData, EntityMessageDeleteMessageResponse, EntityMessageDeleteMessageResponses, EntityMessageDeleteThreadData, EntityMessageDeleteThreadResponse, EntityMessageDeleteThreadResponses, EntityMessageEditData, EntityMessageEditResponse, EntityMessageEditResponses, EntityMessageGetMessageData, EntityMessageGetMessageResponse, EntityMessageGetMessageResponses, EntityMessageGetThreadData, EntityMessageGetThreadResponse, EntityMessageGetThreadResponses, EntityMessageLegacyData, EntityMessageLegacyResponse, EntityMessageLegacyResponses, EntityMessagePatchThreadData, EntityMessagePatchThreadResponse, EntityMessagePatchThreadResponses, EntityMessageReactData, EntityMessageReactResponse, EntityMessageReactResponses, EntityMessageTypingData, EntityMessageTypingResponse, EntityMessageTypingResponses, EntityPermission, EntityPermissionResponse, EntityRef, EntityReference, EntityType, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, ExcludedDefaultView, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerError, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExcludeDefaultViewRequest, ExportDocumentData, ExportDocumentError, ExportDocumentErrors, ExportDocumentResponse, ExportDocumentResponse2, ExportDocumentResponses, Favorite, FavoriteEntityRef, FavoritesList, FileChangeKindDto, FileSystemNodeWithIds, FileType, FileTypeUpdate, FilterCondition, FilterGroup, FilterNode, FilterTest, FinalizeSlackImportData, FinalizeSlackImportErrors, FinalizeSlackImportResponse, FinalizeSlackImportResponses, FolderItem, FollowupState, ForeignEntity, ForeignEntityFilters, GenericErrorResponse, GenericResponse, GenericSuccessResponse, GetActiveCallsData, GetActiveCallsError, GetActiveCallsErrors, GetActiveCallsResponse, GetActiveCallsResponses, GetActivityData, GetActivityError, GetActivityErrors, GetActivityResponse, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesError, GetAttachmentReferencesErrors, GetAttachmentReferencesResponse, GetAttachmentReferencesResponse2, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewError, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewRequest, GetBatchCallRecordPreviewResponse, GetBatchCallRecordPreviewResponse2, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewError, GetBatchChannelPreviewErrors, GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse, GetBatchChannelPreviewResponse2, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerError, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponse, GetBatchPreviewHandlerResponses, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchProjectPreviewData, GetBatchProjectPreviewError, GetBatchProjectPreviewErrors, GetBatchProjectPreviewRequest, GetBatchProjectPreviewResponse, GetBatchProjectPreviewResponse2, GetBatchProjectPreviewResponses, GetBotOwnerProfilesData, GetBotOwnerProfilesError, GetBotOwnerProfilesErrors, GetBotOwnerProfilesResponse, GetBotOwnerProfilesResponses, GetCallRecordData, GetCallRecordError, GetCallRecordErrors, GetCallRecordResponse, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsError, GetChannelAttachmentsErrors, GetChannelAttachmentsResponse, GetChannelAttachmentsResponses, GetChannelData, GetChannelError, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkError, GetChannelJoinLinkErrors, GetChannelJoinLinkResponse, GetChannelJoinLinkResponses, GetChannelParticipantsData, GetChannelParticipantsError, GetChannelParticipantsErrors, GetChannelParticipantsResponse, GetChannelParticipantsResponses, GetChannelResponse, GetChannelResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceError, GetCollabSurfaceErrors, GetCollabSurfaceResponse, GetCollabSurfaceResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContactByEmailData, GetContactByEmailError, GetContactByEmailErrors, GetContactByEmailResponse, GetContactByEmailResponse2, GetContactByEmailResponses, GetContactData, GetContactError, GetContactErrors, GetContactResponse, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsError, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponse, GetCrmTeamSettingsResponses, GetDatabaseData, GetDatabaseError, GetDatabaseErrors, GetDatabasePermissionsData, GetDatabasePermissionsError, GetDatabasePermissionsErrors, GetDatabasePermissionsResponse, GetDatabasePermissionsResponses, GetDatabaseQueryData, GetDatabaseQueryError, GetDatabaseQueryErrors, GetDatabaseQueryResponse, GetDatabaseQueryResponses, GetDatabaseResponse, GetDatabaseResponses, GetDatabaseRowHistoryData, GetDatabaseRowHistoryError, GetDatabaseRowHistoryErrors, GetDatabaseRowHistoryResponse, GetDatabaseRowHistoryResponses, GetDatabaseTableChangesData, GetDatabaseTableChangesError, GetDatabaseTableChangesErrors, GetDatabaseTableChangesResponse, GetDatabaseTableChangesResponses, GetDatabaseViewPositionsData, GetDatabaseViewPositionsError, GetDatabaseViewPositionsErrors, GetDatabaseViewPositionsResponse, GetDatabaseViewPositionsResponses, GetDocumentAnchorsData, GetDocumentAnchorsError, GetDocumentAnchorsErrors, GetDocumentAnchorsResponse, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameError, GetDocumentBranchNameErrors, GetDocumentBranchNameResponse, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugError, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponse, GetDocumentByTeamSlugResponses, GetDocumentData, GetDocumentError, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsError, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponse, GetDocumentGithubPullRequestsResponses, GetDocumentKeyResponse, GetDocumentKeyResponseData, GetDocumentListHandlerData, GetDocumentListHandlerError, GetDocumentListHandlerErrors, GetDocumentListHandlerResponse, GetDocumentListHandlerResponses, GetDocumentListResult, GetDocumentLocationV3Data, GetDocumentLocationV3Error, GetDocumentLocationV3Errors, GetDocumentLocationV3Response, GetDocumentLocationV3Responses, GetDocumentPermissionsResponseDataV2, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenError, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponse, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Error, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Response, GetDocumentPermissionsV2Responses, GetDocumentProcessingResult, GetDocumentProcessingResultData, GetDocumentProcessingResultError, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponse, GetDocumentProcessingResultResponse2, GetDocumentProcessingResultResponses, GetDocumentResponse, GetDocumentResponse2, GetDocumentResponseData, GetDocumentResponses, GetDocumentSearchResponse, GetDocumentShortIdData, GetDocumentShortIdError, GetDocumentShortIdErrors, GetDocumentShortIdResponse, GetDocumentShortIdResponses, GetDocumentsResponse, GetDocumentTeamShareData, GetDocumentTeamShareError, GetDocumentTeamShareErrors, GetDocumentTeamShareResponse, GetDocumentTeamShareResponses, GetDocumentUserAccessLevelResponse, GetDocumentVersionData, GetDocumentVersionError, GetDocumentVersionErrors, GetDocumentVersionResponse, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerError, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponse, GetDocumentViewsHandlerResponses, GetEmailFollowupData, GetEmailFollowupError, GetEmailFollowupErrors, GetEmailFollowupResponse, GetEmailFollowupResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponse, GetEntityPermissionResponses, GetForeignEntityBySourceData, GetForeignEntityBySourceError, GetForeignEntityBySourceErrors, GetForeignEntityBySourceResponse, GetForeignEntityBySourceResponses, GetForeignEntityData, GetForeignEntityError, GetForeignEntityErrors, GetForeignEntityResponse, GetForeignEntityResponses, GetGithubPullRequestChangesData, GetGithubPullRequestChangesError, GetGithubPullRequestChangesErrors, GetGithubPullRequestChangesPatchData, GetGithubPullRequestChangesPatchError, GetGithubPullRequestChangesPatchErrors, GetGithubPullRequestChangesPatchResponse, GetGithubPullRequestChangesPatchResponses, GetGithubPullRequestChangesResponse, GetGithubPullRequestChangesResponses, GetGithubPullRequestData, GetGithubPullRequestError, GetGithubPullRequestErrors, GetGithubPullRequestFacetsData, GetGithubPullRequestFacetsError, GetGithubPullRequestFacetsErrors, GetGithubPullRequestFacetsResponse, GetGithubPullRequestFacetsResponses, GetGithubPullRequestResponse, GetGithubPullRequestResponses, GetHarnessPairingData, GetHarnessPairingError, GetHarnessPairingErrors, GetHarnessPairingResponse, GetHarnessPairingResponses, GetHistoryHandlerData, GetHistoryHandlerError, GetHistoryHandlerErrors, GetHistoryHandlerResponse, GetHistoryHandlerResponses, GetInitiativeData, GetInitiativeError, GetInitiativeErrors, GetInitiativeResponse, GetInitiativeResponses, GetInstructionsDocumentResponse, GetInstructionsHandlerData, GetInstructionsHandlerError, GetInstructionsHandlerErrors, GetInstructionsHandlerResponse, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupError, GetItemsSoupErrors, GetItemsSoupResponse, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerError, GetLocationHandlerErrors, GetLocationHandlerResponse, GetLocationHandlerResponses, GetOrCreateAction, GetOrCreateCallData, GetOrCreateCallError, GetOrCreateCallErrors, GetOrCreateCallResponse, GetOrCreateCallResponses, GetOrCreateChannelResponse, GetOrCreateDmData, GetOrCreateDmError, GetOrCreateDmErrors, GetOrCreateDmRequest, GetOrCreateDmResponse, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateError, GetOrCreatePrivateErrors, GetOrCreatePrivateRequest, GetOrCreatePrivateResponse, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerError, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponse, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerError, GetPinsHandlerErrors, GetPinsHandlerResponse, GetPinsHandlerResponses, GetPinsResponse, GetProjectContentHandlerData, GetProjectContentHandlerError, GetProjectContentHandlerErrors, GetProjectContentHandlerResponse, GetProjectContentHandlerResponses, GetProjectContentResponse, GetProjectHandlerData, GetProjectHandlerError, GetProjectHandlerErrors, GetProjectHandlerResponse, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Error, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Response, GetProjectPermissionsV2Responses, GetProjectResponse, GetProjectResponseData, GetProjectsHandlerData, GetProjectsHandlerError, GetProjectsHandlerErrors, GetProjectsHandlerResponse, GetProjectsHandlerResponses, GetProjectsResponse, GetProjectUserAccessLevelData, GetProjectUserAccessLevelError, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponse, GetProjectUserAccessLevelResponses, GetReminderData, GetReminderError, GetReminderErrors, GetReminderResponse, GetReminderResponses, GetRingStatusData, GetRingStatusError, GetRingStatusErrors, GetRingStatusResponse, GetRingStatusResponses, GetSelfBotData, GetSelfBotError, GetSelfBotErrors, GetSelfBotResponse, GetSelfBotResponses, GetSelfHarnessData, GetSelfHarnessError, GetSelfHarnessErrors, GetSelfHarnessResponse, GetSelfHarnessResponses, GetSlackImportData, GetSlackImportErrors, GetSlackImportResponse, GetSlackImportResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerError, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponse, GetSystemSkillsHandlerResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerError, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponse, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationError, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponse, GetUserDocumentViewLocationResponses, GetUserHistoryResponse, GetViewsHandlerData, GetViewsHandlerError, GetViewsHandlerErrors, GetViewsHandlerResponse, GetViewsHandlerResponses, GetWebhookData, GetWebhookError, GetWebhookErrors, GetWebhookResponse, GetWebhookResponses, GithubLabelFacet, GithubPullRequest, GithubPullRequestChangesPatchResponse, GithubPullRequestChangesResponse, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestFacets, GithubPullRequestLabel, GithubPullRequestReview, GithubPullRequestReviewDecision, GithubPullRequestReviewState, GithubPullRequestsResponse, GithubPullRequestUser, GithubRepositoryFacet, GithubUserFacet, GitRefDto, GroupedInitialParams, GroupedPageParams, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage, GroupedSoupSort, GuestId, GuestJoinRequest, HandlerData, HandlerError, HandlerErrors, HandlerResponse, HandlerResponses, Harness, HarnessAgent, HarnessId, HarnessOwner, HarnessSession, HashMap, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HighlightType, ImportCounters, ImportDatabaseTableData, ImportDatabaseTableError, ImportDatabaseTableErrors, ImportDatabaseTableResponse, ImportDatabaseTableResponses, ImportedAuthor, ImportError, ImportLimits, ImportPage, ImportProgress, ImportTable, ImportWarning, InferColumnTypeOutcome, InferColumnTypeRequest, InferDatabaseColumnTypeData, InferDatabaseColumnTypeError, InferDatabaseColumnTypeErrors, InferDatabaseColumnTypeResponse, InferDatabaseColumnTypeResponses, InFlightTurnSummary, IngestTranscriptData, IngestTranscriptError, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsError, InitializeUserDocumentsErrors, InitializeUserDocumentsResponse, InitializeUserDocumentsResponses, InitialPropertyValue, InitiativeDetail, InitiativeFilters, InitiativeId, InitiativeList, InitiativeSummary, InputReceivedMetadata, InstallSyncData, InstallSyncErrors, InteractionReason, InviteMeetingRequest, InviteMeetingUsersRequest, Item, ItemWithUserAccessLevel, JobId, JobProcessingResultHandlerData, JobProcessingResultHandlerError, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponse, JobProcessingResultHandlerResponses, JobStatus, JoinChannelByCodeData, JoinChannelByCodeError, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelError, JoinChannelErrors, JoinChannelResponses, KeySegment, Lane, LaneKey, LatestMessage, LeaveCallResponse, LeaveChannelData, LeaveChannelError, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallError, LeaveOrEndCallErrors, LeaveOrEndCallResponse, LeaveOrEndCallResponses, LinkShare, ListAgentsData, ListAgentsError, ListAgentsErrors, ListAgentsResponse, ListAgentsResponses, ListBotChannelsData, ListBotChannelsError, ListBotChannelsErrors, ListBotChannelsResponse, ListBotChannelsResponses, ListChannelLabelsData, ListChannelLabelsError, ListChannelLabelsErrors, ListChannelLabelsResponse, ListChannelLabelsResponses, ListCompanyContactsData, ListCompanyContactsError, ListCompanyContactsErrors, ListCompanyContactsResponse, ListCompanyContactsResponses, ListDatabaseColumnCastsData, ListDatabaseColumnCastsError, ListDatabaseColumnCastsErrors, ListDatabaseColumnCastsResponse, ListDatabaseColumnCastsResponses, ListDatabasesData, ListDatabasesError, ListDatabasesErrors, ListDatabasesResponse, ListDatabasesResponses, ListedDatabase, ListEmailRemindersData, ListEmailRemindersError, ListEmailRemindersErrors, ListEmailRemindersResponse, ListEmailRemindersResponses, ListFavoritesData, ListFavoritesError, ListFavoritesErrors, ListFavoritesResponse, ListFavoritesResponses, ListHarnessAgentsData, ListHarnessAgentsError, ListHarnessAgentsErrors, ListHarnessAgentsResponse, ListHarnessAgentsResponses, ListHarnessesData, ListHarnessesError, ListHarnessesErrors, ListHarnessesResponse, ListHarnessesResponses, ListHarnessSessionsData, ListHarnessSessionsError, ListHarnessSessionsErrors, ListHarnessSessionsResponse, ListHarnessSessionsResponses, ListInitiativesData, ListInitiativesError, ListInitiativesErrors, ListInitiativesResponse, ListInitiativesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponse, ListOccurrencesResponses, ListReminderCollectionData, ListReminderCollectionError, ListReminderCollectionErrors, ListReminderCollectionResponse, ListReminderCollectionResponses, ListRemindersData, ListRemindersError, ListRemindersErrors, ListRemindersResponse, ListRemindersResponses, ListSlackImportsData, ListSlackImportsResponse, ListSlackImportsResponses, ListTeamOutOfOfficeData, ListTeamOutOfOfficeErrors, ListTeamOutOfOfficeResponse, ListTeamOutOfOfficeResponses, ListUserApiKeysData, ListUserApiKeysError, ListUserApiKeysErrors, ListUserApiKeysResponse, ListUserApiKeysResponses, ListWebhooksData, ListWebhooksError, ListWebhooksErrors, ListWebhooksResponse, ListWebhooksResponse2, ListWebhooksResponses, LocationResponseData, LocationResponseV3, MacroUserIdStr, Meeting, MeetingCancelData, MeetingCancelError, MeetingCancelErrors, MeetingCancelPreparationData, MeetingCancelPreparationError, MeetingCancelPreparationErrors, MeetingCancelPreparationResponse, MeetingCancelPreparationResponses, MeetingCancelResponse, MeetingCancelResponses, MeetingCreateData, MeetingCreateError, MeetingCreateErrors, MeetingCreateResponse, MeetingCreateResponses, MeetingGuestJoinData, MeetingGuestJoinError, MeetingGuestJoinErrors, MeetingGuestJoinResponse, MeetingGuestJoinResponses, MeetingGuestParticipantsData, MeetingGuestParticipantsError, MeetingGuestParticipantsErrors, MeetingGuestParticipantsResponse, MeetingGuestParticipantsResponses, MeetingInviteData, MeetingInviteError, MeetingInviteErrors, MeetingInvitePermissions, MeetingInvitePermissionsData, MeetingInvitePermissionsError, MeetingInvitePermissionsErrors, MeetingInvitePermissionsResponse, MeetingInvitePermissionsResponses, MeetingInviteResponse, MeetingInviteResponses, MeetingInviteUsersData, MeetingInviteUsersError, MeetingInviteUsersErrors, MeetingInviteUsersResponse, MeetingInviteUsersResponses, MeetingJoinData, MeetingJoinError, MeetingJoinErrors, MeetingJoinResponse, MeetingJoinResponses, MeetingLeaveData, MeetingLeaveError, MeetingLeaveErrors, MeetingLeaveResponse, MeetingLeaveResponses, MeetingListActiveData, MeetingListActiveError, MeetingListActiveErrors, MeetingListActiveResponse, MeetingListActiveResponses, MeetingListData, MeetingListError, MeetingListErrors, MeetingListResponse, MeetingListResponses, MeetingLookupData, MeetingLookupError, MeetingLookupErrors, MeetingLookupResponse, MeetingLookupResponses, MeetingParticipant, MeetingParticipants, MeetingParticipantsData, MeetingParticipantsError, MeetingParticipantsErrors, MeetingParticipantsResponse, MeetingParticipantsResponses, MeetingPreparation, MeetingPrepareData, MeetingPrepareError, MeetingPrepareErrors, MeetingPrepareResponse, MeetingPrepareResponses, MeetingShareData, MeetingShareError, MeetingShareErrors, MeetingShareResponse, MeetingShareResponses, MeetingsResponse, MeetingToken, MeetingUpdateData, MeetingUpdateError, MeetingUpdateErrors, MeetingUpdateResponse, MeetingUpdateResponses, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponse, MentionPreviewsResponses, Message, MessageAttachment, MessageAttachmentCreatedMetadata, MessageAttachmentRemovedMetadata, MessageChange, MessageCursor, MessageDeletedMetadata, MessageDirection, MessageEvent, MessageEventAttachment, MessageListItem, MessageMentionedMetadata, MessagePage, MessageParent, MessagePatch, MessagePatchedMetadata, MessagePostedMetadata, MessageThread, MessageThreadPreview, MessageTimelineData, MessageTimelineQuery, MessageTimelineResponse, MessageTimelineResponses, MessageTopicEvent, NewAttachment, NewColumn, NewOption, NewThreadAnchor, NewView, NotificationFilters, NotificationState, NumberOperator, OpRefusalResponse, OpResult, OptionRef, PairingDetails, Params, ParticipantRole, PatchBotRequest, PatchChannelData, PatchChannelError, PatchChannelErrors, PatchChannelRequest, PatchChannelResponse, PatchChannelResponses, PatchMessageNotificationPolicy, PatchProjectRequestV2, PatchThreadRequestV2, PatchViewHandlerData, PatchViewHandlerError, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookError, PatchWebhookErrors, PatchWebhookRequest, PatchWebhookResponse, PatchWebhookResponses, PdfAnchor, PdfAnchorId, PdfHighlightAnchor, PdfHighlightAnchorRequest, PdfHighlightRect, PdfHighlightRectAnchorRequest, PdfPlaceableCommentAnchor, PendingClaimResponse, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentError, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponse, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectError, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponse, PermanentlyDeleteProjectResponses, PinnedItem, PinRequest, PostActivityData, PostActivityError, PostActivityErrors, PostActivityRequest, PostActivityResponse, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookError, PostChannelBotWebhookErrors, PostChannelBotWebhookResponse, PostChannelBotWebhookResponses, PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest, PostGroupedSoupAstRequest, PostItemsSoupAstData, PostItemsSoupAstError, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedError, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponse, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponse, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupError, PostItemsSoupErrors, PostItemsSoupResponse, PostItemsSoupResponses, PostMessage, PostMessageNotificationPolicy, PostSoupAstRequest, PostSoupRequest, PresaveDocumentHandlerData, PresaveDocumentHandlerError, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponse, PresaveDocumentHandlerResponses, PreSaveDocumentRequest, PreSaveDocumentResponse, PreSaveDocumentResponseData, PresenceOperator, PresignedUrl, PreviewSmartTagData, PreviewSmartTagError, PreviewSmartTagErrors, PreviewSmartTagResponse, PreviewSmartTagResponses, Project, ProjectDeleteResponseData, ProjectDocumentStatus, ProjectFilters, ProjectPreview, ProjectPreviewData, PropertyDefinition, PropertyDefinitionWithOptions, PropertyFilter, PropertyInput, PropertyOption, PropertyOptionValue, PropertyOwner, PropertyValue, PutCrmTeamSettingsData, PutCrmTeamSettingsError, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponse, PutCrmTeamSettingsResponses, PutCrmTeamStagesData, PutCrmTeamStagesError, PutCrmTeamStagesErrors, PutCrmTeamStagesResponse, PutCrmTeamStagesResponses, QueryDefinition, ReactionInput, RecentlyDeletedData, RecentlyDeletedError, RecentlyDeletedErrors, RecentlyDeletedResponse, RecentlyDeletedResponseData, RecentlyDeletedResponses, RegisterSlackImportUploadsData, RegisterSlackImportUploadsErrors, RegisterSlackImportUploadsResponse, RegisterSlackImportUploadsResponses, RegisterUploads, Reminder, ReminderCollectionPage, ReminderCollectionRow, ReminderFilters, ReminderReference, ReminderSchedule, RemindersList, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotError, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponse, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityError, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsError, RemoveParticipantsErrors, RemoveParticipantsRequest, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerError, RemovePinHandlerErrors, RemovePinHandlerResponse, RemovePinHandlerResponses, RenameChannelLabelData, RenameChannelLabelError, RenameChannelLabelErrors, RenameChannelLabelRequest, RenameChannelLabelResponse, RenameChannelLabelResponses, ReorderFavoritesData, ReorderFavoritesError, ReorderFavoritesErrors, ReorderFavoritesRequest, ReorderFavoritesResponses, ReorderPinRequest, ReorderPinsHandlerData, ReorderPinsHandlerError, ReorderPinsHandlerErrors, ReorderPinsHandlerResponse, ReorderPinsHandlerResponses, ReplaceCrmStagesRequest, RequestedHarnessScope, RequestedLayout, ResetCrmTeamStagesData, ResetCrmTeamStagesError, ResetCrmTeamStagesErrors, ResetCrmTeamStagesResponse, ResetCrmTeamStagesResponses, RevertDeleteDocumentData, RevertDeleteDocumentError, RevertDeleteDocumentErrors, RevertDeleteDocumentResponse, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectError, RevertDeleteProjectErrors, RevertDeleteProjectResponse, RevertDeleteProjectResponses, RingStatus, RingStatusResponse, RowChange, RowChangeKind, RowChanges, RowHistoryEntry, RowHistoryResponse, RowsChange, RowsResult, S3ObjectInfo, SaveBomPart, SaveDatabaseQueryData, SaveDatabaseQueryError, SaveDatabaseQueryErrors, SaveDatabaseQueryResponse, SaveDatabaseQueryResponses, SaveDocumentHandlerData, SaveDocumentHandlerError, SaveDocumentHandlerErrors, SaveDocumentHandlerResponse, SaveDocumentHandlerResponses, SaveDocumentRequest, SaveDocumentResponse, SaveDocumentResponseData, SavedQuery, SaveQueryRequest, SearchContactsData, SearchContactsError, SearchContactsErrors, SearchContactsResponse, SearchContactsResponse2, SearchContactsResponses, SearchState, SessionDeletedMetadata, SessionIdentity, SessionMentionedMetadata, SessionOpenedMetadata, SessionRenamedMetadata, SessionSettledMetadata, SessionStoppedMetadata, SetChannelLabelData, SetChannelLabelError, SetChannelLabelErrors, SetChannelLabelRequest, SetChannelLabelResponse, SetChannelLabelResponses, SetChannelPictureData, SetChannelPictureError, SetChannelPictureErrors, SetChannelPictureRequest, SetChannelPictureResponse, SetChannelPictureResponses, SetCompanyHiddenData, SetCompanyHiddenError, SetCompanyHiddenErrors, SetCompanyHiddenRequest, SetCompanyHiddenResponse, SetCompanyHiddenResponses, SetCompanyNameRequest, SetContactHiddenData, SetContactHiddenError, SetContactHiddenErrors, SetContactHiddenRequest, SetContactHiddenResponse, SetContactHiddenResponses, SetContactNameRequest, SetCrmCompanyNameData, SetCrmCompanyNameError, SetCrmCompanyNameErrors, SetCrmCompanyNameResponse, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameError, SetCrmContactNameErrors, SetCrmContactNameResponse, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareError, SetDocumentTeamShareErrors, SetDocumentTeamShareRequest, SetDocumentTeamShareResponse, SetDocumentTeamShareResponses, SetEmailFollowupData, SetEmailFollowupError, SetEmailFollowupErrors, SetEmailFollowupResponse, SetEmailFollowupResponses, SetEmailSyncData, SetEmailSyncError, SetEmailSyncErrors, SetEmailSyncRequest, SetEmailSyncResponse, SetEmailSyncResponses, SetOperator, SetPropertyValue, Sha256Digest, ShareDatabaseAwarenessData, ShareDatabaseAwarenessError, ShareDatabaseAwarenessErrors, ShareDatabaseAwarenessResponse, ShareDatabaseAwarenessResponses, SharedEmailFilter, SharePermissionV2, ShortIdResponse, SimpleMention, SimpleSaveData, SimpleSaveError, SimpleSaveErrors, SimpleSaveResponse, SimpleSaveResponses, SkippedCell, SlackCompleteRequest, SlackCreateRequest, SlackRegisterRequest, SlackTimestamp, SlackUserId, SmartTagChannelMatch, SmartTagPreview, SortDirection, SortKey, SoupAgentSessionSoupPropertiesField, SoupApiItem, SoupApiSort, SoupApiSortDirection, SoupAttachment, SoupCalendarEventSoupPropertiesField, SoupCalendarEventTime, SoupCallRecordGuest, SoupCallRecordParticipant, SoupCallRecordSoupPropertiesField, SoupChannel, SoupChannelThread, SoupChatSoupPropertiesField, SoupContact, SoupCountedReaction, SoupCrmCompanySoupPropertiesField, SoupCrmDomain, SoupDatabaseRowSoupPropertiesField, SoupDocumentSoupPropertiesField, SoupDocumentSubType, SoupEmailThreadPreview, SoupEnrichedEmailThreadPreviewSoupPropertiesField, SoupForeignEntity, SoupInitiativeSoupPropertiesField, SoupItem, SoupLabel, SoupLabelListVisibility, SoupLabelType, SoupMessageAttachment, SoupMessageListVisibility, SoupMessageSender, SoupMessageSenderType, SoupPage, SoupProjectSoupPropertiesField, SoupPropertiesField, SoupProperty, SoupReminderReference, SoupReminderSchedule, SoupReminderSoupPropertiesField, SoupThreadInfo, SoupThreadReply, SourceBinding, SourceId, SourceIdentity, StarterDatabase, StarterDocumentsResponse, StoredGithubPullRequest, StreamEventsData, StreamEventsError, StreamEventsErrors, StreamEventsResponse, StreamEventsResponses, String, SuccessResponse, SurfaceState, SyncServiceVersionId, SystemSkillSummary, Table, TableChange, TableChanged, TableChanges, TableDetail, TableResult, TableVersion, TagFilterMode, TakenId, TaskFilters, TeamOutOfOfficeItem, TeamOutOfOfficeResponse, TeamRole, TextOperator, ThreadAnchor, ThreadOrigin, ThreadPatch, ThreadState, ToggleShareWithTeamData, ToggleShareWithTeamError, ToggleShareWithTeamErrors, ToggleShareWithTeamResponse, ToggleShareWithTeamResponses, TouchedColumn, TouchedRow, TranscribeDictationData, TranscribeDictationError, TranscribeDictationErrors, TranscribeDictationResponse, TranscribeDictationResponses, TranscribeResponse, TranscriptSegmentRequest, TurnEndedMetadata, TurnStartedMetadata, TurnSummary, TypedSuccessResponse, TypedSuccessResponseGetDocumentResponseData, TypingInput, UnassignInitiativeTaskData, UnassignInitiativeTaskError, UnassignInitiativeTaskErrors, UnassignInitiativeTaskResponse, UnassignInitiativeTaskResponses, UndoChangeResponse, UndoDatabaseChangeData, UndoDatabaseChangeError, UndoDatabaseChangeErrors, UndoDatabaseChangeResponse, UndoDatabaseChangeResponses, UndoOutcome, UndoRefusal, UpdateAgentData, UpdateAgentError, UpdateAgentErrors, UpdateAgentRequest, UpdateAgentResponse, UpdateAgentResponses, UpdateChannelSharePermission, UpdateCrmTeamSettingsRequest, UpdateDatabasePermissionsData, UpdateDatabasePermissionsError, UpdateDatabasePermissionsErrors, UpdateDatabasePermissionsResponse, UpdateDatabasePermissionsResponses, UpdateInitiativeData, UpdateInitiativeError, UpdateInitiativeErrors, UpdateInitiativeRequest, UpdateInitiativeResponse, UpdateInitiativeResponses, UpdateMeetingRequest, UpdateOperation, UpdateReminderData, UpdateReminderError, UpdateReminderErrors, UpdateReminderRequest, UpdateReminderResponse, UpdateReminderResponses, UpdateSharePermissionRequestV2, UploadDescriptor, UploadDocumentStatus, UploadExtractFolderHandlerData, UploadExtractFolderHandlerError, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponse, UploadExtractFolderHandlerResponses, UploadExtractFolderRequest, UploadFolderHandlerData, UploadFolderHandlerError, UploadFolderHandlerErrors, UploadFolderHandlerResponse, UploadFolderHandlerResponses, UploadFolderRequest, UploadGrant, UploadId, UpsertHistoryHandlerData, UpsertHistoryHandlerError, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponse, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationError, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationRequest, UpsertUserDocumentViewLocationResponse, UpsertUserDocumentViewLocationResponses, UserApiKeyId, UserApiKeyInfo, UserApiKeysList, UserDocumentsResponse, UserDocumentViewLocation, UserDocumentViewLocationResponse, UserPinsResponse, UserViewsResponse, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenError, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponse, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookError, ValidateWebhookErrors, ValidateWebhookResponse, ValidateWebhookResponse2, ValidateWebhookResponses, Vec, VersionedTable, View, ViewChange, ViewColumn, ViewLayout, ViewPatch, ViewPosition, ViewPositionsResponse, ViewQuery, ViewResult, ViewsResponse, WaitingForInputMetadata, Webhook, WebhookEvent, WebhookFilter, WebhookScope, WebhookStatus, WebhookValidationTestEvent, WithCallId, WithChannelId, WithDocumentId, WithProjectId } from './types.gen';
diff --git a/packages/sdk/generated/storage/sdk.gen.ts b/packages/sdk/generated/storage/sdk.gen.ts
index 2326027aab..c0572cffa2 100644
--- a/packages/sdk/generated/storage/sdk.gen.ts
+++ b/packages/sdk/generated/storage/sdk.gen.ts
@@ -2,7 +2,7 @@
import type { Client, ClientMeta, Options as Options2, RequestResult, ServerSentEventsResult, TDataShape } from './client';
import { client } from './client.gen';
-import type { AddFavoriteData, AddFavoriteErrors, AddFavoriteResponses, AddParticipantsData, AddParticipantsErrors, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerErrors, AddPinHandlerResponses, ApplyDatabaseOpsData, ApplyDatabaseOpsErrors, ApplyDatabaseOpsResponses, ApproveHarnessPairingData, ApproveHarnessPairingErrors, ApproveHarnessPairingResponses, AssignInitiativeTasksData, AssignInitiativeTasksErrors, AssignInitiativeTasksResponses, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponses, CallWebhookData, CallWebhookErrors, CallWebhookResponses, CancelSlackImportData, CancelSlackImportErrors, CancelSlackImportResponses, CheckActiveCallData, CheckActiveCallErrors, CheckActiveCallResponses, ClaimHarnessPairingData, ClaimHarnessPairingErrors, ClaimHarnessPairingResponses, CompleteSlackImportUploadsData, CompleteSlackImportUploadsErrors, CompleteSlackImportUploadsResponses, ConvertDatabaseColumnData, ConvertDatabaseColumnErrors, ConvertDatabaseColumnResponses, CopyDocumentData, CopyDocumentErrors, CopyDocumentResponses, CreateAgentData, CreateAgentErrors, CreateAgentResponses, CreateAnchorData, CreateAnchorErrors, CreateAnchorResponses, CreateChannelData, CreateChannelErrors, CreateChannelLabelData, CreateChannelLabelErrors, CreateChannelLabelResponses, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotErrors, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponses, CreateCrmCompanyData, CreateCrmCompanyErrors, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactErrors, CreateCrmContactResponses, CreateDatabaseData, CreateDatabaseErrors, CreateDatabaseResponses, CreateDocumentData, CreateDocumentErrors, CreateDocumentResponses, CreateEntityMentionData, CreateEntityMentionErrors, CreateEntityMentionResponses, CreateHarnessPairingData, CreateHarnessPairingErrors, CreateHarnessPairingResponses, CreateInitiativeData, CreateInitiativeErrors, CreateInitiativeResponses, CreateInstructionsHandlerData, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponses, CreateMarkdownHandlerData, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponses, CreateProjectHandlerData, CreateProjectHandlerErrors, CreateProjectHandlerResponses, CreateReminderData, CreateReminderErrors, CreateReminderResponses, CreateSkillHandlerData, CreateSkillHandlerErrors, CreateSkillHandlerResponses, CreateSlackImportData, CreateSlackImportErrors, CreateSlackImportResponses, CreateSnippetHandlerData, CreateSnippetHandlerErrors, CreateSnippetHandlerResponses, CreateTaskHandlerData, CreateTaskHandlerErrors, CreateTaskHandlerResponses, CreateUserApiKeyData, CreateUserApiKeyErrors, CreateUserApiKeyResponses, CreateViewHandlerData, CreateViewHandlerErrors, CreateViewHandlerResponses, CreateWebhookData, CreateWebhookErrors, CreateWebhookResponses, DeleteAnchorData, DeleteAnchorErrors, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordErrors, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelErrors, DeleteChannelLabelData, DeleteChannelLabelErrors, DeleteChannelLabelResponses, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponses, DeleteDocumentData, DeleteDocumentErrors, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionErrors, DeleteEntityMentionResponses, DeleteHarnessData, DeleteHarnessErrors, DeleteHarnessResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponses, DeleteInitiativeData, DeleteInitiativeErrors, DeleteInitiativeResponses, DeleteProjectHandlerData, DeleteProjectHandlerErrors, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderErrors, DeleteReminderResponses, DeleteSelfHarnessData, DeleteSelfHarnessErrors, DeleteSelfHarnessResponses, DeleteUserApiKeyData, DeleteUserApiKeyErrors, DeleteUserApiKeyResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookErrors, DeleteWebhookResponses, EditAnchorData, EditAnchorErrors, EditAnchorResponses, EditCallRecordData, EditCallRecordErrors, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptErrors, EditCallTranscriptResponses, EditDocumentData, EditDocumentErrors, EditDocumentResponses, EditProjectV2Data, EditProjectV2Errors, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Errors, EditThreadV2Responses, EnsureCollabSurfaceData, EnsureCollabSurfaceErrors, EnsureCollabSurfaceResponses, EnsureStarterHandlerData, EnsureStarterHandlerErrors, EnsureStarterHandlerResponses, EntityMessageCreateData, EntityMessageCreateResponses, EntityMessageDeleteMessageData, EntityMessageDeleteMessageResponses, EntityMessageDeleteThreadData, EntityMessageDeleteThreadResponses, EntityMessageEditData, EntityMessageEditResponses, EntityMessageGetMessageData, EntityMessageGetMessageResponses, EntityMessageGetThreadData, EntityMessageGetThreadResponses, EntityMessageLegacyData, EntityMessageLegacyResponses, EntityMessagePatchThreadData, EntityMessagePatchThreadResponses, EntityMessageReactData, EntityMessageReactResponses, EntityMessageTypingData, EntityMessageTypingResponses, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExportDocumentData, ExportDocumentErrors, ExportDocumentResponses, FinalizeSlackImportData, FinalizeSlackImportErrors, FinalizeSlackImportResponses, GetActiveCallsData, GetActiveCallsErrors, GetActiveCallsResponses, GetActivityData, GetActivityErrors, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesErrors, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewErrors, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponses, GetBatchProjectPreviewData, GetBatchProjectPreviewErrors, GetBatchProjectPreviewResponses, GetBotOwnerProfilesData, GetBotOwnerProfilesErrors, GetBotOwnerProfilesResponses, GetCallRecordData, GetCallRecordErrors, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsErrors, GetChannelAttachmentsResponses, GetChannelData, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkErrors, GetChannelJoinLinkResponses, GetChannelParticipantsData, GetChannelParticipantsErrors, GetChannelParticipantsResponses, GetChannelResponses, GetChannelsData, GetChannelsErrors, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceErrors, GetCollabSurfaceResponses, GetCompanyData, GetCompanyErrors, GetCompanyResponses, GetContactByEmailData, GetContactByEmailErrors, GetContactByEmailResponses, GetContactData, GetContactErrors, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponses, GetDatabaseData, GetDatabaseErrors, GetDatabasePermissionsData, GetDatabasePermissionsErrors, GetDatabasePermissionsResponses, GetDatabaseQueryData, GetDatabaseQueryErrors, GetDatabaseQueryResponses, GetDatabaseResponses, GetDatabaseRowHistoryData, GetDatabaseRowHistoryErrors, GetDatabaseRowHistoryResponses, GetDatabaseTableChangesData, GetDatabaseTableChangesErrors, GetDatabaseTableChangesResponses, GetDatabaseViewPositionsData, GetDatabaseViewPositionsErrors, GetDatabaseViewPositionsResponses, GetDocumentAnchorsData, GetDocumentAnchorsErrors, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameErrors, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponses, GetDocumentData, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponses, GetDocumentListHandlerData, GetDocumentListHandlerErrors, GetDocumentListHandlerResponses, GetDocumentLocationV3Data, GetDocumentLocationV3Errors, GetDocumentLocationV3Responses, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Responses, GetDocumentProcessingResultData, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponses, GetDocumentResponses, GetDocumentShortIdData, GetDocumentShortIdErrors, GetDocumentShortIdResponses, GetDocumentTeamShareData, GetDocumentTeamShareErrors, GetDocumentTeamShareResponses, GetDocumentVersionData, GetDocumentVersionErrors, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponses, GetEmailFollowupData, GetEmailFollowupErrors, GetEmailFollowupResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponses, GetForeignEntityBySourceData, GetForeignEntityBySourceErrors, GetForeignEntityBySourceResponses, GetForeignEntityData, GetForeignEntityErrors, GetForeignEntityResponses, GetGithubPullRequestData, GetGithubPullRequestErrors, GetGithubPullRequestFacetsData, GetGithubPullRequestFacetsErrors, GetGithubPullRequestFacetsResponses, GetGithubPullRequestResponses, GetHarnessPairingData, GetHarnessPairingErrors, GetHarnessPairingResponses, GetHistoryHandlerData, GetHistoryHandlerErrors, GetHistoryHandlerResponses, GetInitiativeData, GetInitiativeErrors, GetInitiativeResponses, GetInstructionsHandlerData, GetInstructionsHandlerErrors, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupErrors, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerErrors, GetLocationHandlerResponses, GetOrCreateCallData, GetOrCreateCallErrors, GetOrCreateCallResponses, GetOrCreateDmData, GetOrCreateDmErrors, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateErrors, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerErrors, GetPinsHandlerResponses, GetProjectContentHandlerData, GetProjectContentHandlerErrors, GetProjectContentHandlerResponses, GetProjectHandlerData, GetProjectHandlerErrors, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Responses, GetProjectsHandlerData, GetProjectsHandlerErrors, GetProjectsHandlerResponses, GetProjectUserAccessLevelData, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponses, GetReminderData, GetReminderErrors, GetReminderResponses, GetRingStatusData, GetRingStatusErrors, GetRingStatusResponses, GetSelfBotData, GetSelfBotErrors, GetSelfBotResponses, GetSelfHarnessData, GetSelfHarnessErrors, GetSelfHarnessResponses, GetSlackImportData, GetSlackImportErrors, GetSlackImportResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponses, GetViewsHandlerData, GetViewsHandlerErrors, GetViewsHandlerResponses, GetWebhookData, GetWebhookErrors, GetWebhookResponses, HandlerData, HandlerErrors, HandlerResponses, HealthHandlerData, HealthHandlerResponses, ImportDatabaseTableData, ImportDatabaseTableErrors, ImportDatabaseTableResponses, InferDatabaseColumnTypeData, InferDatabaseColumnTypeErrors, InferDatabaseColumnTypeResponses, IngestTranscriptData, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsErrors, InitializeUserDocumentsResponses, InstallSyncData, InstallSyncErrors, JobProcessingResultHandlerData, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponses, JoinChannelByCodeData, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelErrors, JoinChannelResponses, LeaveChannelData, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallErrors, LeaveOrEndCallResponses, ListAgentsData, ListAgentsErrors, ListAgentsResponses, ListBotChannelsData, ListBotChannelsErrors, ListBotChannelsResponses, ListChannelLabelsData, ListChannelLabelsErrors, ListChannelLabelsResponses, ListCompanyContactsData, ListCompanyContactsErrors, ListCompanyContactsResponses, ListDatabaseColumnCastsData, ListDatabaseColumnCastsErrors, ListDatabaseColumnCastsResponses, ListDatabasesData, ListDatabasesErrors, ListDatabasesResponses, ListEmailRemindersData, ListEmailRemindersErrors, ListEmailRemindersResponses, ListFavoritesData, ListFavoritesErrors, ListFavoritesResponses, ListHarnessAgentsData, ListHarnessAgentsErrors, ListHarnessAgentsResponses, ListHarnessesData, ListHarnessesErrors, ListHarnessesResponses, ListHarnessSessionsData, ListHarnessSessionsErrors, ListHarnessSessionsResponses, ListInitiativesData, ListInitiativesErrors, ListInitiativesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponses, ListReminderCollectionData, ListReminderCollectionErrors, ListReminderCollectionResponses, ListRemindersData, ListRemindersErrors, ListRemindersResponses, ListSlackImportsData, ListSlackImportsResponses, ListTeamOutOfOfficeData, ListTeamOutOfOfficeErrors, ListTeamOutOfOfficeResponses, ListUserApiKeysData, ListUserApiKeysErrors, ListUserApiKeysResponses, ListWebhooksData, ListWebhooksErrors, ListWebhooksResponses, MeetingCancelData, MeetingCancelErrors, MeetingCancelPreparationData, MeetingCancelPreparationErrors, MeetingCancelPreparationResponses, MeetingCancelResponses, MeetingCreateData, MeetingCreateErrors, MeetingCreateResponses, MeetingGuestJoinData, MeetingGuestJoinErrors, MeetingGuestJoinResponses, MeetingGuestParticipantsData, MeetingGuestParticipantsErrors, MeetingGuestParticipantsResponses, MeetingInviteData, MeetingInviteErrors, MeetingInvitePermissionsData, MeetingInvitePermissionsErrors, MeetingInvitePermissionsResponses, MeetingInviteResponses, MeetingInviteUsersData, MeetingInviteUsersErrors, MeetingInviteUsersResponses, MeetingJoinData, MeetingJoinErrors, MeetingJoinResponses, MeetingLeaveData, MeetingLeaveErrors, MeetingLeaveResponses, MeetingListActiveData, MeetingListActiveErrors, MeetingListActiveResponses, MeetingListData, MeetingListErrors, MeetingListResponses, MeetingLookupData, MeetingLookupErrors, MeetingLookupResponses, MeetingParticipantsData, MeetingParticipantsErrors, MeetingParticipantsResponses, MeetingPrepareData, MeetingPrepareErrors, MeetingPrepareResponses, MeetingShareData, MeetingShareErrors, MeetingShareResponses, MeetingUpdateData, MeetingUpdateErrors, MeetingUpdateResponses, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponses, MessageTimelineData, MessageTimelineResponses, PatchChannelData, PatchChannelErrors, PatchChannelResponses, PatchViewHandlerData, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookErrors, PatchWebhookResponses, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponses, PostActivityData, PostActivityErrors, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookErrors, PostChannelBotWebhookResponses, PostItemsSoupAstData, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupErrors, PostItemsSoupResponses, PresaveDocumentHandlerData, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponses, PreviewSmartTagData, PreviewSmartTagErrors, PreviewSmartTagResponses, PutCrmTeamSettingsData, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponses, PutCrmTeamStagesData, PutCrmTeamStagesErrors, PutCrmTeamStagesResponses, RecentlyDeletedData, RecentlyDeletedErrors, RecentlyDeletedResponses, RegisterSlackImportUploadsData, RegisterSlackImportUploadsErrors, RegisterSlackImportUploadsResponses, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsErrors, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerErrors, RemovePinHandlerResponses, RenameChannelLabelData, RenameChannelLabelErrors, RenameChannelLabelResponses, ReorderFavoritesData, ReorderFavoritesErrors, ReorderFavoritesResponses, ReorderPinsHandlerData, ReorderPinsHandlerErrors, ReorderPinsHandlerResponses, ResetCrmTeamStagesData, ResetCrmTeamStagesErrors, ResetCrmTeamStagesResponses, RevertDeleteDocumentData, RevertDeleteDocumentErrors, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectErrors, RevertDeleteProjectResponses, SaveDatabaseQueryData, SaveDatabaseQueryErrors, SaveDatabaseQueryResponses, SaveDocumentHandlerData, SaveDocumentHandlerErrors, SaveDocumentHandlerResponses, SearchContactsData, SearchContactsErrors, SearchContactsResponses, SetChannelLabelData, SetChannelLabelErrors, SetChannelLabelResponses, SetChannelPictureData, SetChannelPictureErrors, SetChannelPictureResponses, SetCompanyHiddenData, SetCompanyHiddenErrors, SetCompanyHiddenResponses, SetContactHiddenData, SetContactHiddenErrors, SetContactHiddenResponses, SetCrmCompanyNameData, SetCrmCompanyNameErrors, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameErrors, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareErrors, SetDocumentTeamShareResponses, SetEmailFollowupData, SetEmailFollowupErrors, SetEmailFollowupResponses, SetEmailSyncData, SetEmailSyncErrors, SetEmailSyncResponses, ShareDatabaseAwarenessData, ShareDatabaseAwarenessErrors, ShareDatabaseAwarenessResponses, SimpleSaveData, SimpleSaveErrors, SimpleSaveResponses, StreamEventsData, StreamEventsErrors, StreamEventsResponse, StreamEventsResponses, ToggleShareWithTeamData, ToggleShareWithTeamErrors, ToggleShareWithTeamResponses, TranscribeDictationData, TranscribeDictationErrors, TranscribeDictationResponses, UnassignInitiativeTaskData, UnassignInitiativeTaskErrors, UnassignInitiativeTaskResponses, UndoDatabaseChangeData, UndoDatabaseChangeErrors, UndoDatabaseChangeResponses, UpdateAgentData, UpdateAgentErrors, UpdateAgentResponses, UpdateDatabasePermissionsData, UpdateDatabasePermissionsErrors, UpdateDatabasePermissionsResponses, UpdateInitiativeData, UpdateInitiativeErrors, UpdateInitiativeResponses, UpdateReminderData, UpdateReminderErrors, UpdateReminderResponses, UploadExtractFolderHandlerData, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponses, UploadFolderHandlerData, UploadFolderHandlerErrors, UploadFolderHandlerResponses, UpsertHistoryHandlerData, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationResponses, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookErrors, ValidateWebhookResponses } from './types.gen';
+import type { AddFavoriteData, AddFavoriteErrors, AddFavoriteResponses, AddParticipantsData, AddParticipantsErrors, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerErrors, AddPinHandlerResponses, ApplyDatabaseOpsData, ApplyDatabaseOpsErrors, ApplyDatabaseOpsResponses, ApproveHarnessPairingData, ApproveHarnessPairingErrors, ApproveHarnessPairingResponses, AssignInitiativeTasksData, AssignInitiativeTasksErrors, AssignInitiativeTasksResponses, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponses, CallWebhookData, CallWebhookErrors, CallWebhookResponses, CancelSlackImportData, CancelSlackImportErrors, CancelSlackImportResponses, CheckActiveCallData, CheckActiveCallErrors, CheckActiveCallResponses, ClaimHarnessPairingData, ClaimHarnessPairingErrors, ClaimHarnessPairingResponses, CompleteSlackImportUploadsData, CompleteSlackImportUploadsErrors, CompleteSlackImportUploadsResponses, ConvertDatabaseColumnData, ConvertDatabaseColumnErrors, ConvertDatabaseColumnResponses, CopyDocumentData, CopyDocumentErrors, CopyDocumentResponses, CreateAgentData, CreateAgentErrors, CreateAgentResponses, CreateAnchorData, CreateAnchorErrors, CreateAnchorResponses, CreateChannelData, CreateChannelErrors, CreateChannelLabelData, CreateChannelLabelErrors, CreateChannelLabelResponses, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotErrors, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponses, CreateCrmCompanyData, CreateCrmCompanyErrors, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactErrors, CreateCrmContactResponses, CreateDatabaseData, CreateDatabaseErrors, CreateDatabaseResponses, CreateDocumentData, CreateDocumentErrors, CreateDocumentResponses, CreateEntityMentionData, CreateEntityMentionErrors, CreateEntityMentionResponses, CreateHarnessPairingData, CreateHarnessPairingErrors, CreateHarnessPairingResponses, CreateInitiativeData, CreateInitiativeErrors, CreateInitiativeResponses, CreateInstructionsHandlerData, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponses, CreateMarkdownHandlerData, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponses, CreateProjectHandlerData, CreateProjectHandlerErrors, CreateProjectHandlerResponses, CreateReminderData, CreateReminderErrors, CreateReminderResponses, CreateSkillHandlerData, CreateSkillHandlerErrors, CreateSkillHandlerResponses, CreateSlackImportData, CreateSlackImportErrors, CreateSlackImportResponses, CreateSnippetHandlerData, CreateSnippetHandlerErrors, CreateSnippetHandlerResponses, CreateTaskHandlerData, CreateTaskHandlerErrors, CreateTaskHandlerResponses, CreateUserApiKeyData, CreateUserApiKeyErrors, CreateUserApiKeyResponses, CreateViewHandlerData, CreateViewHandlerErrors, CreateViewHandlerResponses, CreateWebhookData, CreateWebhookErrors, CreateWebhookResponses, DeleteAnchorData, DeleteAnchorErrors, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordErrors, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelErrors, DeleteChannelLabelData, DeleteChannelLabelErrors, DeleteChannelLabelResponses, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponses, DeleteDocumentData, DeleteDocumentErrors, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionErrors, DeleteEntityMentionResponses, DeleteHarnessData, DeleteHarnessErrors, DeleteHarnessResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponses, DeleteInitiativeData, DeleteInitiativeErrors, DeleteInitiativeResponses, DeleteProjectHandlerData, DeleteProjectHandlerErrors, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderErrors, DeleteReminderResponses, DeleteSelfHarnessData, DeleteSelfHarnessErrors, DeleteSelfHarnessResponses, DeleteUserApiKeyData, DeleteUserApiKeyErrors, DeleteUserApiKeyResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookErrors, DeleteWebhookResponses, EditAnchorData, EditAnchorErrors, EditAnchorResponses, EditCallRecordData, EditCallRecordErrors, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptErrors, EditCallTranscriptResponses, EditDocumentData, EditDocumentErrors, EditDocumentResponses, EditProjectV2Data, EditProjectV2Errors, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Errors, EditThreadV2Responses, EnsureCollabSurfaceData, EnsureCollabSurfaceErrors, EnsureCollabSurfaceResponses, EnsureStarterHandlerData, EnsureStarterHandlerErrors, EnsureStarterHandlerResponses, EntityMessageCreateData, EntityMessageCreateResponses, EntityMessageDeleteMessageData, EntityMessageDeleteMessageResponses, EntityMessageDeleteThreadData, EntityMessageDeleteThreadResponses, EntityMessageEditData, EntityMessageEditResponses, EntityMessageGetMessageData, EntityMessageGetMessageResponses, EntityMessageGetThreadData, EntityMessageGetThreadResponses, EntityMessageLegacyData, EntityMessageLegacyResponses, EntityMessagePatchThreadData, EntityMessagePatchThreadResponses, EntityMessageReactData, EntityMessageReactResponses, EntityMessageTypingData, EntityMessageTypingResponses, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExportDocumentData, ExportDocumentErrors, ExportDocumentResponses, FinalizeSlackImportData, FinalizeSlackImportErrors, FinalizeSlackImportResponses, GetActiveCallsData, GetActiveCallsErrors, GetActiveCallsResponses, GetActivityData, GetActivityErrors, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesErrors, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewErrors, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponses, GetBatchProjectPreviewData, GetBatchProjectPreviewErrors, GetBatchProjectPreviewResponses, GetBotOwnerProfilesData, GetBotOwnerProfilesErrors, GetBotOwnerProfilesResponses, GetCallRecordData, GetCallRecordErrors, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsErrors, GetChannelAttachmentsResponses, GetChannelData, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkErrors, GetChannelJoinLinkResponses, GetChannelParticipantsData, GetChannelParticipantsErrors, GetChannelParticipantsResponses, GetChannelResponses, GetChannelsData, GetChannelsErrors, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceErrors, GetCollabSurfaceResponses, GetCompanyData, GetCompanyErrors, GetCompanyResponses, GetContactByEmailData, GetContactByEmailErrors, GetContactByEmailResponses, GetContactData, GetContactErrors, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponses, GetDatabaseData, GetDatabaseErrors, GetDatabasePermissionsData, GetDatabasePermissionsErrors, GetDatabasePermissionsResponses, GetDatabaseQueryData, GetDatabaseQueryErrors, GetDatabaseQueryResponses, GetDatabaseResponses, GetDatabaseRowHistoryData, GetDatabaseRowHistoryErrors, GetDatabaseRowHistoryResponses, GetDatabaseTableChangesData, GetDatabaseTableChangesErrors, GetDatabaseTableChangesResponses, GetDatabaseViewPositionsData, GetDatabaseViewPositionsErrors, GetDatabaseViewPositionsResponses, GetDocumentAnchorsData, GetDocumentAnchorsErrors, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameErrors, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponses, GetDocumentData, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponses, GetDocumentListHandlerData, GetDocumentListHandlerErrors, GetDocumentListHandlerResponses, GetDocumentLocationV3Data, GetDocumentLocationV3Errors, GetDocumentLocationV3Responses, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Responses, GetDocumentProcessingResultData, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponses, GetDocumentResponses, GetDocumentShortIdData, GetDocumentShortIdErrors, GetDocumentShortIdResponses, GetDocumentTeamShareData, GetDocumentTeamShareErrors, GetDocumentTeamShareResponses, GetDocumentVersionData, GetDocumentVersionErrors, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponses, GetEmailFollowupData, GetEmailFollowupErrors, GetEmailFollowupResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponses, GetForeignEntityBySourceData, GetForeignEntityBySourceErrors, GetForeignEntityBySourceResponses, GetForeignEntityData, GetForeignEntityErrors, GetForeignEntityResponses, GetGithubPullRequestChangesData, GetGithubPullRequestChangesErrors, GetGithubPullRequestChangesPatchData, GetGithubPullRequestChangesPatchErrors, GetGithubPullRequestChangesPatchResponses, GetGithubPullRequestChangesResponses, GetGithubPullRequestData, GetGithubPullRequestErrors, GetGithubPullRequestFacetsData, GetGithubPullRequestFacetsErrors, GetGithubPullRequestFacetsResponses, GetGithubPullRequestResponses, GetHarnessPairingData, GetHarnessPairingErrors, GetHarnessPairingResponses, GetHistoryHandlerData, GetHistoryHandlerErrors, GetHistoryHandlerResponses, GetInitiativeData, GetInitiativeErrors, GetInitiativeResponses, GetInstructionsHandlerData, GetInstructionsHandlerErrors, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupErrors, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerErrors, GetLocationHandlerResponses, GetOrCreateCallData, GetOrCreateCallErrors, GetOrCreateCallResponses, GetOrCreateDmData, GetOrCreateDmErrors, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateErrors, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerErrors, GetPinsHandlerResponses, GetProjectContentHandlerData, GetProjectContentHandlerErrors, GetProjectContentHandlerResponses, GetProjectHandlerData, GetProjectHandlerErrors, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Responses, GetProjectsHandlerData, GetProjectsHandlerErrors, GetProjectsHandlerResponses, GetProjectUserAccessLevelData, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponses, GetReminderData, GetReminderErrors, GetReminderResponses, GetRingStatusData, GetRingStatusErrors, GetRingStatusResponses, GetSelfBotData, GetSelfBotErrors, GetSelfBotResponses, GetSelfHarnessData, GetSelfHarnessErrors, GetSelfHarnessResponses, GetSlackImportData, GetSlackImportErrors, GetSlackImportResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponses, GetViewsHandlerData, GetViewsHandlerErrors, GetViewsHandlerResponses, GetWebhookData, GetWebhookErrors, GetWebhookResponses, HandlerData, HandlerErrors, HandlerResponses, HealthHandlerData, HealthHandlerResponses, ImportDatabaseTableData, ImportDatabaseTableErrors, ImportDatabaseTableResponses, InferDatabaseColumnTypeData, InferDatabaseColumnTypeErrors, InferDatabaseColumnTypeResponses, IngestTranscriptData, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsErrors, InitializeUserDocumentsResponses, InstallSyncData, InstallSyncErrors, JobProcessingResultHandlerData, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponses, JoinChannelByCodeData, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelErrors, JoinChannelResponses, LeaveChannelData, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallErrors, LeaveOrEndCallResponses, ListAgentsData, ListAgentsErrors, ListAgentsResponses, ListBotChannelsData, ListBotChannelsErrors, ListBotChannelsResponses, ListChannelLabelsData, ListChannelLabelsErrors, ListChannelLabelsResponses, ListCompanyContactsData, ListCompanyContactsErrors, ListCompanyContactsResponses, ListDatabaseColumnCastsData, ListDatabaseColumnCastsErrors, ListDatabaseColumnCastsResponses, ListDatabasesData, ListDatabasesErrors, ListDatabasesResponses, ListEmailRemindersData, ListEmailRemindersErrors, ListEmailRemindersResponses, ListFavoritesData, ListFavoritesErrors, ListFavoritesResponses, ListHarnessAgentsData, ListHarnessAgentsErrors, ListHarnessAgentsResponses, ListHarnessesData, ListHarnessesErrors, ListHarnessesResponses, ListHarnessSessionsData, ListHarnessSessionsErrors, ListHarnessSessionsResponses, ListInitiativesData, ListInitiativesErrors, ListInitiativesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponses, ListReminderCollectionData, ListReminderCollectionErrors, ListReminderCollectionResponses, ListRemindersData, ListRemindersErrors, ListRemindersResponses, ListSlackImportsData, ListSlackImportsResponses, ListTeamOutOfOfficeData, ListTeamOutOfOfficeErrors, ListTeamOutOfOfficeResponses, ListUserApiKeysData, ListUserApiKeysErrors, ListUserApiKeysResponses, ListWebhooksData, ListWebhooksErrors, ListWebhooksResponses, MeetingCancelData, MeetingCancelErrors, MeetingCancelPreparationData, MeetingCancelPreparationErrors, MeetingCancelPreparationResponses, MeetingCancelResponses, MeetingCreateData, MeetingCreateErrors, MeetingCreateResponses, MeetingGuestJoinData, MeetingGuestJoinErrors, MeetingGuestJoinResponses, MeetingGuestParticipantsData, MeetingGuestParticipantsErrors, MeetingGuestParticipantsResponses, MeetingInviteData, MeetingInviteErrors, MeetingInvitePermissionsData, MeetingInvitePermissionsErrors, MeetingInvitePermissionsResponses, MeetingInviteResponses, MeetingInviteUsersData, MeetingInviteUsersErrors, MeetingInviteUsersResponses, MeetingJoinData, MeetingJoinErrors, MeetingJoinResponses, MeetingLeaveData, MeetingLeaveErrors, MeetingLeaveResponses, MeetingListActiveData, MeetingListActiveErrors, MeetingListActiveResponses, MeetingListData, MeetingListErrors, MeetingListResponses, MeetingLookupData, MeetingLookupErrors, MeetingLookupResponses, MeetingParticipantsData, MeetingParticipantsErrors, MeetingParticipantsResponses, MeetingPrepareData, MeetingPrepareErrors, MeetingPrepareResponses, MeetingShareData, MeetingShareErrors, MeetingShareResponses, MeetingUpdateData, MeetingUpdateErrors, MeetingUpdateResponses, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponses, MessageTimelineData, MessageTimelineResponses, PatchChannelData, PatchChannelErrors, PatchChannelResponses, PatchViewHandlerData, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookErrors, PatchWebhookResponses, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponses, PostActivityData, PostActivityErrors, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookErrors, PostChannelBotWebhookResponses, PostItemsSoupAstData, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupErrors, PostItemsSoupResponses, PresaveDocumentHandlerData, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponses, PreviewSmartTagData, PreviewSmartTagErrors, PreviewSmartTagResponses, PutCrmTeamSettingsData, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponses, PutCrmTeamStagesData, PutCrmTeamStagesErrors, PutCrmTeamStagesResponses, RecentlyDeletedData, RecentlyDeletedErrors, RecentlyDeletedResponses, RegisterSlackImportUploadsData, RegisterSlackImportUploadsErrors, RegisterSlackImportUploadsResponses, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsErrors, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerErrors, RemovePinHandlerResponses, RenameChannelLabelData, RenameChannelLabelErrors, RenameChannelLabelResponses, ReorderFavoritesData, ReorderFavoritesErrors, ReorderFavoritesResponses, ReorderPinsHandlerData, ReorderPinsHandlerErrors, ReorderPinsHandlerResponses, ResetCrmTeamStagesData, ResetCrmTeamStagesErrors, ResetCrmTeamStagesResponses, RevertDeleteDocumentData, RevertDeleteDocumentErrors, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectErrors, RevertDeleteProjectResponses, SaveDatabaseQueryData, SaveDatabaseQueryErrors, SaveDatabaseQueryResponses, SaveDocumentHandlerData, SaveDocumentHandlerErrors, SaveDocumentHandlerResponses, SearchContactsData, SearchContactsErrors, SearchContactsResponses, SetChannelLabelData, SetChannelLabelErrors, SetChannelLabelResponses, SetChannelPictureData, SetChannelPictureErrors, SetChannelPictureResponses, SetCompanyHiddenData, SetCompanyHiddenErrors, SetCompanyHiddenResponses, SetContactHiddenData, SetContactHiddenErrors, SetContactHiddenResponses, SetCrmCompanyNameData, SetCrmCompanyNameErrors, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameErrors, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareErrors, SetDocumentTeamShareResponses, SetEmailFollowupData, SetEmailFollowupErrors, SetEmailFollowupResponses, SetEmailSyncData, SetEmailSyncErrors, SetEmailSyncResponses, ShareDatabaseAwarenessData, ShareDatabaseAwarenessErrors, ShareDatabaseAwarenessResponses, SimpleSaveData, SimpleSaveErrors, SimpleSaveResponses, StreamEventsData, StreamEventsErrors, StreamEventsResponse, StreamEventsResponses, ToggleShareWithTeamData, ToggleShareWithTeamErrors, ToggleShareWithTeamResponses, TranscribeDictationData, TranscribeDictationErrors, TranscribeDictationResponses, UnassignInitiativeTaskData, UnassignInitiativeTaskErrors, UnassignInitiativeTaskResponses, UndoDatabaseChangeData, UndoDatabaseChangeErrors, UndoDatabaseChangeResponses, UpdateAgentData, UpdateAgentErrors, UpdateAgentResponses, UpdateDatabasePermissionsData, UpdateDatabasePermissionsErrors, UpdateDatabasePermissionsResponses, UpdateInitiativeData, UpdateInitiativeErrors, UpdateInitiativeResponses, UpdateReminderData, UpdateReminderErrors, UpdateReminderResponses, UploadExtractFolderHandlerData, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponses, UploadFolderHandlerData, UploadFolderHandlerErrors, UploadFolderHandlerResponses, UpsertHistoryHandlerData, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationResponses, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookErrors, ValidateWebhookResponses } from './types.gen';
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
/**
@@ -1805,6 +1805,21 @@ export class Sdk extends HeyApiClient {
return (options.client ?? this.client).get<GetGithubPullRequestResponses, GetGithubPullRequestErrors, ThrowOnError>({ url: '/github_pull_requests/{id}', ...options });
}
+ /**
+ * Get the changes of the pull request behind a foreign entity record the caller can view.
+ */
+ public getGithubPullRequestChanges<ThrowOnError extends boolean = false>(options: Options<GetGithubPullRequestChangesData, ThrowOnError>): RequestResult<GetGithubPullRequestChangesResponses, GetGithubPullRequestChangesErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetGithubPullRequestChangesResponses, GetGithubPullRequestChangesErrors, ThrowOnError>({ url: '/github_pull_requests/{id}/changes', ...options });
+ }
+
+ /**
+ * Get the patch of changes of the pull request behind a foreign entity record the caller can
+ * view.
+ */
+ public getGithubPullRequestChangesPatch<ThrowOnError extends boolean = false>(options: Options<GetGithubPullRequestChangesPatchData, ThrowOnError>): RequestResult<GetGithubPullRequestChangesPatchResponses, GetGithubPullRequestChangesPatchErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetGithubPullRequestChangesPatchResponses, GetGithubPullRequestChangesPatchErrors, ThrowOnError>({ url: '/github_pull_requests/{id}/changes/patch', ...options });
+ }
+
/**
* Handler for `POST /harness-pairings`.
*
diff --git a/packages/sdk/generated/storage/types.gen.ts b/packages/sdk/generated/storage/types.gen.ts
index 06823c1b90..40818537d7 100644
--- a/packages/sdk/generated/storage/types.gen.ts
+++ b/packages/sdk/generated/storage/types.gen.ts
@@ -2165,6 +2165,100 @@ export type CellWrite = {
value: CellValue;
};
+/**
+ * One changed file.
+ *
+ * Clients deserialize this, so both derives are used.
+ */
+export type ChangedFileDto = {
+ /**
+ * Lines added.
+ */
+ additions: number;
+ /**
+ * The diff carries no text for this file.
+ */
+ binary: boolean;
+ /**
+ * Lines removed.
+ */
+ deletions: number;
+ /**
+ * What happened to the file.
+ */
+ kind: FileChangeKindDto;
+ /**
+ * The file's hunks were left out of the patch to fit the size budget.
+ */
+ patchOmitted: boolean;
+ /**
+ * The file's path after the change, or before it for a deletion.
+ */
+ path: string;
+ /**
+ * Where a renamed file came from.
+ */
+ previousPath?: string | null;
+};
+
+/**
+ * One changeset: the files a patch touches and what happened to each.
+ *
+ * Clients deserialize this, so both derives are used.
+ */
+export type ChangesetDto = {
+ /**
+ * Lines added across all files.
+ */
+ additions: number;
+ /**
+ * The side the work started from.
+ */
+ base: GitRefDto;
+ /**
+ * When the diff was taken.
+ */
+ capturedAt: string;
+ /**
+ * Lines removed across all files.
+ */
+ deletions: number;
+ /**
+ * Every changed file, in patch order.
+ */
+ files: Array<ChangedFileDto>;
+ /**
+ * The side carrying the work.
+ */
+ head: GitRefDto;
+ /**
+ * The changeset's id; a different id means different changes.
+ */
+ id: string;
+ /**
+ * Size of the patch the matching patch route serves; zero when nothing
+ * changed.
+ */
+ patchBytes: number;
+ /**
+ * `https://github.com/owner/name`, when known.
+ */
+ repository?: string | null;
+ /**
+ * Where the diff was read from.
+ */
+ source: ChangesetSourceDto;
+ /**
+ * Some files' hunks were left out of the patch.
+ */
+ truncated: boolean;
+};
+
+/**
+ * The source of a changeset's diff, on the wire.
+ */
+export type ChangesetSourceDto = 'github_pull_request';
+
/**
* Channel metadata in soup payloads.
*/
@@ -6002,6 +6096,11 @@ export type FavoritesList = {
favorites: Array<Favorite>;
};
+/**
+ * What happened to a file, on the wire.
+ */
+export type FileChangeKindDto = 'added' | 'modified' | 'deleted' | 'renamed';
+
export type FileSystemNodeWithIds = {
document_id: string;
item: FolderItem;
@@ -6597,6 +6696,20 @@ export type GetUserHistoryResponse = {
error: boolean;
};
+/**
+ * One end of the compared range.
+ */
+export type GitRefDto = {
+ /**
+ * The branch name, when known.
+ */
+ name?: string | null;
+ /**
+ * The commit, when known.
+ */
+ sha?: string | null;
+};
+
/**
* A label among the visible GitHub pull requests. Labels with the same name in different
* repositories count together.
@@ -6674,6 +6787,31 @@ export type GithubPullRequest = {
url: string;
};
+/**
+ * Response body for `GET /github_pull_requests/{id}/changes/patch`.
+ *
+ * Clients deserialize this, so both derives are used.
+ */
+export type GithubPullRequestChangesPatchResponse = {
+ /**
+ * The git-style unified diff of the changeset.
+ */
+ patch: string;
+};
+
+/**
+ * Response body for `GET /github_pull_requests/{id}/changes`.
+ *
+ * Clients deserialize this, so both derives are used.
+ */
+export type GithubPullRequestChangesResponse = {
+ changeset?: null | ChangesetDto;
+ /**
+ * Why there are no changes, in a sentence the user can act on.
+ */
+ error?: string | null;
+};
+
/**
* A check run associated with a GitHub pull request.
*/
@@ -11917,6 +12055,7 @@ export type StoredGithubPullRequest = {
* The author's GitHub login when the pull request was last synced.
*/
authorLogin?: string | null;
+ base?: null | GitRefDto;
/**
* The latest check runs on the pull request's head commit.
*/
@@ -11947,6 +12086,7 @@ export type StoredGithubPullRequest = {
* When GitHub last updated the pull request.
*/
githubUpdatedAt?: string | null;
+ head?: null | GitRefDto;
/**
* The caller's record for the pull request.
*/
@@ -17837,6 +17977,64 @@ export type GetGithubPullRequestResponses = {
export type GetGithubPullRequestResponse = GetGithubPullRequestResponses[keyof GetGithubPullRequestResponses];
+export type GetGithubPullRequestChangesData = {
+ body?: never;
+ path: {
+ /**
+ * The caller's foreign entity record for the pull request
+ */
+ id: string;
+ };
+ query?: never;
+ url: '/github_pull_requests/{id}/changes';
+};
+
+export type GetGithubPullRequestChangesErrors = {
+ 401: ErrorResponse;
+ 404: ErrorResponse;
+ 500: ErrorResponse;
+};
+
+export type GetGithubPullRequestChangesError = GetGithubPullRequestChangesErrors[keyof GetGithubPullRequestChangesErrors];
+
+export type GetGithubPullRequestChangesResponses = {
+ 200: GithubPullRequestChangesResponse;
+};
+
+export type GetGithubPullRequestChangesResponse = GetGithubPullRequestChangesResponses[keyof GetGithubPullRequestChangesResponses];
+
+export type GetGithubPullRequestChangesPatchData = {
+ body?: never;
+ path: {
+ /**
+ * The caller's foreign entity record for the pull request
+ */
+ id: string;
+ };
+ query: {
+ /**
+ * The changeset whose patch to read
+ */
+ changeset: string;
+ };
+ url: '/github_pull_requests/{id}/changes/patch';
+};
+
+export type GetGithubPullRequestChangesPatchErrors = {
+ 401: ErrorResponse;
+ 404: ErrorResponse;
+ 409: ErrorResponse;
+ 500: ErrorResponse;
+};
+
+export type GetGithubPullRequestChangesPatchError = GetGithubPullRequestChangesPatchErrors[keyof GetGithubPullRequestChangesPatchErrors];
+
+export type GetGithubPullRequestChangesPatchResponses = {
+ 200: GithubPullRequestChangesPatchResponse;
+};
+
+export type GetGithubPullRequestChangesPatchResponse = GetGithubPullRequestChangesPatchResponses[keyof GetGithubPullRequestChangesPatchResponses];
+
export type CreateHarnessPairingData = {
body: CreatePairingRequest;
path?: never;
diff --git a/packages/sdk/specs/storage.json b/packages/sdk/specs/storage.json
index 8d9118827a..c7119e0c3e 100644
--- a/packages/sdk/specs/storage.json
+++ b/packages/sdk/specs/storage.json
@@ -10778,6 +10778,148 @@
}
}
},
+ "/github_pull_requests/{id}/changes": {
+ "get": {
+ "tags": ["github_pull_requests"],
+ "summary": "Get the changes of the pull request behind a foreign entity record the caller can view.",
+ "operationId": "get_github_pull_request_changes",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The caller's foreign entity record for the pull request",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "uuid"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GithubPullRequestChangesResponse"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/github_pull_requests/{id}/changes/patch": {
+ "get": {
+ "tags": ["github_pull_requests"],
+ "summary": "Get the patch of changes of the pull request behind a foreign entity record the caller can\nview.",
+ "operationId": "get_github_pull_request_changes_patch",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The caller's foreign entity record for the pull request",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "uuid"
+ }
+ },
+ {
+ "name": "changeset",
+ "in": "query",
+ "description": "The changeset whose patch to read",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "uuid"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GithubPullRequestChangesPatchResponse"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "409": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/harness-pairings": {
"post": {
"tags": ["harnesses"],
@@ -19381,6 +19523,130 @@
}
}
},
+ "ChangedFileDto": {
+ "type": "object",
+ "description": "One changed file.\n\nClients deserialize this, so both derives are used.",
+ "required": [
+ "path",
+ "kind",
+ "additions",
+ "deletions",
+ "binary",
+ "patchOmitted"
+ ],
+ "properties": {
+ "additions": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Lines added.",
+ "minimum": 0
+ },
+ "binary": {
+ "type": "boolean",
+ "description": "The diff carries no text for this file."
+ },
+ "deletions": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Lines removed.",
+ "minimum": 0
+ },
+ "kind": {
+ "$ref": "#/components/schemas/FileChangeKindDto",
+ "description": "What happened to the file."
+ },
+ "patchOmitted": {
+ "type": "boolean",
+ "description": "The file's hunks were left out of the patch to fit the size budget."
+ },
+ "path": {
+ "type": "string",
+ "description": "The file's path after the change, or before it for a deletion."
+ },
+ "previousPath": {
+ "type": ["string", "null"],
+ "description": "Where a renamed file came from."
+ }
+ }
+ },
+ "ChangesetDto": {
+ "type": "object",
+ "description": "One changeset: the files a patch touches and what happened to each.\n\nClients deserialize this, so both derives are used.",
+ "required": [
+ "id",
+ "source",
+ "base",
+ "head",
+ "files",
+ "additions",
+ "deletions",
+ "patchBytes",
+ "truncated",
+ "capturedAt"
+ ],
+ "properties": {
+ "additions": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Lines added across all files.",
+ "minimum": 0
+ },
+ "base": {
+ "$ref": "#/components/schemas/GitRefDto",
+ "description": "The side the work started from."
+ },
+ "capturedAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the diff was taken."
+ },
+ "deletions": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Lines removed across all files.",
+ "minimum": 0
+ },
+ "files": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ChangedFileDto"
+ },
+ "description": "Every changed file, in patch order."
+ },
+ "head": {
+ "$ref": "#/components/schemas/GitRefDto",
+ "description": "The side carrying the work."
+ },
+ "id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The changeset's id; a different id means different changes."
+ },
+ "patchBytes": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Size of the patch the matching patch route serves; zero when nothing\nchanged.",
+ "minimum": 0
+ },
+ "repository": {
+ "type": ["string", "null"],
+ "description": "`https://github.com/owner/name`, when known."
+ },
+ "source": {
+ "$ref": "#/components/schemas/ChangesetSourceDto",
+ "description": "Where the diff was read from."
+ },
+ "truncated": {
+ "type": "boolean",
+ "description": "Some files' hunks were left out of the patch."
+ }
+ }
+ },
+ "ChangesetSourceDto": {
+ "type": "string",
+ "description": "The source of a changeset's diff, on the wire.",
+ "enum": ["github_pull_request"]
+ },
"Channel": {
"type": "object",
"description": "Channel metadata in soup payloads.",
@@ -25205,6 +25471,11 @@
}
}
},
+ "FileChangeKindDto": {
+ "type": "string",
+ "description": "What happened to a file, on the wire.",
+ "enum": ["added", "modified", "deleted", "renamed"]
+ },
"FileSystemNodeWithIds": {
"oneOf": [
{
@@ -26574,6 +26845,20 @@
}
}
},
+ "GitRefDto": {
+ "type": "object",
+ "description": "One end of the compared range.",
+ "properties": {
+ "name": {
+ "type": ["string", "null"],
+ "description": "The branch name, when known."
+ },
+ "sha": {
+ "type": ["string", "null"],
+ "description": "The commit, when known."
+ }
+ }
+ },
"GithubLabelFacet": {
"type": "object",
"description": "A label among the visible GitHub pull requests. Labels with the same name in different\nrepositories count together.",
@@ -26673,6 +26958,38 @@
}
}
},
+ "GithubPullRequestChangesPatchResponse": {
+ "type": "object",
+ "description": "Response body for `GET /github_pull_requests/{id}/changes/patch`.\n\nClients deserialize this, so both derives are used.",
+ "required": ["patch"],
+ "properties": {
+ "patch": {
+ "type": "string",
+ "description": "The git-style unified diff of the changeset."
+ }
+ }
+ },
+ "GithubPullRequestChangesResponse": {
+ "type": "object",
+ "description": "Response body for `GET /github_pull_requests/{id}/changes`.\n\nClients deserialize this, so both derives are used.",
+ "properties": {
+ "changeset": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/ChangesetDto",
+ "description": "The changes at the pull request's current base and head; absent when GitHub could not\nprovide them."
+ }
+ ]
+ },
+ "error": {
+ "type": ["string", "null"],
+ "description": "Why there are no changes, in a sentence the user can act on."
+ }
+ }
+ },
"GithubPullRequestCheckRun": {
"type": "object",
"description": "A check run associated with a GitHub pull request.",
@@ -35016,6 +35333,17 @@
"type": ["string", "null"],
"description": "The author's GitHub login when the pull request was last synced."
},
+ "base": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/GitRefDto",
+ "description": "The branch and commit the pull request merges into, when known."
+ }
+ ]
+ },
"checks": {
"type": "array",
"items": {
@@ -35053,6 +35381,17 @@
"format": "date-time",
"description": "When GitHub last updated the pull request."
},
+ "head": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/GitRefDto",
+ "description": "The branch and commit carrying the pull request's changes, when known."
+ }
+ ]
+ },
"id": {
"type": "string",
"format": "uuid",
diff --git a/packages/sdk/src/coverage/skipped.ts b/packages/sdk/src/coverage/skipped.ts
index a7c69f72c2..6abc491e47 100644
--- a/packages/sdk/src/coverage/skipped.ts
+++ b/packages/sdk/src/coverage/skipped.ts
@@ -412,6 +412,8 @@ export const storageBacklog = [
'getDocumentVersion',
'getEntityPermission',
'getGithubPullRequest',
+ 'getGithubPullRequestChanges',
+ 'getGithubPullRequestChangesPatch',
'getProjectPermissionsV2',
'getProjectUserAccessLevel',
'getHarnessPairing',
diff --git a/services/agent_harness_service/Cargo.toml b/services/agent_harness_service/Cargo.toml
index d264ad94ed..f7ca0cf1d3 100644
--- a/services/agent_harness_service/Cargo.toml
+++ b/services/agent_harness_service/Cargo.toml
@@ -56,6 +56,11 @@ github = { path = "../../crates/github", default-features = false, features = [
"ports",
"sync",
] }
+github_pull_requests = { path = "../../crates/github_pull_requests", default-features = false, features = [
+ "outbound",
+ "s3",
+ "service",
+] }
pipedream_mcp = { path = "../../crates/pipedream_mcp" }
url = { workspace = true }
contacts = { path = "../../crates/contacts" }
diff --git a/services/agent_harness_service/src/config.rs b/services/agent_harness_service/src/config.rs
index be04b0ba60..c6222ddd41 100644
--- a/services/agent_harness_service/src/config.rs
+++ b/services/agent_harness_service/src/config.rs
@@ -187,6 +187,10 @@ pub struct Config {
/// harness that cannot store a patch cannot show a session's changes,
/// and that is worth failing at boot rather than on the first capture.
pub agent_session_changes_bucket: String,
+ /// S3 bucket of pull request patches, owned by document-storage-service and
+ /// shared with it, so a session capture reuses the patch a pull request
+ /// viewer stored for the same base and head.
+ pub github_pull_request_patch_bucket: String,
/// Client id of the GitHub App installation tokens are minted for.
pub github_sync_app_client_id: String,
/// PEM private key of that App.
diff --git a/services/agent_harness_service/src/main.rs b/services/agent_harness_service/src/main.rs
index 48d2dd5adb..54eee2a5bc 100644
--- a/services/agent_harness_service/src/main.rs
+++ b/services/agent_harness_service/src/main.rs
@@ -114,6 +114,9 @@ use github::domain::service::{
use github::outbound::github_sync_client::GithubSyncClientImpl;
use github::outbound::pg_github_sync_repo::PgGithubSyncRepo;
use github::outbound::pull_request_diff::GithubPullRequestDiffClient;
+use github_pull_requests::domain::service::GithubPullRequestChangesetStore;
+use github_pull_requests::outbound::pg_github_pull_request_repo::PgGithubPullRequestRepo;
+use github_pull_requests::outbound::s3_patch_store::S3GithubPullRequestPatchStore;
use harness_bindings::{PgHarnessBindings, PgHarnessPresence};
use harnesses::outbound::pg_harness_repo::PgHarnessRepo;
use kafka_util::{GroupName, KafkaEventConsumer, consumer_span, record_span_error};
@@ -951,14 +954,19 @@ async fn run() -> anyhow::Result<()> {
MacrodModels::new(Arc::clone(&runtimes), redis.clone(), model_probe_timeout);
// Capture only the session's linked GitHub pull request, for every harness.
- let changes_extractor = PullRequestChanges::new(GithubPullRequestDiffClient::new(
- InstallationTokenService::new(
+ let changes_extractor = PullRequestChanges::new(GithubPullRequestChangesetStore::new(
+ GithubPullRequestDiffClient::new(InstallationTokenService::new(
InstallationTokenConfig {
client_id: config.github_sync_app_client_id.clone(),
private_key_pem: config.github_sync_app_pem_secret_key.as_ref().to_owned(),
},
PgGithubSyncRepo::new(pool.clone()),
GithubSyncClientImpl::default(),
+ )),
+ PgGithubPullRequestRepo::new(pool.clone()),
+ S3GithubPullRequestPatchStore::new(
+ macro_aws_config::s3_client().await,
+ config.github_pull_request_patch_bucket.clone(),
),
));
let changes = AgentChangesService::new(
diff --git a/services/document_storage_service/Cargo.toml b/services/document_storage_service/Cargo.toml
index e005e1b3db..6d7115a6d6 100644
--- a/services/document_storage_service/Cargo.toml
+++ b/services/document_storage_service/Cargo.toml
@@ -133,6 +133,7 @@ github = { path = "../../crates/github", default-features = false, features = [
github_pull_requests = { path = "../../crates/github_pull_requests", default-features = false, features = [
"inbound",
"outbound",
+ "s3",
"service",
] }
graphql_soup = { path = "../../crates/graphql_soup" }
diff --git a/services/document_storage_service/src/api.rs b/services/document_storage_service/src/api.rs
index 2a782cf0dd..5ff67ea4ee 100644
--- a/services/document_storage_service/src/api.rs
+++ b/services/document_storage_service/src/api.rs
@@ -287,6 +287,11 @@ fn api_router(state: ApiContext) -> Router {
"/github_pull_requests",
github_pull_requests::inbound::axum_router::github_pull_requests_router(
state.github_pull_request_state.clone(),
+ )
+ .merge(
+ github_pull_requests::inbound::changes_router::github_pull_request_changes_router(
+ state.github_pull_request_changes_state.clone(),
+ ),
),
)
.nest(
diff --git a/services/document_storage_service/src/api/context.rs b/services/document_storage_service/src/api/context.rs
index c09df513b8..8cce2c895b 100644
--- a/services/document_storage_service/src/api/context.rs
+++ b/services/document_storage_service/src/api/context.rs
@@ -92,10 +92,20 @@ use github::inbound::pull_request_index_router::PullRequestIndexRouterState;
use github::outbound::connection_gateway_realtime::ConnectionGatewayGithubRealtime;
use github::outbound::github_sync_client::GithubSyncClientImpl;
use github::outbound::pg_github_sync_repo::PgGithubSyncRepo;
+use github::outbound::pull_request_diff::GithubPullRequestDiffClient;
use github_pull_requests::{
- domain::service::GithubPullRequestServiceImpl,
- inbound::axum_router::GithubPullRequestRouterState,
- outbound::pg_github_pull_request_repo::PgGithubPullRequestRepo,
+ domain::service::{
+ GithubPullRequestChangesServiceImpl, GithubPullRequestChangesetStore,
+ GithubPullRequestServiceImpl,
+ },
+ inbound::{
+ axum_router::GithubPullRequestRouterState,
+ changes_router::GithubPullRequestChangesRouterState,
+ },
+ outbound::{
+ pg_github_pull_request_repo::PgGithubPullRequestRepo,
+ s3_patch_store::S3GithubPullRequestPatchStore,
+ },
};
use initiative::{
domain::service::InitiativeServiceImpl, inbound::axum_router::InitiativeRouterState,
@@ -675,6 +685,23 @@ pub(crate) type DssGithubPullRequestState = GithubPullRequestRouterState<
AuthorizationService,
>;
+/// Type alias for the store of GitHub pull request changesets and their patches.
+pub(crate) type GithubPullRequestChangesetStoreType = GithubPullRequestChangesetStore<
+ GithubPullRequestDiffClient<PgGithubSyncRepo, GithubSyncClientImpl>,
+ PgGithubPullRequestRepo,
+ S3GithubPullRequestPatchStore,
+>;
+
+/// Type alias for the GitHub pull request changes router state.
+pub(crate) type DssGithubPullRequestChangesState = GithubPullRequestChangesRouterState<
+ GithubPullRequestChangesServiceImpl<
+ GithubPullRequestServiceType,
+ GithubPullRequestChangesetStoreType,
+ >,
+ EntityAccessService,
+ AuthorizationService,
+>;
+
/// Type alias for the github sync service.
pub(crate) type GithubSyncServiceType = GithubSyncServiceImpl<
DocumentService,
@@ -739,6 +766,7 @@ pub(crate) struct ApiContext {
pub github_sync_service: Arc<GithubSyncServiceType>,
pub github_pull_request_index_state: DssGithubPullRequestIndexState,
pub github_pull_request_state: DssGithubPullRequestState,
+ pub github_pull_request_changes_state: DssGithubPullRequestChangesState,
pub dynamodb_client: Arc<DynamodbClient>,
pub dynamo_db: aws_sdk_dynamodb::Client,
pub soup_router_state: DssSoupState,
diff --git a/services/document_storage_service/src/api/swagger.rs b/services/document_storage_service/src/api/swagger.rs
index dc52393795..4a9811e6dc 100644
--- a/services/document_storage_service/src/api/swagger.rs
+++ b/services/document_storage_service/src/api/swagger.rs
@@ -118,6 +118,10 @@ use github_pull_requests::domain::models::{
GithubLabelFacet, GithubPullRequestFacets, GithubRepositoryFacet, GithubUserFacet,
StoredGithubPullRequest,
};
+use github_pull_requests::inbound::changes_router::{
+ ChangedFileDto, ChangesetDto, ChangesetSourceDto, FileChangeKindDto, GitRefDto,
+ GithubPullRequestChangesPatchResponse, GithubPullRequestChangesResponse,
+};
use initiative::domain::models::{
AssignTaskStatus, AssignTasksRequest, AssignTasksResponse, AssignTasksResult,
CreateInitiativeRequest, InitialPropertyValue, InitiativeDetail, InitiativeId, InitiativeList,
@@ -485,6 +489,8 @@ use utoipa::OpenApi;
// github_pull_requests
github_pull_requests::inbound::axum_router::get_github_pull_request_facets_handler,
github_pull_requests::inbound::axum_router::get_github_pull_request_handler,
+ github_pull_requests::inbound::changes_router::get_github_pull_request_changes_handler,
+ github_pull_requests::inbound::changes_router::get_github_pull_request_changes_patch_handler,
// threads
threads::edit_thread::edit_thread_handler,
@@ -621,6 +627,13 @@ use utoipa::OpenApi;
GithubUserFacet,
GithubLabelFacet,
StoredGithubPullRequest,
+ GithubPullRequestChangesResponse,
+ GithubPullRequestChangesPatchResponse,
+ ChangesetDto,
+ ChangesetSourceDto,
+ ChangedFileDto,
+ FileChangeKindDto,
+ GitRefDto,
Favorite,
FavoritesList,
CreatedUserApiKey,
diff --git a/services/document_storage_service/src/config.rs b/services/document_storage_service/src/config.rs
index a60ea21415..4a86d06896 100644
--- a/services/document_storage_service/src/config.rs
+++ b/services/document_storage_service/src/config.rs
@@ -16,6 +16,8 @@ env_vars! {
pub struct DatabaseUrlReadonly;
pub struct DocumentStorageBucket;
pub struct DocxDocumentUploadBucket;
+ /// S3 bucket holding pull request patches, shared with agent-harness-service.
+ pub struct GithubPullRequestPatchBucket;
/// Shared CloudFront distribution URL for document content and call recording GET URLs.
pub struct DocumentStorageServiceCloudfrontDistributionUrl;
/// Shared CloudFront signer public key ID for document content and call recordings.
@@ -92,6 +94,7 @@ pub struct Config {
pub database_url_readonly: DatabaseUrlReadonly,
pub document_storage_bucket: DocumentStorageBucket,
pub docx_document_upload_bucket: DocxDocumentUploadBucket,
+ pub github_pull_request_patch_bucket: GithubPullRequestPatchBucket,
pub document_storage_service_cloudfront_distribution_url:
DocumentStorageServiceCloudfrontDistributionUrl,
pub document_storage_service_cloudfront_signer_public_key_id:
diff --git a/services/document_storage_service/src/main.rs b/services/document_storage_service/src/main.rs
index 805fd15599..e7e5b73b10 100644
--- a/services/document_storage_service/src/main.rs
+++ b/services/document_storage_service/src/main.rs
@@ -90,16 +90,27 @@ use foreign_entity::{
};
use frecency::{domain::services::FrecencyQueryServiceImpl, outbound::postgres::FrecencyPgStorage};
use github::domain::service::{
- GithubSyncConfig, GithubSyncServiceImpl, InstallationTokenConfig, PullRequestIndexService,
+ GithubSyncConfig, GithubSyncServiceImpl, InstallationTokenConfig, InstallationTokenService,
+ PullRequestIndexService,
};
use github::inbound::pull_request_index_router::PullRequestIndexRouterState;
use github::outbound::connection_gateway_realtime::ConnectionGatewayGithubRealtime;
use github::outbound::github_sync_client::GithubSyncClientImpl;
use github::outbound::pg_github_sync_repo::PgGithubSyncRepo;
+use github::outbound::pull_request_diff::GithubPullRequestDiffClient;
use github_pull_requests::{
- domain::service::GithubPullRequestServiceImpl,
- inbound::axum_router::GithubPullRequestRouterState,
- outbound::pg_github_pull_request_repo::PgGithubPullRequestRepo,
+ domain::service::{
+ GithubPullRequestChangesServiceImpl, GithubPullRequestChangesetStore,
+ GithubPullRequestServiceImpl,
+ },
+ inbound::{
+ axum_router::GithubPullRequestRouterState,
+ changes_router::GithubPullRequestChangesRouterState,
+ },
+ outbound::{
+ pg_github_pull_request_repo::PgGithubPullRequestRepo,
+ s3_patch_store::S3GithubPullRequestPatchStore,
+ },
};
use graphql_scheduled_action::ScheduledActionGraphqlContext;
use harnesses::outbound::pg_harness_repo::PgHarnessRepo;
@@ -617,6 +628,32 @@ async fn run() -> anyhow::Result<()> {
authorization_state.clone(),
);
+ let github_pull_request_changes_state = GithubPullRequestChangesRouterState::new(
+ Arc::new(GithubPullRequestChangesServiceImpl::new(
+ GithubPullRequestServiceImpl::new(
+ ForeignEntityServiceImpl::new(PgForeignEntityRepo::new(db.clone())),
+ PgGithubPullRequestRepo::new(db.clone()),
+ ),
+ GithubPullRequestChangesetStore::new(
+ GithubPullRequestDiffClient::new(InstallationTokenService::new(
+ InstallationTokenConfig {
+ client_id: config.github_sync_app_client_id.to_string(),
+ private_key_pem: config.github_sync_app_pem_secret_key.as_ref().to_string(),
+ },
+ PgGithubSyncRepo::new(db.clone()),
+ GithubSyncClientImpl::default(),
+ )),
+ PgGithubPullRequestRepo::new(db.clone()),
+ S3GithubPullRequestPatchStore::new(
+ macro_aws_config::s3_client().await,
+ config.github_pull_request_patch_bucket.to_string(),
+ ),
+ ),
+ )),
+ entity_access_service.clone(),
+ authorization_state.clone(),
+ );
+
let foreign_entity_state = ForeignEntityRouterState::new(
foreign_entity_service.clone(),
entity_access_service.clone(),
@@ -1857,6 +1894,7 @@ async fn run() -> anyhow::Result<()> {
github_sync_service: Arc::new(github_sync_service_impl),
github_pull_request_index_state,
github_pull_request_state,
+ github_pull_request_changes_state,
foreign_entity_state,
db: db.clone(),
readonly_db: readonly_pool::ReadOnlyPool(readonly_db.clone()),
diff --git a/tooling/just/local_stack.just b/tooling/just/local_stack.just
index ce6dd30c3a..c1548b97fa 100644
--- a/tooling/just/local_stack.just
+++ b/tooling/just/local_stack.just
@@ -165,8 +165,9 @@ create_local_buckets:
aws --endpoint-url=http://localhost:4566 s3 mb s3://bulk-upload-staging || true
aws --endpoint-url=http://localhost:4566 s3 mb s3://macro-call-recording-local || true
aws --endpoint-url=http://localhost:4566 s3 mb s3://agent-session-changes || true
+ aws --endpoint-url=http://localhost:4566 s3 mb s3://github-pull-request-patches || true
# Apply CORS configuration to all buckets
- for bucket in macro-email-attachments doc-storage docx-upload static-file-storage bulk-upload-staging macro-call-recording-local agent-session-changes; do \
+ for bucket in macro-email-attachments doc-storage docx-upload static-file-storage bulk-upload-staging macro-call-recording-local agent-session-changes github-pull-request-patches; do \
aws --endpoint-url=http://localhost:4566 s3api put-bucket-cors --bucket $bucket --cors-configuration '{"CORSRules":[{"AllowedOrigins":["http://localhost:3000","http://localhost:3001","http://localhost:3002","http://localhost:3003","http://localhost:3004","http://localhost:3005","http://localhost:3006","http://localhost:3007","http://localhost:3008","http://localhost:3009"],"AllowedMethods":["GET","PUT","POST","DELETE","HEAD"],"AllowedHeaders":["*"],"ExposeHeaders":["ETag"],"MaxAgeSeconds":3600}]}' || true; \
done
@echo "S3 buckets created"
diff --git a/tooling/xtask/crates/xtask_local/src/local/resources.rs b/tooling/xtask/crates/xtask_local/src/local/resources.rs
index cdef681428..485d1a1e65 100644
--- a/tooling/xtask/crates/xtask_local/src/local/resources.rs
+++ b/tooling/xtask/crates/xtask_local/src/local/resources.rs
@@ -307,6 +307,12 @@ pub const BUCKETS: &[Bucket] = &[
name: "agent-session-changes",
env_key: "AGENT_SESSION_CHANGES_BUCKET",
},
+ Bucket {
+ // The patch behind each pull request's Changes pane, shared with the
+ // agent sessions that work on that pull request.
+ name: "github-pull-request-patches",
+ env_key: "GITHUB_PULL_REQUEST_PATCH_BUCKET",
+ },
];
/// Every local DynamoDB table and the env var that references it.