@@ -245,6 +245,7 @@ jobs:
245245 - name : Build the complete native coverage cohort
246246 run : dotnet build KeyLoad.slnx --no-restore --configuration Release
247247 - name : Prepare original source and test-image receipts
248+ id : coverage-source
248249 shell : pwsh
249250 run : |
250251 $root = $env:GITHUB_WORKSPACE
@@ -255,59 +256,90 @@ jobs:
255256 "KEYLOAD_PRODUCT_COVERAGE_SOURCE_MANIFEST=$evidence/functional-coverage.production-source-manifest.json" | Add-Content $env:GITHUB_ENV
256257 - name : Test three-node database with .NET and MCP clients
257258 run : node scripts/Features/TestInfrastructure/run-tests.mjs --KeyLoadTests:Suite=rf3 --KeyLoadTests:ResultsDirectory=TestResults/rf3-required --KeyLoadTests:ReportTrx=true
258- - name : Collect four native functional coverage cohorts
259+ - name : Reconcile original native full and five-group discovery in both modes
260+ id : native-census
261+ if : ${{ !cancelled() && steps.coverage-source.outcome == 'success' }}
262+ shell : pwsh
263+ run : |
264+ & pwsh -NoLogo -NoProfile -File scripts/Features/CodeQuality/functional-coverage.workflow-discovery.ps1 `
265+ -Repository $env:GITHUB_WORKSPACE `
266+ -EvidenceRoot (Join-Path $env:GITHUB_WORKSPACE 'TestResults/functional-coverage/rf3')
267+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
268+ - name : Execute full censuses and twelve original covered suite inputs
259269 id : functional-coverage
270+ if : ${{ !cancelled() && steps.native-census.outcome == 'success' }}
260271 shell : pwsh
261272 run : |
262- $common = @(
263- 'scripts/Features/TestInfrastructure/run-tests.mjs',
264- '--KeyLoadTests:ReportTrx=true',
265- '--KeyLoadTests:CoverageSettings=scripts/Features/CodeQuality/functional-coverage.production.settings.xml',
266- '--KeyLoadTests:CoverageFormat=coverage')
267- & node @common '--KeyLoadTests:Suite=unit' '--KeyLoadTests:Filter=/*/*/(PartitionQueryAuthorizationTests|PartitionQueryCancellationTests|PartitionQueryContractTests|PartitionQueryGrantTests|PartitionQueryMcpContractTests|PartitionQueryMergeTests|PartitionQueryPublicAuthorizationTests|PartitionQueryPublicBudgetTests|PartitionQueryPublicContractTests|PartitionQueryPublicMergeTests|SqlInnerJoinBudgetTests|SqlInnerJoinCancellationTests|SqlInnerJoinDeclaredProjectionTests|SqlInnerJoinExecutionTests|SqlInnerJoinLifecycleTests|SqlInnerJoinOrdinalOrderTests|SqlInnerJoinRowAuthorizationTests|DocumentIndexCommittedScanTests)/*' `
268- '--KeyLoadTests:ResultsDirectory=TestResults/functional-coverage/rf3/unit' `
269- '--KeyLoadTests:CoverageOutput=TestResults/functional-coverage/rf3/unit/coverage.coverage'
270- $unitExitCode = $LASTEXITCODE
271- "unit_exit_code=$unitExitCode" | Add-Content $env:GITHUB_OUTPUT
272- & node @common '--KeyLoadTests:Suite=unit-scalar' '--KeyLoadTests:Filter=/*/*/(PartitionQueryAuthorizationTests|PartitionQueryCancellationTests|PartitionQueryContractTests|PartitionQueryGrantTests|PartitionQueryMcpContractTests|PartitionQueryMergeTests|PartitionQueryPublicAuthorizationTests|PartitionQueryPublicBudgetTests|PartitionQueryPublicContractTests|PartitionQueryPublicMergeTests|SqlInnerJoinBudgetTests|SqlInnerJoinCancellationTests|SqlInnerJoinDeclaredProjectionTests|SqlInnerJoinExecutionTests|SqlInnerJoinLifecycleTests|SqlInnerJoinOrdinalOrderTests|SqlInnerJoinRowAuthorizationTests|DocumentIndexCommittedScanTests)/*' `
273- '--KeyLoadTests:ResultsDirectory=TestResults/functional-coverage/rf3/unit-scalar' `
274- '--KeyLoadTests:CoverageOutput=TestResults/functional-coverage/rf3/unit-scalar/coverage.coverage'
275- $scalarExitCode = $LASTEXITCODE
276- "scalar_exit_code=$scalarExitCode" | Add-Content $env:GITHUB_OUTPUT
277- & node @common '--KeyLoadTests:Suite=recovery' `
278- '--KeyLoadTests:Filter=/*/*/CommandIdempotencyProcessRecoveryTests/*' `
279- '--KeyLoadTests:ResultsDirectory=TestResults/functional-coverage/rf3/recovery' `
280- '--KeyLoadTests:CoverageOutput=TestResults/functional-coverage/rf3/recovery/coverage.coverage'
281- $recoveryExitCode = $LASTEXITCODE
282- "recovery_exit_code=$recoveryExitCode" | Add-Content $env:GITHUB_OUTPUT
283- & node @common '--KeyLoadTests:Suite=rf3' `
284- '--KeyLoadTests:Filter=/*/*/(PartitionQueryPublicRf3Tests|McpDocumentCrudParityTests|RelationalSqlRf3JoinTests|RelationalSqlRf3JoinAuthorizationTests|RelationalSqlRf3JoinBudgetTests|RelationalSqlRf3JoinCancellationTests|RelationalSqlRf3JoinReadCutTests)/*' `
285- '--KeyLoadTests:ResultsDirectory=TestResults/functional-coverage/rf3' `
286- '--KeyLoadTests:CoverageOutput=TestResults/functional-coverage/rf3/coverage.coverage' `
287- '--KeyLoadTests:NativeCoverage:ServerMode=rf3-original-node-v1' `
288- "--KeyLoadTests:NativeCoverage:SourceManifest=$env:KEYLOAD_PRODUCT_COVERAGE_SOURCE_MANIFEST"
289- $rf3ExitCode = $LASTEXITCODE
290- "rf3_exit_code=$rf3ExitCode" | Add-Content $env:GITHUB_OUTPUT
291- if ($unitExitCode -ne 0 -or $scalarExitCode -ne 0 -or $recoveryExitCode -ne 0 -or $rf3ExitCode -ne 0) {
292- exit 1
293- }
273+ & pwsh -NoLogo -NoProfile -File scripts/Features/CodeQuality/functional-coverage.workflow-collect.ps1 `
274+ -Repository $env:GITHUB_WORKSPACE `
275+ -EvidenceRoot (Join-Path $env:GITHUB_WORKSPACE 'TestResults/functional-coverage/rf3') `
276+ -SourceManifestPath $env:KEYLOAD_PRODUCT_COVERAGE_SOURCE_MANIFEST
277+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
278+ - name : Verify original coverage source and test-image receipts after all children settle
279+ id : coverage-source-after
280+ if : ${{ !cancelled() && steps.coverage-source.outcome == 'success' }}
281+ shell : pwsh
282+ run : |
283+ & pwsh -NoLogo -NoProfile -File scripts/Features/CodeQuality/functional-coverage.production-source-manifest.ps1 `
284+ -Mode verify -Root $env:GITHUB_WORKSPACE `
285+ -EvidenceRoot (Join-Path $env:GITHUB_WORKSPACE 'TestResults/functional-coverage/rf3')
286+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
294287 - name : Assemble product descriptor from original reports
295288 id : product-descriptor
296289 if : ${{ success() }}
297290 shell : pwsh
298291 env :
299- UNIT_EXIT_CODE : ${{ steps.functional-coverage.outputs.unit_exit_code }}
300- SCALAR_EXIT_CODE : ${{ steps.functional-coverage.outputs.scalar_exit_code }}
301292 RECOVERY_EXIT_CODE : ${{ steps.functional-coverage.outputs.recovery_exit_code }}
302293 RF3_EXIT_CODE : ${{ steps.functional-coverage.outputs.rf3_exit_code }}
303294 run : |
304295 & pwsh -NoLogo -NoProfile -File scripts/Features/CodeQuality/functional-coverage.native-product-descriptor.ps1 `
305296 -Repository $env:GITHUB_WORKSPACE `
306297 -SourceManifestPath $env:KEYLOAD_PRODUCT_COVERAGE_SOURCE_MANIFEST `
307298 -ResultsRoot (Join-Path $env:GITHUB_WORKSPACE 'TestResults/functional-coverage/rf3') `
308- -UnitExitCode ([int]$env:UNIT_EXIT_CODE) -ScalarExitCode ([int] $env:SCALAR_EXIT_CODE ) `
299+ -UnitRunStatusPath (Join-Path $env:GITHUB_WORKSPACE 'TestResults/functional-coverage/rf3/functional-coverage.unit-run-status.v1.json' ) `
309300 -RecoveryExitCode ([int]$env:RECOVERY_EXIT_CODE) -Rf3ExitCode ([int]$env:RF3_EXIT_CODE)
310301 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
302+ - name : Exercise original product admission and copied TRX denial with healthy re-admission
303+ id : product-admission
304+ if : ${{ success() }}
305+ env :
306+ KEYLOAD_NATIVE_PRODUCT_ADMISSION_REQUIRED : ' true'
307+ KEYLOAD_NATIVE_PRODUCT_DESCRIPTOR_PATH : ${{ github.workspace }}/TestResults/functional-coverage/rf3/functional-coverage.native-product-descriptor.v1.json
308+ run : node scripts/Features/TestInfrastructure/run-tests.mjs --KeyLoadTests:Suite=unit '--KeyLoadTests:Filter=/*/*/NativeCoverageMergeTests/*' --KeyLoadTests:ResultsDirectory=TestResults/native-product-admission --KeyLoadTests:ReportTrx=true
309+ - name : Verify original product-admission test and closed phase receipt
310+ if : ${{ !cancelled() && steps.product-admission.outcome != 'skipped' }}
311+ shell : pwsh
312+ run : |
313+ $ErrorActionPreference = 'Stop'
314+ Set-StrictMode -Version Latest
315+ $directory = Join-Path $env:GITHUB_WORKSPACE 'TestResults/native-product-admission'
316+ $reports = @(Get-ChildItem -LiteralPath $directory -Filter '*.trx' -File -Recurse)
317+ $receipts = @(Get-ChildItem -LiteralPath $directory -Filter 'native-product-admission-phase.v1.json' -File -Recurse)
318+ if ($reports.Count -ne 1 -or $receipts.Count -ne 1 -or $receipts[0].Length -le 0 -or $receipts[0].Length -gt 65536) {
319+ throw 'Exactly one original TRX and bounded product-admission receipt are required.'
320+ }
321+ [xml] $trx = Get-Content -LiteralPath $reports[0].FullName -Raw
322+ $counts = $trx.TestRun.ResultSummary.Counters
323+ if ([int] $counts.total -ne 1 -or [int] $counts.executed -ne 1 -or [int] $counts.passed -ne 1 -or [int] $counts.failed -ne 0) {
324+ throw 'The real product-admission whole operation must execute and pass.'
325+ }
326+ . ./scripts/Features/CodeQuality/functional-coverage.native-merge.inputs.ps1
327+ $bytes = [IO.File]::ReadAllBytes($receipts[0].FullName)
328+ $document = [Text.Json.JsonDocument]::Parse([ReadOnlyMemory[byte]]::new($bytes))
329+ try { Assert-FcNativeJsonUnique $document.RootElement }
330+ finally { $document.Dispose() }
331+ $phase = ConvertFrom-Json ([Text.Encoding]::UTF8.GetString($bytes)) -AsHashtable
332+ Assert-FcNativeExactKeys $phase @('schemaVersion','phase','descriptorSha256','healthyAdmissions','rejectedAdmissions','rejectedOutcome')
333+ $descriptor = Join-Path $env:GITHUB_WORKSPACE 'TestResults/functional-coverage/rf3/functional-coverage.native-product-descriptor.v1.json'
334+ foreach ($name in @('schemaVersion','healthyAdmissions','rejectedAdmissions')) {
335+ if ($phase[$name] -isnot [int] -and $phase[$name] -isnot [long]) { throw 'Invalid product phase integer.' }
336+ }
337+ if ($phase.schemaVersion -ne 1 -or $phase.phase -cne 'product-admission' -or
338+ $phase.descriptorSha256 -cne (Get-FileHash $descriptor -Algorithm SHA256).Hash.ToLowerInvariant() -or
339+ $phase.healthyAdmissions -ne 2 -or $phase.rejectedAdmissions -ne 1 -or
340+ $phase.rejectedOutcome -cne 'An original native test outcome report does not match the exact contributor inventory.') {
341+ throw 'The product-admission phase does not bind the original descriptor and complete flow.'
342+ }
311343 - name : Validate and merge native product coverage
312344 if : ${{ success() }}
313345 shell : pwsh
0 commit comments