Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .claude/knowledge/journal/2026-11-18.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Learning journal 2026-11-18

### 2026-11-18: Configuration and authentication — Kernel applies case variants of client-only conf keys in sorted order, so the lowercase key wins
**Context:** In PR #566 the review bot raised the same finding twice: leaving an uppercase `CLOUDFETCH_MAX_CHUNKS_IN_MEMORY` next to the canonical lowercase key would let Go map iteration order pick the winner. Both times the maintainer cited the pinned kernel `session.rs`. It runs `sort_unstable()` over the recognized case variants, applies them in byte order (so all-lowercase comes last), then strips them all before the request reaches the server.
**Rule:** Before flagging map-iteration nondeterminism for case-variant kernel client-only session-conf keys, check the pinned kernel's sorted case-variant application, where the canonical lowercase key written by a typed option always wins.

### 2026-11-18: Configuration and authentication — Use a Set flag when a Go config field is pre-filled with its default
**Context:** In PR #566 `MaxDownloadThreads` defaults to 10 even when omitted. The PR added `MaxDownloadThreadsSet`, set by both the option and the DSN parser and carried through DeepCopy, so the kernel keeps its own default of 16 when the value is unset but honors an explicit 10.
**Rule:** When a Go config field is pre-populated with a Thrift default and is now forwarded to a backend with a different default, add an explicit Set flag in every entry point and in DeepCopy so that unset and explicitly-set-to-default can be told apart.

### 2026-11-18: Verification and dependencies — Forwarding a formerly inert option to a new backend is a behavior change
**Context:** In PR #566 `maxDownloadThreads` used to do nothing on the kernel and now controls the kernel chunk window. A reviewer pointed out that existing DSNs tuned for Thrift (for example 64) now change kernel memory use and throughput, and the CHANGELOG entry was relabeled `**Behavior change:**`. The same reviewer also noted that the new presence test only had cases where the value was unset, so the forwarding path was never exercised.
**Rule:** When an option that used to be inert on a backend starts being forwarded to it, label the CHANGELOG entry as a behavior change, describe how existing tuned values now affect that backend, and add test cases where the value is set, not only cases where it is unset.

6 changes: 4 additions & 2 deletions .claude/knowledge/lessons.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Lessons

<!-- distilled-through: none -->
<!-- distilled-through: 2026-11-18 -->

## Configuration and authentication
- L-0001 (1×, #446): Verify kernel session parameters and proxies separately from Thrift: kernel allowlists configuration keys and supports HTTP(S) proxies, while Thrift may accept additional keys/schemes.
Expand All @@ -15,14 +15,16 @@
- L-0010 (1×, #479): Validate configuration before cache short-circuits so errors do not depend on global cache state.
- L-0011 (1×, #485): Match URI schemes case-insensitively with the colon delimiter, then verify the chosen backend accepts the scheme.
- L-0012 (1×, #484): Functional options storing pointers must allocate a fresh copy inside each application; test reusing one option across two independently mutable objects.
- L-0013 (2×, #484 #497): Use optional/pointer values when omitted differs from explicit zero/false, including client overrides of server rollout flags.
- L-0013 (3×, #566 #497 #484): Use optional/pointer values or Set flags (set in every entry point and kept by DeepCopy) when omitted differs from explicit zero/false/default, e.g. server rollout overrides or Thrift-prefilled defaults.
- L-0014 (1×, #493): Inject broad default OAuth scopes only for an empty caller scope set; never append them to explicit restricted scopes.
- L-0015 (1×, #493): Check complementary ABI setters before declaring a backend option unsupported because one primary setter lacks the argument.
- L-0016 (1×, #496): Typed JSON flag getters require stored JSON literals; producers must encode strings/lists and document this representation.
- L-0017 (1×, #536): Kernel no-CloudFetch uses can_cloud_download=false for paged inline results. Remove case-insensitive/conflicting caller keys before forcing it, and verify server acceptance live.
- L-0018 (1×, #536): buildKernelConfig also serves Thrift Reyden recovery. Test newly active options through openSessionWithReydenFallback and document changed shared-DSN behavior.
- L-0019 (1×, #539): Avoid adjacent same-typed boolean parameters controlling ownership; use distinct types/options and derive combined lifecycle state in one place.
- L-0020 (1×, #556): Check integer duration values against MinInt64/unit and MaxInt64/unit before multiplication; report overflow with the parameter name.
- L-0060 [phase=review] (1×, #566): Kernel applies case variants of client-only session-conf keys in sorted byte order, so the canonical lowercase key wins; check pinned session.rs before flagging map-order nondeterminism.
- L-0061 (1×, #566): Forwarding a formerly inert option to a backend is a behavior change: label it so in CHANGELOG, explain the effect of existing tuned values, and test set values, not only unset.

## Native boundaries and lifecycle
- L-0021 (1×, #450): Never place fabricated Go pointers or cgo.Handle values into C pointer slots. Use NULL with a global sink or a real C allocation.
Expand Down
Loading