Skip to content

Commit 275c780

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 0bff91e commit 275c780

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,10 @@ until a human merges it. The engineer author phase reads this log (see
198198
- **Context:** PR #1026 forwarded `telemetry_flush_interval_ms` to the PyO3 kernel `Session`. The PyO3 u64 conversion accepted `True` as 1 ms, and its errors for negative or string values did not name the option. A Python-side check was added before the kernel call: `isinstance(v, bool) or not isinstance(v, int) or v <= 0` raises a `ValueError` that names the option.
199199
**Rule:** When validating an integer option in Python, especially one forwarded to native bindings such as PyO3, explicitly reject `bool`, because `bool` is a subclass of `int` and native int conversions accept `True`/`False` as 1/0. Validate before the native call so the error names the option, rather than surfacing a wrapped conversion error.
200200

201+
### 2026-11-13: learnings since 2026-11-12T17:25:58Z
202+
- **Context:** PR #1045 added the engineer-bot mention workflow. Its trusted steps ran `python - <<'PY'` and `python -m databricks_bot_engine...` with the PR checkout as the working directory. The reviewer pointed out that stdin and `-m` mode both put cwd at `sys.path[0]`. A PR branch could therefore add a root-level `pathlib.py` or a `databricks_bot_engine/` package and get its code run in a step that holds `GH_TOKEN`/`DATABRICKS_TOKEN`, OIDC env and `$GITHUB_ENV` write access. The fix ran both with `python -I`.
203+
**Rule:** In CI steps that hold secrets or write `$GITHUB_ENV`, never run `python -`, `python -c` or `python -m` with cwd inside an untrusted checkout. Use `python -I` (or `-P`), or `cd` to a neutral directory, so modules planted by the PR can't shadow the stdlib or trusted packages.
204+
- **Context:** PR #1019 made the kernel backend honor `use_cloud_fetch=False` by injecting `cloudfetch_enabled=false` into `session_conf`. The unit tests only checked that the key reached a fake `Session`. The reviewer noted that CI would stay green if the kernel or server stopped honoring the key. The fix added a credential-gated e2e test: it fetches a large result through a proxy that blocks non-workspace hosts, verifies every row with a digest, and runs an enabled-CloudFetch control to show the same query normally takes the cloud path.
205+
**Rule:** When a fix works by forwarding a config key that another component (kernel or server) must honor, unit tests that check forwarding are not enough. Add a live test that checks the actual behavior, and include a positive control showing the opposite setting changes the outcome, so the test can't pass vacuously.
206+
201207
--- *Add new entries above this line (oldest→newest); newest sections sort to the bottom.* ---

0 commit comments

Comments
 (0)