Skip to content

Implement attach-only Briosa.Cli.exe (JSON CLI and local stdio MCP) for SA 2026.1.0529.7 #445

Done

Description

@davidalucas

Part of #440. Architecture record: Discussion #9.

Goal

Deliver the initial attach-only, observe-only-lifecycle, read-only inspection MVP of Briosa.Cli.exe inside the targets/2026.1.0529.7 Windows x64 server package, providing both a JSON-first CLI and a local stdio MCP server from one shared dynamic protobuf engine.

Scope

  • Implement Briosa.Cli.exe under targets/2026.1.0529.7/src/ using compiled Briosa.Protocol descriptors (for strict JsonParser/JsonFormatter with preserved snake_case field names) and bundled descriptor/briosa.protoset (for documentation metadata).
  • Attach-only, observe-only lifecycle:
    • Attach to an existing local loopback Briosa.Server.exe (e.g., managed by Briosa.ControlCenter.exe); do not spawn or stop servers or mutate SDK lifecycle state in MVP.
    • Validate exact SA target (2026.1.0529.7), compatibility contract (>= 3.2 for caller narrowing), and server identity on connect; invalidate the session on disconnect/restart and require explicit reattachment.
  • MCP surface (Briosa.Cli.exe mcp, UTF-8 no BOM, JSON-RPC-only stdout, separately drained stderr):
    • briosa_status: Server info, SA/SDK states, configured_spatial_analyzer_interaction_mode (warning explicitly when not Silent, Handle state-triggered modal dialogs that block MPs until an operator clicks OK #313), active admission_profile, policy_fingerprint, and explicit metrology context guidance.
    • briosa_list_categories: 20 MP service categories with admitted/denied counts.
    • briosa_search_operations: Paginated search over operation_id, mp_step, rpc, category, effect, and risk flags; supports include_denied with PolicyDenialDetails.
    • briosa_describe_operation: Emits JSON Schema, risk flags, replay_safety, execution_scope, duration_class, validation_status, OperationRequestOptions warnings (including omission-activated UI), and requiredness/workflow notes.
    • briosa_query: Strictly read-only execution (readOnlyHint: true) sending the server-enforced caller-narrowing header (read-only, deny interactive_ui).
  • Companion JSON-first CLI:
    • status, ops categories|search|describe, call <operation_id> (--json | --input) [--output], and mcp.
    • Deterministic structured exit codes distinguishing local validation rejection, policy/lifecycle denial, completed MP failure, PartialSuccess (MP code 4), unavailable completion evidence (transport drop/cancel), and confirmed StartedOutcomeUnknown / failed output-file write.
  • Safety, output bounding, & packaging:
    • Pinned exhaustiveness test mapping every registered operation to exactly one bridge tier.
    • Inspect MpExecutionDetails on every OK response and surface PartialSuccess and per-output retrieval states prominently.
    • Enforce a model-facing output size cap (preserving full gRPC receive allowance) with bounded summary stats and an optional local spill-to-file session handle; never replay an MP to paginate.
    • Ship a copyable exact-path MCP config snippet and one tested end-to-end inspection workflow.
    • Include Briosa.Cli.exe in New-WindowsPackage.ps1, ReleasePackageSigning.psm1 selection tests, Test-WindowsPackage.ps1, and eng/licenses/reviewed-windows-evidence.json.

Acceptance Criteria

  • Briosa.Cli.exe builds, signs, and passes deterministic double-build verification inside the 2026.1.0529.7 Windows ZIP.
  • Pinned tier-partition and dynamic-JSON round-trip tests cover all 1,018 registered operations.
  • Packaged fake-worker conformance suite verifies stdio MCP initialization, tool calls, PartialSuccess, field-level validation errors, policy denials, malformed/missing trailers, 0.10.0 vs. 3.2 server metadata, hostile SA strings, and spill/output-write failures.
  • Explicitly authorized scripted local licensed SA smoke check verifies real status, discovery, and read-only inspection without model-driven test execution.

Refs #440.

Activity

  1. added
    enhancement
    area: testing
    area: protocol
    on Nov 26, 2026
  2. davidalucas commented on Nov 27, 2026

    @davidalucas
    ContributorAuthor

    Inputs from the packaging spike (2026-11-27)

    The spike for #441 is done; its full report is on that issue and the proof of concept is on the unmerged branch https://github.com/spatialanalyzer/briosa/tree/441-cli-packaging-spike (e0c12503ce67458a8c2ec5fb477aee7a377980ac). It found no blocker. These are the points this issue has to carry.

    Recommended layout (awaiting the maintainer's confirmation). Briosa.Cli.exe at the package root, built on ModelContextProtocol.Core 2.4.0, with a framework reference to Microsoft.AspNetCore.App so it resolves the same runtime-pack files as the server, and the existing central System.Diagnostics.DiagnosticSource 11.0.0 pin. Measured cost: about 0.73 MB of ZIP, with the server, worker and Control Center files byte-identical to a package without the CLI. The runner-up, a self-contained cli/ subfolder, costs about 40.7 MB.

    Requirements taken from the spike's follow-ups. They are tracked here instead of as separate issues:

    1. Runtime-pack alignment. The root layout works only while the CLI and the server publish byte-identical shared files with the same owners in the publish receipts. Copy-PublishTree already fails the package build when they differ; the packaging pull request must keep that guard for the CLI and say so in docs/operations/windows-package.md, so that a .NET servicing or DiagnosticSource update that breaks alignment fails CI rather than shipping.
    2. License evidence. The CLI adds two shipped packages: ModelContextProtocol.Core 2.4.0 (Apache-2.0; the nupkg carries neither license nor notice text, so both come from the pinned source commit 4cbf42ef107763f0bc75c358af8cb2dfe47a769a) and Microsoft.Extensions.AI.Abstractions 10.11.0 (MIT; no license text in the nupkg). eng/WindowsPackageNotices.psm1 needs to accept a reviewed source notice, and eng/licenses/reviewed-windows-evidence.json needs the identity rows and three texts. The upstream MCP license records an MIT-to-Apache-2.0 transition; the maintainer reviews these evidence entries in the packaging pull request.
    3. Signed package in release CI. Verify the signature on Briosa.Cli.exe and Briosa.Cli.dll and run the packaged fake-worker CLI scenarios in release.yml before a draft is created. Do not add the CLI to the unconditional required list in eng/ReleasePackageSigning.psm1: that would reject the 2024.1.0508.5 package and earlier releases.
    4. Operation descriptions. The descriptor set carries comments for only three RPCs, one of them an MP operation. briosa_describe_operation and search therefore describe an operation by its mp_step (Expose mp_step in DiscoveryService/ListCapabilities and bundle briosa.protoset in server packages #444), its JSON Schema from the compiled descriptors, and its reviewed classification. The CLI does not need descriptor/briosa.protoset at run time; the compiled Briosa.Protocol descriptors agree with it for all 25 files, 23 services, 1,029 RPCs and 2,148 messages.

    Also established. Strict proto3 JSON with preserved field names round-tripped all 2,036 request and result types of the 1,018 registered operations (4,072 default and populated cases, no failures), and a unary call made from a method name and a JSON body alone worked against the fake worker, including reading OperationError from the trailers.

  3. davidalucas commented on Nov 27, 2026

    @davidalucas
    ContributorAuthor

    Independent review of the spike recommendations (2026-11-27)

    A separate GPT 6.2 Astra session reviewed the spike for #441 adversarially, from the branch, the run logs, the built packages and the restored nupkgs. It agrees with the package-root layout and with using ModelContextProtocol.Core, and adds the requirements below. They extend, and in point 4 correct, the earlier comment #445 (comment). It did not rebuild packages or run a server.

    Decide before call or briosa_query is declared complete

    1. The JSON input contract is not strict by default. Loading the packaged Google.Protobuf and Briosa.Protocol and using the spike's parser settings, the reviewer observed:

      • {"decimalPrecision":"7"} is accepted and becomes {"decimal_precision":7} (camelCase alias and a numeric string);
      • {"overwrite_existing_file":null} becomes {}, so an explicit null silently turns into omission;
      • supplying both event_list and eventList concatenates the two arrays;
      • a duplicated enum field keeps the last value, while a duplicated optional scalar throws.

      Omission has operational meaning for some reviewed request options (OperationConditionalOptions.cs), so null-as-omitted and alias handling are safety-relevant. The bridge must define the accepted input forms, publish them in describe, enforce them before the protobuf parser runs (reject duplicate logical fields, null, and names other than the exact proto field names; bound size and depth before dispatch), and test the same cases through both the CLI and MCP. Server policy stays authoritative.

    2. A schema derived from protobuf presence misstates what is required. Example: GetIthPointFromGroupRequest.group_name is optional in the proto, but the handwritten operation maps it with CollectionObjectNameMapper.Required, so omitting it is rejected. describe must not present protobuf presence as requiredness. It either carries reviewed exact-target requiredness and workflow guidance, or says plainly that requiredness is not described and that the server names the offending field on rejection (Add value-free field-level validation detail to OperationError #442). No second operation registry and no reproduced vendor text.

    Require before the package is distributed

    1. Runtime alignment is a servicing commitment, not only a build check. The byte and owner checks stop a misaligned package but do not prove the next release can build. Run both products' packaged smoke paths on dependency-update pull requests. If a future MCP SDK needs shared files the server's runtime pack does not provide, move the CLI to an isolated subfolder rather than changing server dependencies to suit it. Isolation was only priced for the full SDK (about 40.7 MB); a Core-only isolated layout was not measured.
    2. Signing must also assert presence. The selector signs the CLI when it is there; nothing fails when it is absent. Require Briosa.Cli.exe and Briosa.Cli.dll at their exact paths in the 2026 package test and again in the final signed archive, and run the fake-worker CLI and MCP scenarios against that final archive before the draft release is created.
    3. License evidence: one addition. The declarations are right (Core 2.4.0 Apache-2.0, Microsoft.Extensions.AI.Abstractions 10.11.0 MIT) and the proposed texts match the pinned upstream files. The shipped Core DLL also compiles in System.Net.ServerSentEvents sources that credit MIT-licensed dotnet/runtime code; the proposed notice already contains those terms, but the evidence should record that source-to-component relationship. The notice gate should assert the expected attribution for the shipped Core identity, so that a different validly hashed notice or a later version cannot pass unreviewed.
    4. Restore the Control Center ownership check in CLI-enabled package runs; the spike skipped it locally.

    Test gaps to close in the pinned round-trip test

    1. The sweep (1,018 methods, 2,036 types, 4,072 cases, reproduced by the reviewer) takes only the first arm of each real oneof, and counts discovered methods without comparing them to the handwritten registry, so shrinking discovery would shrink coverage silently. Compare the method set with SpatialAnalyzerApi.Operations, cover every oneof arm and conflicting selections, and add fixtures if maps, bytes or well-known types ever enter the schema (none today). In conformance, assert MP result, disposition and replay fields explicitly, including missing and malformed trailers.
    2. MCP protocol coverage. The spike exercised only initialize and EOF. Before release, drive the packaged executable with an independent client or recorded transcripts through initialization completion, tool listing, a tool call, an error and a cancellation.

    One point about evidence

    The byte-identical comparison (866 existing paths unchanged, only files.sha256 and licenses/index.json differing, +729,163 bytes) was made between packages built at d947d95c. The package used for the double-build and timing was built at a later spike commit, so it has no same-revision baseline. The original comparison stands; the two results are separate evidence.

  4. davidalucas commented on Nov 27, 2026

    @davidalucas
    ContributorAuthor

    Maintainer decisions (2026-11-27)

    1. Layout confirmed: Briosa.Cli.exe at the package root on ModelContextProtocol.Core 2.4.0, as described above. Spike: Validate Briosa.Cli.exe packaging, signing, MCP SDK notices, and dynamic protobuf JSON round-trip #441 is closed.
    2. Requiredness in describe: the first release states plainly that requiredness is not described by the schema, and does not present protobuf optional as "not required". A rejected call names the offending field through the validation detail from Add value-free field-level validation detail to OperationError #442. Publishing reviewed requiredness in discovery is not part of this Epic; it would touch the open decision in Decide MP omission and default semantics for optional and risky arguments (D2) #243.
    3. Strict input: the CLI and MCP accept exact proto field names only, and reject null, duplicate fields and unknown fields before the protobuf parser runs.
  5. moved this from Todo to In Progress in Briosa Roadmap & Deliveryon Nov 28, 2026
  6. davidalucas commented on Nov 28, 2026

    @davidalucas
    ContributorAuthor

    Slice A surface approved (2026-11-27)

    The maintainer approved the public surface of #465 as its description states it, and these choices:

    • Enum input by exact name only; numbers are rejected.
    • The endpoint must be a loopback IP literal; localhost and other hostnames are rejected, as the server rejects them.
    • A default inline cap of 64 KiB for the CLI. The MCP cap is decided in the MCP slice.
    • Spill files are not deleted automatically in the read-only release. Expiry is added with controlled mutation in Add controlled mutating execution, async long-running handles, and replay interlock to Briosa.Cli.exe #446.
    • --output never overwrites an existing file; it is created before the call.
    • One connection per session, so a server that replaces the verified one on the same port cannot be called unverified.
    • Tests read SpatialAnalyzerApi.Operations and the discovery builder by reflection for now, to avoid a server change in this slice.
    • Exit codes split validation (7) from other not-started outcomes (6), and unreachable (4) from incompatible (5).
  7. davidalucas commented on Nov 28, 2026

    @davidalucas
    ContributorAuthor

    Slice A merged (2026-11-28)

    #465 merged as the commit now at the head of main: the Briosa.Cli project, the shared engine, and the commands status, ops categories, ops search, ops describe and a read-only call, for SA 2026.1.0529.7. It went through eight independent review passes; the last approved the final head, and all 35 CI checks passed on it.

    What later slices must carry from the review:

    • Documentation corrections in docs/operations/briosa-cli.md: the result-format-failed row 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.
    • Result delivery, stated limits (documented on that page): the delivery invariants apply to calls that end with an envelope, so a process killed mid-delivery can leave a partial file that no envelope names; two faults on the same file at once are not in the fault matrix; a close error and a hand-over path mismatch can only be injected, not produced.
    • Unknown cause: on GitHub's hosted runner (an elevated administrator account), an earlier version of the "spill changes nothing already in results" test saw a pre-existing file's access entry change from inherited to explicit. The product code was judged, with high confidence, unable to cause it, and the rewritten test passes there; what rewrote the entry was never established.
    • MP code 4: the CLI treats MP code 4 reported as a failure as conflicting evidence for any served read, because none of the server's four code-4-as-failure operations is in the read_only tier (pinned by a test). The mutating tier in Add controlled mutating execution, async long-running handles, and replay interlock to Briosa.Cli.exe #446 must revisit this.
    • Spill retention: spill files are not deleted automatically; expiry is to be added with Add controlled mutating execution, async long-running handles, and replay interlock to Briosa.Cli.exe #446.

    Not yet done for this issue: the mcp command (slice B), packaging, signing, notices and packaged fake-worker conformance (slice C), and the licensed smoke check (slice D).

  8. 21 remaining items

  9. davidalucas commented on Nov 29, 2026

    @davidalucas
    ContributorAuthor

    Slice C merged (2026-11-29)

    #473 merged as 1fb8281e: Briosa.Cli.exe is in the 2026.1.0529.7 Windows x64 server package. All 35 checks passed on the merged head 561ba05d.

    What is on main now

    • Package. Briosa.Cli.exe, Briosa.Cli.dll, Briosa.Cli.deps.json, Briosa.Cli.runtimeconfig.json, ModelContextProtocol.Core.dll and Microsoft.Extensions.AI.Abstractions.dll sit at the package root and share the server's runtime files. The build fails, naming the file, if a file two publishes share differs, and refuses hidden or system files. The server, worker and Control Center files are byte-identical to before; the archive goes from 867 to 876 entries. The 2024.1.0508.5 package is unchanged.
    • Signing selection. Briosa signs Briosa.Cli.exe and Briosa.Cli.dll (16 first-party files for 2026, 14 for 2024). The release workflow fails if the signed 2026 archive lacks a validly signed, timestamped CLI. ModelContextProtocol.Core.dll ships unsigned, like the eight unsigned third-party DLLs the package already ships.
    • License notices. Reviewed evidence and texts for ModelContextProtocol.Core 2.4.0 (Apache-2.0, with its upstream license and third-party notices) and Microsoft.Extensions.AI.Abstractions 10.11.0 (MIT). The three texts were compared with upstream at the pinned commits. The evidence states what is not established about the attribution of code compiled into the two DLLs.
    • Packaged scenarios. targets/2026.1.0529.7/eng/Test-CliScenarios.ps1 and PackagedCliTests run the packaged CLI and MCP server against the packaged server with its fake worker and against a test server, in CI and in release validation. They cover MCP initialization and all five tools, partial success, a field-level validation rejection, policy denials, malformed and missing trailers, servers below 3.2 refused, hostile strings, a spilled result and an output-write failure, and an MCP cancellation with reattach. Every process they start runs with a profile the script creates, so the real per-user results directory is never written.
    • Documentation. An MCP host configuration snippet with the installed path, an end-to-end inspection walkthrough, and what each command needs (nothing, a Briosa server, or a connected SpatialAnalyzer).
    • Text corrections. The three CLI wording points recorded above, and "measured values, not every result, are in the working frame" in four product texts.

    Maintainer decisions during this slice (2026-11-28 and 2026-11-29): license evidence accepted; the MCP DLL ships unsigned; the conformance package's server folder stays a verbatim copy and so carries the CLI; no release job runs scenarios on the signed archive (they are run on the signed draft in acceptance); the signed-CLI check stays in the sign job; the package smoke job's limit is 25 minutes.

    Review. Three independent review passes. The package, signing, notices, policies and scenarios were confirmed; the last pass requested harness and wording changes only. The maintainer decided to merge after the small ones, with the rest tracked in #474; the read of the final diff is recorded on the pull request.

    Acceptance criteria

    • Criterion 2 (tier partition and round-trip tests over all 1,018 operations): met by slice A.
    • Criterion 3 (packaged fake-worker conformance suite): met by this slice; the pull request maps each phrase to its scenario.
    • Criterion 1 (builds, signs, deterministic double build): the build and the double build are verified in CI. Signing of the two CLI files is proven only by a real release run; it stays open until the first release that ships the CLI.
    • Criterion 4 (licensed smoke check): not started. It needs the maintainer's explicit authorization.
  10. davidalucas commented on Nov 30, 2026

    @davidalucas
    ContributorAuthor

    Licensed smoke check passed (2026-11-29)

    The scripted smoke check of the packaged CLI and stdio MCP server (#475) passed all 26 steps against a licensed SpatialAnalyzer 2026.1.0529.7. The maintainer authorized the run and prepared the station; the script ran once, unattended, with no model choosing or interpreting steps.

    What ran

    • Script commit 86a6312fc7727a8b546a3800850e91e3bc37c679, checked by the script against the checkout before it started.
    • Briosa.Cli.exe from a local unsigned package built from main at 1fb8281e2a31e3a7a44ab81864660a8f47924c5f (0.10.3-dev.445). The pull request changes no product source, so this is the CLI the branch would package.
    • Server: the released 0.10.2 (5ca27a84ed7f80e7dd12cc0e6c0238e71090421e) on loopback, started and connected by the maintainer through the Control Center, standard admission profile.

    What the server reported at step 1

    • Ready for MP, worker ready, execution ready.
    • Activated SDK 2026.1.0529.7, verified at runtime, exact match.
    • Connected SpatialAnalyzer 2026.1.0529.7, operator attestation, exact match.
    • Interaction mode unchanged. The script records this as a warning, not a failure; none of the six calls requests a dialog.

    Result

    Steps What Outcome
    1–3 CLI status, ops categories, ops search succeeded
    4–10 MCP start, initialize, tools/list, status, categories, search succeeded
    11–18 Describe eight operations (CLI and MCP) succeeded
    19–21 CLI call: number of collections, active collection name, active units (result delivered to a file, as required) completed, MP code 2
    22–24 MCP briosa_query: collection name by index, working frame properties, defined report tags completed, MP code 2
    25 CLI call of a mutating operation refused locally by the CLI, exit 3, nothing sent
    26 MCP briosa_query asking for a results dialog denied by the server before dispatch
    • 233 checks recorded; 232 passed. The one that did not is the non-fatal interaction-mode warning above.
    • Discovery through the real server: 20 categories, 1,018 operations, 184 in the read-only tier, all 184 admitted by the server.
    • Nothing was retried. The temporary profile was removed and the real per-user results directory was unchanged.

    An earlier run the same day stopped at step 1

    The first run stopped before any MP call because the server reported it was not ready for MP: the connected SpatialAnalyzer version had not been supplied. The script labelled it "not started" and made no further request. That finding is tracked in #476. Both runs' evidence files are kept by the maintainer outside the repository, as the script requires.

    Limits of this evidence

  11. davidalucas commented on Nov 30, 2026

    @davidalucas
    ContributorAuthor

    The CLI builds reproducibly and is signed in the 0.11.0 release run (2026-11-29)

    The Server 0.11.0 release run (https://github.com/spatialanalyzer/briosa/actions/runs/46336324995, main at e0f64975ed676c9ed9bc5942fd04fc65103b8a73) gives the proof for the first acceptance criterion.

    Build job — Build SA 2026.1.0529.7 products:

    • "Build twice and verify package" succeeded. This step builds the Windows package twice, requires identical archives, checks the CLI files and their place in the layout, and starts the packaged CLI.
    • "Run packaged CLI and MCP scenarios" succeeded on that same package.

    Sign job — Sign SA 2026.1.0529.7 product:

    • "Verify transferred product digest" succeeded: the package that was signed is the one the build job verified.
    • "Sign verified Windows product" and "Verify final archive and retain developer artifacts" succeeded.
    • "Verify the signed CLI in the final archive" succeeded: Briosa.Cli.exe and Briosa.Cli.dll carry valid, timestamped signatures in the released ZIP.

    The signed package is attached to the draft release as briosa-0.11.0-sa-2026.1.0529.7-win-x64.zip, SHA-256 624d195785487d81798ad2016ceaf635351026222eb61fed5713e5af6dbe37fb.

    The double build proves reproducibility of the unsigned input; the signing and final-archive steps prove that this input's CLI is in the signed package. Acceptance of the signed draft, including a second licensed smoke check with the signed CLI, is tracked in #486. This issue stays open until the release is published.

  12. davidalucas commented on Nov 30, 2026

    @davidalucas
    ContributorAuthor

    Released in Briosa Server 0.11.0. Briosa.Cli.exe ships signed in the SpatialAnalyzer 2026.1.0529.7 Windows package, and the licensed smoke check passed with the signed CLI against the signed server on 2026-11-30 (recorded on #486). All four acceptance criteria are met.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: protocolarea: testingenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions