Prepare verified laboratory 4 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:31:17 +03:00
parent ec540a1a72
commit 4fc1f40099
172 changed files with 15646 additions and 38 deletions
+13
View File
@@ -0,0 +1,13 @@
# Independent runtime review
Scope: approved lab3/lab4 k3s + Pingap migration, scripts/k3s.ts, scripts/k3s-model.ts, new unit tests and native research/concurrent-images/reconciliation call sites. Reviewer: independent agent /root/lab1_review, read-only. Backend and original course contracts were outside the implementation diff.
No confirmed remaining P1/P2 findings in the reviewed scope. Confirmed prior findings were corrected: Pingap shutdown grace, pinned manifest/config identities, scoped kubectl arguments, game guard at the native memory Job, partial-claim ownership and native CRI verification of stopped Pod processes.
Closure review checked withCleanup preserving primary and teardown errors, ready waiting for managed terminating Pods, restart pairing evidence by run_id and rejecting reused original UIDs, and the lab4 hard2048MiB/soft1536MiB image budget. Runtime/model copies in both labs matched. Reviewer ran no live operations or tests; author test output is separate.
Live tests are author evidence, separate from read-only review. Archive validation, teacher acceptance and an awarded grade are not inferred from this review.
Follow-up review checked the lab4 outage test timeout: no assignment/contract/public test requires8seconds for upload dependency failure. The handler budgets20seconds and the student client now waits at most25seconds, still requiring HTTP502/503 and a complete response. Public failover deadlines remain unchanged. Both acceptance helpers annotate their current operation and preserve the original error as cause. No blocker found; reviewer performed no live test.
Fresh measurement/report review checked concurrent-images/run-Y14n1Y and image-memory-6l7yZ5 against REPORT.md and actual source:8 successful originals out of10,2 bounded503,68,116,480/68,026,368-byte cgroup peaks;1555800KiB VmHWM over5.34s for normal/Adam7 with3 Argon2 workers. Image source hash matches. Job2CPU/2Gi and soft1536MiB agree with runtime. No confirmed issue found; RSS and cgroup memory are correctly distinguished.
+3
View File
@@ -0,0 +1,3 @@
Running as unit: run-p1575081-i1559791.scope; invocation ID: db13d69a08e64d219f5921bde505b15e
S3 outage: HTTP 503; elapsed_ms=8448
PASS lab4: 457 HTTP assertions, registration race, rollback, pagination, authentication, concurrent idempotency and replica sharing; fixture cleanup completed
@@ -0,0 +1 @@
{"run_id":"st_efe85880a251428a","started_at":"2026-11-12T17:18:15.524Z","state":"started"}
@@ -0,0 +1,242 @@
{
"complete": true,
"run_id": "st_efe85880a251428a",
"result": {
"attempts": 10,
"image_bytes": 3148214,
"success": 8,
"rejected_503": 2,
"peaks": [
{
"pod": "api-78d745c9fc-9h2m7",
"uid": "5e223e0e-bbac-4a51-9e45-f0b19abb172a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 63053824,
"memory_peak_bytes": 68116480,
"cpu_usage_usec": 134384,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
},
{
"pod": "api-78d745c9fc-cnk5x",
"uid": "ed6245f4-7e26-46ff-b767-4a93625d3c6a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 63324160,
"memory_peak_bytes": 68026368,
"cpu_usage_usec": 134482,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
}
],
"samples": [
{
"at": "2026-11-12T17:18:37.959Z",
"pods": [
{
"pod": "api-78d745c9fc-9h2m7",
"uid": "5e223e0e-bbac-4a51-9e45-f0b19abb172a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 45563904,
"memory_peak_bytes": 47030272,
"cpu_usage_usec": 52396,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
},
{
"pod": "api-78d745c9fc-cnk5x",
"uid": "ed6245f4-7e26-46ff-b767-4a93625d3c6a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 43900928,
"memory_peak_bytes": 44310528,
"cpu_usage_usec": 53345,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
}
]
},
{
"at": "2026-11-12T17:18:38.434Z",
"pods": [
{
"pod": "api-78d745c9fc-9h2m7",
"uid": "5e223e0e-bbac-4a51-9e45-f0b19abb172a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 46219264,
"memory_peak_bytes": 47030272,
"cpu_usage_usec": 55081,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
},
{
"pod": "api-78d745c9fc-cnk5x",
"uid": "ed6245f4-7e26-46ff-b767-4a93625d3c6a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 44617728,
"memory_peak_bytes": 44789760,
"cpu_usage_usec": 55237,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
}
]
},
{
"at": "2026-11-12T17:18:38.907Z",
"pods": [
{
"pod": "api-78d745c9fc-9h2m7",
"uid": "5e223e0e-bbac-4a51-9e45-f0b19abb172a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 47841280,
"memory_peak_bytes": 47968256,
"cpu_usage_usec": 58743,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
},
{
"pod": "api-78d745c9fc-cnk5x",
"uid": "ed6245f4-7e26-46ff-b767-4a93625d3c6a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 45617152,
"memory_peak_bytes": 46268416,
"cpu_usage_usec": 57697,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
}
]
},
{
"at": "2026-11-12T17:18:39.380Z",
"pods": [
{
"pod": "api-78d745c9fc-9h2m7",
"uid": "5e223e0e-bbac-4a51-9e45-f0b19abb172a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 51871744,
"memory_peak_bytes": 53153792,
"cpu_usage_usec": 74038,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
},
{
"pod": "api-78d745c9fc-cnk5x",
"uid": "ed6245f4-7e26-46ff-b767-4a93625d3c6a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 53915648,
"memory_peak_bytes": 55042048,
"cpu_usage_usec": 85294,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
}
]
},
{
"at": "2026-11-12T17:18:39.874Z",
"pods": [
{
"pod": "api-78d745c9fc-9h2m7",
"uid": "5e223e0e-bbac-4a51-9e45-f0b19abb172a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 56737792,
"memory_peak_bytes": 58642432,
"cpu_usage_usec": 92618,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
},
{
"pod": "api-78d745c9fc-cnk5x",
"uid": "ed6245f4-7e26-46ff-b767-4a93625d3c6a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 60203008,
"memory_peak_bytes": 61734912,
"cpu_usage_usec": 109171,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
}
]
},
{
"at": "2026-11-12T17:18:40.362Z",
"pods": [
{
"pod": "api-78d745c9fc-9h2m7",
"uid": "5e223e0e-bbac-4a51-9e45-f0b19abb172a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 60317696,
"memory_peak_bytes": 61952000,
"cpu_usage_usec": 109883,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
},
{
"pod": "api-78d745c9fc-cnk5x",
"uid": "ed6245f4-7e26-46ff-b767-4a93625d3c6a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 66547712,
"memory_peak_bytes": 67411968,
"cpu_usage_usec": 126969,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
}
]
},
{
"at": "2026-11-12T17:18:40.865Z",
"pods": [
{
"pod": "api-78d745c9fc-9h2m7",
"uid": "5e223e0e-bbac-4a51-9e45-f0b19abb172a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 67006464,
"memory_peak_bytes": 68116480,
"cpu_usage_usec": 133814,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
},
{
"pod": "api-78d745c9fc-cnk5x",
"uid": "ed6245f4-7e26-46ff-b767-4a93625d3c6a",
"image": "sha256:2c372175c10ff3c9dbc906be2e9da23b22e5129f863e4ed22d3dfe7d8ee784dc",
"memory_current_bytes": 63062016,
"memory_peak_bytes": 68026368,
"cpu_usage_usec": 134135,
"limits": {
"cpu": "1",
"memory": "2Gi"
}
}
]
}
],
"originals_verified": true
}
}
+4
View File
@@ -0,0 +1,4 @@
.venv/bin/python scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
.venv/bin/python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:28204"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 64, "failed_attempts": 17, "first_recovery_seconds": 3.875}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:28204"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 94, "failed_attempts": 38, "first_recovery_seconds": 2.096}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
@@ -0,0 +1,4 @@
=== RUN TestWorstCaseImagesWithinBudget
stress_test.go:134: PASS native RGBA64 40000000x1, normal+Adam7, two sequential validations each, 3 concurrent Argon2 workers; peak_rss_kib=1555800 hard_limit_kib=2097152
--- PASS: TestWorstCaseImagesWithinBudget (5.34s)
PASS
@@ -0,0 +1 @@
{"state":"complete"}
@@ -0,0 +1 @@
8a9b399b22573992fd7fd4c87096f953b46c1bc7cad4e09c023923919d755375 backend/internal/adapter/imagefile/image.go
+3
View File
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:28204"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
@@ -0,0 +1 @@
Ready: vp-lab4-r-68d294e2 via Pingap on localhost:28404
@@ -0,0 +1,6 @@
{
"complete": true,
"cluster": "vp-lab4-r-68d294e2",
"primary": null,
"cleanup_errors": []
}
@@ -0,0 +1 @@
{"cluster":"vp-lab4-r-68d294e2","started_at":"2026-11-12T15:26:26.803Z","state":"started"}
@@ -0,0 +1,9 @@
=== RUN TestFixtureCleanupRejectsForeignMembership
--- PASS: TestFixtureCleanupRejectsForeignMembership (0.44s)
=== RUN TestS3InventoryAndStatReturnComparableVersionMetadata
--- PASS: TestS3InventoryAndStatReturnComparableVersionMetadata (0.13s)
=== RUN TestReconciliationAgainstPostgresAndPrivateS3
reconcile_test.go:243: Waiting 61 seconds for the real S3 orphan to exceed the safe minimum grace period
reconcile_test.go:304: {"apply":{"Metadata":5,"Objects":5,"Orphans":1,"Missing":2,"Recovered":2,"Fresh":1,"Deleted":1,"Changed":4,"NextMetadata":"","NextObject":""},"dry_run":{"Metadata":5,"Objects":5,"Orphans":1,"Missing":2,"Recovered":2,"Fresh":1,"Deleted":0,"Changed":0,"NextMetadata":"","NextObject":""},"private_application_identity":true,"repeat":{"Metadata":5,"Objects":4,"Orphans":0,"Missing":0,"Recovered":0,"Fresh":1,"Deleted":0,"Changed":0,"NextMetadata":"","NextObject":""},"s3_http_requests":12,"s3_response_bytes":2227}
--- PASS: TestReconciliationAgainstPostgresAndPrivateS3 (63.23s)
PASS
+3
View File
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/up.sh" --base-url "http://127.0.0.1:28204"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
+41
View File
@@ -0,0 +1,41 @@
{
"run_id": "8c6a7030-eb14-487c-88b1-e6fc2a6c63f3",
"pods": [
{
"name": "api-d8d66c869-ktb2x",
"uid": "262a0e5a-5ff2-4061-be00-ff1e8716ba4a",
"role": "api",
"started": "2026-11-12T16:15:58Z"
},
{
"name": "api-d8d66c869-q8h8m",
"uid": "0d77da46-9ab1-4393-b42d-9a48065cb78e",
"role": "api",
"started": "2026-11-12T16:15:42Z"
},
{
"name": "pingap-7bbffccf59-2t7f6",
"uid": "e8fb887c-2d5f-48fc-8159-fb712316efc9",
"role": "pingap",
"started": "2026-11-12T16:15:42Z"
},
{
"name": "postgres-66765d8575-x8r68",
"uid": "73f44e77-2bed-4bec-a67f-b05e7c728b4c",
"role": "postgres",
"started": "2026-11-12T16:15:48Z"
},
{
"name": "s3-5c568ff589-lmdkm",
"uid": "942296b1-a30d-4ce4-adec-9e4628108c4e",
"role": "s3",
"started": "2026-11-12T16:15:46Z"
},
{
"name": "valkey-5ddb4db5c8-zgls6",
"uid": "ac078f32-6f72-4dc3-96c4-5a11d79a6599",
"role": "valkey",
"started": "2026-11-12T16:15:46Z"
}
]
}
+41
View File
@@ -0,0 +1,41 @@
{
"run_id": "8c6a7030-eb14-487c-88b1-e6fc2a6c63f3",
"pods": [
{
"name": "api-7cb65fb5dd-6wxkl",
"uid": "cec5bf7e-b71f-42bc-853a-9928e9c3165b",
"role": "api",
"started": "2026-11-12T16:02:52Z"
},
{
"name": "api-7cb65fb5dd-lsh52",
"uid": "76294b23-b267-432f-b1c5-e2a289d84fbc",
"role": "api",
"started": "2026-11-12T16:02:52Z"
},
{
"name": "pingap-76c6746fc8-cx9v8",
"uid": "10876b0e-828f-4ef1-9e60-71eb32d85d0a",
"role": "pingap",
"started": "2026-11-12T15:34:35Z"
},
{
"name": "postgres-8ffc7d686-wng99",
"uid": "227d9341-dfe8-4aaf-8803-66697af58d86",
"role": "postgres",
"started": "2026-11-12T15:34:40Z"
},
{
"name": "s3-585f5b4d8-7z6lh",
"uid": "0517386d-a330-4577-9a2e-0a4782e16cd6",
"role": "s3",
"started": "2026-11-12T16:00:03Z"
},
{
"name": "valkey-7759455fd9-4dxcx",
"uid": "542fd5e8-312e-4246-97bd-5c6585448401",
"role": "valkey",
"started": "2026-11-12T15:34:39Z"
}
]
}
@@ -0,0 +1,10 @@
1 | import {resolve} from 'node:path';
2 | const root=resolve(import.meta.dir,'..');
3 | const before=await Bun.file(resolve(root,'evidence/k3s/restart-before.json')).json();
4 | const after=await Bun.file(resolve(root,'evidence/k3s/restart-after.json')).json();
5 | if(!before.length||!after.length||after.some((p:any)=>before.some((b:any)=>b.uid===p.uid)))throw new Error('Restart returned while an original workload Pod UID still existed');
^
error: Restart returned while an original workload Pod UID still existed
at /mnt/data/home/bench-saves/vp-k3s-nHACGCQi/lab4/student-tests/restart-evidence.ts:5:102
Bun v1.4.4 (Linux x64)
+1
View File
@@ -0,0 +1 @@
PASS: every recorded original workload Pod UID was replaced
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://127.0.0.1:28204"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
+7
View File
@@ -0,0 +1,7 @@
{
"stopped": "api-db894bc84-sc847",
"stoppedUID": "ced5ff71-ce69-4832-aeb9-57d8a93aa4f0",
"containerID": "b324a807667700c66fcd16f4a98eb5608cdf434e867dec09050bdce2eb32dcaf",
"state": "CONTAINER_EXITED",
"survivor": "api-db894bc84-swsdp"
}
+8
View File
@@ -0,0 +1,8 @@
{
"target": "api-db894bc84-sc847",
"uid": "ced5ff71-ce69-4832-aeb9-57d8a93aa4f0",
"pods": [
"api-db894bc84-sc847",
"api-db894bc84-swsdp"
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"stopped": "api-db894bc84-6j27t",
"stoppedUID": "a1e91438-850d-4a29-a29d-509b1732106b",
"containerID": "fc099106b5262aa44572b447e1bced27e1091353f5e35dcd0bbe8c6bc7fc6ff1",
"state": "CONTAINER_EXITED",
"survivor": "api-db894bc84-swsdp"
}
+8
View File
@@ -0,0 +1,8 @@
{
"target": "api-db894bc84-6j27t",
"uid": "a1e91438-850d-4a29-a29d-509b1732106b",
"pods": [
"api-db894bc84-6j27t",
"api-db894bc84-swsdp"
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"stopped": "api-db894bc84-sc847",
"stoppedUID": "ced5ff71-ce69-4832-aeb9-57d8a93aa4f0",
"containerID": "b324a807667700c66fcd16f4a98eb5608cdf434e867dec09050bdce2eb32dcaf",
"state": "CONTAINER_EXITED",
"survivor": "api-db894bc84-swsdp"
}
+50
View File
@@ -0,0 +1,50 @@
bun test v1.4.4 (38afee6c8)
student-tests/k3s-model.test.ts:
(pass) rejects an image API budget below the verified decoder limit [0.12ms]
(pass) accepts the verified image API budget [0.04ms]
(pass) allows smaller text-only API research budgets [0.02ms]
(pass) cleanup failure preserves the original operation error [0.35ms]
(pass) cleanup failure cannot publish a successful operation [0.10ms]
(pass) accepts the canonical Docker Hub form of a pinned repository [0.25ms]
(pass) rejects foreign or malformed cluster platform [0.12ms]
(pass) rejects foreign or malformed cluster vp-lab4-medvedev [0.01ms]
(pass) rejects foreign or malformed cluster ../vp-lab3
(pass) rejects foreign or malformed cluster vp-lab3;echo
(pass) rejects invalid public port 0 [0.06ms]
(pass) rejects invalid public port 65536 [0.01ms]
(pass) rejects invalid public port NaN
(pass) rejects invalid public port 28203;echo
(pass) accepts default and isolated experiment names [0.03ms]
(pass) rejects an unclaimed cluster [0.04ms]
(pass) rejects a recreated foreign container [0.02ms]
(pass) rejects a replaced namespace [0.02ms]
(pass) accepts the exact claimed cluster and namespace [0.02ms]
(pass) foreign cluster never reaches the mutation port [0.19ms]
(pass) inventory failure never reaches the mutation port [0.09ms]
(pass) claimed cluster dispatches the requested action once [0.11ms]
(pass) accepts pinned manifest identity when image config ID differs [0.02ms]
(pass) rejects an unpinned image [0.03ms]
(pass) rejects target or resource override [ "get", "pods", "-nforeign" ] [0.16ms]
(pass) rejects target or resource override [ "get", "pods", "--cluster=foreign" ]
(pass) rejects target or resource override [ "get", "nodes" ] [0.09ms]
(pass) rejects target or resource override [ "get", "secrets" ] [0.01ms]
(pass) allows flags belonging to the executed application [0.09ms]
(pass) allows stdin for scoped PostgreSQL execution [0.03ms]
(pass) rejects a second resource that discloses a Secret [0.03ms]
(pass) rejects the short server override [0.02ms]
(pass) refuses measurement for active or unknown game status 0 [0.03ms]
(pass) refuses measurement for active or unknown game status 2
(pass) refuses measurement for active or unknown game status -1
(pass) accepts measurement only for confirmed inactive game [0.02ms]
(pass) rejects extra resources after delimiter outside exec [0.01ms]
(pass) partial cleanup accepts only the exclusive server owner nonce [0.05ms]
(pass) partial cleanup never weakens a ready namespace guard [0.03ms]
(pass) partial cleanup accepts an owned server before namespace creation [0.03ms]
(pass) rejects a running replacement process despite stale Kubernetes status [0.06ms]
(pass) accepts native absence of the victim process [0.04ms]
42 pass
0 fail
45 expect() calls
Ran 42 tests across 1 file. [25.00ms]