Add tests for write-path error handling and packaging bugs - #80
Merged
Conversation
Four version-independent bugs, none previously covered:
- handleWriteError drops InfluxDB's response body on the write path for
400/401/403/413/422, has no 503 arm, and renders parsed JSON bodies as
[object Object] (write-error-core.test.ts, write-error-cloud.test.ts).
Mirrors the query-error-core.test.ts pattern; handleQueryError already
does this correctly.
- write routing per product type was untested (write-routing.test.ts):
which endpoint/transport each product type uses, and that an unknown
product type rejects rather than silently defaulting.
- zod is imported at runtime throughout src/tools/ but declared only in
devDependencies, so a clean `npm i --omit=dev` breaks (packaging.test.ts).
- ping()'s x-influxdb-version/x-influxdb-build header passthrough was
untested (base-connection-ping.test.ts).
- protocol-write.test.ts covers write_line_protocol's advertised schema,
error surfacing over the protocol boundary, and health_check's
hasAnySuccess bug (a constructed client reports HEALTHY even when both
/ping and /health fail).
test:integration now matches any *integration* test file instead of only
integration.test.ts — query-error-integration.test.ts was never actually
wired into the live-instance run.
Several `describe.skip("[P<n>] ...")` blocks are acceptance criteria for
fixes not yet implemented; each is paired with an active test asserting
today's (wrong) behavior, so implementing the fix flips both at once.
Split off a broader InfluxDB 3.11 compatibility pass: the version-gated
parts (live-instance tests, the 3.11 tool-surface guardrail, open
questions) moved to the influxdb-3.11-compat-patch branch instead.
jstirnaman
had a problem deploying
to
cloud-serverless
July 28, 2026 17:25 — with
GitHub Actions
Failure
Two of three guessed response shapes for a duplicate-tag-key write
rejection never occur. Verified live against both Core (3.11.0-nightly)
and Enterprise (3.11.0-0.rc.1, --upgrade-pacha-tree): a duplicate tag
key is always reported under data[].error_message inside the
partial-write body, byte-for-byte identical on both builds. Neither
data.error nor data.message carries it.
- Delete CORE_400_DUPLICATE_TAG_UNDER_ERROR and
CORE_400_DUPLICATE_TAG_UNDER_MESSAGE; they don't represent real
responses.
- Update CORE_400_DUPLICATE_TAG_UNDER_PARTIAL_DATA with the actual
wording ("invalid line protocol - multiple instances of 'region' tag
found") and InfluxDB's own truncated original_line; promote from
PROVISIONAL to RECORDED.
- write-error-core.test.ts: drop the it.each over three shapes down to
the one real shape; fix the /duplicate/i assertions in the [P1]
acceptance block to the real wording; fold [P1/A2] into [P1] now that
A2 is answered rather than leaving a separate blocked-on-A2 block.
jstirnaman
had a problem deploying
to
cloud-serverless
July 28, 2026 18:10 — with
GitHub Actions
Failure
- tests/README.md: table column alignment per prettier. - query-error-integration.test.ts asserted Core's "database not found" wording unconditionally. It was previously dead in CI (test:integration only matched integration.test.ts), so this never ran. Now that it runs, it also executes under the cloud-serverless CI job, which reports the same condition as "bucket ... not found" (v2-lineage vocabulary). Both wordings verified against real CI runs on this PR: Core job passed with "database not found", serverless job failed with the real "bucket ... not found" text. Pick the expected pattern by INFLUX_DB_PRODUCT_TYPE instead of hardcoding Core's wording.
jstirnaman
temporarily deployed
to
cloud-serverless
July 28, 2026 19:09 — with
GitHub Actions
Inactive
jstirnaman
enabled auto-merge
July 28, 2026 19:10
Comments referenced alphanumeric codes (P1-P7, A1-A4, "impact map 1.1") from a planning document that now lives only on the influxdb-3.11-compat-patch branch, not this one. A reader of this branch had no way to resolve what "P2" or "A2" meant. Replaced with plain, self-contained descriptions of the same technical content; renamed the matching describe.skip() block titles to drop the [P<n>] tags. Also fixes a factual error in write-routing.test.ts and fixtures/write-errors.ts: the "InfluxDB 3.11 notes document a 400->503 change for /api/v2/write, which only the clustered product type uses" framing conflated two unrelated facts. The Core/Enterprise-scoped 3.11 release notes describe a legacy v1/v2 write endpoint that Core/ Enterprise themselves also expose for backward compatibility - not `InfluxProductType.Clustered`, a separate product (InfluxDB Clustered, grouped with Cloud Dedicated per src/config.ts:98-105) on its own release train that happens to also call /api/v2/write for unrelated reasons. This server never calls the legacy endpoint for Core/ Enterprise regardless; it always uses /api/v3/write_lp.
jstirnaman
temporarily deployed
to
cloud-serverless
July 28, 2026 19:37 — with
GitHub Actions
Inactive
caterryan
approved these changes
Jul 28, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four version-independent bugs found while auditing for InfluxDB 3.11 compatibility, none previously covered by tests:
handleWriteError(src/services/write.service.ts) discards InfluxDB's response body for 400/401/403/413/422, has no 503 arm, and renders parsed JSON bodies as[object Object].handleQueryErroralready handles this correctly — the write path is the outlier. (write-error-core.test.ts,write-error-cloud.test.ts)write-routing.test.ts)zodis a misdeclared runtime dependency. Imported throughoutsrc/tools/but listed only indevDependencies, so a cleannpm i --omit=devbreaks. (packaging.test.ts)write_line_protocol's advertised schema, error surfacing over the MCP protocol boundary,health_check'shasAnySuccessbug (reports HEALTHY even when both/pingand/healthfail), andping()'s version/build header passthrough. (protocol-write.test.ts,base-connection-ping.test.ts)Also:
test:integrationnow matches any*integration*test file instead of onlyintegration.test.ts—query-error-integration.test.tswas never actually wired into the live-instance run.Several
describe.skip("[P<n>] ...")blocks are acceptance criteria for fixes not yet implemented, each paired with an active test asserting today's (wrong) behavior — implementing the fix flips both at once. Seetests/README.mdfor the convention.This PR does not include the code fixes for the bugs above — tests only, characterizing current behavior.
Split off a broader InfluxDB 3.11 compatibility pass: the version-gated parts (live-instance tests, the 3.11 tool-surface guardrail, open questions) moved to a separate
influxdb-3.11-compat-patchbranch instead of landing here.Test plan
npm run build && npx vitest run— 88 passed, 30 skipped (skips are deliberate: unimplemented-fix acceptance criteria, and live-instance tests withoutINFLUX_TEST_ENABLED)