foundationdb-dotnet-client
CLAUDE.md159 starsChanged 20 days agoBSD-3-ClauseView on GitHub
Guidance for AI agents (and humans) working in this repository. If you are instead trying to use this library in your own application, read the skills under .claude/skills/, they are written for consumers and are the canonical guide to the key/value and transaction APIs. A C#/.NET binding for FoundationDB (a distributed, ordered key/value store), plus the general-purpose libraries it is built on. The main solution is FoundationDB.Client.slnx (the new XML .slnx format). Current version: see Common/VersionInfo.props (7.4.x). The repo holds…
In this repository9 other files it gives its agents.
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 66
Test classes use the *Facts naming convention (e.g.
- Very specific: line 190
Don't break public surface casually.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Guidance for AI agents (and humans) working in this repository. If you are instead trying to use this library in your own application, read the skills under .claude/skills/, they are written for consumers and are the canonical guide to the key/value and transaction APIs.
What this repository is
A C#/.NET binding for FoundationDB (a distributed, ordered key/value store), plus the general-purpose libraries it is built on. The main solution is FoundationDB.Client.slnx (the new XML .slnx format). Current version: see Common/VersionInfo.props (7.4.x).
The repo holds two distinct product families:
SnowBank.*, general-purpose foundation, not FoundationDB-specific.SnowBank.Coreis the bedrock (Slices, the Tuple encoding, the CrystalJson stack, collections, async LINQ, UUIDs). AlsoSnowBank.Shell,SnowBank.Serialization.Json.CodeGen(a Roslyn source generator),SnowBank.Networking.*,SnowBank.Testing.*.FoundationDB.*, the actual binding.FoundationDB.Clientis the core (native interop, transactions, keys/values, subspaces, the Directory layer, tenants, DI).FoundationDB.Layers.Commonholds demo layers (Map, Index, Vector, Queue, Counter, Blob, …). Aspire, FakeDb, Testing, BindingTester, and theFdb*tools sit around it.
Dependency direction (do not invert)
SnowBank.Core ◄─ FoundationDB.Client ◄─ FoundationDB.Layers.Common ◄─ Layers.Experimental, Linq.Providers
▲
SnowBank.Shell, SnowBank.Networking.*, SnowBank.Testing.*, SnowBank.Serialization.Json.CodeGenSnowBank.Core has no project references and must never depend on FoundationDB. FoundationDB.Client depends only on SnowBank.Core. Tooling/tests reference downward only.
Build & test
dotnet build FoundationDB.Client.slnx # DEBUG build of everything
dotnet test <Project>.csproj -f net11.0 # ONE suite; always scope the TFM, see "Tests"- New machine: the prerequisites (SDK, extra runtimes, Docker, the native client download) are in the README sections How to build and How to test, verified on Linux. Read them before setting up a host or diagnosing a missing prerequisite.
- SDK: pinned in
global.jsonto a .NET 11 preview SDK (rollForward: latestMinor).LangVersionispreview. - Target frameworks: libraries multi-target
net11.0;net10.0;net8.0(seeDirectory.Build.props). Each project builds once per target. Several projects also build anetstandard2.0"lite" variant, see The netstandard2.0 / net472 "lite" targets below; keeping it green is part of any change to those projects. - Build output goes to
artifacts/(ArtifactsPath), not per-projectbin/obj. - Central package management: all versions live in
Directory.Packages.props. Add/bump packages there, not in.csprojfiles. Version policy: this SDK is a BOM for downstream applications, each pin should be the latest version that still supports its TFM bucket (the .NET platform wave is multi-TFM, so net8/net9/net10 usually share one version; ASP.NET Core packages are single-TFM and stay capped per bucket). Deliberate exception:Microsoft.CodeAnalysis.*stays low, because it sets the minimum Roslyn/SDK for consumers of theSnowBank.Serialization.Json.CodeGensource generator. - As a submodule: a parent repo can override targets via
CoreSdkVersions(or the finerCoreSdkRuntimeVersions/CoreSdkToolsVersions/CloudSdkRuntimeVersions), and disable the lite targets viaCoreSdkNetStandardEnabled=false, in its ownDirectory.Build.props. The override import is gated on a.gitfile check; bypass withFDB_BUILD_PROPS_OVERRIDE=1. - Standalone (isolated) build: to build, test, or pack THIS repo with its own COMPLETE target set (net8/net10/net11 + netstandard2.0 + the net472 validation targets) while it sits under a target-trimming parent, force
CORESDK_STANDALONE_BUILD=true, which makesDirectory.Build.propsignore the parent import. Pass it as an MSBuild-p:property, NEVER as an$env:/export: a persistent env var leaks into the shell and silently forces every laterdotnetcommand into a standalone build (this bit us once; the pack/build scripts were fixed to pass-p:). Usescripts/build.ps1/scripts/build.shfor an isolatedrestore+clean+build, andscripts/pack.ps1/scripts/pack.shfor packaging (packing MUST be standalone, or the.nupkgships an incomplete target set). - Shared-restore gotcha:
restorewritesartifacts/obj/**/project.assets.jsonfor whatever mode it ran in, and that state is shared.restore,build, andcleanMUST use the SAME mode; mixing them fails withNETSDK1005("assets file doesn't have a target for <TFM>"). After a standalone build, the parent must re-rundotnet restoreto reset the submodule's assets to its trimmed set (and vice-versa); to switch modes cleanly, re-rundotnet restorein the target mode (or wipeartifacts/obj). - Analyzers in the build: the AoT-compatible libraries (
IsAotCompatible:SnowBank.Core,FoundationDB.Client, the layers) run their analyzers in every build (Directory.Build.targets): the trim and AoT analysis, and theSBKandFDBrules of this repository. A trim warning there reaches every trimmed or Native AoT consumer: fix it, or declare[RequiresUnreferencedCode]/[RequiresDynamicCode]so callers see it, and suppress only with a justification that says why it is safe. The other projects keepRunAnalyzersDuringBuild=false;scripts/dogfood-analyzers.shruns theSBKandFDBrules over the tests and samples.
Tests
- NUnit 5 on
master, NUnit 4 onrelease/7.4, and the runner must be 64-bit (the native client is 64-bit only). Each branch builds, tests and packs against one NUnit version, which is also the minimum theSnowBank.Testing.*packages declare: NUnit 5.0.0 from 8.0, NUnit 4.6.1 on 7.4.x. - Cherry-picking a test down to
release/7.4: NUnit 5'sAssert.ThrowsAsync,CatchAsyncandDoesNotThrowAsyncreturn aTaskthat must be awaited (var ex = (await Assert.ThrowsAsync<X>(...))!;), and thatawaitdoes not compile on NUnit 4, so drop it on the release side.Assert.That(async () => ..., Throws.InstanceOf<X>(out var captured))compiles on both and needs no edit. A forgottenawaiton NUnit 5 compiles and asserts nothing: inside anasynctest the compiler warns (CS4014), inside a synchronous test only the analyzer rule NUnit2059 reports it, and test projects build withRunAnalyzersDuringBuild=false, so check with-p:RunAnalyzersDuringBuild=true. - Test order:
[Canary]runs a test first (an assumption whose failure explains the failures that follow),[RunOrder(n)]ranks basic tests before advanced ones; both come fromSnowBank.Testingand behave the same on NUnit 4 and 5. Do not use NUnit's[Order](obsolete in NUnit 5) or[DependsOnTest]to order tests: a failed dependency makes the runner drop its dependents from the results without reporting them as skipped. Ordering is not a way to share state: each test sets up its own, or uses the OnBeforeAll / OnBeforeEach hooks. - ⚠️
global.jsonopts into the MTP mode ofdotnet test("test": { "runner": "Microsoft.Testing.Platform" }) and that opt-in is load-bearing: these projects use the NUnit MTP runner, and MTP v2 refuses to run under the old VSTest bridge on the .NET 10+ SDK, failing with "Testing with VSTest target is no longer supported by Microsoft.Testing.Platform". Every test project declaresEnableNUnitRunner=truein its OWN.csproj, next toIsTestProject,IsPackable=falseandRunAnalyzersDuringBuild=false, so all targets use MTP uniformly. This block is deliberately per-project and NOT shared fromDirectory.Build.props: a shared block can only be conditioned on the project name, and a test project is not required to be named*.Tests. A new test project must carry the block, or it falls back to VSTest and exits 0 having run nothing, which is indistinguishable from a passing suite. - Scoping
dotnet testto a single project and TFM (dotnet test <Project>.csproj -f <tfm>) is the standard invocation. A solution-widedotnet test FoundationDB.Client.slnxis not supported (MTP requires every project in the run to use the same runner, and the solution includes non-test projects). - Running the assembly directly also works and skips the build, which is faster in a tight loop:
dotnet artifacts/bin/<Project>/debug_net11.0/<Project>.dll, filtering with--filter "FullyQualifiedName~<NamePart>"(not--treenode-filter) and--output Detailedfor per-assert output. The same--filterworks throughdotnet test, with or without the--separator. - ⚠️ Exclude the benchmark categories from normal suite runs: append
--filter "TestCategory!=LongRunning&TestCategory!=Benchmark". The benchmark fixtures are correctly categorised and interactive runners filter them by default, an agent running the assembly UNFILTERED is the only consumer that pays for them (measured:SnowBank.Core.Testsnet10 5m19s → 4s, net472 6m20s → 8s, keeping 98.4% of tests). Two exceptions: benchmarks stay runnable on purpose via--filter "TestCategory=Benchmark", and a run whose subject needs GC/allocation pressure (e.g. the SliceReader GC-safety detector) runs unfiltered, a filtered run is structurally blind to that class. SnowBank.*.Testsare pure and need no database.FoundationDB.Testsrequires a running local FoundationDB cluster and the nativefdb_clibrary (libfdb_c.dylibon macOS,libfdb_c.soon Linux,fdb_c.dllon Windows).FoundationDB.Client.Nativeredistributes these.- ⚠️ Tests write to a dedicated subspace but can corrupt data, only point them at a throwaway local cluster.
- Client, server and API versions of a real-cluster run. A native client only connects to a server of its own major.minor version, and the API version is selected once per process. Three environment variables set the combination of a test process:
FDB_TEST_NATIVE_LIB_PATH: the native client library (file or folder). Default: the copy in the test output folder, which is the versionDownloadBinarieslast fetched intoFoundationDB.Client.Native/runtimes/.FDB_TEST_DOCKER_TAG: thefoundationdb/foundationdbserver image. Default: the client version (an 8.0.1 client runs against the 8.0.1 image). With a tag of another major.minor, the fixture fails at once (except the[Explicit]mismatch fixtures).FDB_TEST_API_VERSION: the API version. Default: the highest version of both the binding and the client (800 for an 8.0 client onmaster, 740 for a 7.4 client).- A plain
dotnet testsets none of them, so it runs the newest client of the branch, its own server image, and the highest API version.
- Other combinations:
scripts/test-fdb.ps1(Linux and macOS:scripts/test-fdb.sh). Each run uses the test assemblies as built: build the test projects first. Each client version is cached underartifacts/native/<version>/, for the current platform only, and the cached files are checked againstmanifest.jsonbefore each run. Examples:scripts/test-fdb.ps1 -Client 7.4: the newest 7.4 client of the manifest, the 7.4 server, API 740, on every project ofscripts/test-matrix.json.scripts/test-fdb.ps1 -Client 8.0 -Api 730 -Project FoundationDB.Tests -Filter "FullyQualifiedName~Tenant": one combination, one project, some tests.-Projectalso finds the test assemblies of a parent repository (ex:SnowBank.Layers.DocStore.Testsin CloudLayer).scripts/test-fdb.ps1 -Matrixruns every combination ofscripts/test-matrix.json, and-Matrix -Run 7.3-api730,mismatch-apiruns some of them. Run the full matrix before a release, and when a bug may depend on the client, server or API version.- The output of each run goes to
artifacts/test-results/fdb/<run>/<project>.txt. The log of each run names the client version, the API version and the library path. scripts/test-matrix.jsonlists the supported combinations of the branch: 7.3, 7.4 and 8.0 onmaster, 7.3 and 7.4 onrelease/7.4. A versionx.ythere means the newestx.yentry ofmanifest.json.- The mismatch fixtures (
FdbVersionMismatchFacts.cs) are[Explicit]. CategoryFdb-Mismatch-Server: a transaction times out against a server of another branch. CategoryFdb-Mismatch-Api:Fdb.Startthrows with an API version above the client maximum. Each category runs in a process of its own.
FoundationDB.FakeDbprovides an in-memory fake for tests that don't want a real cluster.- Test classes use the
*Factsnaming convention (e.g.FdbKeyFacts,TuPackFacts).
Test project layout (which tests go where)
Three test projects, split by what they exercise:
FoundationDB.FakeDb.Tests, the FakeDb emulator's OWN tests only: conformance against real FDB semantics, internals, and the differential scenario harness. Docker-free. (FdbLite's emulator tests will land here too.)FoundationDB.Tests, the client binding: transactions, keys, subspaces, values, tenants, error handling, the native handler, plus "don't know where else to put it" tests. Docker-backed (Testcontainers). The Directory-layer tests (DirectoryFacts,FdbPathFacts) live here and are SPECIAL: they open the database manually at the root, because a test of the Directory layer cannot use the Directory-layer-based partition helper (that would test the layer through itself).FoundationDB.Layers.Tests, the home for every LAYER suite (Layers.Common,Layers.Experimental). Each suite is written ONCE and runs against BOTH the in-memory FakeDb (fast) and a real cluster (validation).
Dual-backend pattern (see FullText/FdbTextIndexFacts.cs, and SmokeConformanceFacts for the original): a layer suite is an abstract XxxFacts : FdbTest whose bodies open an isolated partition with OpenTestPartitionAsync() and clear it with CleanLocation(db, location), backend-agnostic. Two thin concrete fixtures pick the backend:
public abstract class FooFacts : FdbTest { /* the tests, via OpenTestPartitionAsync() / CleanLocation() */ }
[TestFixture] // FAST default: in-memory FakeDb, no Docker, no native client
public sealed class FooFakeDbFacts : FooFacts
{
private FakeDbTestBackend Backend { get; } = new();
protected override bool UseRealServer => false;
[TearDown] public void ResetBackend() => this.Backend.Reset();
protected override Task<IFdbDatabase> OpenTestDatabaseAsync(bool readOnly = false) => this.Backend.OpenAsync(FdbPath.Root, readOnly);
protected override Task<IFdbDatabase> OpenTestPartitionAsync(string? testMethod = null) => this.Backend.OpenAsync(GetTestPartitionPath(testMethod));
}
[TestFixture, Explicit("Requires a local Docker daemon"), Category("RealCluster")]
public sealed class FooRealClusterFacts : FooFacts { } // inherits the real-cluster FdbTest behaviorWorkflow: iterate against the *FakeDbFacts fixtures (Docker-free, instant); then run the *RealClusterFacts fixtures (opt-in via the RealCluster category or the Unit Test Sessions UI) to validate against a real cluster. Real-cluster runs require Docker and the native fdb_c client (one-time per worktree: FoundationDB.Client.Native/DownloadBinaries.ps1 on Windows, or DownloadBinaries.sh on macOS/Linux, which needs curl + python3; pass --rid osx-arm64, or -rid win-x64 to the .ps1, to fetch only the current platform's binaries). The same suites double as a ready-made realistic test bed for a future FdbLite backend (a third *FdbLiteFacts subclass).
The netstandard2.0 / net472 "lite" targets
SnowBank.Core, FoundationDB.Client, FoundationDB.Client.Native, FoundationDB.Layers.Common, and FoundationDB.FakeDb also build for netstandard2.0 (gated by CoreSdkNetStandardEnabled, default true). This is a deliberate stopgap for applications migrating from .NET Framework 4.7.2 to modern .NET: their legacy main branch can already consume the modern APIs (Contract.NotNull, CrystalJson, Slice, subspace.Key(...)), which reduces merge pain with their modernized vnext branch. The lite build must run on the net472 CLR (including the native fdb_c interop), not just compile, and it must produce byte-identical keys/values: what is written to the database must never depend on the TFM.
Any change to these projects must keep the netstandard2.0 target building (dotnet build <proj>.csproj -f netstandard2.0). When code needs something the old BCL lacks:
- Missing BCL API with many call sites → prefer a polyfill in
SnowBank.Core/Polyfills/so call sites compile unchanged. Public extension polyfills live in theSnowBank.Compatnamespace (imported via a guardedglobal usingin each project'sGlobalUsings.cs; this includes C# 14 static extension members likestring.Create(provider, $"...")andSpan<char>.TryWrite($"...")). Statics that can't be extensions are internal*Compatclasses redirected per-file:using CollectionsMarshal = SnowBank.Compat.CollectionsMarshalCompat;under#if NETSTANDARD2_0. - Point fallback →
#if/#else/#endifwith the original implementation FIRST under#if NETX_0_OR_GREATER(X = the version that introduced the feature/API), and the fallback in#elsewith a comment on the next line stating what is missing and the cost ("X is not available, doing Y instead (which allocates)"). - Needs runtime support, cannot be polyfilled (default interface members,
static abstractinterface members, covariant return types, ref fields,allows ref struct) → guard the member out, or exclude the whole feature from the lite build (e.g.FdbValue<TValue, TEncoder>andFdbValueCodec.FixedSize, the FQLQuery/engine, the JSON source-gen proxies). - Portable
Span<T>gotchas: on netstandard2.0,Span<T>cannot wrap raw pointers/refs of types containing references or pointers (e.g.Span<FdbKeyValue>), andMemoryMarshal.CreateSpanshims only support unmanaged types, use direct pointer indexing or a temporary array instead.
Validation: net472 test targets exist on SnowBank.Core.Tests, FoundationDB.Tests, FoundationDB.FakeDb.Tests, and FoundationDB.Layers.Tests (they consume the netstandard2.0 builds and run on the real .NET Framework CLR). Test files covering excluded features are guarded with #if !NETFRAMEWORK (or <Compile Remove> in the csproj for whole folders). Run them with dotnet test <Project>.csproj -f net472 --no-build (all TFMs use MTP uniformly now), on Windows only: the net472 targets build on Linux and macOS, but dotnet test stops there with NETSDK1243 (.NET Framework runs only on Windows). On net472 the fdb test container is driven through the docker CLI (Docker.DotNet cannot run on the netfx CLR). On every TFM, a freshly created test container self-provisions its database on first start (Fdb.Provisioning.EnsureDatabaseConfiguredAsync, called from FdbServerTestContainer.StartContainer); no manual fdbcli step is needed.
Known accepted netfx differences (do not "fix" by changing shared code): doubles may format with 17 digits instead of shortest-roundtrip (FastDtoa is excluded), and IVarTuple ↔ ValueTuple/ITuple interop is unavailable (System.Runtime.CompilerServices.ITuple is not visible to netstandard2.0).
Releasing
The published NuGet packages come from release branches, never from master:
masteris the development branch. It holds the next version with thedevsuffix inCommon/VersionInfo.props(for example8.0.0+dev), may carry unfinished work, and is never packed for nuget.org.- One
release/X.Ybranch per released minor line (release/7.4,release/8.0). It holds the latest released X.Y.z and itsVersionInfo.propshas no suffix. - A change lands on
masterfirst, then moves down withgit cherry-pick -x <sha>. A fix that only concerns an older line goes directly on that release branch. Never mergemasterinto a release branch, and never merge a release branch back. - A new minor line starts when its first version ships: cut
release/X.Yfrommaster, then open the next version onmaster(Build: open <next> development). - A point release happens on its branch: cherry-pick the fixes, bump
VersionInfo.propsto X.Y.z, write the release notes, pack standalone, tagX.Y.zon the release branch, publish.
The reference sample and sandbox projects are not part of the release: they pin published FoundationDB.* package versions (so a reader can restore them like their own app), which means they legitimately lag the in-development version. Fold this sweep into the pre-tag routine, on the release branch:
- Before the tag, the skills match the release. This is a hard gate. The skills under
.claude/skills/are versioned by the git tag: an agent that uses version N reads them at tag N, so a skill fixed after the tag stays wrong for that version. Comparegit log <prev-tag>..HEADwith the skills: every new or changed public API, option or behavior that a skill covers is updated, the plugin copy is synced (scripts/sync-plugin-skills.shor.ps1), and the plugin version is bumped inplugins/foundationdb-skills/.claude-plugin/plugin.jsonand.claude-plugin/marketplace.json. 7.4.7 shipped with a stale native-client section infoundationdb-aspire. - Before the tag, write
Documentation/releases/<N>.mdfrom the commit log of the release branch (which follows theArea: summaryhouse form:git log <prev-tag>..HEAD --format='- %s', grouped by area prefix, then curated into prose, never the raw log). It opens with the release date (Released on YYYY-MM-DD., the day the packages went live on nuget.org; fill it at publish time). It is the single release-notes and upgrade document: every change from the previous STABLE version (not the previous rc), ordered by what applications use, each behavior change inlining what to do about it, and a final Breaking changes section for the rest. There is no separate migration guide. FollowDocumentation/writing-style.md, and add areleases/<N>.mdentry toDocumentation/toc.yml. The GitHub release body stays slim: highlights and the breaking-change list, pointing to the published pagehttps://snowbanksdk.github.io/foundationdb-dotnet-client/releases/<N>.htmlfor the full detail (never the in-repo.md: GitHub renders it degraded, and a NuGet-packed README cannot resolve it at all). - Before packing, bump the pinned
FoundationDB.*versions in the standalone samples (samples/getting-started/) and any sandbox projects to the version being released. The same sweep bumps the documentation's own version pins:versioninDocumentation/docgen.json, and the package snippets inDocumentation/fdb/aspire/getting-started.mdplus its.fr.mdtwin (7.4.5 shipped with all three still saying 7.4.2/7.4.3). This puts the correct pins in the commit that gets packed and tagged, so the tag (which targets the packed commit, for SourceLink) also carries samples that point at the release. The bump is a pin, not a verification: the samples do not restore until the packages are live, which is expected. After upload, when the packages are live,restore+ build the samples to confirm they work against the shipping packages. Do NOT defer the pin bump to after upload: the pin then lands in a commit after the packed one, and the tag ships stale sample pins (7.4.4 did this, tag292796a7pins the samples to 7.4.3). - Push FdbShell with every release, its pointer package
FdbShelland the per-platform packagesFdbShell.<rid>, even when FdbShell did not change:WithFdbShell()inFoundationDB.Aspire.Hostingrunsdotnet tool exec FdbShell@<its own version>, so a hosting package without the FdbShell of the same version has a dashboard command that fails. - After the push, publish the documentation from the newest release branch (
release/7.4until 8.0.0 ships, thenrelease/8.0): dispatch thedocs.ymlworkflow on that branch, and wait for it before publishing the GitHub release, whose body links toreleases/<N>.html. The workflow builds the API reference from the code of the branch it runs on and republishes the whole site, so a dispatch frommasterwould publish unreleased APIs and draft pages. Release notes written on a release branch are cherry-picked tomaster, and also to the newest release branch when they belong to an older line (7.4.8 notes written after 8.0.0 shipped go torelease/7.4,release/8.0andmaster); a page missing from the newest release branch is missing from the site.
Releasing FoundationDB.Client.Native (one package per FoundationDB branch)
FoundationDB.Client.Native ships the native client libraries, and a native client only talks to a
cluster of its own major.minor, so the package exists once per FoundationDB branch: today 7.3.x and 7.4.x
(the 7.4.7 package and the 7.3.78 package). Its version follows the native version, not the binding's.
The csproj takes that version as the MSBuild property FdbNativeVersion, which names the
FoundationDB.Client.Native/manifest.json entry to ship
and becomes VersionPrefix; its default is the manifest's latest. The pack refuses to run when
runtimes\ holds the files of another version: DownloadBinaries.ps1 (and .sh) write the version
they fetched into runtimes\fdb-native-version.txt, and the CheckFdbNativeVersionStamp target
compares that stamp with FdbNativeVersion. The steps, and who does what:
- Owner: the binaries exist. The Windows and macOS files of the version are published on the
SnowBankSDK/foundationdb-windows-buildrelease of that tag (built and checked by that repository's kit), the Linux files are the upstream release assets. - Session: the manifest entry.
manifest.jsongains the<version>entry: 10 files (win-x64,osx-arm64andosx-x64pairs from our release,linux-x64andlinux-arm64pairs from upstream), checksums from the.sha256assets.latestmoves only when the newest branch's newest version is meant to be the default package. One commit,Fdb: add the <version> manifest entry. - Session: the Aspire image constants. Once the cluster image of that version is on Docker Hub, run
scripts/check-fdb-image-tags.ps1 -Fix(Linux and macOS:scripts/check-fdb-image-tags.sh --fix). It sets theLatestVersion7xconstants inFoundationDB.Aspire.Hosting/FdbAspireHostingExtensions.csto the newest image of each branch (the highest even patch, the non-AVX build), whichAddFoundationDbstarts under aLatestversion policy. One commit,Aspire: default the <branch> cluster images to <version>, and a line in the release notes of the next SDK version. - Session: fetch the branch's files. In
FoundationDB.Client.Native:.\DownloadBinaries.ps1 -version <version>(Linux and macOS:./DownloadBinaries.sh --version <version>). It verifies every checksum and stampsruntimes\fdb-native-version.txt. Files of another version already present are replaced (the checksum check re-downloads them). - Session: pack the branch. From the repository root:
dotnet pack FoundationDB.Client.Native/FoundationDB.Client.Native.csproj -c Release -p:CORESDK_STANDALONE_BUILD=true -p:FdbNativeVersion=<version> -o artifacts/packages/native-<version>(standalone, so the package carries the complete target set; the property may be omitted when<version>is the manifest'slatest). A stamp mismatch stops the pack with the message naming both versions. Inspect the.nupkg: version<version>,runtimes/<rid>/native/holding one file per supported rid. - Session: prove the package. Restore it into a throwaway console project (a
nuget.configpointing at the output folder) built forwin-x64on net10.0, and check that thefdb_c.dllin the output hashes to the manifest entry's checksum. - Repeat 4 to 6 for the other branch in the same tree: the download replaces the files and the stamp,
the pack takes the other
-p:FdbNativeVersion. Nothing in the csproj changes between branches. - Owner: publish. Push each
.nupkgto nuget.org; the two branches are two versions of one package id, and applications pin the branch their cluster runs (7.3.*or7.4.*).
Coding conventions
Style is enforced by .editorconfig and the .DotSettings files. Match the surrounding code; notable points:
- Tabs, not spaces. (This is deliberate and non-negotiable per the README.)
- Block-scoped namespaces (
namespace Foo { … }), not file-scoped. Every file opens with the BSD-3-Clause copyright header#region. Nullableis enabled;ImplicitUsingsis enabled (shared usings live in each project'sGlobalUsings.cs).- Public API is documented with XML doc comments (
///), keep them accurate and add<remarks>/<example>for non-obvious behavior, as the existing code does heavily. - House writing style (design docs, notes, documentation, code comments, commit messages). Principles: one idea per sentence, prefer short; active voice with a named actor; concrete words, numbers over adjectives; the same word for the same thing (no synonym rotation); every "this"/"it"/"that" has a clear referent; noun stacks capped at three, broken with prepositions; positive form, no double negatives; no trailing "-ing" pile-ups. Banned everywhere: em-dashes, shouted CAPS mid-sentence, emoji, and the
no-slopword list (delve, leverage, robust, seamless, ...). In comments only, a beacon at the start is a review marker kept verbatim:REVIEW,BUGBUG,HACKHACK,PERF,OPTIMIZE,NOTE. Comments explain the code; they do not point at design, spike, or campaign documents (state the fact or rationale inline). This is a blacklist plus principles: no approved-word dictionary, no length audit, no sign-off process. When in doubt, write the plainest true sentence. - Allocation-consciousness is a core value: prefer
Slice/ReadOnlySpan<byte>, pooled buffers, andstructkeys/values overbyte[]. Many hot types arereadonly structimplementing span-based interfaces (ISpanEncodable). - Guard clauses and assertions use the
Contract.*family (SnowBank.Diagnostics.Contracts, a global using in these projects), not rawthrow new ArgumentNullException(...),ArgumentNullException.ThrowIfNull(...),ArgumentOutOfRangeException.ThrowIf*, orSystem.Diagnostics.Debug.Assert(...). Always-on preconditions:Contract.NotNull(x),Contract.NotNullOrEmpty(...),Contract.Positive(n),Contract.Requires(cond). Debug-only invariants:Contract.Debug.Requires(...)/Contract.Debug.Assert(...)(andParanoid.*for the hottest paths). They carry[CallerArgumentExpression]param names and integrate with the test harness's contract-failure interceptor. - Don't break public surface casually. Retire APIs with
[Obsolete](the codebase useserror: truefor hard-removed ones) rather than deleting outright.
Working on the key/value API or layers
The single most important thing to get right (and the most common source of incorrect "vibe-coded" usage) is how keys are encoded and how a custom Layer is structured. The rules:
- Keys are built with
subspace.Key(item1, …)and friends, returning lazy strongly-typed key structs (FdbTupleKey<…>). They are rendered to bytes only when handed to the transaction (tr.GetAsync(key),tr.Set(key, …)). Do not eagerly call.ToSlice()and pass bytes around. - A Layer is a thin wrapper over an
ISubspaceLocation; it implementsIFdbLayer<TState>, andResolve(tr)returns a per-transactionStateholding the resolvedIKeySubspace. The state must never escape the transaction.
Full guidance, worked examples, and the list of reference layers to imitate are in the skill .claude/skills/foundationdb-keys-and-layers/SKILL.md. Transaction/retry semantics are in .claude/skills/foundationdb-transactions/SKILL.md. For sophisticated/distributed layers (cluster internals, read-batching/latency, change feeds, version-as-clock leases, retention and fencing), see .claude/skills/foundationdb-advanced-layers/SKILL.md. For the Slice type and its companions (SliceReader/SliceWriter/SliceOwner, Span-first I/O, pooled buffers) that underlie all keys/values, see .claude/skills/snowbank-slices-and-buffers/SKILL.md. For standing up a cluster and connecting to it (the .NET Aspire hosting & client integrations, the native libfdb_c client, client⇄cluster version compatibility), i.e. getting the IFdbDatabaseProvider the other skills assume, see .claude/skills/foundationdb-aspire/SKILL.md. Read these before writing or reviewing key-encoding or layer code, even when working inside this repo.
These skills are also packaged as a Claude Code plugin (plugins/foundationdb-skills/) so consumers can install them (/plugin marketplace add SnowBankSDK/foundationdb-dotnet-client). The canonical skills live in .claude/skills/; the plugin's skills/ is a committed copy kept in sync by the sync script (scripts/sync-plugin-skills.sh, or scripts/sync-plugin-skills.ps1 on Windows), after editing any skill, run that script (--check/-Check verifies they haven't drifted) and bump the version in plugins/foundationdb-skills/.claude-plugin/plugin.json and .claude-plugin/marketplace.json.
The NuGet packages carry the skills too, so that a consumer gets the skills of the package version it references: a project declares <PackSkill Include="<skill-name>" />, and its package then contains skills/<skill-name>/ (the rule is in Directory.Build.targets). The dotnet-package-skills tool copies these folders into the consumer's repository. Declare each skill in one project only, the one whose API it covers: the tool skips a skill name that two referenced packages both contain. A new skill needs its PackSkill line.
Docs
Human-facing docs live in Documentation/ as Markdown (listed in Documentation/toc.yml), rendered to a static site by SnowBank.DocGen, a standalone .NET tool in this repo. It is not part of FoundationDB.Client.slnx; build and run it on its own:
dotnet run --project SnowBank.DocGen # renders to artifacts/_siteThe tool builds the guide pages, an API reference reflected from the built assemblies (SnowBank.Core, FoundationDB.Client, FoundationDB.Aspire, FoundationDB.Aspire.Hosting, so build those in Release first for the reference to appear), and a French twin under /fr/ from the *.fr.md files. It shells out to Node for two build-time passes: mermaid diagrams to static SVG (needs a Chrome, pointed to by CHROME_PATH) and Shiki syntax highlighting; run npm ci in SnowBank.DocGen/tools once. The docs.yml workflow runs all of this and publishes to GitHub Pages (manual dispatch).
The top-level README.md is the authoritative getting-started narrative, and it is packed into the NuGet package, so treat it as shipped surface.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

