From 852eed7556adff10203d58228423b3bc0b703e2e Mon Sep 17 00:00:00 2001 From: "peco-engineer-bot[bot]" Date: Thu, 3 Dec 2026 17:32:33 +0000 Subject: [PATCH] learn: retrospective learnings Signed-off-by: peco-engineer-bot[bot] --- .claude/knowledge/journal/2026-12-03.md | 21 +++++++++++++++++++++ .claude/knowledge/lessons.md | 15 +++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .claude/knowledge/journal/2026-12-03.md diff --git a/.claude/knowledge/journal/2026-12-03.md b/.claude/knowledge/journal/2026-12-03.md new file mode 100644 index 00000000..edd75640 --- /dev/null +++ b/.claude/knowledge/journal/2026-12-03.md @@ -0,0 +1,21 @@ +# Learning journal 2026-12-03 + +### 2026-12-03: Arrow results — Arrow bigNumToBigInt returns a string for Decimal128 despite its bigint typing +**Context:** In PR #658, wide negative DECIMAL values lost exactness because `util.bigNumToBigInt` returns a decimal string for Decimal128 even though it is typed as `bigint`. The formatter's tests passed hand-built `BigInt` values, so they never hit the real runtime type. +**Rule:** Normalize Arrow `bigNumToBigInt` output with `BigInt(value)` before doing arithmetic, and test DECIMAL formatting with values decoded from real Arrow Decimal vectors, including wide negatives, rather than hand-built BigInts. + +### 2026-12-03: Test design — Test oracles must not certify known-wrong values +**Context:** In PR #658, a new precision-mode oracle treated negative-scale decimals as unscaled integers, so it expected `"1"` where the true value is `100`. The reviewer asked that exactness assertions be limited to nonnegative scales. +**Rule:** Restrict new exactness assertions to inputs where production behavior is correct, keep default-mode coverage for unsupported edge cases, and track the gap separately instead of writing an expectation that blesses a wrong value. + +### 2026-12-03: Test design — Extend existing fixture matrices instead of adding parallel test scaffolding +**Context:** In PR #658, the reviewer had a separate nested-decimal block and a new e2e file removed. Swapping the wide negative into the existing scalar/container fixture and the shared rowMaterialization e2e matrix still caught the regression. +**Rule:** Cover a regression by strengthening values in the existing backend/mode fixture matrix rather than adding duplicate connection or session scaffolding, and confirm that the extended fixture fails against the old code. + +### 2026-12-03: Arrow results — Thrift non-native Arrow mode parses complex values as lossy JSON +**Context:** In PR #658, exactness for nested DECIMALs inside structs, arrays and maps was asserted only for the kernel and native-Arrow Thrift. Thrift's non-native mode parses complex values as JSON, which loses precision. +**Rule:** Assert nested numeric exactness only on the kernel and on Thrift with `useArrowNativeTypes`, and never add assertions that treat Thrift non-native JSON-parsed complex values as exact. + +### 2026-12-03: Configuration and authentication — Map generic SOCKS protocol to socks5h on kernel for DNS parity with Thrift +**Context:** In PR #653, the kernel's `proxy` option gained SOCKS support. Thrift's socks-proxy-agent resolves DNS at the proxy for `socks`, and the kernel rejects a bare `socks://`. The kernel still drops the SOCKS4 user ID that Thrift sends from `auth.username`, so the reviewer required partial (⚠️) support marking. +**Rule:** Map the `socks` proxy protocol to `socks5h` on the kernel, pass the other schemes through verbatim, and mark proxy support partial until SOCKS4 user IDs are forwarded the way Thrift forwards them. diff --git a/.claude/knowledge/lessons.md b/.claude/knowledge/lessons.md index 0b3ae3f9..31fe4d9f 100644 --- a/.claude/knowledge/lessons.md +++ b/.claude/knowledge/lessons.md @@ -1,6 +1,6 @@ # Lessons - + ## Configuration and authentication - L-0001 (3×, #457): Trace option support through DBSQLClient, auth adapters and each transport. Type declarations and class comments do not establish forwarding; shared preparation can precede backend-specific filtering. @@ -8,7 +8,7 @@ - L-0003 (2×, #501 #505): Normalize native-bound strings with isBlankOrReserved so blank, placeholder and whitespace values do not select unintended auth modes. - L-0004 (1×, #501): Kernel federation behavior differs from Thrift flags: verify native support and document always-on/ignored flags and federationClientId routing explicitly. - L-0005 (2×, #505): Fully normalize hosts before domain matching, including scheme, path and port. Keep Azure suffix lists and auth flag semantics aligned across backends or document deliberate differences. -- L-0006 (1×, #509): Mark partially honored backend options as partial support; full-support labels require consistent forwarding and behavior across all relevant flows. +- L-0006 (2×, #653 #509): Mark partially honored backend options as partial support; full-support labels require consistent forwarding and behavior across all relevant flows. - L-0007 (1×, #509): Verify native capabilities against generated declarations and shipped bindings. Do not assert unobservable published-binary behavior from connector source alone. - L-0008 (1×, #506): Resolve runtime telemetry identity identically on both backends, including POSIX locale precedence LC_ALL, LC_MESSAGES, then LANG. - L-0009 (1×, #506): Verify omitted/default branches are reachable; upstream default injection may prevent native defaults from ever taking effect. @@ -25,6 +25,7 @@ - L-0020 (1×, #589): Reject missing required napi arguments in TypeScript with matching Thrift message/SQLSTATE before opaque native conversion errors. - L-0021 (1×, #583): Activating formerly ignored configuration changes existing users' behavior. Document consequences and invalidate persisted caches whose inputs no longer match, including OAuth scopes. - L-0022 (1×, #588): Match host/URL normalization across backends for slashes, embedded ports and IPv6; compare edge cases on both before changing either. +- L-0088 (1×, #653): Map generic `socks` proxy protocol to `socks5h` on kernel for Thrift DNS parity; pass other schemes verbatim. Kernel drops SOCKS4 user IDs Thrift sends from auth.username, so proxy support stays partial. ## Native packages and public compatibility - L-0023 (4×, #505 #513 #514): New native fields need published binding support. Land router capability/version checks and all platform optionalDependency pins together; source-only KERNEL_REV bumps or accepted TypeScript fields do not ship support. @@ -78,3 +79,13 @@ - L-0065 (1×, #566): Build after installs that omit prepare so generated lib/version.ts exists before tests/type checks. - L-0066 (1×, #566 #562): Serialize branch-editing bot flows with one per-PR concurrency group and restore dependency-setup lockfile rewrites before agent edits. - L-0067 (1×, #621 #620): GitHub Actions expressions allow hyphens in dot-dereferenced names; do not flag or rewrite `${{ inputs.some-name }}` as subtraction. + +## Results and Arrow +- L-0089 (1×, #651): Detect Thrift no-output statements from an empty Arrow schema, not the `Result STRING` TTableSchema placeholder; normalize into a separate cached copy and leave raw wire accessors like getMetadata() verbatim. +- L-0090 (1×, #651): Every result handler's hasMore() must return false for zero-column schemas; test fetchAll and fetchChunk for termination and a bounded fetchResults call count. +- L-0091 (1×, #658): Arrow util.bigNumToBigInt returns a string for Decimal128 despite bigint typing; wrap in BigInt() before arithmetic and test with values decoded from real Arrow Decimal vectors, including wide negatives. +- L-0092 (1×, #658): Assert nested numeric exactness only on kernel and Thrift with useArrowNativeTypes; Thrift non-native mode JSON-parses complex values lossily. + +## Test design +- L-0093 (1×, #658): Never write oracles that bless known-wrong values: limit exactness assertions to inputs production handles correctly, keep default coverage for edge cases, and track gaps separately. +- L-0094 (1×, #658): Cover regressions by strengthening values in existing backend/mode fixture matrices instead of adding parallel connection/session scaffolding; confirm the extended fixture fails on old code.