@@ -25,45 +25,40 @@ if completing the task requires a broader change or policy decision, report
2525
2626Tests live under ` tests/ ` :
2727 - ` tests/e2e/ ` — integration against a ** live Databricks warehouse** (mocha +
28- ts-node). ** An e2e test here that exercises the fix against the REAL warehouse
29- is REQUIRED for every fix** — this job provides a live connection (the ` E2E_* `
30- env is set for you). A unit test alone is ** NOT** sufficient: the unit suite is
31- fully mocked (stubs in ` tests/unit/.stubs/ ` ), so it checks offline artifacts —
32- a computed value, a constructed Thrift request — not that the real server
33- behaves correctly end-to-end. A fix can make a mocked test pass while still
34- being wrong against the live server (this failure mode has bitten sibling
35- connectors). Reproduce the bug (red) and verify the fix (green) through an e2e
36- test that talks to the live warehouse.
37- - ` tests/unit/ ` — fast, fully MOCKED, no network (` npm test ` ). You MAY add a
38- unit test ** in addition** (good for edge cases), but it does not satisfy the
39- e2e requirement above.
40- There is ONE carve-out. Some bugs are genuinely ** offline-only** — the correct
41- behavior is a client-side computed artifact, not live-server behavior:
42- client-side parameter binding/inlining (` DBSQLParameter.ts ` , ` lib/utils/ ` ),
43- Thrift request construction, retry/backoff math, error-message formatting. For
44- these the ground truth is the spec/DB-API value, not what the warehouse returns,
45- so an e2e test cannot meaningfully observe the fix. A ** unit test IS sufficient**
46- for such a bug ** only when both** hold: (a) the expected value is anchored in an
47- external authority (the issue's stated expectation, a cited spec, or the
48- reference JDBC driver — see GROUND TRUTH below), NOT inferred from the current
49- connector code; and (b) you state explicitly in your reason why the behavior is
50- not end-to-end observable. Absent an external anchor, a mocked unit test just
51- agrees with your fix — the failure mode this policy exists to prevent. If the
52- behavior SHOULD be observable end-to-end but you cannot reproduce it, report
53- ` blocked ` — do ** not** substitute a unit test to paper over an unreproduced e2e
54- bug.
55-
56- Read ` tests/e2e/ ` for the established patterns (how specs `import config from
57- './utils/config'`, open a client, run queries, and assert) and match them. Read
58- ` CONTRIBUTING.md ` for conventions first.
28+ ts-node). This job provides a live connection (the ` E2E_* ` env is set for
29+ you).
30+ - ` tests/unit/ ` — fast, fully MOCKED, no network (` npm test ` ; stubs in
31+ ` tests/unit/.stubs/ ` ).
32+
33+ Choose the reproduction's level by whether observing the bug needs the server:
34+ - ** Server-observable** (results, metadata, types, or errors the warehouse
35+ returns; session and operation lifecycle; data fetched through CloudFetch):
36+ reproduce with a ` tests/e2e/ ` test against the live warehouse. A mocked unit
37+ test alone is NOT sufficient: it can agree with a fix that is wrong against
38+ the real server (this has bitten sibling connectors). If you cannot
39+ reproduce such a bug end-to-end, report ` blocked ` ; do not substitute a unit
40+ test.
41+ - ** Client-side** (logging and local files, option and config handling,
42+ parameter binding/inlining, Thrift request construction, retry/backoff
43+ math, error construction and messages): reproduce with a ` tests/unit/ `
44+ test. Don't add an e2e test only to satisfy this policy, and don't redirect
45+ or stub server traffic inside an e2e test to fake a client-side failure;
46+ follow-up jobs have no warehouse to rerun it. Anchor the expected value in
47+ an external authority (the issue's stated expectation, a cited spec, or the
48+ reference JDBC driver — see GROUND TRUTH below), not the current connector
49+ code, and state in your reason why the server can't observe the bug.
50+
51+ Read the existing tests at the level you chose and match their patterns (e2e
52+ specs ` import config from './utils/config' ` , open a client, run queries, and
53+ assert). Read ` CONTRIBUTING.md ` for conventions first.
5954
6055** Backend note.** The connector has a Thrift backend (default) and a kernel
6156(native Rust) backend. ** This job does NOT build the native kernel binary** — the
6257` build:native ` toolchain (private kernel repo + Rust + napi) isn't provisioned
63- here, so the driver runs over ** Thrift** . Reproduce the bug on the ** Thrift path **
64- (the general ` tests/e2e/*.test.ts ` suite). Do NOT write a repro under
65- ` tests/e2e/kernel/** ` — it needs the native binary this job lacks; if the bug is
66- genuinely kernel-only, report ` blocked ` and say so.
58+ here, so the driver runs over ** Thrift** . Reproduce server-observable bugs on the
59+ ** Thrift path ** (the general ` tests/e2e/*.test.ts ` suite). Do NOT write a repro
60+ under ` tests/e2e/kernel/** ` — it needs the native binary this job lacks; if the
61+ bug is genuinely kernel-only, report ` blocked ` and say so.
6762
6863== GROUND TRUTH — where "correct" comes from ==
6964
@@ -109,19 +104,24 @@ you see an abrupt exit, it means a required `E2E_*` value is genuinely absent
109104
110105== HOW TO WORK (bug-fix flow) ==
111106
112- 1 . ** Write the failing e2e test FIRST — before you deep-dive the fix.** Your first
113- substantive action is a ` tests/e2e/ ` test (Thrift path) that REPRODUCES the
107+ 1 . ** Write the failing test FIRST — before you deep-dive the fix.** Your first
108+ substantive action is a test at the level chosen above that REPRODUCES the
114109 bug. Do only the minimal reading needed to write it. Run the single spec and
115110 confirm it ** fails for the right reason** (the bug — not a compile/setup error
116111 or a skip). A * skipped* test is not a reproduction.
112+ - ** Every new test case must fail before the fix.** Assert the consequence a
113+ user sees (lost or stalled output, a wrong value or message), not a guessed
114+ mechanism. Drop assertions that already pass before the fix, and don't
115+ claim a cause (a crash, a hang) that no failing assertion shows.
117116 - ** Reproduction is a HARD GATE.** If after a focused effort (a few attempts,
118117 not dozens) you cannot get a test that fails for the right reason — it only
119118 skips, you can't reach the warehouse, or you can't trigger the bug — ** STOP
120119 and report ` blocked ` ** , naming what you tried. A fast, honest ` blocked ` beats
121- exploring to the turn limit or substituting a unit test.
120+ exploring to the turn limit or substituting a unit test for a
121+ server-observable bug.
1221222 . ** Now fix the code** in ` lib/ ` . Only after the test is red do you dive into the
123123 fix path. Keep the change minimal and scoped to the bug.
124- 3 . ** Re-run** your e2e test (green), then ` npm test ` to confirm the unit suite
124+ 3 . ** Re-run** your test (green), then ` npm test ` to confirm the unit suite
125125 still passes.
126126
127127== RULES ==
@@ -141,9 +141,9 @@ you see an abrupt exit, it means a required `E2E_*` value is genuinely absent
141141- Before reporting the outcome, check the final diff against the acceptance
142142 criteria. Remove unnecessary changes and summarize the resulting behavior,
143143 verification results, and deferred work accurately.
144- - ** Write boundary.** ` .git/ ` , ` .gitleaksignore ` , ` .github/ ` , ` native /` , and
145- ` thrift/ ` are denied paths (they return "Path denied or invalid"). Keep the fix
146- in ` lib/ ` with its test in ` tests/ ` .
144+ - ** Write boundary.** ` .git/ ` , ` .gitleaksignore ` , ` .github/ ` , ` .bot /` , ` native/ ` ,
145+ and ` thrift/ ` are denied paths (they return "Path denied or invalid"). Keep the
146+ fix in ` lib/ ` with its test in ` tests/ ` .
147147- ** Do NOT touch ` package.json ` / ` package-lock.json ` .** A bug fix almost never
148148 needs a dependency change; if it truly does, note it in your reason rather than
149149 editing the lockfile (a stray ` npm install ` would rewrite it to lockfileVersion
0 commit comments