Исправить замечания ревью: restart API, JSON, текст, deps, restore.
Skeleton contracts / contracts (pull_request) Canceled after 0s

Hook теперь реально перезапускает api; хвост JSON и тело login отклоняются; текст сообщений сохраняется целиком; отказы deps проверяются assert-ами; pg_restore замеряется.
This commit is contained in:
Mlvn
2026-10-29 20:48:47 +03:00
parent 096c53ecdb
commit 60d2615cf3
16 changed files with 462 additions and 200 deletions
+13 -13
View File
@@ -1,12 +1,12 @@
{
"explain": [
{
"Execution Time": 0.091,
"Execution Time": 0.089,
"Plan": {
"Actual Loops": 1,
"Actual Rows": 50,
"Actual Startup Time": 0.061,
"Actual Total Time": 0.075,
"Actual Startup Time": 0.035,
"Actual Total Time": 0.059,
"Async Capable": false,
"Local Dirtied Blocks": 0,
"Local Hit Blocks": 0,
@@ -14,18 +14,18 @@
"Local Written Blocks": 0,
"Node Type": "Limit",
"Parallel Aware": false,
"Plan Rows": 50,
"Plan Rows": 1,
"Plan Width": 24,
"Plans": [
{
"Actual Loops": 1,
"Actual Rows": 50,
"Actual Startup Time": 0.06,
"Actual Total Time": 0.068,
"Actual Startup Time": 0.034,
"Actual Total Time": 0.052,
"Alias": "messages",
"Async Capable": false,
"Heap Fetches": 50,
"Index Cond": "((chat_id = 'dd159fd8-b79e-4a15-a48c-4a84bd479430'::uuid) AND (ROW(created_at, id) \u003e ROW('2026-10-14 19:46:28.256+00'::timestamp with time zone, 'f051734d-6f81-440a-9253-0b417ccee2b1'::uuid)))",
"Index Cond": "((chat_id = '8f7acbf7-3f3a-4512-b7d3-1018a9c57a24'::uuid) AND (ROW(created_at, id) \u003e ROW('2026-10-29 17:48:54.814+00'::timestamp with time zone, 'c7a07079-b045-42ef-b516-b5f4d9f08aec'::uuid)))",
"Index Name": "messages_history_idx",
"Local Dirtied Blocks": 0,
"Local Hit Blocks": 0,
@@ -34,29 +34,29 @@
"Node Type": "Index Only Scan",
"Parallel Aware": false,
"Parent Relationship": "Outer",
"Plan Rows": 167,
"Plan Rows": 1,
"Plan Width": 24,
"Relation Name": "messages",
"Rows Removed by Index Recheck": 0,
"Scan Direction": "Forward",
"Shared Dirtied Blocks": 0,
"Shared Hit Blocks": 1,
"Shared Read Blocks": 3,
"Shared Read Blocks": 4,
"Shared Written Blocks": 0,
"Startup Cost": 0.42,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Total Cost": 635.76
"Total Cost": 8.44
}
],
"Shared Dirtied Blocks": 0,
"Shared Hit Blocks": 1,
"Shared Read Blocks": 3,
"Shared Read Blocks": 4,
"Shared Written Blocks": 0,
"Startup Cost": 0.42,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Total Cost": 190.64
"Total Cost": 8.44
},
"Planning": {
"Local Dirtied Blocks": 0,
@@ -70,7 +70,7 @@
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.17,
"Planning Time": 0.282,
"Triggers": []
}
]
+24 -24
View File
@@ -1,12 +1,12 @@
{
"explain": [
{
"Execution Time": 16.435,
"Execution Time": 16.287,
"Plan": {
"Actual Loops": 1,
"Actual Rows": 50,
"Actual Startup Time": 16.393,
"Actual Total Time": 16.403,
"Actual Startup Time": 16.235,
"Actual Total Time": 16.245,
"Async Capable": false,
"Local Dirtied Blocks": 0,
"Local Hit Blocks": 0,
@@ -14,14 +14,14 @@
"Local Written Blocks": 0,
"Node Type": "Limit",
"Parallel Aware": false,
"Plan Rows": 50,
"Plan Rows": 1,
"Plan Width": 24,
"Plans": [
{
"Actual Loops": 1,
"Actual Rows": 50,
"Actual Startup Time": 16.392,
"Actual Total Time": 16.396,
"Actual Startup Time": 16.234,
"Actual Total Time": 16.238,
"Async Capable": false,
"Local Dirtied Blocks": 0,
"Local Hit Blocks": 0,
@@ -30,18 +30,18 @@
"Node Type": "Sort",
"Parallel Aware": false,
"Parent Relationship": "Outer",
"Plan Rows": 167,
"Plan Rows": 1,
"Plan Width": 24,
"Plans": [
{
"Actual Loops": 1,
"Actual Rows": 44448,
"Actual Startup Time": 4.156,
"Actual Total Time": 10.771,
"Actual Startup Time": 4.107,
"Actual Total Time": 10.993,
"Alias": "messages",
"Async Capable": false,
"Exact Heap Blocks": 847,
"Filter": "(ROW(created_at, id) \u003e ROW('2026-10-14 19:46:28.256+00'::timestamp with time zone, 'f051734d-6f81-440a-9253-0b417ccee2b1'::uuid))",
"Filter": "(ROW(created_at, id) \u003e ROW('2026-10-29 17:48:54.814+00'::timestamp with time zone, 'c7a07079-b045-42ef-b516-b5f4d9f08aec'::uuid))",
"Local Dirtied Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
@@ -50,16 +50,16 @@
"Node Type": "Bitmap Heap Scan",
"Parallel Aware": false,
"Parent Relationship": "Outer",
"Plan Rows": 167,
"Plan Rows": 1,
"Plan Width": 24,
"Plans": [
{
"Actual Loops": 1,
"Actual Rows": 74449,
"Actual Startup Time": 1.682,
"Actual Total Time": 1.683,
"Actual Startup Time": 1.697,
"Actual Total Time": 1.698,
"Async Capable": false,
"Index Cond": "(chat_id = 'dd159fd8-b79e-4a15-a48c-4a84bd479430'::uuid)",
"Index Cond": "(chat_id = '8f7acbf7-3f3a-4512-b7d3-1018a9c57a24'::uuid)",
"Index Name": "messages_chat_only_idx",
"Local Dirtied Blocks": 0,
"Local Hit Blocks": 0,
@@ -68,7 +68,7 @@
"Node Type": "Bitmap Index Scan",
"Parallel Aware": false,
"Parent Relationship": "Outer",
"Plan Rows": 500,
"Plan Rows": 3,
"Plan Width": 0,
"Shared Dirtied Blocks": 0,
"Shared Hit Blocks": 0,
@@ -77,10 +77,10 @@
"Startup Cost": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Total Cost": 8.04
"Total Cost": 4.32
}
],
"Recheck Cond": "(chat_id = 'dd159fd8-b79e-4a15-a48c-4a84bd479430'::uuid)",
"Recheck Cond": "(chat_id = '8f7acbf7-3f3a-4512-b7d3-1018a9c57a24'::uuid)",
"Relation Name": "messages",
"Rows Removed by Filter": 30001,
"Rows Removed by Index Recheck": 0,
@@ -88,10 +88,10 @@
"Shared Hit Blocks": 847,
"Shared Read Blocks": 66,
"Shared Written Blocks": 0,
"Startup Cost": 8.08,
"Startup Cost": 4.32,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Total Cost": 918.22
"Total Cost": 15.91
}
],
"Shared Dirtied Blocks": 0,
@@ -105,20 +105,20 @@
"Sort Method": "top-N heapsort",
"Sort Space Type": "Memory",
"Sort Space Used": 28,
"Startup Cost": 923.77,
"Startup Cost": 15.92,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Total Cost": 924.19
"Total Cost": 15.92
}
],
"Shared Dirtied Blocks": 0,
"Shared Hit Blocks": 847,
"Shared Read Blocks": 66,
"Shared Written Blocks": 0,
"Startup Cost": 923.77,
"Startup Cost": 15.92,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Total Cost": 923.89
"Total Cost": 15.92
},
"Planning": {
"Local Dirtied Blocks": 0,
@@ -132,7 +132,7 @@
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.131,
"Planning Time": 0.165,
"Triggers": []
}
]
+4 -4
View File
@@ -3,11 +3,11 @@
"counts_match": true,
"first_id_match": true,
"restore_chats": 6,
"restore_first_id": "4f8212c8-fea5-4870-989c-b5edf0dfdcf5",
"restore_first_id": "27220db3-c3ed-46b6-96c2-0cecaa48e77c",
"restore_messages": 100000,
"restore_sha256": "a6cec9d9dbd5898032730f587fdd6fad981f64360584ccfe6da60384b87e28c9",
"restore_sha256": "f130fa3a20fac69679ab0b6aabcd54fb5ca36a403b8429d5953762eae424a57c",
"source_chats": 6,
"source_first_id": "4f8212c8-fea5-4870-989c-b5edf0dfdcf5",
"source_first_id": "27220db3-c3ed-46b6-96c2-0cecaa48e77c",
"source_messages": 100000,
"source_sha256": "a6cec9d9dbd5898032730f587fdd6fad981f64360584ccfe6da60384b87e28c9"
"source_sha256": "f130fa3a20fac69679ab0b6aabcd54fb5ca36a403b8429d5953762eae424a57c"
}
+5
View File
@@ -0,0 +1,5 @@
{
"pg_restore_seconds": 1.256,
"boundary": "wall clock around `docker compose exec pg_restore` only; empty DB already created; before checksum verify",
"tool": "pg_restore -Fc --no-owner --exit-on-error"
}
+4 -3
View File
@@ -1,5 +1,6 @@
prepared messages=100000 chats=6
weak: node=Limit execution_ms=16.435 shared_hit_blocks=847 sort=true
strong: node=Limit execution_ms=0.091 shared_hit_blocks=1 sort=false
write: only_chat_id_index_ms=30 chat_id_plus_history_ms=31 rows=5000
weak: node=Limit execution_ms=16.287 shared_hit_blocks=847 sort=true
strong: node=Limit execution_ms=0.089 shared_hit_blocks=1 sort=false
write: only_chat_id_index_ms=38 chat_id_plus_history_ms=49 rows=5000
pg_restore_seconds=1.256
restore match counts=true checksum=true messages=100000
+4 -4
View File
@@ -2,12 +2,12 @@
"cursor_offset": 30000,
"largest_chat_messages": 74449,
"strong_index": "messages_history_idx (chat_id, created_at, id)",
"strong_plan": "node=Limit execution_ms=0.091 shared_hit_blocks=1 sort=false",
"strong_plan": "node=Limit execution_ms=0.089 shared_hit_blocks=1 sort=false",
"weak_index": "messages_chat_only_idx (chat_id)",
"weak_plan": "node=Limit execution_ms=16.435 shared_hit_blocks=847 sort=true",
"weak_plan": "node=Limit execution_ms=16.287 shared_hit_blocks=847 sort=true",
"write_cost": {
"chat_id_plus_history_ms": 31,
"only_chat_id_index_ms": 30,
"chat_id_plus_history_ms": 49,
"only_chat_id_index_ms": 38,
"rows": 5000
}
}