Repository navigation
Add the attach-only Briosa.Cli JSON engine and commands for SA 2026.1.0529.7 - #465
Merged
Merged
Conversation
….0529.7 Briosa.Cli is a generic protocol adapter over the compiled Briosa.Protocol descriptors. A shared engine attaches to an existing loopback server, verifies its exact target, compatibility major and revision, and returns one stable result envelope; the JSON command line only parses arguments and maps the outcome to a process exit code, so the stdio MCP server can sit on the same engine. - status, ops categories, ops search, ops describe, and read-only call. - Attach only: no lifecycle RPC, one verified TCP connection per session, IP loopback endpoints only, no retries and no hidden MP calls. - call sends exactly one briosa-caller-restriction entry (profile=read-only; deny=interactive_ui) and refuses servers before 0.10.2. - Strict JSON input checked against the request descriptor before the protobuf parser runs; value-free local rejections. - Outcomes keep transport status, failure kind, diagnostic code, disposition, recovery and replay guidance, and MP result separate; deterministic exit codes; inline cap with spill to a protected per-user file. - Four bridge tiers, pinned over all 1,018 registered operations. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An OperationError without a recognized execution disposition is still reported as completion evidence unavailable, but its own diagnostic code stays in failure.diagnostic_code and the reason moves to a dedicated warning, so the CLI never overwrites what the server sent. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closed
4 tasks done
Review round 1 of the Briosa CLI (findings 1, 2, 4 to 11): - A typed error trailer counts only when it names the requested operation and matches a (status, kind, disposition, MP details) shape the server's outcome mapper produces; an OK response must carry no error trailer and name only fields of its result. Anything else is completion evidence unavailable with a null disposition and reconciliation guidance. - One submission per call below the gRPC client: each logical request permits one HTTP/2 stream, and a HEADERS frame that would open another is never written, so a refused-stream resend cannot reach the server. - A completed internal failure after MP success is outputs_incomplete, not mp_failed; the classification is checked against every mapper shape. - A failed delivery never claims a completion the evidence did not establish. - Spill directories are opened without following reparse points at every managed level, held while the file is created, and the file must resolve to the verified path; reservations are removed through their handle. - Standard error names only locally recognized diagnostic codes. - Inconsistent or oversized discovery is refused for what it is. - --output is reserved before any RPC; a refused call carries the not-sent execution block; port 80 survives normalization; a BOM counts in offsets. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of the Briosa CLI (finding 3 and documentation): - The tests no longer take expected values from the code under test. The restriction header name and value, the error trailer name, the exact target, the input limits, the requiredness statement, the excluded flags, and the public diagnostic codes are literals in the tests; result files are checked by decoding them against the result itself; the fake server reads the header by its literal wire name. Changing the production restriction to deny=invalid_flag now fails 72 tests. - An OK result whose execution details are missing or inconsistent carries the same conflict warning as every other rule failure. - The operations page lists the evidence-consistency rules, single submission, when --output is reserved, the spill directory checks, the stderr vocabulary, and the updated exit code meanings. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unfiltered dotnet test of the whole 2026 solution failed in 2 of 3 runs on this branch, always in the server's WorkerProcessSupervisorTests.NormalLifecycleReportsStatesAndReleasesStaOnOwningThread, whose worker must stop within a 500 ms graceful bound, while main passed 3 of 3. The new CLI test assembly started its in-process servers and message sweep in parallel beside the server tests. Running its classes serially keeps its load near one core; the same unfiltered run then passed 3 of 3. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 of #465, items A to G. A. Output rows: the server writes one row per output contract, named by the contract's field name, which may be a dotted path or the bare name of a nested field. A row must name something in the result, and every top-level result field must be named by a row. An OK result must have every row retrieved. Genuine replies of all 1,018 operations pass. B. Typed errors must match the mapper's table in status, disposition, recovery and replay guidance (replay follows discovery's replay safety), fixed diagnostic codes, details and MP details. Unknown enum values are conflicts; an unknown diagnostic code alone stays data. An exhaustive enumeration of the mapper and a single-change oracle derive the table. C. An operation ID must name its method: without underscores it equals Service.Rpc, ignoring ASCII case. Holds for all 1,018 operations. D. The spill directory's DACL is set through its verified handle, the file gets its own protected DACL, and a volume without persistent ACLs is refused before anything is created; the result is reported lost. E. An output failure of an operation with no outputs has no rows. F. RESOURCE_EXHAUSTED on discovery is "too large" only when a received gRPC length prefix exceeded the receive limit. G. The blocked-resend warning no longer says why the first attempt ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CLI page now gives the operation ID rule, the full typed-error table with replay and recovery guidance and fixed codes, the output-row rules and what they cannot detect, the MP code 4 limit, the blocked-resend wording, the evidence behind discovery-response-too-large, and how spill permissions are set and when a spill is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 3 of #465, items A to D. A. Every top-level result field needs a row of its own: rows are matched to fields, so one bare-named row never answers for two fields. 26 operations nest one field name under several top-level fields; each gets a single-row case that must fail. B. A policy denial carries exactly the fields its rule names, and a caller rule names the restriction this CLI sent: profile read-only, or the denied flag interactive_ui. The oracle enumerates each rule with its payload from the server's denial factory, and a test checks the real policy's caller denials against it. C. Spill directories and the file are opened or created relative to the held parent handle (NtCreateFile with RootDirectory), never by path, and results gets its owner and DACL only after it is reached that way. A redirected base between levels changes nothing outside the tree it first led to. D. For an operation call serves, an MP failure with code 4 is conflicting evidence: none of the server's code-4 exceptions is in the read-only tier, which a pinned test keeps true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CLI page now describes the row-to-field matching and its limits, the payload each denial rule carries and the caller values it is checked against, the read-only code 4 rule and what a mutating tier must revisit, the handle-relative spill design with what it guarantees and what it does not, that a fixed-code row conflicts on its code alone, and that a failed --output keeps output-write-failed when its spill is also refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ean up on failure Review round 4 of #465. 1. The results directory's owner and protected DACL are written with SetKernelObjectSecurity on its held handle, which does not propagate: files and folders already in results, including earlier spill files, keep their owner and access list byte for byte. 2. Directories are opened with read-attributes and traverse access only. Creating a missing directory is decided by the file system from the parent's own permissions, so an existing ancestor that denies new subdirectories no longer blocks a spill. 3. Nothing created is left behind and no handle leaks on failure: a newly created file (spill or --output) is removed through its own handle if it cannot be handed over; a directory handle is closed when its check throws; a spill file whose write fails is removed; a ResultFile closes its handle even when its stream fails to close, and Discard after close does nothing. 4. The mapper oracle's known-gap text says what is now true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spill section now says that the results directory's permissions are written to it alone, so existing files, folders and earlier spill files keep theirs; that only read-attributes and traverse access is requested, with creation decided by the parent's own permissions; and that a spill file is removed through its handle if anything fails before it is written in full, while created directories are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…L tests Review round 5 of #465, and the CI failure of ASpillChangesNothingAlreadyInTheResultsDirectory at 8982058. 1. A result file is written, read back through its own handle and compared with the result, then flushed and closed. Only content known to be incomplete (shorter or different) is removed. A file that read back intact but whose write, flush or close reported an error is kept as file_unconfirmed; one that could not be read back is kept as file_unverified. Result files are opened with read access for this. 2. The partial-write test writes three bytes before failing, so a removal that spares non-empty files fails it. 3. An incomplete spill file that cannot be removed is named in data.result_file with the reason incomplete_not_removed, and the warning incomplete-file-left says so. 4. The existing-entries test gives its own tree a protected access list with a BUILTIN\Users entry and a CREATOR OWNER entry, so a propagating writer is visible under any account and nothing depends on the temporary folder. On failure it reports the SDDL of every object at every stage. 5. The stale code-4 comment is corrected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CLI page now defines each data.result_delivery state and what it asserts, says that a file that may hold the result is never removed and that removal of an incomplete one can fail and is then reported, says when exit code 12 applies, and lists SYNCHRONIZE among the access requested on spill directories. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t matrix Review round 6 of #465. Result delivery now keeps one record per file the call wrote or created: what reading it back showed, whether a later step reported an error, and whether it is still on disk. The delivery state, data.result_file, its new verification and other_files members, the delivery error, the warnings, and the result-lost warning are all derived from those records. 1. An --output file that could not be read back is kept and named as not_read_back with the result's size and SHA-256, also when the spill that should back it is refused. The new error output-verify-failed distinguishes it from a known mismatch, and no warning claims that the result is in no file while a file may hold it. 2. A file is flushed to the storage device with RandomAccess.FlushToDisk (FlushFileBuffers) after the read-back; a failure makes it matched_unconfirmed. The parameterless FileStream.Flush on an unbuffered stream did not reach the operating system. Result files are now written and read through their handle with RandomAccess, behind a small internal IResultFileIo seam that tests use to inject faults. 3. Tests cover a file of the right length with different bytes. 4. A new spill file that can be neither handed over nor removed raises ResultFileLeftException with the path it was created at, and the envelope names it as incomplete. An unused --output reservation that cannot be removed is named too, with the warning output-reservation-left. An --output file that read back shorter or different is now removed through its handle, as a spill file is. DeliveryFaultMatrixTests drives 664 cells through the real CLI: each fault point crossed with the destination, the spill's own fault when --output fails, removal that works or is refused, and whether completion was established. It checks six invariants against the files on disk and a log of the real handle operations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CLI page now lists the four steps of writing a result file and what the flush to disk does and does not establish, the verification labels of each file, how data.result_file and other_files are chosen, each delivery state and delivery error, the warnings, the six delivery invariants, and the fault matrix that checks them, including the two fault points that can only be injected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…atrix Review round 7 of #465. 1. Everything that can fail without touching a file now runs before any file exists: formatting, summarizing, and the SHA-256. A formatting failure is caught there, and only there. A SHA-256 that cannot be computed leaves that field null, with the warning result-hash-unavailable, and never loses a file. The report is built in memory from the file records, files first, and the engine's catch no longer overwrites what delivery recorded; it only marks a defect as result-report-failed. 2. The flush calls FlushFileBuffers itself and checks its result. .NET's RandomAccess.FlushToDisk treats ERROR_ACCESS_DENIED as success, so a denied flush could be reported as matched. A test calls the real adapter on a read-only handle. 3. The fault matrix now predicts each cell from its injected faults alone: which files must be written, including the fallback spill, what must be on disk and how large, which file is named first by the primary-file rule, the delivery state, the error, the exit code, and the key warnings. The envelope, the disk, and the handle log are compared with that prediction. 4. output-reservation-left gives the reservation's resolved path, and a spill file that failed its hand-over checks is no longer reported as one that could not be created. 5. An incomplete file keeps the size its read-back measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CLI page now says that the flush calls FlushFileBuffers and checks its result, why RandomAccess.FlushToDisk is not used, that the SHA-256 is computed before any file exists and what a null sha256 means, that a file labeled not_read_back or matched_unconfirmed must be checked against its size and SHA-256 before use, the rule for which file is named first, the new result-report-failed error and result-hash-unavailable warning, that output-reservation-left gives the path, that the invariants hold only for a call that ends with an envelope, and how the fault matrix predicts each cell from its faults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 8 of #465. 1. result-hash-unavailable now says only that the SHA-256 is missing, and is given whenever it could not be computed, also when the result is lost. The warnings for a not_read_back or matched_unconfirmed file tell the caller to check it against its size and SHA-256 when there is one, and otherwise that its size alone cannot verify it. The unverified warning no longer says the file was written, the failed-write warnings say what the read-back showed, incomplete-file-left points to other_files too, and output-reservation-left calls the reservation empty only when its size was read; its entry gives no size otherwise. 2. The fault matrix records the order of the handle operations, and every file it predicts to be matched must have a successful flush after its last write and read and before its close. 3. The leftover-reservation cells check the entry's size against the file on disk, a null SHA-256 and empty other_files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne means The CLI page now says that the SHA-256 is computed before any result bytes are written, with the --output reservation already in place, that a null sha256 is reported in any delivery state, that reading back does not use it, that without it a not_read_back or matched_unconfirmed file cannot be verified by its size alone, and that an incomplete entry's size may be null when it could not be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davidalucas
marked this pull request as ready for review
November 28, 2026 10:59
This was referenced Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of four pull requests for #445 (Epic #440). It adds
Briosa.Cli.exefor SpatialAnalyzer2026.1.0529.7: the project, the shared engine, and the JSON commands, with their tests and an operations page. The CLI attaches to a local server that is already running, verifies it, and inspects a live session. It runs read-only operations only.What later slices add
Briosa.Cli.exe mcp) on the same engine and envelope, withModelContextProtocol.Core.Mutating execution and the
2024.1.0508.5target are later issues.What this slice adds
targets/2026.1.0529.7/src/Briosa.Cli(console,net10.0-windows,win-x64) andtests/Briosa.Cli.Tests, both inBriosa.slnxwith committed lock files. No new NuGet package: the CLI referencesBriosa.Protocol,Grpc.Net.Client, the existing centralSystem.Diagnostics.DiagnosticSourcepin, and a framework reference toMicrosoft.AspNetCore.App. Everything restores offline from the cache.status,ops categories,ops search,ops describe OPERATION_ID,call OPERATION_ID (--json TEXT | --input FILE) [--output FILE],version,help.targets/2026.1.0529.7/docs/operations/briosa-cli.md, linked from the operations index.Design choices
Engine layering.
Engine/holds everything both front ends need: endpoint parsing, the connection, server verification, discovery views, the JSON Schema, strict input, the dynamic call, outcome classification, result delivery, and the envelope.CommandLine/only parses arguments, maps the outcome to an exit code, and writes the envelope. The engine never throws for an outcome. It is a generic protocol adapter over the compiledBriosa.Protocoldescriptors and standard protobuf reflection, with no per-operation code.Attach only, one verified connection. Endpoints must be
http://, an IP loopback address (127.0.0.0/8or[::1]), and an explicit port. Hostnames, includinglocalhost, are rejected, as the server rejects them. The channel has no proxy, no redirects, no service config (so no retry or hedging), and aConnectCallbackthat connects to the parsed address at most once. If the verified connection drops, the CLI never opens another one. A server that took over the port, perhaps an older one that ignores the restriction header, never receives the call. Below the gRPC client, each request may open exactly one HTTP/2 stream: the HTTP client's own resend of a refused stream is never written (review round 1, finding 2). The CLI's only RPCs areGetServerInfo,ListCapabilities, and the one MP call. A discovery row that names a method without MPexecutiondetails is refused, so even a misbehaving server cannot steer it to a lifecycle RPC.Verification. Every command checks the exact target, the
briosapackage, and compatibility major 3.callalso requires revision 2 (Server 0.10.2). Against an older server it fails closed with exit code 5 and sends nothing afterGetServerInfo. Discovery commands work against revisions 0 and 1 and warn about what is missing (mp_step, request options, and so on).Caller restriction. Every call sends exactly one
briosa-caller-restriction: profile=read-only; deny=interactive_uientry. The CLI does not decide admission. It refuses locally only for an invalid or unknown operation, an operation outside the read-only tier, invalid input, an output file it cannot create, or an unverified or too-old server.Bridge tiers. These come from discovery metadata only; the first matching rule decides:
excludedphysical_motion,device_session,device_config,code_execution,external_io; an exclusive-workflow, unknown or unrecognized scope; an unknown or unrecognized effect or flag; or an unreviewed row (unspecified duration class or validation status)read_only(served bycall)filesystem_metadataread_only_restrictedfilesystem_metadata,filesystem_read,interactive_ui(the 6 data-share getters and 11 runtime-selects)mutating(reserved)A pinned test computes the tier of all 1,018 registered operations from the server's own discovery projection and pins the counts.
Strict input. Before the protobuf parser runs, the request is checked against its descriptor:
suggested_field_name.null, no duplicate key at any depth, no unknown field, and at most one field per oneof."NaN","Infinity","-Infinity".A rejection gives a code, a schema path, and a byte offset, line and column. It never includes the offending text, not even an unknown key. MP messages use no other field kinds, and any other kind fails closed.
Envelope. One line of UTF-8 JSON, no BOM. The top-level members are always present:
envelope_version,command,outcome,exit_code,endpoint,server,transport,failure,execution,data,warnings,guidance.executionalways has the same ten members:request_sent,caller_restriction,disposition,disposition_source,completion_evidence,recovery_guidance,replay_guidance,replay_safety,worker_generation, andmp_execution.completion_evidenceisunavailable. The consistency rules are in the operations page and in review rounds 1 and 2. gRPC OK with consistent MP details is reported asCOMPLETEDfromgrpc_ok.Exit codes:
succeededinternal_errorusage_errorrejected_locallyserver_unreachableserver_incompatiblenot_started(policy, caller restriction, readiness, capacity)invalid_requestmp_failedpartial_successoroutputs_incompletecompletion_evidence_unavailablestarted_outcome_unknownoutput_write_failedCap and spill. The receive allowance stays at 4 MiB. The default inline cap is 65,536 bytes of result JSON (
--max-inline-bytes, 0 to 4 MiB).%LOCALAPPDATA%\Briosa\cli\2026.1.0529.7\results. The volume must keep file permissions, or nothing is spilled and the result is reported lost. Every directory below%LOCALAPPDATA%is opened or created relative to its held parent handle, never by path, without following a reparse point, refused if it is one, and held while the file is created. Only then, through its held handle, doesresultsget a protected DACL for the current user and SYSTEM only, written to it alone, so that existing entries keep their permissions. The file is created relative to that handle with its own protected DACL for the same two, and must resolve to exactly the base's final path and the components. The file name is a timestamp, the requested operation ID and random hex.--outputmust not exist yet. It is created before any RPC and held exclusively, so an unwritable path is refused before anything is sent. An unused reservation is removed through its own handle. If writing it fails after a completion the evidence established, the result goes to the spill directory and the exit code is 12. Without established completion, the outcome stays exit 10. The MP is never run again to fetch data.Project shape and shared files
On
main(5ca27a84), I published the CLI and the server self-contained forwin-x64with the package script's release properties and compared every common file by SHA-256. I repeated the comparison at the head of this PR. All 335 shared files are byte-identical. The CLI adds four files (Briosa.Cli.exe,.dll,.deps.json,.runtimeconfig.json, 384,169 bytes at the head).AllowUnsafeBlocksfor the source-generated Win32 calls changes onlyBriosa.Cli.dll. Both references are still needed:DiagnosticSourcepin,System.Diagnostics.DiagnosticSource.dlldiffers.Microsoft.AspNetCore.Appframework reference,Microsoft.Extensions.DependencyInjection.Abstractions.dllandMicrosoft.Extensions.Logging.Abstractions.dlldiffer.I did not change the package scripts.
How I verified it
Everything ran locally with offline restore (an empty
RestoreSourcesfolder andNuGetAudit=false) and no SpatialAnalyzer, license, or real worker. The heavy steps ran under the shared verification lock (Invoke-WithVerificationLock.ps1 -AgainstRef origin/main). All steps below passed.Full locked run at
89820587:dotnet restore Briosa.slnx --locked-modedotnet build Briosa.slnx -c Release --no-restore(warnings as errors,10.0-all)./eng/Verify-Protocol.ps1 -AgainstRef origin/maindotnet test Briosa.slnx -c Release --no-build --no-restore --filter Category!=Performance, as CI runs itTest-RuntimePerformance.ps1 -NoBuild -IncludeGrpc,Test-ObservabilityPerformance.ps1 -NoBuild)ManualServerStartupTests./eng/Test-WindowsPackage.ps1,Test-ProtocolArtifact.ps1,Test-ClientConformancePackage.ps1,Test-ClientScenarios.ps1on the fresh packageNote on the 2024 test step: in the locked run at
89820587, one 2024 server test failed:UnaryCallAuditPipelineTests.WithDebugOffGrpcBuildsThePreChangeInvocationPath. It measured 0.038 bytes allocated per call against an allowed 0.01. The 2024 target is identical tomain(an empty diff since5ca27a84), and the test measures allocations, so it is sensitive to noise. I reran the 2024 test step with CI's filter three times under the lock. All three passed, Server 1,535 each time.Unfiltered
dotnet test Briosa.slnx -c Release --no-build --no-restore(2026 target, under the lock):e7665542: 2 of 3 whole-solution runs failed, always in the server'sWorkerProcessSupervisorTests.NormalLifecycleReportsStatesAndReleasesStaOnOwningThread. Its fake worker must stop within a 500 ms graceful bound and was reportedForced. One of those runs also had a performance test whose log directory was still in use when it tried to delete it.Briosa.Server.Testsalone: passed.main(5ca27a84): 3 of 3 whole-solution runs passed.0a3c5aderuns the CLI test classes one at a time.0a3c5ade: 3 of 3 unfiltered whole-solution runs passed, with all 1,571 server tests, including the performance ones.bbcf78f3: 3 of 3 unfiltered whole-solution runs passed: Cli 275, Server 1,571 including the performance tests, Worker 415, LicensedProbes 445, Protocol 56.d2b26b83: 3 of 3 unfiltered whole-solution runs passed: Cli 328, Server 1,571 including the performance tests, Worker 415, LicensedProbes 445, Protocol 56.89820587: 3 of 3 unfiltered whole-solution runs passed: Cli 335, Server 1,571 including the performance tests, Worker 415, LicensedProbes 445, Protocol 56.bd1d681b: 3 of 3 unfiltered whole-solution runs passed: Cli 343, Server 1,571 including the performance tests, Worker 415, LicensedProbes 445, Protocol 56.b192800a: 3 of 3 unfiltered whole-solution runs passed: Cli 350, Server 1,571 including the performance tests, Worker 415, LicensedProbes 445, Protocol 56.a1fded8f: 3 of 3 unfiltered whole-solution runs passed: Cli 357, Server 1,571 including the performance tests, Worker 415, LicensedProbes 445, Protocol 56.444438d5: 3 of 3 unfiltered whole-solution runs passed: Cli 360, Server 1,571 including the performance tests, Worker 415, LicensedProbes 445, Protocol 56. See review round 8 for the rest of that round's verification.Repository root, at
bd1d681b(rounds 6 to 8 reran the isolation and propagation checks at their heads):./eng/Verify-TargetIsolation.ps1,Verify-CiWorkflow.ps1,Test-DependencySnapshot.ps1, andTest-CrossTargetProtocol.ps1pass, the last with no new conflicts../eng/Test-CrossTargetPropagation.ps1reports the expected finding below.Also passed in the locked run at
89820587:Verify-LicensedRunnerWorkflow.ps1(both targets),Test-ReleaseCatalog.ps1,Test-ReleaseSigning.ps1,Test-RetainedClientPolicy.ps1, the compatibility-matrix checks, and the publishing unit tests.What the 360 CLI tests cover (no SpatialAnalyzer needed):
callpath.GrpcOperationOutcomeMapperand their ownCreateResult(14,875 cases). An exhaustive enumeration of the mapper (45,207 replies, with every policy-denial rule and payload), and a single-change oracle derived from it (167,688 changes). A single-row case for each of the 26 operations whose result nests one field name under several top-level fields. 36 mapper shapes for one operation, with its real output contracts, through the real CLI.resultskept byte for byte across two spills, an ancestor that denies new subdirectories, injected failures of the final-path and attribute queries, an unremovable incomplete file, a volume without ACLs, and the reservation-replacement race.briosa-caller-restriction: profile=read-only; deny=interactive_uientry, or that none was sent.Expected cross-target divergence
./eng/Test-CrossTargetPropagation.ps1 -BaseRef 5ca27a84ed7f80e7dd12cc0e6c0238e71090421ereports one finding:One-sided change: Briosa.slnx (2026.1.0529.7 modified, 2024.1.0508.5 unchanged). This is expected until the2024.1.0508.5port.Directory.Packages.propsis unchanged.Left out or worth a look
SpatialAnalyzerApi.Operations, the server's discovery projection (ServerDiscoveryService.BuildCapabilities), each operation'sOutputContractsandCreateResult,MpPartialSuccessExceptions,OperationPolicyand theOperationPolicyDenialfactory by reflection, because all are internal. AddingInternalsVisibleTowould have changed the server, which this slice must not do.Review round 1
These commits answer the adversarial review of
cb435d66:1c36f11d(the fixes),e7665542(test literals and documentation), and0a3c5ade(CLI test classes run one at a time; see "How I verified it"). The approved public surface is unchanged: command names, options, envelope members, exit code numbers, and tier names and counts.Before changing code, I reproduced each finding with a new test that failed on
cb435d66. I then proved each fix with a mutation that compiles and makes its test fail. All 22 mutations do.cb435d66VALIDATION/NOT_STARTEDfor another operation: exit 7.DATA_LOSS+NOT_STARTED+ MP success: exit 7. 13 further contradictions: exits 6 to 9.EvidenceConsistency: the trailer must name the requested operation, and every reported output must be a field of the result. Status, kind, disposition and MP details must match a shape the server's mapper produces. An OK must carry no error trailer. Any conflict gives exit 10, a null disposition, no recovery or replay guidance, and reconcile guidance.SocketsHttpHandlerretrying aREFUSED_STREAMon the same connection. gRPC has no retry policy, and reconnects were already blocked. ADelegatingHandlernow grants each logical request one stream. The connection stream reads outgoing HTTP/2 frame headers and never writes aHEADERSframe that would open a stream beyond the grants. The call ends withrequest-resend-blocked, exit 10, and a warning saying the first attempt was refused and the second blocked.profile=read-only; deny=invalid_flag, all 232 tests passed.tests/Briosa.Cli.Tests/Wire.cs, and the fake server reads the header by its literal name (other instances below).INTERNAL/worker-output-shape-invalid/COMPLETEDwithoutmp_execution:mp_failed, exit 8. This was the only kind of wrong mapping: 34 of the 36 mapper shapes were already right, and the two wrong ones were both shape-invalid cases.MP_FAILUREisoutputs_incomplete, exit 9.ServerFailureShapeTestsbuilds all 36 shapes with the server's ownGrpcOperationOutcomeMapper, by reflection, and runs each through the CLI.SUCCEEDEDand code 4, then a failed spill: exit 12, null disposition, guidance "The operation completed."completion_evidence_unavailable(10), withdata.result_deliverylostanddata.result_delivery_errorset. Delivery warnings name completion only when it is established.!deliveredalone: 1 test fails.%LOCALAPPDATA%is created, opened withFILE_FLAG_OPEN_REPARSE_POINT, refused if it is a reparse point, and held without delete sharing until the file exists. The file is created with delete access and must resolve (GetFinalPathNameByHandle) to exactly the expected path, or it is removed through its handle. A reservation is held exclusively and removed through its own handle (SetFileInformationByHandle), never by name.mklink /J, no elevation: reparse checks and final-path check both removed: 3 of 3 junction levels fail. Reparse checks alone removed: 2 fail, because directories are created through an intermediate junction even though the final-path check stops the file. Delete by name after closing: the file that replaced the reservation is deleted, 1 fails.briosa-cli: not_started (customer-part-17).cliortransport) or in the server's documented vocabulary; otherwiseserver-diagnostic. The code stays in the stdout JSON.describe,searchandcategories.callselected the impostor's method: the example request failed its input schema (exit 3);{}would have dispatchedGetWorkingDirectory. Oversized discovery:RESOURCE_EXHAUSTED, exit 4, "start the server"./<service>/<rpc>. Otherwise every command gets exit 5,capabilities-inconsistent.RESOURCE_EXHAUSTEDis exit 5,discovery-response-too-large. Only unavailable, deadline, internal, unknown and cancelled count as unreachable.--outputfile: exit 3 after two discovery RPCs. Acallrefused forlocalhost, a zero deadline, or an unknown option:execution: null.--outputis reserved before any RPC and released through its handle on every later refusal. A recognizedcallrefused before any RPC, including on usage errors, carries the not-sentexecutionblock.http://127.0.0.1:80printed ashttp://127.0.0.1.Expected values taken from production code (finding 3), now literals:
FakeBriosaServer: the restriction header name, the exact target inGetServerInfo, and the error trailer name.CallOutcomeTests: the restriction value (two assertions), the trailer name, and the MP outcome codes. Result files were compared withProtocolJson.Formatoutput; they are now decoded and compared with the result's protobuf bytes. Operations of each tier were picked withBridgeTiers.Classify; they are now picked from discovery metadata.StrictInputCommandTestsandProtocolRoundTripTests:InputRejectionCodes.*and the input limits.DiscoveryCommandTests: the requiredness statement and the input limits.CommandLineTests: the usage line count and the target.BridgeTierTests: the five excluded flags. A new test pins the production list to them.What remains reasoning only:
%LOCALAPPDATA%itself, which the CLI does not manage.worker-result-missing(the outcome type forbids a completed status without an execution) and the transport default branch. TheINTERNALrule covers both.CI flake: the 2024 package smoke and client scenarios, including
watchdog-recovery, passed in both of my locked runs, atcb435d66and ate7665542. I did not reproduceunexpected-rpc-Cancelled.Review round 2
These commits answer the re-check of
0a3c5ade:c361a96f(the fixes and their tests) andbbcf78f3(the operations page). The approved public surface is unchanged: command names, options, envelope members, exit code numbers, and tier names and counts. Diagnostic codes changed:operation-error-enum-unrecognized,result-output-missing,spill-permissions-unsupported, and the warningspill-refused.result-output-not-retrieved, the warningoutput-not-retrieved, andoperation-error-disposition-unrecognized. What they reported is now conflicting evidence, exit 10 (items A and B).Where this round changes a rule, it supersedes findings 1, 2, 4 and 8 of round 1.
Before changing code, I reproduced each item on
0a3c5adewith new tests. All 21 failed there, and the all-operations test misclassified 2,338 of 13,858 genuine replies. For D, the old behaviors had no test, so I reproduced each one by re-creating it as a mutation of the new code. I then proved every fix with a mutation that compiles and makes its test fail. All 22 mutations do.0a3c5adeOutputRetrievalDetails.field_namefrom each operation'sOutputContracts(CreateMpDetails,CreateSuccessfulMpDetails,CreateSdkFaultOutputDetails): one row per contract, in contract order, in every MP details it sends, with the contract's field name verbatim. Of the 1,018 operations, 312 declare 908 output names: 829 top-level fields, 57 dotted paths and 22 bare names of nested fields; 13 repeat a name for one aggregate field. The other 706 have no outputs. Only top-level names were accepted: every genuine reply with rows from 16 of the 312 operations was a conflict (224 cases), includingrelationship_operations.get_relationship_status. An OK with none of its outputs was exit 0.execution, a dotted path that resolves through one, or a bare name of a field nested inside one. R2: every top-level field of the result is named by at least one row. On OK, every row must also beRETRIEVED, because the server answers OK only then.MAY_REPLAYon a completedMP_FAILUREgave exit 8, numeric replay guidance gave exit 6, andOPERATOR_INTERVENTION_REQUIREDon a watchdog timeout without the dialog code gave exit 11. An unspecified disposition gave exit 10, but it kept the server's guidance.EvidenceConsistencycarries the mapper's table per kind: status, disposition, replay guidance, recovery guidance, the code where the mapper fixes it, and the MP details. Replay guidance follows the replay safety discovery reported, which the error must also carry. Further rules: worker generation present and not negative; policy denial exactly onPOLICY_DENIEDwith a known rule; request validation only onVALIDATIONwithrequest-validation-failed. Unknown enum values giveoperation-error-enum-unrecognized. An unknown diagnostic code alone stays data. One rule came from the derived oracle, not from reading: the mapper never pairsWORKER_UNAVAILABLEwith operator recovery.analysis_operations.get_number_of_collectionsandfile_operations.get_working_directory:callandops searchboth gave exit 0.category.operationequalsService.Rpc, ignoring ASCII case, without thebriosa.package. This holds for 1,018 of 1,018 registered operations, with no exception. No ID names any other registered method: 0 of 1,035,306 cross pairs. A pinned test checks both, and a listing that breaks the rule gets exit 5capabilities-inconsistentbefore anything else is sent. The round-1 test of a row pointing at a lifecycle RPC now stops here: exit 5, not 3.resultsis opened withREAD_CONTROL,WRITE_DACandWRITE_OWNER. Its owner and protected DACL (user and SYSTEM, container and object inherit) are written through that held handle (ObjectSecurity<FileSystemRights>.Persist(SafeHandle)). The file is created with its own self-relative descriptor: owner the user, protected DACL for the user and SYSTEM, no inheritance.GetVolumeInformationByHandleWmust reportFILE_PERSISTENT_ACLSon the base, before any directory is created. Otherwise the spill is refused:result_deliveryislost,result_delivery_errorisspill-permissions-unsupported, and the warningspill-refusedsays the result was discarded and is in no file. Exit 12 only with established completion. New tests read the effective ACL back from disk, check a base junction re-pointed after the directories are held, and inject a volume without ACLs.OUTPUTS_UNAVAILABLE, withheld getter outputs) was a conflict, 2,114 cases.MapperEnumerationdrives the real mapper over every constructible worker outcome in finite domains: 90,516 attempted, 42,240 rejected by their own constructors, 49,035 replies (759 results, 48,276 typed errors, 5,523 distinct signatures, all 17 kinds). Every reply is classified as its real outcome. A single-change oracle then changed one field of each signature at a time (status, kind, disposition, recovery, replay, replay safety, code, generation, details, MP state, code and rows): 147,726 changes. The 33,327 producible ones are accepted, the 114,288 never produced are refused, and 111 fall in the gap below.ServerMapperShapesnow uses the operation's three real output contracts, not a one-output stand-in.RESOURCE_EXHAUSTEDfrom discovery was reported asdiscovery-response-too-large.ReceiveEvidenceHandlerpasses each response body through unchanged and reads the length prefix of its first gRPC message. Only a declared length above the 4 MiB receive limit is reported as too large. Any otherRESOURCE_EXHAUSTEDis exit 5transport-resource-exhausted.RESOURCE_EXHAUSTEDread as too large: 1 test fails. Prefix never observed: the oversized test fails.What the rules cannot detect (also on the operations page):
get_relationship_status.I evaluated a stronger rule, a row for every leaf of a field named only through nested names, over the registry and rejected it.
gdt_operations.get_gdt_optionssharesGdtOptionswith a setter, and two of its optional fields are never outputs.Known gap: MP code 4. The server reports code 4 as an MP failure for four reviewed operations (
MpPartialSuccessExceptions). Without a table of operations, the CLI accepts code 4 in an MP failure of any operation, and a code-4 partial success of those four. The oracle counts these 111 cases separately. A pinned test shows that none of the four is in the read-only tier, socallnever sends them.What the enumeration does not cover: worker diagnostic codes beyond the mapper's own codes and fallbacks, one ordinary code and one it must replace; nine sample MP codes; six representative operations (the all-operations test covers the completed paths of all 1,018); worker generations 0 and 3; one policy denial per rule the real policy reaches for the read-only and full profiles; one typed value per output kind. In the all-operations test, the sample values make
robot_operations.get_robot_machine_model_link_parametersfail its own result mapping, so that operation's genuine success is the executor'sresult-mapping-failed, which is classified as such.Verification: the locked run in "How I verified it" is at the head of this round, for both targets, including the four package scripts.
mainis still5ca27a84, so nothing was merged.Review round 3
These commits answer the second re-check of
bbcf78f3:e2376e9a(the fixes and their tests) andd2b26b83(the operations page). The approved public surface is unchanged: commands, options, envelope members, exit codes, tiers, and diagnostic codes. Before changing code, I reproduced each item onbbcf78f3with new tests. 45 failed there: the 26 single-row cases, the datum case through the CLI, the 13 denial cases, the served-read code-4 case, and the 4 redirect points. The 7 positive denial cases passed. I then proved each fix with a mutation that compiles and makes its test fail. All 8 do.bbcf78f3RETRIEVEDrow namedcollection_namewas a success forgdt_operations.get_feature_check_datum_references(exit 0), because the bare name is nested in all three datum fields. The review counted five such operations. Searching the result descriptors for any field name nested under two or more top-level fields finds 26 (15 in the read-only tier), for example the circle, cone and line property getters, whose two vector fields both containx. A single-row case failed for all 26.CALLER_FLAG, with nocaller_denied_flag, gave exit 6 withcaller-restriction-denied. 13 denials that do not fit their rule were all accepted.OperationPolicyDenial.ToDetailswrites them.PROFILEneedsadmission_profile;FLAGneedsdenied_flag;CALLER_PROFILEneedscaller_admission_profile;CALLER_FLAGneedscaller_denied_flag;OVERRIDEandUNREVIEWEDcarry nothing;request_option_fieldis allowed on the others and must not be blank. Caller values are checked against the restriction the CLI sent: the server names the restriction's profile, and the first of the request's flags that the restriction itself denies (EvaluateCallerRestriction), soread-onlyandinteractive_ui. The oracle now enumerates each rule with its payload from the server's denial factory: every profile, every risk flag, and with and without an option. Caller rules use the restriction's own values. A test runs the real policy with the CLI's restriction over every operation and reviewed option (29 caller denials, three payload shapes) and checks that each is one the oracle has. The signature carries each field's presence and the caller values.Briosaorcliwas held, the CLI rewrote the owner and access list ofelsewhere\Briosa\cli\results, outside the intended tree, then refused the file.FILE_OPEN_IF), withNtCreateFilerelative to its held parent's handle (RootDirectory), as itself (FILE_OPEN_REPARSE_POINT), refused if it is a reparse point or not a directory, and held without delete sharing. Only then doesresultsget its owner and DACL, through its own handle. The file is created relative to theresultshandle with its own descriptor. Its reported path is its final path, checked against the base's final path and the components. Every path element must be a single name.CodeFourMayBeFailure, which is true only outside the read-only tier. For a served read, code 4 in an MP failure is conflicting evidence, exit 10, with no table of operations. The pinned test that no code-4-as-failure operation is in the read-only tier stays. The engine notes that a later mutating tier must keep the flag true for its operations. The old test now checks, in-process, that each of the four exception operations' genuine code-4 reply is still an MP failure outside the read-only tier.C, what the design guarantees: whatever happens to any path during the call, including a redirection of
%LOCALAPPDATA%between two levels, the CLI changes owner or permissions only on theresultsdirectory inside the tree that%LOCALAPPDATA%led to when the CLI opened it, and creates the file only there. A new theory re-points the base after each of the four levels and checks the SDDL and existence of every pre-existing entry under the test root. Nothing outside the verified tree changes, and the spill succeeds in the verified tree. What it does not guarantee: that%LOCALAPPDATA%leads where the user expects when the CLI opens it, because whoever can redirect that folder chooses the tree. Another process running as the same user can still change the file or its permissions after the write. An--outputfile is not a spill file and keeps the permissions of the directory the caller chose.Oracle at the head: 79,032 attempted outcomes, 34,584 rejected by their constructors, and 45,207 replies (759 results, 44,448 typed errors, 6,216 distinct signatures, all 17 kinds), each classified as its real outcome. 167,688 single changes: 37,575 producible ones accepted, 130,092 never produced refused, and 0 failures. The remaining 21 known-gap accepts are all the mirrored code-4 gap for the one exception operation in the enumeration, which is outside the read-only tier. Denials are no longer crossed with connections and deadlines, which the mapper does not read for them; the limits text says so.
Documentation: the operations page now has the row matching and its limits, the denial payload table, the read-only code-4 rule and its dependency, the spill design and its guarantees, that a fixed-code row conflicts on its code alone, and that a failed
--outputkeepsoutput-write-failedwhen its spill fallback is also refused.Verification: the locked run in "How I verified it" is at the head of this round, for both targets, including the four package scripts, and so are the unfiltered runs and the root checks.
mainis still5ca27a84, so nothing was merged. Where this round changes a rule, it supersedes round 2: items A, B and D (spill), and the code-4 gap, which is now closed for every operationcallserves.Review round 4
These commits answer the third re-check of
d2b26b83, which found problems in the spill code only:482a95bb(the fixes and their tests) and89820587(the operations page). The approved public surface is unchanged. Before changing code, I reproduced each item ond2b26b83with a new test. 5 of the 7 new tests failed there. The other two pin behavior that held before and must hold after: a fresh tree, and a refusal where a parent denies creating a missing directory. I then proved each fix with a mutation that compiles and makes its test fail. All 5 do.d2b26b83resultswith inherited permissions had a different owner-and-access-list binary after a spill. Writing the directory's security withObjectSecurity.Persist(SafeHandle)(SetSecurityInfo) propagates inheritable entries to existing children.resultsare written withSetKernelObjectSecurityon its held handle, which writes that object alone. The protection comes from the descriptor'sSE_DACL_PROTECTEDflag. A new test puts an ordinary file and a folder, both with inherited permissions, inresults, then spills twice. Both keep their binary owner and access list byte for byte, and so does the first spill file across the second spill.resultsand both spill files end with the intended protected lists. Earlier spill files carry their own protected list, which propagation does not rewrite, so they should have been unaffected before too. That part is reasoning, not something I tested ond2b26b83; the test now pins it.FILE_ADD_SUBDIRECTORY, the spill failed: every level was opened asking for that right.FILE_READ_ATTRIBUTESandFILE_TRAVERSEonly, plusWRITE_DACandWRITE_OWNERonresults. No right to create is requested on any handle. Where a directory or the file must be created, the file system checks the parent's own permissions at that moment. Tests: an existing ancestor that denies new subdirectories is passed through; a fresh tree is created level by level; a missing directory under a parent that denies it is refused, and nothing is created.results. An injected failure of a directory's attribute query left that directory's handle open, so the directory could not be renamed.ResultFiles.csand the result delivery that uses it is listed below.Item 3, every error path checked:
ResultFileconstruction, failsresultsAdopt)--outputreservation whoseResultFileconstruction (theFileStream) failsAdopt); found in this reviewRequireDirectoryresultsTryWritediscards spill files); found in this review--outputwrite that fails part wayResultFile.Disposewhen the stream's own close throwsfinally; found in this reviewResultFile.Discardafter the file was already closedCreateFile,NtCreateFile)finally--outputreservation whose cleanup query failsItem 4: the mapper oracle's known-gap text now says that code 4 is accepted as a failure only outside the read-only tier, and that for a served read it is conflicting evidence.
Documentation: the spill section now states that the permissions of
resultsare written to it alone, so existing files, folders and earlier spill files keep their own. It also states which access is requested, that a spill file is removed through its handle if anything fails before it is written in full, and that created directories are kept.Verification: the locked run in "How I verified it" is at the head of this round, for both targets, and so are the unfiltered runs and the root checks. Only
src/Briosa.Cli,tests/Briosa.Cli.Testsand the documentation page changed, so the package scripts and the 2024 target did not need rerunning. They ran anyway, because the shared harness runs everything. The 2024 test step failed once in that run, in a server allocation test, in a target identical tomain; three reruns under the lock passed (see the note there).mainis still5ca27a84, so nothing was merged.Review round 5
These commits answer the CI failure at
89820587and the fourth re-check of89820587:3b078ba6(the fixes and their tests) andbd1d681b(the operations page). The approved envelope members and exit code table are unchanged. New values: delivery statesfile_unconfirmedandfile_unverified; delivery errorsspill-finalize-failed,output-finalize-failedandspill-verify-failed; result-file reasonincomplete_not_removed; warningsresult-file-unconfirmed,result-file-unverifiedandincomplete-file-left.CI failure of
ASpillChangesNothingAlreadyInTheResultsDirectory(job https://github.com/spatialanalyzer/briosa/actions/runs/46121899794/job/140908023131,windows-2025-vs2026, asrunneradminwith an elevated token). The test failed at line 33, which comparesordinary.txt, a file created inresultsbefore the spills, before and after two spills.0x10, 20 bytes: a one-subauthority SID such as SYSTEM) to explicit (0x00, 24 bytes: a two-subauthority SID such as BUILTIN\Administrators). The 72 bytes before it are identical: the control flags, the owner, the access list's size and entry count, and the first entry. A 16-byte owner (BUILTIN\Administrators, the default owner under an elevated token) is the only owner size that puts an entry at byte 72.ordinary.txt; it writes security only to the heldresultshandle. Propagation of the spill's list would replace the file's inherited entries with the user (36 bytes) and SYSTEM (20 bytes), changing the count, and could never make an entry explicit. So the change is not the spill's list propagating. Nothing else in the repository sets ACLs on an ancestor of the test tree. (Searched: the only other writer isDesktopStore, which works under%LOCALAPPDATA%\Briosa\ControlCenter.)BUILTIN\Usersentry that any propagation fromresultswould visibly remove, and aCREATOR OWNERentry. TheCREATOR OWNERentry resolves to the user under an ordinary token and to Administrators under an elevated one, which exercises the elevated case. On failure, the test reports the owner-and-access-list SDDL of the root,results, both pre-existing entries and both spill files, at each of the three stages. The propagating writer, with theREAD_CONTROLit needs, makes the test fail on its comparison (ordinary.txt changed.), not on access denied.Who owns and can access the spill files. The same under an ordinary account and an elevated administrator account.
resultsand each spill file are owned by the current user's own SID, set explicitly, so never BUILTIN\Administrators, which would otherwise own new objects under an elevated token. Each has a protected access list with full control for that user and for SYSTEM only, inheritable onresultsand not on the file. That is what the documentation promises. An administrator can still take ownership, or read with backup privileges, outside the CLI's control.TheSpillDirectoryAndFileAdmitOnlyTheUserAndSystem, which asserts this owner and list on disk, passed on the elevated runner at89820587.89820587lost, and a close error kept the file but still reportedlost. I reproduced both by re-creating the old behavior as mutations of the new code (right-hand column); the new tests fail on them.file_unconfirmed. One that could not be read back is kept asfile_unverified. An--outputfile that read back intact is kept and reported, with no spill. Tests cover each fault point for a spill (before any byte, after a 3-byte prefix, at flush, at close, at read-back) and for--output(prefix, flush, close).lost: both fail. Unreadable file trusted: the spill theory fails.data.result_filewith its size on disk, no SHA-256 and the reasonincomplete_not_removed, and the warningincomplete-file-left. The docs now say removal can fail.SYNCHRONIZEmissing from the docs.Delivery states (the operations page has the table):
none: no result came back.inline:data.resultholds the whole result.file: the file read back as exactly the result, and flushed and closed without an error.file_unconfirmed: it read back as exactly the result, but the write, flush or close reported an error, so it is not confirmed to stay intact. It is kept.file_unverified: the spill file could not be read back, so whether it holds the result is not known. It is kept.lost: no file the CLI can vouch for holds the result.result_filemay name an incomplete file it could not remove.Any state other than
inlineandfile, and any failed--outputfile, is a failed delivery: exit 12 only when the call's own evidence established completion.Verification at
bd1d681b, under the lock, in the 2026 target:Verify-TargetIsolation,Verify-CiWorkflowandTest-DependencySnapshotpassed, andTest-CrossTargetProtocolpassed with no new conflicts.Test-CrossTargetPropagationreported only the expectedBriosa.slnxfinding.src/Briosa.Cli,tests/Briosa.Cli.Testsand the operations page changed, so I did not rerun the package scripts or the 2024 target. The full harness table above is from89820587.mainis still5ca27a84, so nothing was merged.Review round 6
These commits answer the fifth re-check of
bd1d681b, which found combinations of faults that result delivery reported wrongly:afc1d4d2(the change and its tests) andb192800a(the operations page). The approved envelope members and exit code table are unchanged. New values inside existing members:data.result_filegainsverification(matched,matched_unconfirmed,not_read_back,incomplete) andother_files, every other file the call left on disk, in the same form.output-verify-failed, and a new result-file reason,reservation_not_removed.result-lost,spill-write-failedandoutput-reservation-left.spill-write-failedis the spill's own failed write, which round 5 reported asoutput-write-failed.spill-refusedtoresult-lost, which is given exactly when the state islost.Rather than adding one more case, delivery now keeps one record per file the call wrote or created: what reading it back showed, whether a later step reported an error, and whether it is still on disk. The delivery state,
data.result_file, the error, and the warnings are all derived from those records. A fault matrix checks six invariants across every combination of fault points, against the files on disk.bd1d681b--outputfile held all 821 bytes, yet the delivery waslost,result_filewas null, and a warning said the result was "not in this envelope or in any file". Exit 12.--outputfile that could not be read back is kept and named asnot_read_back, with the result's size and SHA-256 to check it against. The state isfile_unverifiedand the erroroutput-verify-failed, distinct from a known mismatch, and the warning says how to check the file.result-lostappears only when no file may hold the result.--outputfile not named) fails the new test and 120 matrix cells (I1, I3). The old wording (a refused spill says "in no file") fails the new test and 8 cells (I1).Stream.Flush()on aFileStreamwith no buffer, which never reaches the operating system. No test could see the difference.RandomAccess.FlushToDisk(FlushFileBufferson Windows) flushes the file. A failure makes the filematched_unconfirmed. Result files are now written and read through their handle withRandomAccess, behind a small internalIResultFileIoseam that tests use to inject faults and log what really happened. The operations page says what the flush establishes and what it does not.bd1d681bwith the byte comparison replaced by a length check, all 343 committed tests passed; only the reviewer's probe failed.123read back against124), a CLI test whose spill file has the right length and one different byte, and the matrix'sContentMismatchfault on both destinations.result_filenull and onlyoutput-write-failed.ResultFileLeftExceptioncarries the path the file was created at, and the envelope names it asincomplete: 0 bytes,incomplete_not_removed, the warningincomplete-file-left. An unused--outputreservation that cannot be removed is named as well, withoutput-reservation-left. Removal is judged by whether the handle accepted the delete, not byFile.Exists.The reviewer's three probes pass at
afc1d4d2, with one line changed to the new write call.One behavior change beyond the findings. An
--outputfile that read back shorter or different is now removed through its handle, as a spill file is. The CLI created it, since the path must not exist beforehand. An incomplete file at the caller's path could be taken for the result by anything that reads the path without the envelope. A file that may hold the result is never removed.Invariants (on the operations page, checked by
DeliveryFaultMatrixTests):verificationand the result's size and SHA-256. It is never removed, and the result is never reported as absent.matched, and the statefile, only when the file was read back in full as exactly the result and the write, the flush to disk, and the close all succeeded.data.result_fileor itsother_files.incomplete, with no SHA-256 and an explicit reason, and nevermatchedormatched_unconfirmed.data.result_delivery_errorrecords the failed delivery.inlinedelivery within the cap.The matrix. Each cell runs the real CLI entry point against the in-process fake server, and all 664 take about 8 seconds.
What each cell checks. The six invariants, against every file under the test's root after the call and a log of the real handle operations: what bytes reached each file, its reads, flushes, closes, and refused removals. A file counts as complete when its bytes on disk equal the result's.
Fault points for a spill only: opening a directory, setting the permissions of
results, a volume without permissions, creating the file, a failed final-path lookup at hand-over, and a final path that differs.Fault points for either destination: a write that fails before any byte, after a 3-byte prefix, or after the whole payload; the right length with one different byte; the read-back's length query; its read; the flush to disk; and the close. There is no separate open for the read-back: it uses the file's own handle, and the length query is its first step.
The cells:
--output: each of its faults (or none) crossed with each spill fault (or none).Each is crossed with removal that works or is refused, and with completion established (MP code 2) or not (a code-4 contract violation, exit 10). That makes 60, 60 and 540 cells, plus 4 for an unused
--outputfile: no result, or refused before the operation is found, each with removal working or refused. 664 in all.Result: every cell keeps every invariant.
Where an invariant cannot fully hold, or a fault is not real:
Refused before the operation is found (2 cells).
datais null by the approved shape, so an unremovable reservation is named only by the warningoutput-reservation-left, which refers to it as "the --output file". The caller supplied that path.A close that reports an error. It can only be injected: .NET's
SafeFileHandleignores the result ofCloseHandle. In practice the flush is the last step that can fail.A final path that differs at hand-over. It can only be injected. Real redirections are stopped earlier by the held handles (round 3).
Not in the matrix:
--outputreservation, which fails before any RPC as a local rejection with nothing on disk, covered by the round 1 tests;And by design: the read-back reads what the file system holds, possibly from its cache, and a device that acknowledges writes it has not made durable is beyond the CLI.
Mutations of the product the matrix catches (each compiles; the whole CLI suite ran for each):
With the five finding mutations above, 11 of 11 mutations fail the matrix. In my first mutation run, the harness kept only the last 400 lines of detailed test output, which dropped the failure of the length-check mutation. I reran all 11 with the whole output, and the counts above are from that run.
Verification at
b192800a, under the lock, in the 2026 target:NuGetAudit=false: pass.Verify-TargetIsolationpassed.Test-CrossTargetPropagationreported only the expectedBriosa.slnxfinding.src/Briosa.Cli,tests/Briosa.Cli.Testsand the operations page changed, so I did not rerun the package scripts, the other root checks, or the 2024 target.mainis still5ca27a84, so nothing was merged.Review round 7
These commits answer the sixth re-check of
b192800a:1dc366c8(the fixes and their tests) anda1fded8f(the operations page). The approved envelope members and exit code table are unchanged. New values inside existing members:result-report-failed, which marks a defect in the CLI, not a delivery fault.result-hash-unavailable.output-reservation-leftnow gives the reservation's path.nullsha256on a file that may hold the result, when the SHA-256 could not be computed.I reproduced each finding on
b192800ain this worktree, with temporary probes I removed afterwards. Then I proved each fix with a mutation that compiles and makes a test fail.b192800a--outputfile held the whole result, but the envelope saidlost,result-format-failedandresult-lost, named no file, and exited 12.result-format-failed. A SHA-256 that cannot be computed leavessha256null on every entry, withresult-hash-unavailable. The file is still written, read back byte for byte and named. The report is built in memory from the file records, naming the files first. The engine's catch no longer overwrites anything delivery recorded; it only recordsresult-report-failedfor a defect.--outputand spill) fail. SHA-256 taken after the files and unguarded, as before: both fail.SystemResultFileIo.FlushToDiskreturned normally on a real read-only handle, on which Windows refuses the flush withERROR_ACCESS_DENIED.FlushFileBuffersitself and throws on any failure, which makes the filematched_unconfirmed. A new test calls the real adapter on a real read-only handle and expectsERROR_ACCESS_DENIED; another lets a writable handle pass.RandomAccess.FlushToDisk: the adapter test fails. The reviewer's no-op flush (GC.KeepAlive): the adapter test fails.--outputfile, the old matrix passed all 664 cells; only the separate refused-spill test failed. With the spill winning a tie, all 350 tests passed.M-primary).--outputfile remained and the warning gave no path. After a failed hand-over with removal refused, the warning said no spill file could be created while the empty file existed.output-reservation-leftgives the resolved--outputpath, which the caller supplied. A spill file that fails its hand-over checks and cannot be removed is its own outcome: the warning says it failed its checks and could not be removed, withincomplete-file-left. A creation failure says no spill file is left.incompletewithbytesnull.How the matrix's oracle is now derived. Before looking at the envelope, each cell predicts what must happen, using the operations page's rules applied to its faults:
incompletefile.incompletefile of 0 bytes; after a prefix, 3 bytes; a content mismatch, the full length.matched_unconfirmed.not_read_back.matched.--outputfile, if given. A spill is written without--output, and also behind an--outputfile that is neithermatchednormatched_unconfirmed.matched, thenmatched_unconfirmed,not_read_back,incomplete; on a tie, the--outputfile. This rule is stated on the operations page, in the model, and in the product.matched.--outputfile's when there is one, otherwise the spill's.result-lost,spill-refused,result-spilledandincomplete-file-left.The checks then compare:
The six invariant checks still run on top. In the unused-reservation cells the model checks the warning's path as well.
Mutations at the head (15; each compiles, and the whole CLI suite ran for each):
RandomAccess.FlushToDisk--outputThe matrix does not inject a SHA-256 failure, a flush denied by the real adapter, or two faults on one file. The dedicated tests cover the five mutations it passes.
Everything that runs after the first file record, and why none of it can remove a record:
result-report-failedand removes nothing.What is still not covered, and why:
matched_unconfirmed.Documentation: the operations page now says:
RandomAccess.FlushToDiskis not used;sha256means;not_read_backormatched_unconfirmedfile against its size and SHA-256 before using it;Verification at
a1fded8f, under the lock, in the 2026 target:NuGetAudit=false: pass.Verify-TargetIsolationpassed.Test-CrossTargetPropagationreported only the expectedBriosa.slnxfinding.src/Briosa.Cli,tests/Briosa.Cli.Testsand the operations page changed, so I did not rerun the package scripts, the other root checks, or the 2024 target.mainis still5ca27a84, so nothing was merged.Review round 8
These commits answer the seventh re-check of
a1fded8f:85ed8056(the fixes and their tests) and444438d5(the operations page). The diff is 190 lines added and 35 removed. The surface is unchanged, apart from wording and one new case: an unused--outputreservation whose size could not be read now has a nullbytes.result-hash-unavailablenow says only that the SHA-256 is missing. It is given whenever the SHA-256 could not be computed, including when the result islost; the documentation's promise was right and the code was wrong. The warnings for anot_read_backormatched_unconfirmedfile say to check it against its size and SHA-256 when there is one; without one, they say its size alone cannot verify it. New tests: a spill whose length query fails with no SHA-256 (0 bytes read; no warning claims a comparison or a SHA-256), and alostresult with no SHA-256.matchedmust have a successful flush after its last write and its last read, and before its close.M-order).bytesagainst the file's size on disk, a null SHA-256, and an emptyother_files.Other warning and guidance strings checked for item 1. I checked every string the delivery code can give against the records in every case where it can be emitted.
Changed:
result-file-unverifiedsaid the result "was written to" the file, which is not established when a write also failed. It now says "was sent to".output-write-failed,spill-write-failed) said the result "could not be written in full". That is inexact for a file of the right length with different bytes. They now say the file did not read back intact: it is shorter than the result or differs from it.incomplete-file-leftpointed only todata.result_file. The file can be inother_files, and the warning now says so.output-reservation-leftcalled the reservation empty even when its size could not be read. It now says so only when the size was measured. A new test checks the unknown-size case, where the entry'sbytesis null. Calling it empty regardless fails that test.Accurate as they were:
result-spilled, given only for amatchedspill;result-file-unconfirmed's statement that the file read back intact;spill-refused;spill-write-failedtexts for a failed creation and a failed hand-over;result-lost;Documentation: the SHA-256 is computed before any result bytes are written, and the
--outputreservation already exists by then. A nullsha256is reported in any delivery state. Reading back does not use the SHA-256. An uncertain file without one cannot be verified by its size. An incomplete entry's size may be null.Verification at
444438d5, under the lock, in the 2026 target:NuGetAudit=false: pass.Verify-TargetIsolationpassed.Test-CrossTargetPropagationreported only the expectedBriosa.slnxfinding.mainis still5ca27a84, so nothing was merged.Refs #445
Merge readiness (
444438d5)444438d5on its eighth pass, with no blocking finding. The earlier rounds are described above.mainat5ca27a84.444438d5, including both build-and-test jobs, both package smoke jobs and every retained-client job.result-format-failedrow should say "before result bytes are written" rather than "before any file exists", and the warning list's "failed write" shorthand should also cover a write whose bytes differ on read-back.🤖 Generated with Claude Code