Skip to content

Bind the driver to the shared wire contract and test both halves - #65

Closed
Chuccle wants to merge 7 commits into
masterfrom
claude/api-contract-alignment-28zdeb
Closed

Chuccle wants to merge 7 commits into
masterfrom
claude/api-contract-alignment-28zdeb

Conversation

@Chuccle

@Chuccle Chuccle commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Before: a 403 from the server reached the user as "The parameter is incorrect" when it should have been "Access is denied". The server sends 403 when the host denies permission, or when it refuses a path because it escapes the share root. A 416 (the read starts past the end of a file that shrank on the host) gave the same wrong error. Request lines, expected statuses and size ceilings were literals that matched server-rs only by convention.

After: 403 maps to STATUS_ACCESS_DENIED and 416 maps to STATUS_END_OF_FILE. The routes, the query key, expected statuses and size ceilings now come from the generated blorg_contract.h, which is built from the contract both repos pin. The ceilings are C_ASSERTed against it.

How

  • src/Client.c:
    • Request formats concatenate the contract macros.
    • HttpStatusToNtStatus implements the contract's error table (B04).
    • The subdirectory vector now has its correct flatcc type.
  • tests/sandbox/ContractTest.cpp, added to ClientSandbox, which build.yml already runs:
    • Each request in the contract must match the bytes on the wire exactly.
    • The flatc-encoded golden listings and entries go through the real receive path and must decode to the declared values. That includes u64 extremes, a surrogate-pair name, and an empty directory.
    • The status table is checked.
    • Chunked framing must be refused.
  • tests/guest-suites/Contract.ps1 and tests/guest-suites/Contract.corpus/ form a suite for the Scripted Windows test guest on KVM/QEMU for driver runtime tests #64 test guest. It can also be run by hand against any server:
    • The corpus is exactly the tree the wire probe seeds. The test host serves it as Contract\, and lists it in -CorpusManifest.
    • The suite reads the corpus back through the mounted drive: the listing, byte-identical reads either side of the 8 MiB resident limit, and FileNotFound for a missing file.
    • It then runs the live wire probe against the server.
    • The suite can't change a file on the server's host, so the checks that need one (B08 after a change, and B11) stay in server-rs CI, where the probe gets -SeedRoot.
    • B09 (case sensitivity) is reported as INFO.
  • tests/README.md documents the contract tests, how to run the suite by hand, and how to change the contract.
  • .github/workflows/contract.yml is a new file. It fails in three cases:
    • A driver behaviour has no tagged sandbox test.
    • The corpus drifts from what the pinned probe seeds.
    • A guest suite doesn't parse under Windows PowerShell 5.1.
  • third_party/schemas and third_party/server-rs move together, so Package the driver with server-rs as one versioned build #63's package pins check stays green. Both pins compile schemas 6f22f48.

Landing order. This PR includes #63 as a merge, so its diff shows #63's files until #63 lands. The base stays master so that build.yml and contract.yml run.

  1. Merge Make this repo the full server-rs ↔ BlorgFS contract schemas#1 with a merge commit, not squash or rebase. That keeps the pinned 6f22f48 on schemas master.
  2. Merge Bind the server to the shared wire contract and test it over a socket server-rs#153, also with a merge commit, so the pinned 65f414a stays on server-rs master.
  3. Merge Package the driver with server-rs as one versioned build #63.
  4. Merge this PR.

If either upstream PR is squashed instead, re-pin here to the resulting master commit before merging.

@Chuccle Chuccle self-assigned this Oct 3, 2026
Pin server-rs as third_party/server-rs and build both in build.yml:

- pins: fails when the driver's schemas submodule and the pinned
  server-rs's schemas submodule point at different commits.
- server: builds server-rs for x86_64-pc-windows-msvc from the pin,
  with flatc built from server-rs's own flatbuffers submodule.
- package: assembles the test-signed driver, its install scripts and
  server-rs.exe with a manifest.json of the exact commits, uploaded as
  the stable blorg-package-windows-x64 artifact; a v* tag matching
  VERSION publishes it as a release.

Dependabot now groups the schemas and server-rs bumps into one PR. Also
uploads the staged driver package dir, and fixes the binlog upload path,
whose trailing comment was part of the pattern.
@Chuccle
Chuccle force-pushed the claude/api-contract-alignment-28zdeb branch from 7af8f02 to 439af9e Compare October 3, 2026 21:56
@Chuccle
Chuccle changed the base branch from master to claude/unified-packaging-kpzjo8 October 3, 2026 22:00
…by id

Move the server half of the package (flatc from server-rs's own
submodule, then cargo build --release --locked) into
tools/Build-BlorgServer.ps1, and have build.yml's server job call it, so
other tooling can build the package's server the same way instead of
copying the steps.

workflow_dispatch now takes an optional correlation_id that is echoed
into the run name, so a caller that dispatches build.yml can find its
own run and read the blorg-package-windows-x64 artifact from it.
@Chuccle
Chuccle changed the base branch from claude/unified-packaging-kpzjo8 to master October 3, 2026 22:08
The driver's request lines, expected statuses and size ceilings were
literals that only matched server-rs by convention. They now come from
third_party/schemas/generated/blorg_contract.h, generated from the
contract.json both repos pin, so a route or status that changes on one
side without the other fails to build.

Two behaviours were wrong against the contract and are fixed here: a 403
from the server (permission denied on the host, or a path it refuses as
escaping its root) surfaced as STATUS_INVALID_PARAMETER instead of
STATUS_ACCESS_DENIED, and a 416 (the read starts past a file that shrank
on the host) did too, instead of STATUS_END_OF_FILE. The subdirectory
vector in HttpDeserializeDirectoryInfo was also declared with the
file-entry vector type; same representation, wrong name.

tests/sandbox/ContractTest.cpp checks the driver's half: the contract's
exact request bytes on the wire, the flatc-encoded golden fixtures decoded
through the real receive path, the status table, and refusal of chunked
framing. tests/guest-suites/Contract.ps1 runs the live wire probe against
the guest's server and reads the same tree back through the mounted drive.
contract.yml fails if a behaviour the driver is responsible for has no
tagged test.
MSVC rejects the STATUS_* constants (unsigned long in the sandbox headers)
as a narrowing conversion inside a braced StatusCase initialiser (C2397).
The guest's server runs on the KVM host, which the guest cannot write
to, so Contract.ps1 no longer seeds the served tree. The tree is
committed as tests/guest-suites/Contract.corpus (exactly what the
pinned probe seeds), served as Contract\ and listed in -CorpusManifest.
The checks that change a file on the host stay in server-rs CI, where
the probe gets -SeedRoot. contract.yml fails if the corpus drifts from
the probe.

Moves third_party/schemas and third_party/server-rs together, to the
probe with -ProbeDir and the server-rs commit that pins the same
schemas, so the package pins check stays green.
@Chuccle
Chuccle force-pushed the claude/api-contract-alignment-28zdeb branch from ac8f001 to c3f0bfe Compare October 3, 2026 22:14
They describe the contract tests and how to run them by hand, which
belongs beside the tests rather than in AGENTS.md.

Chuccle commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner Author

Superseded: no separate contract machinery. API breakage between the driver and server-rs is caught by the driver's runtime tests in a Windows guest against the packaged server (#70).

@Chuccle Chuccle closed this Oct 4, 2026
@Chuccle
Chuccle deleted the claude/api-contract-alignment-28zdeb branch October 4, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant