Skip to content

Latest commit

 

History

History
1538 lines (1333 loc) · 95.9 KB

DECISIONS.md

File metadata and controls

1538 lines (1333 loc) · 95.9 KB

Decisions & History Log

Append-only. Newest at the bottom. This is the home for anything history-worthy — design decisions and their reasoning, dated milestones, gotchas discovered, schema/protocol bugs. If future-you would want to know why, how, or when something happened, it goes here (not in STATUS.md, which holds only the current state). Never rewrite or delete old entries — if a decision is reversed or a fact changes, add a new entry that supersedes it and note which one it replaces. This is the memory that survives long gaps.

Format:

  • Design decision: ## YYYY-MM-DD — Title · Decision · Why · Alternatives · (optional) Status if later superseded.
  • Milestone / gotcha / bug: ## YYYY-MM-DD — Title · What · Why it matters (and, for a gotcha/bug, how it was found and the fix).

2026-06-11 — Language, build, and dependencies

Decision: C++17, built as a static library (libhotrod-client.a) via CMake; Google Test for unit tests; OpenSSL for cryptography. Why: C++17 gives broad compiler support; static lib is simplest to consume; CMake is cross-platform (Linux + Windows); OpenSSL is the standard crypto dep and is available on both platforms (needed for SCRAM in Step 3). Alternatives: C++20 (narrower compiler support at the time); header-only or shared lib (more consumer friction).

2026-06-11 — Infrastructure-first porting order

Decision: Build the foundation (primitives → headers → auth → topology → hashing) before any cache operations. Why: Every operation then automatically inherits auth, topology-aware failover, smart routing, and cross-platform transport. Avoids reworking operations later. (ROADMAP v2.0.) Alternatives: Operation-first (get PING/GET working end-to-end early) — would have meant retrofitting cluster features into each op.

2026-06-11 — Protocol 4.0 header has 11 fields, not 8

Decision: Always emit the media-type and other-param-count fields for version ≥ 0x28 / ≥ 40. Why: Older test vectors show 8 fields; the real 4.0 header has 11. Omitting fields 9–11 causes the server to time out with no clear error. Alternatives: none — this is a protocol correctness requirement.

2026-06-11 — MurmurHash3 x64_32 with seed 9001

Decision: Use the upper 32 bits of the x64 128-bit MurmurHash3, seed 9001. Why: Matches Infinispan's default exactly (byte-for-byte with the Java org.infinispan.commons.hash.MurmurHash3), required for keys to route to the same segment/owner the server expects.

2026-07-01 — Async-only API (breaking change, no sync wrappers)

Decision: All operations return std::future; there are no synchronous convenience wrappers. get/put/remove return std::future<std::optional<ByteArray>>; ping returns std::future<void>. Why: A single async surface keeps the API small and honest about the underlying multiplexed transport. std::optional gives clear "found vs. not found" semantics without output parameters. Callers who want blocking behavior just call .get(). Alternatives: Keep bool-returning sync methods with output params (rejected: output params are error-prone, and dual APIs double the surface); provide backward-compatible sync wrappers (rejected while pre-1.0 — clean break is cheaper now).

2026-07-01 — Temporary blocking shim during the async migration

Decision (interim): First ship the async signatures backed by a blocking implementation that returns already-ready futures, before the real transport existed. Why: Let the API and all tests migrate once, so they wouldn't need changing again when true async landed. Status: ✅ Superseded — the real MultiplexedConnection replaced this shim (see next entry). No blocking shim remains in RemoteCache.cpp.

2026-07-02 — MultiplexedConnection design

Decision: One connection per server multiplexes concurrent requests over a single socket. A dedicated read-loop thread reads responses; a messageId → std::promise pending map matches responses to callers; message IDs are generated by the connection; each operation passes a body-parser lambda to execute(). Shutdown does shutdown() then close(), and closeAllPending() fails any in-flight requests on error/close. Why: True request pipelining (target 5–10× concurrent throughput) with one socket per server instead of a connection per in-flight request. Connection- generated IDs avoid cross-layer coordination. Body-parser lambdas keep response decoding next to each operation. Alternatives: Connection-per-request pool (more sockets, contention); caller-generated message IDs (needs shared counter across layers).

2026-09-16 — Source hierarchy: Java client first, Kaitai schema for byte layout

Decision: Rank the protocol references explicitly.

  1. Java client is authoritative for behavior and semantics (what each op does, statuses, edge cases) — study it first for every step (MANDATORY, per the porting workflow). Local /home/rigazilla/git/infinispan/client/hotrod-client/, public https://github.com/infinispan/infinispan/tree/main/client/hotrod-client.
  2. Kaitai schema (hotrod40.ksy, protocol 4.0/4.1) is authoritative for byte layout — a precise, machine-readable cross-check of the Java client. Local ../hotrod-dissector/schemas/, public https://github.com/rigazilla/hotrod-dissector/tree/main/schemas.
  3. Test vectors are the regression check baked into unit tests. If any two disagree, one has a bug — stop and investigate before shipping. Why: The .ksy is an independent declarative encoding of the same protocol the Java client implements imperatively, which makes it a strong cross-check — but it describes bytes, not behavior, so it complements the Java source rather than replacing it. Prose docs (including infinispan.org) drift. The Step 10 metadata plan was validated against the schema (opcodes, entry_metadata, get_with_metadata_response). Alternatives: Treat the schema as the single source of truth (rejected — it doesn't capture semantics); rely on prose protocol docs (known to drift).

2026-09-21 — Step 11 error handling: split, user-decided retry, retry-on-cache

Decision: Three linked decisions for Step 11 (full design + progress tracking in ERROR_HANDLING_DESIGN.md):

  1. Split Step 11 into 11a error surfacing (typed HotRodClientException replacing bare std::runtime_error; ERROR 0x50 parsing) and 11b retry.
  2. Retry is user-decided, not automatic. The exception carries the facts — retriable, a FailurePhase (BeforeSend / AfterSend / ServerError), and triedNodes — and the user decides whether their operation is safe to retry.
  3. Retry lives on the cache (fork 1.b): ops take an optional (defaulted) RetryContext; the exception stays a pure-data value. Rejected fork 1.a (err.retry() on the error object). Why: (1) 11a is a safe additive edit and is a prerequisite for 11b (can't retry-on-transient without classifying transient first). (2) The only judgment only the user can make safely is the idempotency of the ambiguous AfterSend failure — dangerous for the Step 10 conditional ops (putIfAbsent/replace/ replaceWithVersion/removeWithVersion), where a blind retry can return a wrong logical answer. (3) 1.b is ~40–55% of 1.a's effort and avoids a permanent lifetime hazard: 1.a would need a shared dispatcher so the error can re-enter the client after crossing the future boundary (and UB if the client is destroyed first) plus a templated RetriableError<T> to return the op's value; 1.b needs only a defaulted param per op and an exclusion-aware selectServerForKey. Alternatives: Automatic retry in the client (rejected — the library would have to guess op idempotency); fork 1.a retry-on-error (rejected — ~2× effort + lifetime footgun for marginally cleaner signatures the default param recovers anyway).

2026-09-21 — Enforce the STATUS.md update rule; split current-state from history

Decision: Make WORKFLOW.md §3 mechanically enforced instead of convention-only, and split doc responsibilities cleanly:

  1. Versioned pre-commit hook (.githooks/pre-commit, activated with git config core.hooksPath .githooks) blocks any commit that changes project source (src/, include/, tests/, CMakeLists.txt, .github/workflows/) without also staging docs/STATUS.md. Merge commits are skipped; git commit --no-verify is the documented escape for a legitimate pure-docs catch-up.
  2. Root AGENTS.md (the working agreement) so any agent or human gets the rule and the hooks-setup step at the top of the repo. A one-line CLAUDE.md containing @AGENTS.md keeps Claude Code loading it on every version and on Bedrock/Vertex; chose the @-import over a symlink (symlinks break on Windows checkouts, which this project supports, and block the Edit tool).
  3. Tightened rule (this doc's new scope): STATUS.md holds current state only (next steps, backlog, what's shipped, test numbers). All history-worthy detail — what changed and why, dated milestones, gotchas, schema bugs — goes here, in this append-only log. DECISIONS.md renamed in spirit to "Decisions & History". Why: The rule was 100% convention with zero mechanical backing — no git hooks, no CI check, no CLAUDE.md. History showed the leak: five source/CI commits (9e7c345, eafad44, 9ceb6d3, f3d6b86, 21413e2) shipped with a stale STATUS.md and were reconciled retroactively in a separate batch commit (832b29e) — exactly the recall cost the workflow exists to remove. STATUS.md had also drifted into a current-state/history hybrid (rich dated per-feature narrative in the Backlog), which the split now resolves going forward. Alternatives: CI-only check (rejected as the primary guard — fires after push, too late; kept as a possible future belt-and-suspenders); a warning-only hook (rejected — a warning is just convention with extra steps); leaving history in STATUS.md (rejected — it's the source of the drift). Existing historical narrative already in STATUS.md is left in place (not migrated); the split is forward-looking.

2026-09-25 — Step 11a shipped: two-axis error model; 0x86 transient (diverges from Java)

What: Step 11a (error surfacing) is implemented and tested (11 unit + 3 integration; full suite green: 187 unit, 78 integration across 15 suites). HotRodClientException (in include/hotrod/HotRodClientException.h) is a pure-data exception extending std::runtime_error with FailurePhase phase {BeforeSend, AfterSend, ServerError}, std::optional<uint8_t> serverStatus, std::vector<ServerAddress> triedNodes, and bool ownersExhausted. Server ERROR responses (opcode 0x50) are now parsed and surfaced; RemoteCache's bare throw std::runtime_error(...) sites became typed throws (FailurePhase::ServerError + status). Status constants REQUEST_PARSING_ERROR (0x84), NODE_SUSPECTED (0x87), ILLEGAL_LIFECYCLE_STATE (0x88) were added to HeaderCodec.h.

Decisions (refine the 2026-09-21 design):

  1. Two orthogonal axes, no stored retriable bool. Instead of baking a retriable flag into the exception, classification is derived by free helpers: isTransient(e) = futility ("is a retry worth it?" — the library's call) and outcomeUncertain(e) = ambiguity/safety ("might the op have applied?" — the user's call). isTransient: BeforeSend & AfterSend → true; ServerError → isTransientStatus(status) (0x86/0x87/0x88 transient, 0x81–0x85 permanent). outcomeUncertain: AfterSend, or ServerError with 0x86. This replaces the design's earlier retriable field.
  2. COMMAND_TIMEOUT (0x86) is transient and outcome-uncertain — intentionally diverges from Java (Java does not treat it as retriable). Rationale: with the two-axis model the ambiguity is carried separately by outcomeUncertain(), so marking 0x86 transient just says "a retry may succeed elsewhere" without hiding that the op may have already applied — the user still decides via outcomeUncertain().
  3. proxyToNonOwner client config, default true (matches Java's non-owner fallback via OperationDispatcher.addressForObject → balancer.nextServer). Deferred to 11b (it governs retry routing, not surfacing).

Why it matters / gotcha found: the old read loop treated ERROR 0x50 as an "opcode mismatch" and left the length-prefixed error message unread, desyncing the socket for every subsequent response on that connection. The fix drains the ERROR body in readLoop before the pending-request lookup (so even an orphan ERROR keeps the stream in sync). Proven by the ConnectionUsableAfterServerError integration test: trigger an ERROR on a missing cache, then PUT/GET round-trip on a real cache over the same connection succeeds. (Also learned along the way: the server's default cache isn't configured, so a missing/undefined cache returns status 0x84 CacheNotFoundException — permanent under the classification above.)

Java cross-check (Explore): non-owner fallback confirmed; Java default max_retries = 3 (ConfigurationProperties.DEFAULT_MAX_RETRIES); Java's retriable set is RemoteNodeSuspectException (0x87), RemoteIllegalLifecycleStateException (0x88), and TransportException (no status) — we additionally treat 0x86 as transient per decision 2, and make retry user-decided rather than automatic (2026-09-21 entry).

Alternatives: store a retriable bool on the exception (rejected — conflates the two axes and forces the library to pre-judge user idempotency); follow Java and treat 0x86 as non-retriable (rejected — the ambiguity is already carried by outcomeUncertain(), so the extra futility signal is safe and useful).


2026-09-25 — Step 11b (slice 1): exclusion-aware server selection

What shipped: the first slice of Step 11b — the routing mechanism a user-driven retry needs, with no behavioural change to existing (non-retrying) call sites.

  • orderKeyCandidates() (new include/hotrod/ServerSelection.h, header-only, pure): given owners, all topology servers, and an exclusion set, returns the ordered candidate list — owners first (in owner order), then non-owner proxy fallback — with excluded nodes and duplicates removed. Pulled out precisely because the old inline selection logic was untestable (needs live sockets); the pure decision now has 7 unit tests (ServerSelectionTest.cpp).
  • RetryContext (new include/hotrod/RetryContext.h): pure-value user→library input, currently just excludeNodes. Deliberately does NOT carry proxyToNonOwner — that is client-level routing policy (D5), landing in slice 2.
  • selectServerForKey rewritten over orderKeyCandidates; gains defaulted RetryContext + optional triedOut out-param that reports every node it attempted (for accumulating triedNodes across retries in slice 3). On exhaustion it now computes ownersExhausted honestly (an owner counts as exhausted if tried this attempt or in excludeNodes from a prior one) instead of the previous hard-coded true.

Why sliced this way: exclusion-aware selection is the foundation both the op-level RetryContext threading (slice 3) and proxyToNonOwner (slice 2) build on, and it is the one piece testable without a cluster. Keeping it a pure function keeps the I/O (connection acquisition, which can throw per candidate) separate from the decision.

Note: the design-doc example loop still referenced a removed e.retriable field; corrected to isTransient(e) while here.


2026-09-25 — Step 11b (slice 2): proxyToNonOwner client flag

What shipped: client-level proxyToNonOwner (default true, matching Java), gating whether hash-aware selection falls through from a key`s owners to a non-owner that proxies to the real owner.

  • setProxyToNonOwner() / getProxyToNonOwner() on RemoteCache; backing proxyToNonOwner_ member defaulted true.
  • The gate lives in the pure orderKeyCandidates() (new bool param): when false it stops after owners, so selectServerForKey exhausting the owners throws the transient BeforeSend exception with ownersExhausted=true instead of silently proxying. 3 new unit tests (10 total in ServerSelectionTest).

Why a client-level flag, not RetryContext (D5): proxy fallback is routing policy, not per-call input — it mirrors how Java models balancing/maxRetries at the client, and keeps RetryContext a pure exclusion carrier. Scope: the flag governs only the BeforeSend connection-fallback inside selectServerForKey; it does NOT make AfterSend retry automatic (that stays user-decided, D2). So true means "Java-like routing fallback", not "fully Java-automatic".

Unit: 197/197 (was 194).

2026-09-25 — Step 11b (slice 3): op-level retry via a bound view, NOT a per-op parameter

What shipped: the retry path that lets a caught exception feed the next attempt, without putting any retry machinery on the base operation signatures.

  • New RetryView (RetryView.h): a lightweight, non-owning view holding RemoteCache* + RetryContext. It exposes the same key-routed ops, each forwarding to a private RemoteCache::…Impl(args, const RetryContext&).
  • RemoteCache::excluding(std::vector<ServerAddress>) and excluding(const HotRodClientException&) return a RetryView; the second seeds the exclusion set directly from a caught exception's triedNodes.
  • Each of the 9 ops split into a thin public forwarder (return getImpl(key, RetryContext{});) + a private …Impl carrying the body. The public signatures are byte-for-byte unchanged.
  • triedNodes accumulation: every attempt (including the plain first call) unions the nodes it touched into any thrown HotRodClientException via the new pure unionNodes() helper (ServerSelection.h), folding excludeNodes ∪ tried-this-attempt ∪ e.triedNodes. A file-private rethrowWithTriedNodes() in RemoteCache.cpp does this on the async path; the selection-exhaustion and inline-status throws do it inline. 4 new unit tests (14 total in ServerSelectionTest).

Why a bound view instead of a defaulted RetryContext on each op (supersedes the fork-1.b sketch in the 2026-09-21 entry): the original 11b plan added an optional RetryContext parameter to every op. The user rejected that — the requirement is that the base call (cache.get(key)) stay completely free of retry machinery in its signature, while it's fine for the exception to carry tried-node data. The bound view satisfies both: base ops are pristine and retry-free; opting into exclusion is an explicit, separate cache.excluding(e) step on the retry path; and triedNodes is populated on every exception (first call included) so a retry loop always has the exclusion set it needs. This supersedes only the mechanism (per-op parameter → bound view); the fork 1.b rationale (retry threads exclusion through selection; policy/idempotency stay the user's call, D2/D3) is unchanged.

Unit: 201/201 (was 197). Full multi-target build clean under -Werror.

2026-09-25 — Two intentional divergences from the Java client's routing/retry

Cross-checked our hash-aware selection and retry model against the authoritative Java client (verified in-source, not from prose): SegmentConsistentHash.getServer and the RoundRobinBalancingStrategy / OperationDispatcher retry path. Two deliberate divergences, chosen with eyes open and kept:

1. Candidate ordering — backup-first + strict exclusion (routing). Java, hash-aware with the default RoundRobin balancer:

  • SegmentConsistentHash.getServer() returns segmentOwners[segmentId][0] — the primary owner only. Backups get no priority.
  • On failure it falls to RoundRobinBalancingStrategy.nextServer(failedServers), round-robining over the entire topology (shared atomic index), skipping the per-op failed set best-effort (it can return a failed server once it has looped failedServers.size() times).

Ours (orderKeyCandidates, proxyToNonOwner=true): candidates are [primary, backups…, then all other servers] in deterministic owner order, and excluded nodes are strictly removed (never returned). Why kept (option 1): preferring backup owners avoids a server-side proxy hop (backups hold the data), the order is deterministic (easier to reason about/test), and strict exclusion is what makes the user-driven retry loop actually converge instead of possibly re-hitting a dead node. Trade-off: not byte-for-byte Java behavior. This is the routing analogue of the 0x86 divergence already recorded (2026-09-25, 11a).

2. After-send retry is delegated to the user (not automatic). Java's balancer + maxRetries re-dispatches after-send failures across servers automatically. For non-idempotent ops with an uncertain outcome (COMMAND_TIMEOUT 0x86 / FailurePhase::AfterSend — the server may already have applied the op) that risks double-apply or clobbering a concurrent write. We do NOT auto-retry: we surface phase + outcomeUncertain() and let the caller — who alone knows whether this op is replay-safe — decide. Why kept: strictly more correct for the non-idempotent case; the idempotent read case costs only a three-line retry loop. Trade-off: naive callers get no automatic retry. This reinforces D2 (retry user-decided) and D4 (classify futility/ambiguity, don't auto-decide safety); it is a considered improvement over Java's default, not an omission.

2026-09-25 — Step 11b (slice 4): thread-safety for the routing/pool state

What shipped: the selection path can now be driven from user/retry threads concurrently with the read-loop thread's topology callbacks, which is exactly the concurrency the RetryView retry loop introduces.

  • One stateMutex_ (mutable) guards the three shared members — topology_, consistentHash_, connectionPool_. It is acquired at the top of the two entry points that touch them: handleTopologyUpdate (read-loop thread, writes) and selectServerForKey (user/retry threads, reads + pool mutate). Their internal helpers — cleanupStaleConnections and getConnectionForServer — assume the lock is held and do not re-lock (documented; avoids a recursive mutex).
  • Connection lifetime via shared_ptr. The pool and the default connection are now shared_ptr<MultiplexedConnection>; selectServerForKey returns a shared_ptr and each op captures it into its response lambda. This closes a use-after-free the concurrent path would otherwise expose: previously selectServerForKey handed back a raw pointer that cleanupStaleConnections could erase/destroy while the op was mid-execute(). Now a connection handed to an in-flight op stays alive for the op's duration even if a topology update evicts it from the pool.

Deadlock / lock-ordering analysis (verified in-source):

  • connect() never fires the topology callback synchronously — onTopologyUpdate_ is invoked only from readLoop() on the connection's own read thread — so holding stateMutex_ across getConnectionForServer→connect() cannot self-deadlock.
  • In readLoop, onTopologyUpdate_ is called after pendingMutex_ is released, so the read thread holds no MultiplexedConnection-internal lock when handleTopologyUpdate acquires stateMutex_. There is thus no cycle with selectServerForKey (which takes stateMutex_ first, then connection-internal locks via connect()).

Trade-offs / known limits (deliberate, noted for the next session):

  • stateMutex_ is held across the blocking connect() inside getConnectionForServer, so a slow connect serializes other selections and can briefly delay a topology callback. Correctness-first; a double-checked connect-outside-lock is possible later if it ever matters.
  • The debug/test accessors getTopology() / getConsistentHash() still return references to the guarded state and are not safe to read concurrently with live ops / topology churn (documented on them); getTopologyId() is locked and safe. Converting the reference getters to by-value was out of scope (pervasive test use, chaining, ConsistentHash copyability).
  • Teardown still assumes single-threaded shutdown (pool connections' read threads stop when connectionPool_ is destroyed); not a concurrent-operation concern, left as-is.

Validation: full multi-target build clean under Release -Werror; unit 201/201. Thread-safety itself is best validated by the existing concurrent integration suites (ConcurrentClientsTest, ConcurrentMultiServerTest) and a TSan run — these need live servers/Docker and were not run in this session.

2026-09-25 — Step 11b (slice 4): TSan validation + test-harness race fix

TSan run (done this session, against live Docker cluster). The concurrent integration suites were run both functionally (8/8 pass, including ConcurrentWithFailover, which kills node2 mid-run) and under ThreadSanitizer (-fsanitize=thread, dedicated build-tsan/).

Result: slice 4's synchronization held clean. TSan reported zero races in production code — no frame in any race stack touches RemoteCache.cpp or MultiplexedConnection.cpp (selectServerForKey, handleTopologyUpdate, getConnectionForServer, connectionPool_ all absent). The stateMutex_ + shared_ptr design (previous entry) is confirmed race-free under the retry loop's concurrency.

One test-harness race found and fixed. All 9 TSan warnings pointed at the same line — TopologyTestFixture.h createClient() doing an unsynchronized clients.push_back() on a shared std::vector<unique_ptr<RemoteCache>> while ConcurrentMultiServerTest.MultipleClientsInterlaced calls it from several threads. std::vector::push_back is not safe for concurrent callers (a reallocation moves the buffer out from under another thread's write). This is test scaffolding, predates slice 4, and never corrupted production state — but a dirty TSan baseline hides future real races. Fix: a clientsMutex guards the push_back; TearDown stays lockless (runs single-threaded after joins). Test-only change; behavior unchanged; concurrent suites still build clean.

2026-09-25 — Step 11b (slice 5): RetryView end-to-end integration test

What shipped: tests/integration/RetryViewIntegrationTest.cpp (3 tests, verified 3/3 against a live 3-node Docker cluster), wired into CMake/ctest as RetryViewIntegrationTests. It is deliberately distinct from the existing failover tests (ConcurrentWithFailover, FailoverToBackupOwner), which cover automatic before-send re-routing; this suite asserts the explicit user-driven excluding() dispatch that is the point of slice 3.

  • ExcludingRoutesAroundOwner (deterministic, no kill): cache.excluding( {primaryOwner}).get(key) still returns the value, proving the RetryView routes the request to a different node (backup owner or non-owner proxy). Isolates the routing decision from failure timing.
  • ProxyDisabledOwnersExhaustedThrows (deterministic, no kill): with setProxyToNonOwner(false) and every owner excluded, selection has no candidate and throws HotRodClientException{phase=BeforeSend, ownersExhausted=true}, isTransient(e)==true, with the excluded owners present in triedNodes. Locks in the D5 contract (refuse to silently proxy; hand the decision back).
  • UserRetryLoopAfterPrimaryKilled (end-to-end, kills the primary owner): runs the documented catch→excluding(e) loop from ERROR_HANDLING_DESIGN §3.2.

Design note — why the loop test tolerates two recovery paths. After the primary owner is killed, a plain get can recover either by throwing (dead connection / owner unreachable) and being retried via excluding(e), or by automatic before-send re-routing once the topology update lands — which path wins is a timing race we cannot make deterministic without artificial fault injection. The test therefore asserts the invariant that actually matters (the value is recovered) and, only if an exception was caught, that the failure was transient, that each attempt widened triedNodes, and that the killed primary ended up in the exclusion set. The first observed run recovered via automatic re-routing; the deterministic excluding() dispatch is nonetheless fully covered by the two no-kill tests above, so RetryView routing does not depend on that race. Trade-off accepted: no artificial after-send fault injection (would need a fault hook in the transport) — deferred as not worth the complexity for this step.

2026-09-25 — Step 11b (slice 6): retry-loop example — Step 11b complete

What shipped: examples/quickstart/retry.cpp (built as a second target alongside quickstart) plus a README section. Two reusable loops — getWithRetry (idempotent) and putWithRetry (shows the extra outcomeUncertain() gate a non-idempotent write needs) — implement the documented pattern: retry-free first call, then cache.excluding(e) seeded from the caught exception's triedNodes, stopping on !isTransient(e). Builds warning-clean under -Wall -Wextra -Werror -pedantic; runs end-to-end against a live single server (the retry branch only fires on a cluster with a node killed mid-run, as the file/README note).

The clarification folded in (user's Q from the prior session). The example header and README state explicitly that proxyToNonOwner=true does not let a caller skip the catch block: the flag only widens the connection-selection candidate pool for a single pre-send dispatch, but one operation still executes on exactly one node, so any after-send/server-error failure still surfaces as an exception the caller must catch and retry. This closes the open question from the 2026-09-25 "two intentional divergences" discussion and completes Step 11b.

Deliberately left out of the example: artificial fault injection to force the retry branch. Keeping the example runnable against a plain single server (and pointing at RetryViewIntegrationTest for the kill-a-node scenario) was judged clearer than shipping an example that needs a cluster to run at all.

2026-09-25 — Step 11c (slice 1): keyless-op retry — ping mirrors the keyed strategy

Decision. Keyless operations get the same two-tier retry model as keyed ops (see 2026-09-21 / D2): (1) automatic before-send failover — when the chosen server is unreachable the client silently sweeps to the next server in topology order; (2) user-decided after-send retry — once a request has been sent, any AfterSend/ServerError failure surfaces as a HotRodClientException carrying triedNodes, and the caller retries via cache.excluding(e).ping(). Replay safety stays the caller's call. ping() is the first keyless op converted; the implementation is generic (selectAnyServer) so future non-key ops (server stats/admin) reuse it — satisfying the user's directive that this be "the approach for all the non-key operations."

Mechanism. ping() now delegates to pingImpl(const RetryContext&) (the same base-call / …Impl(ctx) split every keyed op uses), and RetryView::ping() forwards the bound exclusion set. Routing goes through a new selectAnyServer(ctx, triedOut), which reuses the pure, unit-tested orderKeyCandidates({}, allServers, ctx.excludeNodes) — an empty owner list means "every server is a candidate, in topology order, minus the exclusion set," so no new pure helper was needed. It sweeps candidates, returning the first reachable connection (recording tried nodes via the out-param), and on total exhaustion throws HotRodClientException{BeforeSend, ownersExhausted=false, …}.

Two deliberate choices.

  • ownersExhausted is always false for keyless ops — there is no "owner" concept for a keyless request, so the flag that means "proxy was refused" is meaningless here; the exhaustion is a plain BeforeSend "no servers reachable."
  • Early-ping seed fallback (per user note). Ping is typically one of the very first operations, before any topology update has arrived, so selectAnyServer returns the seed connection_ when the topology is empty (rather than throwing "no servers"). This preserves today's first-ping behavior exactly (verified: PingIntegrationTest still 5/5).

Order divergence from Java (consistent with our keyed determinism). Java's user-facing cache ping (CachePingOperation, supportRetry=true) routes via the keyless round-robin balancer and auto-retries across servers excluding a failedServers set up to maxRetries. We instead use deterministic topology order (matching our keyed-routing determinism divergence) and keep the after-send retry user-decided rather than automatic (D2). Java's other ping, NoCachePingOperation (supportRetry=false, per-connection health/liveness, force-written to one channel), has no user-facing analog here and is unaffected.

Tests. 3 keyless-ordering unit tests added to ServerSelectionTest (KeylessNoOwnersYieldsAllServersInOrder, KeylessExcludesTriedNodes, KeylessAllExcludedYieldsEmpty) — 201→204, all green; PingIntegrationTest still 5/5 with the new routing. Integration coverage for the kill-and-recover path is slice 2.

2026-09-25 — Step 11c (slice 2): keyless-ping retry — end-to-end integration test

What shipped: tests/integration/PingRetryIntegrationTest.cpp (3 tests, verified 3/3 against a live 3-node Docker cluster), wired into CMake/ctest as PingRetryIntegrationTests. It is the keyless mirror of RetryViewIntegrationTest, asserting that ping()'s selectAnyServer path behaves like the keyed retry path on real infrastructure:

  • ExcludingRoutesToAnotherServer (deterministic, no kill): a plain ping() succeeds, and cache.excluding({firstCandidate}).ping() also succeeds — the keyless op is routed to a different server.
  • AllServersExcludedThrowsBeforeSend (deterministic, no kill): excluding every topology server leaves selectAnyServer no candidate and throws HotRodClientException{phase=BeforeSend}, isTransient==true, with every excluded server in triedNodes. Crucially it asserts ownersExhausted==false — the one behavioural difference from the keyed ProxyDisabledOwnersExhaustedThrows case (a keyless op has no owners).
  • RecoversAfterFirstCandidateKilled (kills a node): kills the server the keyless ping targets first, then drives the documented catch→excluding(e).ping() loop; asserts recovery on a surviving node, and — only if an exception was caught — that the failure was transient and the killed node ended up in the exclusion set.

Two integration-harness notes worth recording.

  • Topology reports internal container addresses. On the Linux Docker bridge the Hot Rod topology advertises container IPs (e.g. 172.18.0.2:11222), which the client reaches directly — not the published localhost:1132x ports the test harness tracks. So a topology address cannot be mapped to a node number by matching MultiServerTestEnvironment ports (returns -1). The test maps by topology position instead (topology is ordered node1, node2, …), the same convention RetryViewIntegrationTest already relies on.
  • First observed recovery was via automatic before-send re-routing, not the catch path. Killing the first candidate node made selectAnyServer's connect to that node fail, so it swept to the next server before sending and the very first ping() succeeded (no exception). The test tolerates both this path and the throw-then-excluding(e) path, exactly as the keyed loop test does — which path wins is a timing race we don't force with artificial fault injection. The deterministic excluding() dispatch and the exhaustion throw are fully covered by the two no-kill tests, so keyless routing does not depend on that race.

2026-09-25 — Step 11c (slice 3): keyless-ping retry example — Step 11c complete

What shipped: examples/quickstart/retry.cpp gained a keyless pingWithRetry loop (built into the existing retry target), plus doc updates to examples/quickstart/README.md and docs/ERROR_HANDLING_DESIGN.md (a new Step 11c checklist block under §5). The loop is byte-for-byte the same shape as getWithRetry — retry-free first call, then cache.excluding(e).ping() seeded from the caught exception — underscoring that keyless ops need no special handling. main() calls pingWithRetry right after connect(), the realistic spot: ping is usually the first op, before any topology has arrived (the seed-connection fallback covers that). Compiles warning-clean under -Wall -Wextra -Werror -pedantic and runs end-to-end against a live single server (the retry branch only fires on a cluster with a node killed mid-run, as the file/README note; the kill scenario is covered by PingRetryIntegrationTest).

Doc note folded in. The README/example spell out the one visible difference of the keyless path — a keyless exhaustion reports ownersExhausted == false (no owners) — so a reader porting the keyed loop to ping isn't surprised.

With slices 1–3 done, Step 11c is complete: keyless ops mirror the keyed two-tier retry model (auto before-send failover, user-decided after-send), the implementation (selectAnyServer) is generic for future non-key ops, and the behaviour is unit-, integration-, and example-covered.

2026-09-25 — SASL/SCRAM authentication, end-to-end (whole SCRAM family)

What shipped. The client can now authenticate against a secured Infinispan server. RemoteCache::setAuthentication(username, password, realm="default", serverName="infinispan", mechanism="SCRAM-SHA-256") enables a SASL handshake that runs on every connection the client opens — the seed connection and every topology-discovered cluster member — inside MultiplexedConnection::connect(), after the TCP connect and before the read-loop thread is spawned (the only synchronous window; nothing consumes bytes before it). New public headers: Authentication.h (pure-data config), AuthCodec.h (header-only body encode/decode, following the ServerSelection.h inline precedent), and SaslAuthenticator.h; implementation in src/auth/SaslAuthenticator.cpp. The existing SCRAM crypto — previously dead code (unit-tested but never on any code path) — is now generalized across the digest family and actually driven.

Why flat setters, not a builder. Locked with the user: setAuthentication(...) matches the existing setClientIntelligence / setProtocolVersion idiom rather than introducing a Java-style ConfigurationBuilder. A builder / multi-seed model stays a possible future thread.

Why the whole SCRAM family. The API is mechanism-aware (defaults to SCRAM-SHA-256). C++ has no JDK-style SASL provider framework, so each mechanism is hand-rolled over OpenSSL; the three SCRAM variants share one generalized implementation. SCRAM was parameterized by a Digest { SHA1, SHA256, SHA512 } enum → EVP_MD*, with PBKDF2/HMAC/H output lengths derived from EVP_MD_size (SHA-1=20, SHA-256=32, SHA-512=64). The prior SHA-256 behavior stays the default and the existing SCRAMTest.cpp still passes. Any non-SCRAM mechanism (PLAIN, DIGEST-MD5, EXTERNAL, GSSAPI, OAUTHBEARER, …) throws a clear HotRodClientException ("unsupported SASL mechanism") at connect() time.

Load-bearing protocol finding — SCRAM is exactly two client turns and the client completes on its own side. Confirmed against the two authoritative sources (AGENTS.md order: Java client behavior, then Kaitai byte layout):

  • Java (AuthHandler / AuthOperation): AuthOperation.createResponse returns complete ? null : challenge; the loop is driven by the client SASL state, not the server's completed flag. client-first→server-first (completed=false); client-final→server-final. Infinispan/Elytron sends the server-final with completed=false carrying the v= server signature, and expects no confirmation round — the client finishes once it has verified that signature (SASL client returns null / nothing more to send).
  • Kaitai (hotrod40.ksy): mech-list request 0x21 = empty body; mech-list response 0x22 = vint count + N×lp_string; auth request 0x23 = lp_string mech (re-sent every round) + lp_bytes response; auth response 0x24 = u1 completed + lp_bytes challenge.

Two earlier wrong attempts, now recorded so they aren't repeated: (1) requiring completed=true on the server-final hung the handshake ("SASL exchange did not complete") — the server sends completed=false; (2) "fixing" that by adding an empty confirmation round in a completed-flag loop triggered Elytron ELY05037 ("mechanism client refuses to initiate authentication"). The correct behavior is: send nothing after verifying the server signature; ignore the server completed flag. This mirrors Java exactly.

Testable transport seam. Hot Rod responses have no total-length prefix, so a response body can only be consumed by reading its fields in order — the SASL driver therefore reads typed fields, not a length-delimited blob. To keep the state machine unit-testable without a socket, SaslAuthenticator::authenticate runs against an abstract SaslTransport (send + typed reads + readResponseHeader()); ConnectionSaslTransport is the production adapter over a live blocking Connection, and its readResponseHeader() mirrors the read loop's header parse (magic / messageId / opcode / status / topology-change marker, consuming any topology update so the stream stays aligned) and surfaces server ERROR/failed-status as a typed HotRodClientException. Unit tests drive a FakeScramServer that computes the server side with OpenSSL, parameterized across SCRAM-SHA-1/256/512, plus mech-not-offered / unsupported-mech / bad-server-signature failure paths.

Server config gotchas (Infinispan 16), discovered while standing up the integration fixture. The SCRAM family derives keys from the cleartext password, so the realm must store plain-text passwords: a properties-realm with plain-text="true". A single-port endpoint requires both a hotrod-connector and a rest-connector ("There must be a REST route!"), and the connectors nest inside <endpoint> inside <endpoints>. The image entrypoint auto-generates conf/users.properties, so the test mounts non-default filenames (test-users.properties / test-groups.properties) to avoid a read-only clash. Auth succeeding does not create a cache, so the config pre-defines a distributed-cache name="authcache" the test targets (no admin round-trip on a secured server). See test-configs/infinispan-auth.xml and scripts/start_infinispan_auth.sh (starts with -p 0:11222 for an ephemeral host port, avoiding the fixed-port cluster clash noted elsewhere).

Tests. +19 unit (AuthCodecTest + parameterized SaslAuthenticatorTest) and +5 integration (AuthIntegrationTest: SCRAM-SHA-1/256/512 put/get round-trips, wrong-password throws at connect, no-credentials-against-secured-server fails), all green live against a Dockerized auth-enabled Infinispan 16.0.7. Documented in documentation/topics/security.adoc (new AsciiDoc user guide, documentation/index.adoc) with a runnable snippet in examples/quickstart/README.md.

2026-10-09 — Hot Rod URI support (RemoteCache::fromUri) — issue #9

What shipped. A connection-string entry point, requested in issue #9 by Tristan Tarrant (linking the .NET client's "create from URI" docs). New pure, header-only parser HotRodURI::parse() (include/hotrod/HotRodURI.h, following the ServerSelection.h / AuthCodec.h inline precedent) turns a hotrod://[user:password@]host1[:port1][,host2...][?k=v&...] string into a validated value object; RemoteCache::fromUri(uri, cacheName="") consumes it and applies the existing flat setters. +20 unit tests (HotRodURITest), full suite 243/243, Release -Werror clean. No integration test: parsing is pure (unit-covered) and fromUri only wires existing, already-integration-tested setters.

Authoritative behaviour is the Java HotRodURI, not the .NET docs (AGENTS.md source order). Reading org.infinispan.client.hotrod.impl.HotRodURI + ConfigurationProperties + ProtocolVersion surfaced one real divergence from the .NET docs the issue links:

  • protocol_version value form. The .NET docs show version40/version41. Java's ProtocolVersion.parseVersion matches the "major.minor" text form ("4.0", "4.1", "AUTO"). We follow Java → ?protocol_version=4.0.
  • Java query params are generic: every k=v is prefixed with infinispan.client.hotrod. and dumped into a Properties bag that the ConfigurationBuilder later reads, silently ignoring unknowns. We have no such property bag (typed flat setters only), so a translation table is unavoidable — the "generic passthrough" shortcut doesn't exist for us.
  • client_intelligence values are the enum names (BASIC/TOPOLOGY_AWARE/ HASH_DISTRIBUTION_AWARE), parsed case-insensitively in Java; we match that.

Decisions (agreed with the user).

  1. Returns std::unique_ptr<RemoteCache>, not a value. RemoteCache owns a std::mutex (stateMutex_, Step 11b slice 4), so it is non-movable and cannot be returned by value. The client is returned not-yet-connected — the caller still calls connect(), matching the existing constructor flow.
  2. v1 scope: parse the whole URI, wire only what the client supports today, throw clearly on the rest. Only hotrod://; the first host seeds the topology (the rest are parsed into servers but unused for now — topology discovery finds them); credentials enable SCRAM; query whitelist is sasl_mechanism / client_intelligence / protocol_version.
  3. Throw on unknown/unsupported, do NOT silently ignore (diverges from Java). Consistent with the explicit-error choice for the scheme: an unknown param or a bad value for a known param throws HotRodClientException{BeforeSend} rather than being dropped, so a user who sets socket_timeout isn't silently ignored. Trade-off: less forward-compatible than Java's ignore-unknowns, but fail-fast and honest about the gap. BeforeSend is the phase for a construction-time error (nothing was sent).
  4. Exception messages stay generic — no GitHub issue numbers in them (user directive: avoid having to maintain those references in code). The deferred list lives in issue #10, not in the throw strings.

Deferred to issue #10 (each drops its "unsupported" throw as the capability lands): hotrods:///TLS + cert/SNI/hostname-validation params, connect_timeout/socket_timeout, multi-server seed list (startup failover across seeds), non-SCRAM SASL (PLAIN/OAUTHBEARER token), protocol_version=AUTO/3.x.

Aside (not changed here). CMakeLists.txt links OpenSSL::SSL as well as OpenSSL::Crypto, but the code only uses libcrypto (EVP/HMAC/PBKDF2 for SCRAM) — the data socket is plain TCP (Connection.cpp: SOCK_STREAM, ::connect, ::send/::recv, no SSL_*). Confirms STATUS.md's "no TLS". The OpenSSL::SSL link is dead weight; left as a possible future cleanup, folded into the TLS work.

2026-10-09 — Hot Rod URI: end-to-end integration coverage + a single-server caveat

What shipped (same session as the parser). The pure unit tests (HotRodURITest, 20 cases) cover URI string→fields exhaustively, but nothing proved a client built from a URI actually connects and operates. Added that end-to-end proof:

  • tests/integration/FromUriIntegrationTest.cpp (single-server, 2 tests): a plain hotrod://host:port client round-trips a value; a ?protocol_version=4.0 client reports VERSION_40 and round-trips (proves a query param flows all the way to a working client).
  • AuthIntegrationTest.FromUriWithCredentialsAuthenticates: credentials + ?sasl_mechanism=SCRAM-SHA-256 in the URI authenticate end-to-end against the auth server (reuses the existing AuthServerEnvironment, no new auth executable).

Integration: 89→92 across 19 suites; all verified live this session.

Deliberately NOT done: convert the whole test suite to build clients via fromUri. Tempting ("then parsing is always exercised"), rejected because (1) the URI can't express every config — realm, serverName, proxyToNonOwner, cacheName (the path is ignored; cache is a separate fromUri arg); (2) it would couple dozens of unrelated tests to the parser, so a parser change could redden the whole suite — the opposite of the "cheap re-orientation" goal; (3) most tests use a stack RemoteCache while fromUri returns a unique_ptr. The pure unit test is the right home for exhaustive parsing coverage; integration only needs the one end-to-end chain proof.

Caveat found: client_intelligence=hash_distribution_aware can't be integration-tested on the single-server fixture. The first draft of the second test used that param and failed with ISPN006017 Operation 'GET' requires authentication. Cause: the Dockerized single node (started with -p 0:11222, ephemeral host port) advertises its internal container address in the topology, so a hash-aware client reconnects to an address that, from the host, resolved to a different server (the host's ispn-demo/memory-service on 11222, which requires auth). This is the same "topology reports internal container addresses" limitation already recorded for the retry suites (2026-09-25, Step 11c slice 2), not a client bug. Hash-aware routing is therefore exercised only by the multi-server suites; the single-server FromUri test uses the routing-neutral protocol_version instead. (All other single-server suites likewise use BASIC intelligence.)

2026-10-09 — Hot Rod URI: port parser rejected trailing garbage (stoi gap)

Bug fixed. HotRodURI::parse() parsed the port with std::stoi(portStr), which stops at the first non-digit and returns the leading number without error — so hotrod://host:8080x silently became port 8080, and :80 (trailing space) was accepted too. Java's authoritative parser uses Integer.parseInt, which throws on any non-numeric content. Fixed by passing the pos out-param (std::stoi(portStr, &consumed)) and failing unless consumed == portStr.size(), so the whole token must be digits. The range check (1..65535) is unchanged. New unit test HotRodURITest.PortWithTrailingGarbageThrows (:8080x, :80 ); suite 243→244. Found during a post-merge review of issue #9.

2026-10-09 — Hot Rod URI: percent-decode userinfo + query values (RFC 3986)

Bug fixed. HotRodURI::parse() operated on the raw URI substrings end to end — no %XX decoding anywhere. The Java client parses through java.net.URI and reads the decoded getUserInfo()/getQuery(), so the two diverged for any component carrying a URI-reserved or non-ASCII character. The reserved characters @ and : are the userinfo/host and user/pass delimiters, so a password containing them (e.g. p@ss) has only one legal URI form — percent-encoded (hotrod://admin:p%40ss@node). Java decoded that back to p@ss; this parser handed the literal string p%40ss to setAuthentication, so SCRAM hashed the wrong secret → ISPN006017 ... requires authentication. There was no workaround (a literal @ in the password misparses the authority), so credentials with reserved characters were simply unexpressible through fromUri. Found during a post-merge review of issue #9.

Fix. Added a header-only percentDecode() helper (%XX → byte, everything else verbatim) and applied it to username, password, and query-parameter values. Query keys stay raw — they are matched against the fixed whitelist names, none of which contain escapable characters. Suite 244→250 (+6: PasswordPercentDecoded, UsernamePercentDecoded, EncodedColonInPasswordPreserved, PercentDecodeLowercaseHex, QueryValuePercentDecoded, MalformedPercentEscapeThrows). Release -Werror clean.

Decisions.

  1. Decode after the raw split, not before (diverges from Java, deliberately). Userinfo is split into user/pass on the raw string (so an encoded @/: isn't mistaken for a delimiter), then each half is decoded. Java instead decodes the whole userinfo then split(":"), which truncates a password at a decoded : and drops the tail — a real Java limitation. Splitting first preserves pa%3Ass → pa:ss. For every character that is not a colon the two orders agree, so this only improves the colon case. (EncodedColonInPasswordPreserved locks it in.)
  2. + is left as-is, NOT mapped to space. java.net.URI does not treat + as a space — that is application/x-www-form-urlencoded, not RFC 3986 URI decoding. Mapping it would break Java parity.
  3. Malformed escapes throw (% not followed by two hex digits), matching java.net.URI's parse-time rejection and this parser's fail-fast stance, rather than passing a stray % through. BeforeSend phase (construction-time).

Note. The three whitelisted query values (sasl_mechanism, client_intelligence, protocol_version) never contain escapable characters today, so decoding them is currently a no-op; it is done anyway for Java parity and to be ready for issue #10's token= (OAUTHBEARER), whose values can carry =/+//.

2026-10-09 — Stop repeating test counts across docs (CI badge considered, rejected)

Problem. The unit/integration test counts were hand-typed in ~6 places across README.md and docs/STATUS.md. Every test change meant editing all of them, and nothing verified the numbers — one README spot had silently drifted to 223 unit tests while the real count had moved on.

Considered: a CI-published shields.io badge. Compute counts from the built test binaries in CI (scripts/count_tests.sh, counting via --gtest_list_tests so the number matches what actually runs and needs no Docker) and force-push a shields endpoint JSON to an orphan badges branch for the README to embed. Prototyped, then rejected as overkill for a solo, intermittently-worked repo: it added a CI step with contents: write, an orphan branch, a helper script, and a badge that 404s until the first post-merge run and lags behind CDN caching — a lot of moving parts to avoid typing a number.

Decision. Just remove the duplication. docs/STATUS.md (the authoritative current-state doc) carries the totals once, in its "Test status" section; everywhere else describes what is covered rather than repeating the totals:

  • README drops all hard counts — the ### Unit Tests / ### Integration Tests headings, the directory-tree comments, and the "Test Results" block (which now points at STATUS.md for the breakdown).
  • Per-feature breadcrumbs ("shipped … N unit + M integration tests") stay, as point-in-time slice notes.

The one-place count is refreshed by hand when it drifts; --gtest_list_tests on the built binaries (unit_tests plus the ctest integration-labelled suites) is the quick way to get the real number without a grep TEST(, which overcounts parameterized/disabled macros.

Provenance. This decision + convention originated in PR #14 (feat/test-count-badge); that PR was closed unmerged and its changes were re-applied here (it had gone stale/conflicting against main). Counts as of this re-application: 250 unit / 96 integration / 20 suites.

2026-10-12 — Integration tests hung on CI: Infinispan :latest CLI stopped exiting on EOF

Symptom. Every CI run from Oct 9 on hung: GetIntegrationTests started and produced no further output until the 30-min job timeout cancelled it (an orphan docker process was left behind). Only the Ubuntu job runs integration tests (Fedora is build-only, Windows doesn't build them), so it looked Ubuntu-specific. main had last run green on 2026-09-25 and the branch on top of it was docs-only — the code was identical, so the trigger was environmental, not the change.

Root cause. The integration tests pull quay.io/infinispan/server:latest (never pinned). Between Sep-25 and Oct-9 :latest advanced from 16.0.x to 16.3.0, and 16.3's cli.sh, when fed a command through a pipe (echo 'create cache …' | cli.sh -c <url>), now runs the command but does not exit on stdin EOF — it drops into an interactive session and blocks forever. 16.0.x exited cleanly on EOF. The helper createCacheViaCLI (copy-pasted into 13 integration files) wraps that in system("… >/dev/null 2>&1") with no timeout, so the whole suite hung. Reproduced locally against both 16.3.0 (hangs) and 16.0.7 (exits) via podman.

Fix. Run the CLI in batch mode: cli.sh -c <url> -f - (read commands from stdin, exit at EOF). Applied to all 13 createCacheViaCLI copies. Also added a per-test ctest TIMEOUT 300 to every integration suite so a future stall fails in minutes instead of burning the 30-min job budget (slowest real suite is TopologyIntegrationTests at ~117s, so 300s has comfortable headroom).

Not pinned. 16.3.0 is otherwise fully compatible — the full ctest -L integration suite passes 18/18 green against real docker on :latest (16.3.0) (verified 2026-10-12). An earlier local Connection reset by peer on the Get ops was a rootless-podman networking artifact (reproduced identically on known-good 16.0.7, and absent under real docker), not a version regression — so :latest was left unpinned rather than frozen to an old release.

2026-10-19 — FromUri integration suite back-filled with the 16.3 CLI-hang fix

The createCacheViaCLI helper added with the Hot Rod URI work (tests/integration/FromUriIntegrationTest.cpp) was copied from a pre-fix template, so it still piped create cache into cli.sh without batch mode and was missing from the ctest TIMEOUT 300 group — the exact hang the 2026-10-12 fix addressed everywhere else. Added -f - to its CLI invocation and listed FromUriIntegrationTests in the timeout block so this suite can no longer stall the CI job on Infinispan :latest.

2026-10-19 — Multi-server seed list: startup + runtime failover (issue #12)

What: fromUri now carries all comma-separated hosts as seed servers (RemoteCache::seeds_, retained in URI order; mirrors the Java client's immutable ClusterInfo.getInitialServers()). Two failover tiers were added:

  • Startup — connect() tries each seed in order, reusing the pre-built connection_ for seeds_[0] and building fresh for the rest; the first success becomes the bootstrap connection_ (and host_/port_). If every seed is unreachable it throws one HotRodClientException(BeforeSend) whose message lists every seed tried (with its error).
  • Runtime — a new tryConnectSeeds(exclude, tried) helper (caller holds stateMutex_) is wired into the fall-through points of both selection methods: selectAnyServer (keyless), the hash-owners-exhausted path of selectServerForKey, and that method's no-hash/no-owners/empty fallback (which previously just return connection_). It prefers the live bootstrap connection_ (fast path, so the happy path and BASIC mode do no new I/O), else walks the seeds via the existing pure orderKeyCandidates({}, seeds_, exclude∪tried) and adopts the first reachable seed as the new bootstrap connection so the next op's fast path reuses it instead of re-probing a dead one.

Why it matters: v1 of the URI work (issue #9) used only the first host as the seed and relied on topology discovery for the rest, which loses startup failover and — in BASIC mode, where no topology is ever learned — any failover at all.

Design decisions (discussed before implementing, compared against the Java 16.3 client):

  • Honor proxyToNonOwner for keyed seed fallback (D5 preserved). When a key's owners are all down/excluded and proxyToNonOwner_ == false, we do not fall back to a seed — a seed serving a non-owned key is a proxy, exactly what that flag forbids. So keyed seed fallback is gated on proxyToNonOwner_. (Java has no such flag — it always proxies; our default true matches Java, the strict mode is a C++-only opt-in.) Bootstrap cases (empty/no topology, no owners) ignore the flag, since there are no owners to exhaust.
  • Caller-driven exhaustion ≠ unreachability. If the topology is non-empty but the caller excluded every known server, we throw rather than rescue via a seed. Found via PingRetryIntegrationTest.AllServersExcludedThrowsBeforeSend: the seed's address (localhost:11222) differs from the topology's internal container address (172.18.0.x:11222) for the same node, so an exclusion set built from topology addresses does not contain the seed — the seed fast path would have wrongly rescued the excluded ping. Fix: seed fallback fires only when we have no topology at all, or when we actually attempted ≥1 server and it failed (not when the candidate list was emptied purely by exclusion). Applied to both selection paths (an explicit candidates.empty() throw in selectAnyServer; a !tried.empty() gate on the keyed path).
  • Reassign connection_ on runtime failover (+ fast path), and lock its reads. Pointing connection_ at the reached seed keeps isConnected() truthful and avoids re-probing the dead bootstrap seed on every op during an outage. Because connection_ can now be reassigned from a user/op thread (under stateMutex_), the previously-unlocked reads in isConnected()/disconnect() now take stateMutex_ to remove the shared_ptr assignment race. disconnect() copies the pointer out under the lock and calls close() outside it (close joins the read loop, which may be blocked in handleTopologyUpdate waiting on the same mutex). The startup connect() reassignment is pre-read-loop/single-threaded.
  • Runtime seed (re)connection is gated on a connect()..disconnect() lifecycle flag (active_). First cut of tryConnectSeeds reconnected whenever the bootstrap connection was down — which silently re-established a connection for an op issued after disconnect() (or before connect()), breaking the long- standing contract that such ops throw. Caught by the full ctest sweep: all ten *AfterDisconnect suite tests failed (they EXPECT_THROW std::runtime_error after disconnect(); BASIC mode has empty topology, so they hit exactly the new keyed seed-fallback path). Fix: active_ is set true at the end of a successful connect() and false in disconnect() (both under stateMutex_); when false, tryConnectSeeds returns the bootstrap connection_ unchanged so the op throws "Not connected" as before. ReconnectAndPing (disconnect → connect again) still works because connect() re-sets the flag.

Divergences from the Java client (intentional, cross-checked against /home/rigazilla/git/infinispan/client/hotrod-client @ 16.3):

  • connect() all-seeds-down throws; Java tolerates. Java's OperationDispatcher .start() eagerly connects to all initial servers but swallows every failure and defers to the first op. We keep our existing "connect() establishes ≥1 connection or throws" contract — clearer for callers; the thrown message names every seed for diagnosis.
  • No failed-server timeout memo. Java keeps a global connectionFailedServers set with serverFailureTimeout expiry so it pre-emptively avoids known-dead servers. We have no equivalent, so during an outage we re-probe dead topology members per op (the dead bootstrap seed is avoided by the reassign+fast-path). Latency-under-failure only, never a wrong result. Left as future work.
  • Privileged connection_ kept (not folded into the pool). Java 16.x has one equal channel per address and no distinguished connection; our bootstrap connection_ lives outside connectionPool_, which is why the fast-path/locking dance exists and why seeds_[0] can hold a duplicate socket (one as connection_, one as a pool entry) once it also appears in topology. Keeping it was a scope call: folding it into the pool as just-another-entry (the Java-faithful model, which would delete the fast-path/locking code) is a larger refactor tracked as future work. Functionally the layered model matches Java's observable failover behavior.

Tests: +2 startup-failover in FromUriIntegrationTest (recover via 2nd seed; all-seeds-unreachable throws naming each) and +2 MultiSeedIntegrationTest: RuntimeFailoverAcrossSeedsBasic (2-node cluster, BASIC client seeded with both, kill the connected node, next op recovers via the other seed) and TopologyAwareStartupFailoverAndHashRouting (HASH client from a multi-seed URI with a dead first seed: connect() fails over, then topology discovery + hash routing work). The pure "all topology members unreachable -> seed" corner is not staged as an integration test: the seeds are the cluster nodes, so killing every topology member also kills every seed — the BASIC test isolates the seed tier instead. All affected regressions re-run green: RetryView (incl. the D5 proxy-disabled throw), PingRetry (incl. the all-excluded throw fixed above), HashAwareRouting, ConcurrentMultiServer; unit 250/250; -Werror/Release build clean.

2026-10-19 — Schema gotcha preserved from STATUS: replace_if_unmodified nibble flip

What: Recording — in its proper home — a schema bug found 2026-09-20 that had only ever lived in STATUS.md, moved here during the STATUS backlog cleanup so it is not lost. hotrod40.ksy replace_if_unmodified_request packs the expiration time_units nibbles in the OPPOSITE order from put_request/expiration_params (lifespan and maxIdle swapped). Java uses one shared writeExpirationParams for both PUT and replaceWithVersion, so PUT's order — high nibble = lifespan, low nibble = maxIdle — is authoritative and is what this client implements (replaceWithVersion 0x09, shipped 2026-09-20). Cross-checked against this client + Java ReplaceIfUnmodifiedOperation + a corrected reading of the schema. Why it matters: if someone later "fixes" the client to match the .ksy here, replaceWithVersion's lifespan/maxIdle would silently swap. The .ksy is still wrong on this point; fix pending upstream in hotrod-dissector.

2026-10-19 — Align all test fixtures to :latest (cluster compose was pinned 16.2)

What: test-configs/docker-compose-cluster.yml (the multi-node fixture used by start_cluster.sh/add_cluster_node.sh for the topology/hash/retry/concurrent/ multi-seed suites) pinned quay.io/infinispan/server:16.2, while the single-server and auth fixtures (scripts/start_infinispan_noauth.sh, start_infinispan_auth.sh) already used :latest. Changed all four cluster node images to :latest so every integration suite exercises the same (newest) server. The quickstart example (examples/quickstart/start-server.sh) intentionally stays pinned to 16.2 — it's a copy-paste demo, not a test.

Why: the split meant different suites tested different server versions (so a multi-node regression on a new server could hide until a cluster run happened to use it). STATUS.md already claimed "integration tests pull :latest", which was an overclaim until now.

Risk + mitigation: :latest can drift and break (see the 2026-10-12 CLI-hang entry) — the TIMEOUT 300 guard per ctest suite plus cli.sh -f - batch mode keep a server-side change failing fast rather than hanging CI. Verified the full multi-node suite set green against :latest = 16.3.0 on 2026-10-19 after the switch.

2026-11-06 — Server-authenticated TLS for hotrods:// (issue #18, sub-issue of #10)

What: first TLS slice. hotrods:// no longer throws; the client wraps every connection it opens (seed + topology-discovered) in a TLS session over OpenSSL. New pure value TlsConfig (include/hotrod/TlsConfig.h); RemoteCache::setTls(...) mirrors setAuthentication and is pushed to each MultiplexedConnection → Connection at the same two build sites as auth/protocol/intelligence. The handshake lives in Connection::startTls() (src/transport/Connection.cpp): TLS_client_method, min TLS 1.2, trust anchors from a PEM ca_file (empty = SSL_CTX_set_default_verify_paths, the system store), SSL_VERIFY_PEER always, SNI via SSL_set_tlsext_host_name, host-name match via SSL_set1_host. send/ receive route through SSL_write/SSL_read when a session is live.

Scope decisions (settled with the maintainer before coding):

  • Server-auth only this slice. Mutual TLS (client cert/key) is deferred.
  • PEM, not Java keystores. This is an OpenSSL-native client; JKS/PKCS12 + type/alias/store-password make no sense here. We deliberately diverge from the Java SslConfiguration surface. Note the semantic reuse: the URI key trust_store_file_name (a keystore in Java) is interpreted here as a PEM CA file; trust_store_type is not accepted (PEM is implied). Java itself supports trust_store_type=pem, so this isn't alien to Infinispan.
  • URI = option C. hotrods:// enables TLS with defaults; the URI additionally recognizes exactly the three Java-named keys that map onto TlsConfig (trust_store_file_name→ca_file, sni_host_name→sni_host, ssl_hostname_validation→hostname_validation). Every settable TlsConfig field is reachable both programmatically and from the URI; nothing more. The other recognized Java TLS keys (use_ssl, key_store_*, *_store_type, *_password, key_alias, ssl_protocol/ciphers/named_groups/provider/ context) are rejected with "not supported yet (… deferred; issue #10)" rather than silently ignored — preserving the parser's fail-fast contract. TLS params on a plain hotrod:// URI are a hard error ("require the hotrods:// scheme").

Behavioral calls:

  • Min TLS 1.2 (SSL_CTX_set_min_proto_version).
  • SNI skipped for literal IPs (RFC 6066) — and such a name is not host-validated as a DNS name either (isLiteralIp guards both). To dial a loopback IP but still verify a name, set sni_host to the DNS name (what the unit test does).
  • hostname_validation=false disables only the host-name match, not chain verification — chain verification is unconditional. Matches Java's hostnameValidation semantics.
  • Quiet shutdown on teardown. Connection::close() sets SSL_set_quiet_shutdown before SSL_shutdown, so teardown never writes a close_notify. Writing it to an already-dead peer raises SIGPIPE/EPIPE, which with the default disposition kills the process for no benefit. (The in-process test server also installs SIG_IGN for SIGPIPE, since its echo thread writes on close.)

OpenSSL::SSL link is now live. Supersedes the 2026-10-09 "Aside": CMakeLists.txt already linked OpenSSL::SSL as dead weight next to libcrypto; the handshake code now uses it (SSL_*), so the link is no longer dead. The entry's "folded into the TLS work" prediction holds.

Tests: tests/unit/TlsConnectionTest.cpp drives the real handshake against an in-process OpenSSL echo server (loopback, ephemeral port) presenting a PEM leaf (SAN=test.local) signed by a test CA — fixtures in tests/fixtures/tls/ (36500-day validity; path injected via the TLS_FIXTURE_DIR compile definition). Cases: trusted-CA + matching name → handshake + encrypted round-trip; untrusted CA → throw; name mismatch with validation on → throw, with validation off → succeed. POSIX-only (like the integration suites); the cross-platform URI-level parsing is in HotRodURITest.cpp. Full unit suite green (260 tests), stable across repeated runs.

Integration test (Docker): tests/integration/TlsIntegrationTest.cpp + scripts/start_infinispan_tls.sh + test-configs/infinispan-tls.xml run the full parse→connect→PUT/GET chain over hotrods:// against a real TLS-enabled Infinispan (Hot Rod endpoint with a PKCS12 server identity, no SASL). Server cert test-configs/tls/server.p12 (alias server, SAN DNS:localhost / IP:127.0.0.1, password password); client trusts test-configs/tls/ca.pem. Cases: programmatic setTls round-trip, hotrods://?trust_store_file_name= round-trip, untrusted anchor (empty CA → system store) rejected, host-name mismatch rejected / accepted with validation off. Label integration;docker;tls, TIMEOUT 300. Two gotchas hit while wiring it: the mounted keystore must be world-readable (the in-container user can't read a 0600 :ro mount → FileNotFoundException: … (Permission denied)), and keystore-password is deprecated in favor of password on the <keystore> element.

SIGPIPE on a dropped TLS connection — fixed at the library, per-connection. The first integration run was killed by SIGPIPE (exit 141): a client-side write onto a closed TLS peer raises SIGPIPE, whose default disposition terminates the process. We checked the authoritative Java client — it has no SIGPIPE handling because the JVM sets SIGPIPE to SIG_IGN process-wide at startup; a broken connection then surfaces as an IOException. That is a runtime (process-owner) decision. Our C++ client is a guest linked into someone else's process and has no business flipping process-global signal disposition — a global SIG_IGN would, e.g., break a well-behaved CLI tool that relies on SIGPIPE for shell-pipeline semantics. So instead of mirroring the JVM's global flip, we suppress SIGPIPE per connection, confining the effect to our own sockets (option 2):

  • Plain send() uses MSG_NOSIGNAL on Linux (HOTROD_SEND_FLAGS).
  • macOS/BSD set the socket option SO_NOSIGPIPE after socket() — socket-level, so it also covers OpenSSL's writes on that fd.
  • Linux's TLS path routes all OpenSSL socket I/O through a custom BIO (sigpipeSafeBioMethod in Connection.cpp) whose write uses MSG_NOSIGNAL. One mechanism covers every OpenSSL write — SSL_write, plus the writes SSL_connect/SSL_read trigger internally (handshake, renegotiation, TLS 1.3 post-handshake). The BIO never closes the fd (Connection owns it); SSL_set_bio takes ownership and frees it in SSL_free. Windows has no SIGPIPE, so it keeps the default SSL_set_fd BIO.

Net: observably identical to Java (dropped connection → our thrown exception, process survives), but with a narrower blast radius than the JVM — we never touch the app's global signal disposition. The integration test's main() deliberately does not install SIG_IGN, so it genuinely proves the library is self-sufficient (exit 0, not 141). The unit test still installs SIG_IGN, but only to guard its in-process echo server thread (harness code doing raw SSL_write/SSL_shutdown), not the client. close() additionally uses quiet shutdown so teardown performs no close_notify write at all.

Deferred (unchanged, issue #10): mutual TLS / client cert+key, Java keystore formats, cipher/protocol/provider tuning, connect_timeout/socket_timeout, non-SCRAM SASL, protocol_version=AUTO/3.x.

2026-11-09 — Integration tests force --pull always (stale :latest cache, not an API change)

What: The integration suites bring up quay.io/infinispan/server:latest. Every cluster-dependent suite (Topology, HashAwareRouting, ConcurrentMultiServer, RetryView, PingRetry, MultiSeed) suddenly failed — first "Failed to start cluster", and once the cluster did start, "Resource not found" from the REST helpers (getServerClusterSize, getPrimaryOwnerForKey, RestAPIHelper). The fix: pin the pull behavior, not the API — pull_policy: always on all four nodes in test-configs/docker-compose-cluster.yml, and docker run -d --pull always in scripts/start_infinispan_{noauth,auth,tls}.sh.

Why it matters / how it was found: The tests query the server over the REST v3 API (/rest/v3/cluster/_distribution, /rest/v3/caches/{c}/...). That API is correct for current server builds. The failures were environmental: Docker only pulls :latest when the tag is absent locally, so an 8-month-old cached :latest (Feb 2026, id 43285deb7485) — which predates rest/v3 and 404s on it — kept being reused, even though newer tags (16.3, id fa22dddecda4, 2026-10-20) were present under other names. The REST probes counted 0 members / returned 404, so clusters "never formed" and owner lookups came back empty. Confirmed by probing both images directly: cached :latest → rest/v3 404; 16.3 → rest/v3 200. A manual docker pull …:latest (now resolves to the 16.3 build) turned the suite green; the pull-policy change makes that automatic so a stale local cache can never again silently run an old server. CI (no cache) was unaffected, which is why this only bit local runs.

Dead end (not shipped): first mis-diagnosed as an API removal and rewrote the test helpers + cluster scripts from rest/v3 to rest/v2 ?action=. Reverted in full once the 16.3 probe showed rest/v3 still present — the API was never the problem. Test code stays on rest/v3.

Gotcha for next time: scripts/ and test-configs/ are copied into the build dir by file(COPY …) at configure time (CMakeLists.txt), and integration tests run from ${CMAKE_BINARY_DIR} using those copies. After editing a script or compose file, re-run cmake -S . -B build (a reconfigure, not cmake --build) or the test keeps executing the stale build copy.

2026-11-09 — TLS host validation uses X509_VERIFY_PARAM (SSL_set1_host deprecated in OpenSSL 4.0)

What: The Fedora CI job failed to build src/transport/Connection.cpp: SSL_set1_host is deprecated as of OpenSSL 4.0 and the build uses -Werror=deprecated-declarations. Ubuntu and Windows (older OpenSSL) built fine, so this was CI-only on Fedora's bleeding-edge OpenSSL. Fix: drop the deprecated SSL_set_hostflags / SSL_set1_host convenience wrappers in startTls() and configure the SSL's verification params directly: X509_VERIFY_PARAM_set_hostflags(SSL_get0_param(ssl), …) and X509_VERIFY_PARAM_set1_host(SSL_get0_param(ssl), host, 0).

Why it matters: The SSL_set1_host family are thin aliases over the X509_VERIFY_PARAM_* functions, so behaviour is byte-for-byte identical on every OpenSSL version, and the param API exists since OpenSSL 1.1.0 — the change builds clean on 1.1.0 through 4.0 with -Werror=deprecated-declarations. Verified locally against OpenSSL 3.5.9 (compiles) and confirmed the replacement against the OpenSSL 4.0 docs. (Cannot reproduce the 4.0 deprecation locally — local Fedora ships 3.5.9 where the symbol is not yet deprecated — but the fix references no deprecated symbol, which is what the 4.0 build needs.)

Watch out (not yet an issue): OpenSSL 4.1 additionally drops the common-name fallback entirely (RFC 9525 — SAN-only matching). Our test certs/validation already rely on SANs, so no action needed now, but keep it in mind if a future runner moves to 4.1.

2026-11-09 — TLS test certs: committed fixtures + a generator to reproduce them

What: The TLS suites use certificate fixtures that were hand-made with openssl and committed as opaque blobs in the #18 commits (f28a911 added the unit set tests/fixtures/tls/{ca,otherca,server}.pem + server.key; 7d39cfa added the integration set test-configs/tls/{ca.pem,server.p12}). There was no script to regenerate them — the "how" lived only in prose. Added scripts/gen-test-certs.sh which reproduces both sets.

Why it matters: The fixtures carry ~100-year validity so they never expire and normally need no touching, but any change (a new SAN, different key type, mutual-TLS client certs for #10, rotation) previously meant reverse-engineering the chain. The generator documents it as runnable code: self-signed roots via stock req -x509 (critical CA:TRUE + SKI/AKI), leaves carrying only the SAN, RSA-2048/SHA-256. Unit set: CN=Test Root CA + leaf CN=test.local SAN DNS:test.local, plus an unrelated CN=Other Root CA for the untrusted-anchor test. Integration set: CN=Integration Test CA + CN=localhost leaf (SAN DNS:localhost,IP:127.0.0.1) exported to server.p12 (alias server, password password).

Note: Output is NOT byte-identical to the committed files (fresh random keys/serials/timestamps) — the committed set is left as-is; the script is only run when the fixtures must actually change, and the regenerated files must then be git added deliberately. CA private keys are not written to the tree (not part of the committed fixtures); each run regenerates the whole chain together. Output dirs overridable via UNIT_DIR/INT_DIR env vars (used to self-test without clobbering the committed set).

2026-11-12 — PEM-honest TLS URI keys + mutual TLS (client cert/key)

What: Two linked changes to the TLS story.

  1. Mutual TLS (client certificate). TlsConfig gains cert_file / key_file / key_password (all PEM). Connection::startTls now loads a client cert chain + private key (SSL_CTX_use_certificate_chain_file + SSL_CTX_use_PrivateKey_file + SSL_CTX_check_private_key) and supplies the key passphrase via SSL_CTX_set_default_passwd_cb so an encrypted key never blocks on a terminal prompt. cert and key must be set together (fail-fast otherwise).

  2. PEM-honest URI keys + fail-fast on Java keystore keys. The server-trust URI key was renamed trust_store_file_name → ca_file (the name no longer implies a JKS/PKCS12 container). New client-identity keys client_cert_file, client_key_file, client_key_password. The Java keystore keys (trust_store_file_name, trust_store_type, trust_store_password, key_store_file_name, key_store_type, key_store_password, key_alias) are now rejected with a redirect message pointing at the PEM equivalent, instead of the old generic "not supported yet".

Why it matters: This client uses PEM, not Java keystores (decided for the #18 trust store). The shipped #18 key trust_store_file_name accepted a path but read it as PEM — so a ported Java URI (trust_store_file_name=truststore.jks) would have been silently misread. That was the one TLS URI footgun that failed silently rather than loudly. Renaming to ca_file and making every keystore key throw with the fix ("use ca_file= / client_cert_file=+client_key_file= (PEM)") removes the ambiguity: a ported Java URI now fails fast with the exact correction.

Superseded: the 2026-11-06 #18 decision that the URI carried trust_store_file_name as a PEM CA path — that key is now rejected; use ca_file. This is a deliberate backward-compat break, taken while #18 is still fresh.

Gotcha discovered (TLS 1.3 mutual-TLS failure surfaces late): when the server requires a client cert and the client presents none, SSL_connect() succeeds under TLS 1.3 — the server's "certificate required" alert only arrives on the first I/O. (Under TLS 1.2 it fails at the handshake.) Production is unaffected because a PING/SASL exchange immediately follows connect(); the unit test asserts the failure across connect()+first-I/O rather than at connect() alone.

Deferred still: PKCS12/JKS keystore formats (PEM only, by decision), non-SCRAM SASL, timeouts (issue #10). EXTERNAL SASL (which authenticates via the client cert) is now unblocked by this change but not yet implemented.

Keys still rejected (not keystore-related): use_ssl, ssl_protocol, ssl_ciphers, ssl_named_groups, ssl_provider, ssl_context — protocol/cipher tuning deferred (issue #10).

2026-11-12 — Non-SCRAM SASL: PLAIN, EXTERNAL, OAUTHBEARER

What: The SASL driver (SaslAuthenticator) now supports three single-message mechanisms beyond the SCRAM family: PLAIN (RFC 4616), EXTERNAL (RFC 4422), and OAUTHBEARER (RFC 7628). GSSAPI/GS2-KRB5 (Kerberos) and DIGEST-MD5 remain unsupported and throw at connect().

  • Authentication gains a token field (OAUTHBEARER bearer token). A new RemoteCache::setAuthentication(const Authentication&) overload configures mechanisms the username/password convenience setter can't (OAUTHBEARER token, EXTERNAL cert identity).
  • HotRodURI now parses token (previously an unknown-key error) and keeps sasl_mechanism; fromUri enables auth on any auth signal (mechanism, creds, or token) rather than requiring a username — EXTERNAL/OAUTHBEARER have none.
  • Pure, unit-testable initial-response builders live in include/hotrod/SaslMechanisms.h (header-only, like AuthCodec.h).

Why it matters: The wire layer (AuthCodec, SaslTransport) was already mechanism-agnostic — it carries a mechanism name + opaque token bytes — so only the driver was SCRAM-specific. Generalizing it (classify mechanism → SCRAM multi-turn vs single-message path) kept the well-tested SCRAM flow untouched while adding the common non-Kerberos mechanisms cheaply. EXTERNAL was unblocked by mutual TLS (same-day #18 work): the client identity is the TLS client certificate.

Design notes / gotchas:

  • PLAIN builds authzid NUL authcid NUL passwd as raw bytes (NULs), never a C string; authzid empty = authorize as the authcid. Must be used over TLS (password is effectively cleartext). Requires a username (throws otherwise, BeforeSend).
  • EXTERNAL sends the authorization id (usually empty — identity from the cert). Needs no credentials; pointless without a mutual-TLS client cert.
  • OAUTHBEARER sends n,[a=authzid],^Aauth=Bearer <token>^A^A (^A = 0x01). Requires a token (throws otherwise). On failure the server returns a non-completed error challenge and expects a lone 0x01 continuation before failing the exchange with an ERROR frame (RFC 7628) — the driver handles that extra turn.
  • Mechanism names are matched case-sensitively against the server's offered list (as on the wire): use the canonical upper-case names.

Coverage: unit only — pure builders + driver flows against fake servers (success, bad credentials, missing username/token, mechanism-not-offered, OAUTHBEARER failure continuation). End-to-end integration against a real server is deferred (needs server realms/token issuer; see STATUS backlog), as with mutual TLS.

Deferred: GSSAPI/GS2-KRB5 (needs MIT krb5/Heimdal + multi-round GSS exchange), DIGEST-MD5 (obsolete). SASL QOP/sasl_properties.* not wired.

2026-11-13 — Integration coverage: mutual TLS, SASL PLAIN, SASL EXTERNAL

What: Added Docker-backed, end-to-end integration tests for three features that previously had unit coverage only, closing two STATUS backlog items (mutual TLS, non-SCRAM SASL — all but OAUTHBEARER). One integration-coverage change set:

  • PLAIN — no new infra. infinispan-auth.xml already offers PLAIN alongside the SCRAM family and uses the same plain-text realm, so PLAIN reuses the existing AuthMechanismRoundTrip fixture via a second INSTANTIATE_TEST_SUITE_P (now 7 AuthIntegrationTests).
  • Mutual TLS — new MutualTlsIntegrationTest (suite MutualTlsIntegrationTests) against test-configs/infinispan-mtls.xml (require-ssl-client-auth, client-CA truststore, no SASL). Cases: programmatic setTls(cert/key) round-trip, hotrods:// URI with client_cert_file/ client_key_file round-trip, and a no-client-cert rejection.
  • EXTERNAL — new ExternalAuthIntegrationTest (suite ExternalAuthIntegrationTests) against test-configs/infinispan-external.xml (the mutual-TLS realm + <truststore-realm/> + SASL EXTERNAL). Cases: programmatic setAuthentication({mechanism="EXTERNAL"}) + mutual TLS round-trip, and the same via a hotrods:// URI with sasl_mechanism=EXTERNAL.

One parameterized start script (scripts/start_infinispan_mtls.sh [config]) serves both TLS configs; scripts/gen-test-certs.sh now also emits the integration client identity (client.pem/client.key) and the server truststore bundle (client-truststore.pem). Fixtures are committed. New ctest labels: mutual-tls (both new suites), plus auth+tls on the EXTERNAL suite.

Why it matters / gotchas discovered while wiring the server side:

  1. <truststore-realm/> trusts specific client certificates, not just the CA. With a CA-only PEM truststore the pure-mTLS endpoint (no realm) accepted our client cert fine, but the EXTERNAL endpoint rejected the TLS handshake with tlsv1.3 alert certificate unknown (OpenSSL 0A000416, SSL alert 46). Root cause confirmed against Infinispan's own harness: CertificateAuthority.export Certificates stores each leaf cert (getCertificateChain()[0]) as a truststore entry, not the issuing CA. Fix: the committed server truststore is a bundle of the client leaf cert + its CA (client-truststore.pem) — the leaf entry satisfies the truststore-realm's exact-cert trust, and the CA lets the pure-mTLS trust manager validate the chain too. One bundle serves both configs.

  2. TLS 1.3 reports a required-but-missing client cert after the handshake, not at connect(). With require-ssl-client-auth, a client that presents no cert still sees SSL_connect() succeed under TLS 1.3 — the server's certificate required alert arrives post-handshake, surfacing on the first read/op. So the no-client-cert test asserts an exception across connect()+op (the AuthIntegrationTest.NoCredentialsFails pattern), not EXPECT_THROW(connect). (openssl s_client ... <<< Q masks this: it verifies only the server cert and quits before reading the alert, so it looks like success.)

  3. require-ssl-client-auth is valid on the single-port <endpoint> (it is a protocol-connector base attribute in the 16.0 server schema), and Infinispan auto-detects a PEM truststore (password="" per the schema) — no PKCS12 needed for the client-trust material.

Authoritative references used (per AGENTS.md): Infinispan server tests AuthenticationCertIT + security/trustrealm.xml + endpoints/auth-tls-external.xml (realm/endpoint shape), and the 16.0 server XSD (attribute placement, PEM detection).

Deferred: OAUTHBEARER integration (needs a token issuer/realm — Keycloak or a static-JWT public key + pre-minted token); it remains unit-only. See STATUS backlog.

2026-12-02 — Docs: mirror the Go single-book layout + publish to GitHub Pages (issue #26)

Decision: Align the user guide and README with the sibling Hot Rod clients by mirroring the Go client's documentation model, and publish the rendered guide to GitHub Pages. Document shipped features only (per AGENTS.md: STATUS.md is authoritative; no stubs for unshipped features). This commit lands the infrastructure only (phase 1 of 3):

  • scripts/build-docs.sh — the single source of truth for rendering: runs asciidoctor to documentation/_build/index.html, copies css//js/ when present, and offers --serve (python http.server) / --watch (entr) for a local edit loop. Works from a fresh clone with no CMake configure.
  • CMake docs target wrapping the script (cmake --build <dir> --target docs), gated on find_program(asciidoctor) so it is a no-op when asciidoctor is absent.
  • .github/workflows/docs.yml — renders on every push/PR touching the docs (catches breakage early) and deploys to Pages only on push to main, via actions/upload-pages-artifact + actions/deploy-pages.

Why Go, not Java: the C++ docs are already the Go single-book layout (index.adoc + flat topics/, same filenames for the six shared topics), so convergence is polish + content, not a restructure. The Java guide uses a heavier three-tier titles/→stories/→proc_/con_/ref_ topics/ structure built for monorepo reuse — a poor fit for a standalone repo.

Why Pages (vs Go's approach): the Go client only attaches a docs.zip to releases and relies on infinispan.org for a browsable page — there is no live GitHub-hosted HTML. Pages gives a always-current browsable URL (https://<owner>.github.io/cpp17-client/), strictly better for a standalone repo. Enable Pages on the rigazilla fork for an immediate preview; the same workflow serves upstream once a maintainer enables Pages there.

Alternatives considered: release-zip only (Go parity, but no live page — rejected); Doxygen API reference alongside the guide (deferred to a follow-up to keep this focused); Java three-tier layout (rejected, see above).

Shared build command (CI == local): both the docs target and the workflow call scripts/build-docs.sh, so "renders locally" means "renders on Pages".

Remaining (phases 2–3, tracked in #26): adopt the Go conventions (:brandname:, docinfo jsTree TOC, AI-CODE.md, [source,cpp]), reorder chapters to Go order, flesh out the stub topics, and restructure README.md.

2026-12-03 — Opt-in code-coverage CMake targets (full + patch/diff)

Decision: added -DENABLE_COVERAGE=ON plus three custom targets — coverage (whole-project gcovr report: terminal summary + HTML + Cobertura XML), coverage-diff (patch coverage of only the lines changed vs a base branch, via diff-cover), and coverage-reset (wipe stale .gcda). Off by default; normal and CI builds are untouched. Tools (gcovr, diff-cover) are discovered with find_program, so a target simply isn't created when its tool is absent.

Why: there is no coverage gate in the repo and none is being added — these are local/dev reporting aids. The patch-coverage target in particular answers "how well tested are the lines this PR changes" (diff-cover coverage.xml --compare-branch), which is more useful for review than a drifting whole-repo percentage.

Gotchas found while wiring it:

  • ENABLE_COVERAGE forces CMAKE_BUILD_TYPE=Debug. Coverage needs -O0 for accurate line mapping, but under a non-Debug type the warnings block defines _FORTIFY_SOURCE=2, which errors at -O0 ("requires optimization") under -Werror. Appending -U_FORTIFY_SOURCE does NOT help — CMake de-duplicates the repeated flag. Forcing Debug skips the fortify define (it is gated on non-Debug) and yields -O0 -g for free.
  • gcovr must run from the source root with relative --filters; running it from the build dir with an absolute --root matches no files (reports 0/0). Both targets use WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} and pass the build dir as the .gcda search path.

Config knobs: COVERAGE_DIFF_BASE (default origin/main) and COVERAGE_DIFF_THRESHOLD (default 0 = report only; set a percent to fail below it).

Alternatives: a CI coverage gate (Codecov/Coveralls) — not done; this is local-only for now, and can be layered on later using the same Cobertura XML.

2026-12-04 — Coverage: work around gcov negative-hit parse error (GCC bug 68080)

What: the coverage/coverage-diff gcovr invocation now passes --gcov-ignore-parse-errors negative_hits.warn_once_per_file.

Why: with GCC + a non-trivial data set, gcov can emit a negative branch hit count (e.g. src/codec/HeaderCodec.cpp:48), which gcovr treats as a fatal parse error and aborts the whole report. This is the long-standing GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080. The flag (gcovr's own recommended remedy) downgrades it to a once-per-file warning so the report still generates; only the affected, rare branch counts are unreliable. Did not surface in the initial unit-only smoke test — it needs the richer .gcda a full/integration run produces.

2026-12-04 — Coverage: run gcovr serially to avoid gcov intermediate-file race

What: the shared gcovr invocation now passes -j 1 (serial gcov).

Why: on a large data set (a full ctest run leaves many .gcda in one tree), gcovr's parallel gcov workers race on the intermediate *.gcov.json.gz files gcov writes into the shared working directory. A file one worker expects is clobbered by another, surfacing as SanityCheckError: Output file ...doesn't exist but no error from GCOV detected (note the mangled /home/<file>##<hash>... path). That error is an AssertionError, and gcovr's --gcov-ignore-errors only catches RuntimeError, so it cannot be ignored — serial execution is the fix. Did not reproduce with a small unit+one-integration data set (few .gcda); only a many-.gcda run triggers the race, which is why the first smoke tests passed. Trade-off: slower aggregation, but reliable. Stacks with the earlier negative-hits parse-error tolerance.

2026-12-04 — Coverage: coverage-diff creates its own report directory

What: the coverage-diff target now runs cmake -E make_directory .../coverage before diff-cover.

Why: diff-cover's --format html:.../coverage/patch.html does not create the parent directory, so running coverage-diff standalone (without first running coverage, which does the mkdir) crashed with FileNotFoundError: .../coverage/ patch.html. Each coverage target must be independently runnable; the earlier smoke tests masked this by always running coverage first.