ЛР7: финальные доказательства проверок

This commit is contained in:
Ivan Melnikov
2026-12-06 19:07:07 +03:00
parent 8d8117b987
commit 3ac47ebcfb
4 changed files with 181 additions and 6 deletions
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "https://localhost:8447" --ca-file ".local-secrets/pki/edge-ca.crt"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 130, "failed_attempts": 0, "first_recovery_seconds": 3.253}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "https://localhost:8447" --ca-file ".local-secrets/pki/edge-ca.crt"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
+4 -2
View File
@@ -1,4 +1,6 @@
python3 student-tests/track2.py --base-url "https://localhost:8447" --ca-file ".local-secrets/pki/edge-ca.crt"
PASS duplicate delivery before and after ready is a no-op
PASS reordered v1 delivery after v2 is a no-op
PASS stale v1 replay cannot overwrite the v2 result
evidence: /Users/ivanmuller/Desktop/oh_my_life/highload/lab7/evidence/track2/summary.json
FAIL: stream pending entries did not drain: {'entries': 261, 'group': 'lab7-attachment-workers', 'pending': 1, 'recent': [{'attachment_id': 'df98770d-d452-4aad-bbb3-1fa143801a03', 'attempt': 1, 'job_id': '76d561da-d2fb-486e-83be-b655ebd6b43c', 'pipeline_version': 1, 'stream_id': '1796572865569-0'}, {'attachment_id': 'df98770d-d452-4aad-bbb3-1fa143801a03', 'attempt': 1, 'job_id': '76d561da-d2fb-486e-83be-b655ebd6b43c', 'pipeline_version': 1, 'stream_id': '1796572856954-0'}, {'attachment_id': 'df98770d-d452-4aad-bbb3-1fa143801a03', 'attempt': 1, 'job_id': '76d561da-d2fb-486e-83be-b655ebd6b43c', 'pipeline_version': 1, 'stream_id': '1796572856662-0'}, {'attachment_id': 'df98770d-d452-4aad-bbb3-1fa143801a03', 'attempt': 1, 'job_id': '76d561da-d2fb-486e-83be-b655ebd6b43c', 'pipeline_version': 1, 'stream_id': '1796572855987-0'}, {'attachment_id': '335e0f76-2979-4e1c-b471-ac64d3e629a6', 'attempt': 1, 'job_id': 'd8d6c6f7-8406-4758-9d2d-ac698e38b852', 'pipeline_version': 1, 'stream_id': '1796572853161-0'}, {'attachment_id': 'aeda55d2-6620-471f-b6e8-8fc07e4077c2', 'attempt': 1, 'job_id': '870e79d8-e4fc-44a4-a2b1-f32ec3e4d24d', 'pipeline_version': 1, 'stream_id': '1796572838825-0'}, {'attachment_id': 'c7fc6912-e5d4-4662-815a-fa9aeeda9f30', 'attempt': 1, 'job_id': 'c76f9a49-c917-4739-8ac2-3adfbca9c161', 'pipeline_version': 1, 'stream_id': '1796572829350-0'}, {'attachment_id': '381f67c1-2d68-4f28-bce1-e4ba72a9f3bb', 'attempt': 1, 'job_id': 'd6b06110-edfb-489c-ae33-4d9175b54a2e', 'pipeline_version': 1, 'stream_id': '1796572827133-0'}, {'attachment_id': '381f67c1-2d68-4f28-bce1-e4ba72a9f3bb', 'attempt': 1, 'job_id': 'd6b06110-edfb-489c-ae33-4d9175b54a2e', 'pipeline_version': 1, 'stream_id': '1796572733291-0'}, {'attachment_id': 'bcf59ee2-aaa2-4736-a65e-d12281559c54', 'attempt': 1, 'job_id': '87c9c728-128a-449e-8fa9-65be3e5c2f58', 'pipeline_version': 1, 'stream_id': '1796572731003-0'}, {'attachment_id': 'bcf59ee2-aaa2-4736-a65e-d12281559c54', 'attempt': 1, 'job_id': '87c9c728-128a-449e-8fa9-65be3e5c2f58', 'pipeline_version': 1, 'stream_id': '1796572636742-0'}, {'attachment_id': 'a06ccee5-a599-4312-9446-a527d3c51479', 'attempt': 1, 'job_id': 'ab0bc0d9-c3c6-4256-9b5e-f87c51f78267', 'pipeline_version': 1, 'stream_id': '1796572634517-0'}, {'attachment_id': '0e869bd2-b4cd-4f35-b72a-17882ed174f8', 'attempt': 1, 'job_id': '0190478e-36cb-42e3-b2b6-dffc6f96d692', 'pipeline_version': 1, 'stream_id': '1796572625151-0'}, {'attachment_id': 'b7f6b90d-411c-4f84-bab3-900eec98d770', 'attempt': 1, 'job_id': 'f086e696-8334-4c83-983c-190032a2e614', 'pipeline_version': 1, 'stream_id': '1796572598862-0'}, {'attachment_id': '6c60aa56-8909-42dc-98bc-9907267c6034', 'attempt': 1, 'job_id': '82d3bfbd-da46-453a-a1e3-f674f1e946e9', 'pipeline_version': 1, 'stream_id': '1796572584987-0'}, {'attachment_id': 'd615d2c6-be49-4398-9b5e-c09e4900e015', 'attempt': 1, 'job_id': '63d0d38d-426c-42b3-a231-7db8836569c5', 'pipeline_version': 1, 'stream_id': '1796572574676-0'}, {'attachment_id': 'd881d38c-f386-445a-b5dd-e7e35485ba00', 'attempt': 1, 'job_id': 'c0176434-a0e7-4134-bc0b-00e3e97e284a', 'pipeline_version': 1, 'stream_id': '1796572513110-0'}, {'attachment_id': 'a4b8715b-05a8-44ba-b0dd-d36ed74aad30', 'attempt': 1, 'job_id': '5e0f9308-a871-4eec-aad1-aba6695d8c4b', 'pipeline_version': 1, 'stream_id': '1796572511081-0'}, {'attachment_id': '96c8386e-1cec-4b45-b0b5-0fd61b983385', 'attempt': 1, 'job_id': 'cdcdae30-01f0-4ca9-8e7e-12e32c716e50', 'pipeline_version': 1, 'stream_id': '1796572510692-0'}, {'attachment_id': '05c233eb-d78a-46c9-9a10-f4b51d622f84', 'attempt': 1, 'job_id': 'b84d8241-54d6-47c0-a738-8371ca41bfaa', 'pipeline_version': 1, 'stream_id': '1796572510675-0'}], 'stream': 'lab7:attachments:jobs'}
make: *** [test-track2] Error 1
PASS: lab6 track 2 fault injection, 31 assertions
+170 -4
View File
@@ -1,12 +1,12 @@
{
"track": 2,
"title": "proven idempotency of the versioned pipeline",
"when": "2026-12-06T16:00:50.431567Z",
"when": "2026-12-06T16:04:34.671347Z",
"hypothesis": "At-least-once delivery + deterministic version-keyed effects + monotonic ready_version make duplicate, reordered, crashed and stale deliveries safe without extra variants or lost confirmed jobs.",
"protocol": "Stop the worker or selected dependency, inject duplicate/old/retry messages through cmd/jobctl, kill the worker at documented hooks, restart the normal worker, and compare exact variant hashes against a control.",
"checks": 5,
"checks": 31,
"control": {
"attachment_id": "335e0f76-2979-4e1c-b471-ac64d3e629a6",
"attachment_id": "6e3ff717-466c-4a2b-a680-dcf7f6d1b990",
"variants": [
[
"crop",
@@ -25,5 +25,171 @@
]
]
},
"completed_at": "2026-12-06T16:02:08.746555Z"
"duplicate": {
"attachment_id": "a4124b84-7dc9-4fca-8621-db0e0a17d358",
"job_id": "c84881b2-69d8-4174-94c7-5603dfc95a76",
"injected_before_ready": [
{
"attachment_id": "a4124b84-7dc9-4fca-8621-db0e0a17d358",
"attempt": 1,
"duplicated_job_id": "c84881b2-69d8-4174-94c7-5603dfc95a76",
"pipeline_version": 1,
"stream_id": "1796573082100-0"
},
{
"attachment_id": "a4124b84-7dc9-4fca-8621-db0e0a17d358",
"attempt": 1,
"duplicated_job_id": "c84881b2-69d8-4174-94c7-5603dfc95a76",
"pipeline_version": 1,
"stream_id": "1796573082418-0"
}
],
"injected_after_ready": {
"attachment_id": "a4124b84-7dc9-4fca-8621-db0e0a17d358",
"attempt": 1,
"duplicated_job_id": "c84881b2-69d8-4174-94c7-5603dfc95a76",
"pipeline_version": 1,
"stream_id": "1796573091474-0"
},
"variants": [
[
"crop",
"f84fdd553b49d0d8a1a312656e4782f84818694a870b795093bb5aebc8c5cfe6",
2220
],
[
"optimized",
"0302173a63de740229e17755dba11e74b69f1d16d9d6f4b5017857cbfe223534",
2738
],
[
"thumbnail",
"d57bd5e2e4b9cfb01a63960c65856e3ffe3cfd3c3f0aeab235f9973f024e5c40",
4840
]
],
"updated_at": "2026-12-06T16:04:45.435246Z"
},
"reorder": {
"attachment_id": "fcdee7e7-472d-4147-9cc7-9b6ea7030154",
"v1_job_id": "84ccc927-105f-4d54-a683-04e4e673c07f",
"v1_withdrawn_stream_id": "1796573094356-0",
"v2_job_id": "b925b994-f9f3-4fd2-bc17-8537a476df55",
"v2_stream_entry": {
"attachment_id": "fcdee7e7-472d-4147-9cc7-9b6ea7030154",
"attempt": 1,
"job_id": "b925b994-f9f3-4fd2-bc17-8537a476df55",
"pipeline_version": 2,
"stream_id": "1796573096003-0"
},
"old_v1_injected": {
"attachment_id": "fcdee7e7-472d-4147-9cc7-9b6ea7030154",
"attempt": 1,
"duplicated_job_id": "84ccc927-105f-4d54-a683-04e4e673c07f",
"pipeline_version": 1,
"stream_id": "1796573105262-0"
},
"v2_variants": [
[
"crop",
"b0ceb80313e014c6577c15b1b5ce2e1ac85b69176cc11ed004232a5967445489",
2470
],
[
"optimized",
"03adddd76d373d94b38280b651b7d3fbd2cb9efbd31fd0f2c08622812fdc0fb3",
4326
],
[
"thumbnail",
"c390ef508fd937d476a112e025b66b3cd68a66e965ff3ac7f7de292ae256308e",
5703
]
],
"final_variants": [
[
"crop",
"b0ceb80313e014c6577c15b1b5ce2e1ac85b69176cc11ed004232a5967445489",
2470
],
[
"optimized",
"03adddd76d373d94b38280b651b7d3fbd2cb9efbd31fd0f2c08622812fdc0fb3",
4326
],
[
"thumbnail",
"c390ef508fd937d476a112e025b66b3cd68a66e965ff3ac7f7de292ae256308e",
5703
]
],
"ready_version": 2,
"stale_audit_events": 1
},
"stale_version": {
"attachment_id": "0e89f939-74a9-4ffe-9a1b-95b246b2b0ca",
"v1_job_id": "36ae0b4c-5425-4b5d-9565-a9321789bee1",
"v2_job_id": "c7f467b7-8e7e-4888-88b1-e41962c45dac",
"v1_failure": "staging_corrupt",
"failed_registry_entry": {
"job_id": "36ae0b4c-5425-4b5d-9565-a9321789bee1",
"attachment_id": "0e89f939-74a9-4ffe-9a1b-95b246b2b0ca",
"pipeline_version": 1,
"attempts": 1,
"max_attempts": 5,
"error_code": "staging_corrupt",
"updated_at": "2026-12-06T16:05:12.1856Z",
"filename": "sample.png"
},
"v2_variants": [
[
"crop",
"b0ceb80313e014c6577c15b1b5ce2e1ac85b69176cc11ed004232a5967445489",
2470
],
[
"optimized",
"03adddd76d373d94b38280b651b7d3fbd2cb9efbd31fd0f2c08622812fdc0fb3",
4326
],
[
"thumbnail",
"c390ef508fd937d476a112e025b66b3cd68a66e965ff3ac7f7de292ae256308e",
5703
]
],
"final_variants": [
[
"crop",
"b0ceb80313e014c6577c15b1b5ce2e1ac85b69176cc11ed004232a5967445489",
2470
],
[
"optimized",
"03adddd76d373d94b38280b651b7d3fbd2cb9efbd31fd0f2c08622812fdc0fb3",
4326
],
[
"thumbnail",
"c390ef508fd937d476a112e025b66b3cd68a66e965ff3ac7f7de292ae256308e",
5703
]
],
"ready_version": 2,
"v1_replay_count": 1,
"stale_audit_events": 1
},
"invariants": {
"confirmed_jobs_not_lost": true,
"old_result_did_not_overwrite_new": true,
"no_extra_variants": true,
"delivery_semantics": "at-least-once; effects are idempotent per (attachment_id, pipeline_version, variant)"
},
"limitations": [
"Single Docker host; broker, PostgreSQL and S3 are single points of failure outside the tested restarts.",
"Fault injection is compiled into the worker but refuses to run outside APP_ENV=lab.",
"The experiment proves effect-level idempotency, not exactly-once delivery; duplicate messages are expected and acknowledged as no-ops.",
"Variant determinism is verified for the bundled synthetic fixtures and the two documented pipeline versions, not for every possible decoder input."
],
"completed_at": "2026-12-06T16:05:33.382234Z"
}