Skip to content

Commit 257decd

Browse files
author
peco-engineer-bot[bot]
committed
learn: retrospective learnings
Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
1 parent 3a3663f commit 257decd

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎.claude/knowledge/learning-log.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,8 @@ until a human merges it. The engineer author phase reads this log (see
210210
- **Context:** PR #1024 cached the result of `inspect.signature(_kernel.Session)` in a module-level global keyed on the `Session` class identity, filled under a double-checked lock. The reviewer pointed out that the tests only passed because each one installed a brand-new `Session` class. A test that reused a shared `Session` or patched only `inspect.signature` would quietly read a value cached by an earlier test, and `assert_called_once` checks would depend on test order.
211211
**Rule:** When adding a process-global cache (memoized introspection, singleton lookup), add an autouse fixture that resets it (`monkeypatch.setattr(module, "_CACHE", None)`) in the tests that exercise it. Each test should start cold instead of relying on cache-key changes to force a refresh.
212212

213+
### 2026-11-17: learnings since 2026-11-16T17:27:13Z
214+
- **Context:** PR #1016 fixed `cursor.rowcount` staying at -1 after async DML. The sync path gets `numModifiedRows` from the execute response, but the async path (`get_execution_result`) only calls Thrift `FetchResults`, which does not carry that field. The count is only on `TGetOperationStatusResp`, and `get_query_state` had been reducing that response to a `CommandState` and dropping the count. The fix caches the SUCCEEDED status response per `CommandId` instance in a `WeakKeyDictionary`. `get_execution_result` reuses that cached response, and polls again (with the error/closed-state check) only when a caller resumes directly. The count is accepted only when the state is `FINISHED_STATE`. Reviewers also flagged that the kernel async path read the count differently from the sync path, so both now go through one shared `_read_num_modified_rows` helper.
215+
**Rule:** When the sync execute path has some result metadata (rowcount/numModifiedRows, staging flags), check that the async `get_execution_result` path carries it too. Thrift `FetchResults` has no `numModifiedRows`, so take it from the terminal `TGetOperationStatusResp` that was already polled, not from an extra RPC, and trust it only in `FINISHED_STATE`. Read the value through the same helper the sync path uses so missing, callable or raising getters behave the same way on both paths.
216+
213217
--- *Add new entries above this line (oldest→newest); newest sections sort to the bottom.* ---

0 commit comments

Comments
 (0)