test(documents): preserve revision race and legacy capture evidence

This commit is contained in:
cesnimda
2026-11-11 18:20:38 +01:00
parent f807d46ff0
commit dbae196291
8 changed files with 127 additions and 0 deletions
@@ -0,0 +1,15 @@
# Submitted CV snapshot revision integrity
Baseline9f341750; sourcee161ea33 on codex/frozen-document-integrity. This is a bounded integrity fix, not Phase10/A3/security/release acceptance.
The package service selected CV metadata and then rendered through the unversioned overload. A deterministic interleaving with the real CvVariantService reproduced publishing newer render data with older selected metadata, or continuing after deletion. Capture now passes the selected positive revision and rechecks the stored revision/settings after render. A missing selected CV aborts. The controller returns the existing409 revision_conflict code for this condition, preserving unauthenticated rejection and owner filtering.
An initial positive-only guard broke the native SQLite legacy version-zero fixture. The final path preserves zero-version capture through the existing unversioned compatibility path plus the post-render snapshot check. The public renderer's positive-revision validation was not relaxed. No fixture was weakened or renderer/physical PDF style changed.
Verification:RED8 cases (three failed/five passed); intermediate broader20 cases (one legacy compatibility failure/19 passed); final22 cases across package, controller conflict/auth, CV export revision and native SQLite compatibility suites passed with no skips. Four changed/deleted interleavings cover revisions4 and0; controller cases cover authenticated conflict/unauthenticated refusal. Existing frozen bytes/hash, tenant rejection, missing-file cleanup, later source mutation, account-export and native SQLite workflows remain covered. Native TRX gzip/raw receipts and source hashes are in evidence/package-revision.
The first build could not execute tests because C: was full. Only this run's fresh ignored bin/obj directories were removed after absolute-path/Git checks; generated output/temp/results were redirected to E using command flags, with offline cached restore. No source/evidence/dependency/user work was deleted. Delegated workers hit usage limits; root continued sequentially. C: capacity remains constrained.
Remaining investigation:concurrent Career Profile changes during render may require their own snapshot binding. AttachmentStorage.SnapshotAsync has a separate source-backed destination-ownership cleanup concern; no deterministic race reproduction or fix is claimed here. MariaDB, actual HTTP/browser capture, real models/providers, native device/AT, physical PDF acceptance, integrated security and recovery were not rerun. Existing accepted PDF metrics/visuals remain source-bound.
Rollback:revert the source commit, rebuild on the isolated development branch and rerun the affected suite. No migration/data repair is involved. UI callers retain the existing revision-conflict/review flow; an aborted capture publishes no package. This does not establish atomic consistency across every package source entity or filesystem race.
@@ -0,0 +1,43 @@
{
"baseline": "9f341750ece2a3d2ddb11c14482df1ecc485a5c1",
"sourceCommit": "e161ea33461eaefbecf08c96d79984029131e990",
"sourcesLfSha256": {
"JobTrackerApi/Services/SubmittedApplicationPackageService.cs": "f6315d491ccd5ddffb098ef22f35b0d727485bfe866ea875fc19c33ab897867e",
"JobTrackerApi/Controllers/ApplicationAssetsController.cs": "bbed71f315f0be0381e4d6a09a536880f40040ba808b83a9d058b9fb1089bcc2",
"JobTrackerApi.Tests/SubmittedApplicationPackageTests.cs": "9073b2ddc1e92e84063e10c071042c408c9eb9ab7f8403b2801bf5bbd121463b",
"JobTrackerApi.Tests/SubmittedPackageConflictTests.cs": "e24038cae68c0d034bbcc07605aff09be1e23d4659ce391cf3de16c98f6a2ddf",
"JobTrackerApi.Tests/CvExportRevisionTests.cs": "ee19195cec7486dd71d30ce6daa064ad07d5995c1dd97e529761e43511d9235d",
"JobTrackerApi.Tests/SqliteDateTimeOffsetCompatibilityTests.cs": "5fb244d50d2378b8d18b14ac260beafc4bfd58190447306244b2916ea808d572",
"JobTrackerApi/Services/CvVariantService.cs": "da85153ff2199a4410df91807c6073aa19736676332266a227149d6d089ea841"
},
"nativeReceipts": [
{
"name": "red",
"artifact": "red.trx.gz",
"total": 8,
"passed": 5,
"failed": 3,
"rawSha256": "1c970594d7f3c7e86bc7d15ea7b79967cfcfb2202333d9933d9b70180d680bac",
"gzipSha256": "3b69eafa4bda144a132547ec54a8d20b54b14fe263eb5c23ea854afff7f69598"
},
{
"name": "intermediate",
"artifact": "intermediate.trx.gz",
"total": 20,
"passed": 19,
"failed": 1,
"rawSha256": "26968e1cf8b575ba37de5f57f2898e4542427cf03a5136e7df351b9c4096b99c",
"gzipSha256": "8a6021ee11a9dcd77b29f43cc3a146dd75d2f514e74f8650301a6e1cbd4fa0d2"
},
{
"name": "final",
"artifact": "final.trx.gz",
"total": 22,
"passed": 22,
"failed": 0,
"rawSha256": "faaa712ee6919280cda1e4384746f04ba02c7d807b3d4808b4468815df208062",
"gzipSha256": "36e214810c9c840b5335385d1c18786489f57dd6f4812249a7e7c7ecb652f76a"
}
],
"environment": "Pinned .NET9.0.317; existing offline NuGet cache; build/temp/results on E after C-drive exhaustion. No physical PDF/provider/MariaDB/live services."
}
@@ -0,0 +1,11 @@
JobTrackerApi -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi\debug\JobTrackerApi.dll
PdfBrowserStub -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\PdfBrowserStub\debug\PdfBrowserStub.dll
JobTrackerApi.Tests -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi.Tests\debug\JobTrackerApi.Tests.dll
Test run for E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi.Tests\debug\JobTrackerApi.Tests.dll (.NETCoreApp,Version=v9.0)
VSTest version 17.14.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results File: E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\green-final\green-final.trx
Passed! - Failed: 0, Passed: 22, Skipped: 0, Total: 22, Duration: 4 s - JobTrackerApi.Tests.dll (net9.0)
@@ -0,0 +1,21 @@
JobTrackerApi -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi\debug\JobTrackerApi.dll
PdfBrowserStub -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\PdfBrowserStub\debug\PdfBrowserStub.dll
JobTrackerApi.Tests -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi.Tests\debug\JobTrackerApi.Tests.dll
Test run for E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi.Tests\debug\JobTrackerApi.Tests.dll (.NETCoreApp,Version=v9.0)
VSTest version 17.14.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:03.64] JobTrackerApi.Tests.SqliteDateTimeOffsetCompatibilityTests.Tailoring_and_submission_capture_work_on_native_sqlite [FAIL]
Failed JobTrackerApi.Tests.SqliteDateTimeOffsetCompatibilityTests.Tailoring_and_submission_capture_work_on_native_sqlite [768 ms]
Error Message:
Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException : The CV changed after it was loaded.
Stack Trace:
at JobTrackerApi.Services.CvVariantService.RenderAsync(String ownerUserId, Int32 id, CvRenderPerson person, CancellationToken ct, Nullable`1 expectedVersion) in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi\Services\CvVariantService.cs:line 188
at JobTrackerApi.Services.SubmittedApplicationPackageService.CaptureAsync(String ownerUserId, Int32 jobApplicationId, CvRenderPerson person, CancellationToken ct) in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi\Services\SubmittedApplicationPackageService.cs:line 75
at JobTrackerApi.Tests.SqliteDateTimeOffsetCompatibilityTests.Tailoring_and_submission_capture_work_on_native_sqlite() in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi.Tests\SqliteDateTimeOffsetCompatibilityTests.cs:line 50
at JobTrackerApi.Tests.SqliteDateTimeOffsetCompatibilityTests.Tailoring_and_submission_capture_work_on_native_sqlite() in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi.Tests\SqliteDateTimeOffsetCompatibilityTests.cs:line 94
--- End of stack trace from previous location ---
Results File: E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\green\green.trx
Failed! - Failed: 1, Passed: 19, Skipped: 0, Total: 20, Duration: 3 s - JobTrackerApi.Tests.dll (net9.0)
@@ -0,0 +1,37 @@
JobTrackerApi -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi\debug\JobTrackerApi.dll
PdfBrowserStub -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\PdfBrowserStub\debug\PdfBrowserStub.dll
JobTrackerApi.Tests -> E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi.Tests\debug\JobTrackerApi.Tests.dll
Test run for E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\artifacts\bin\JobTrackerApi.Tests\debug\JobTrackerApi.Tests.dll (.NETCoreApp,Version=v9.0)
VSTest version 17.14.1 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:03.04] JobTrackerApi.Tests.SubmittedPackageConflictTests.Capture_reports_revision_conflict_only_for_an_authenticated_caller(authenticated: True) [FAIL]
Failed JobTrackerApi.Tests.SubmittedPackageConflictTests.Capture_reports_revision_conflict_only_for_an_authenticated_caller(authenticated: True) [723 ms]
Error Message:
Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException : CV changed
Stack Trace:
at JobTrackerApi.Controllers.ApplicationAssetsController.CaptureSubmittedPackage(Int32 jobId, CancellationToken ct) in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi\Controllers\ApplicationAssetsController.cs:line 151
at JobTrackerApi.Tests.SubmittedPackageConflictTests.Capture_reports_revision_conflict_only_for_an_authenticated_caller(Boolean authenticated) in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi.Tests\SubmittedPackageConflictTests.cs:line 31
--- End of stack trace from previous location ---
[xUnit.net 00:00:05.56] JobTrackerApi.Tests.SubmittedApplicationPackageTests.Cv_changed_between_metadata_and_render_aborts_without_a_partial_package(deleted: False) [FAIL]
[xUnit.net 00:00:05.58] JobTrackerApi.Tests.SubmittedApplicationPackageTests.Cv_changed_between_metadata_and_render_aborts_without_a_partial_package(deleted: True) [FAIL]
Failed JobTrackerApi.Tests.SubmittedApplicationPackageTests.Cv_changed_between_metadata_and_render_aborts_without_a_partial_package(deleted: False) [137 ms]
Error Message:
Assert.Throws() Failure: No exception was thrown
Expected: typeof(Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException)
Stack Trace:
at JobTrackerApi.Tests.SubmittedApplicationPackageTests.Cv_changed_between_metadata_and_render_aborts_without_a_partial_package(Boolean deleted) in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi.Tests\SubmittedApplicationPackageTests.cs:line 120
at JobTrackerApi.Tests.SubmittedApplicationPackageTests.Cv_changed_between_metadata_and_render_aborts_without_a_partial_package(Boolean deleted) in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi.Tests\SubmittedApplicationPackageTests.cs:line 124
--- End of stack trace from previous location ---
Failed JobTrackerApi.Tests.SubmittedApplicationPackageTests.Cv_changed_between_metadata_and_render_aborts_without_a_partial_package(deleted: True) [20 ms]
Error Message:
Assert.Throws() Failure: No exception was thrown
Expected: typeof(Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException)
Stack Trace:
at JobTrackerApi.Tests.SubmittedApplicationPackageTests.Cv_changed_between_metadata_and_render_aborts_without_a_partial_package(Boolean deleted) in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi.Tests\SubmittedApplicationPackageTests.cs:line 120
at JobTrackerApi.Tests.SubmittedApplicationPackageTests.Cv_changed_between_metadata_and_render_aborts_without_a_partial_package(Boolean deleted) in C:\Users\Connor\.codex\worktrees\frozen-document-integrity\Job tracker\JobTrackerApi.Tests\SubmittedApplicationPackageTests.cs:line 124
--- End of stack trace from previous location ---
Results File: E:\Storage\Projects\Active\temp docs\jobjakt-local-build\frozen-document-integrity\red\red.trx
Failed! - Failed: 3, Passed: 5, Skipped: 0, Total: 8, Duration: 3 s - JobTrackerApi.Tests.dll (net9.0)