test: protect operator telemetry and remove recovery timeout race - #938
Merged
Conversation
Every runtime knob is read through `env()` — `MERIDIAN_<X>` with a
`CLAUDE_PROXY_<X>` fallback — so anything a developer exports to run their
own proxy silently reconfigures the code under test. Two real cases on one
machine:
- `MERIDIAN_NO_FILE_CHANGES=1` disables the PostToolUse hook, failing the
three "other adapters still track" cases in proxy-file-changes.test.ts.
- `MERIDIAN_TELEMETRY_PERSIST=1` makes the global telemetry store the real
~/.config/meridian/telemetry.db, which the suite then DELETEs: tests call
`telemetryStore.clear()` and `diagnosticLog.clear()`, so a local run
destroys every metric and diagnostic the operator's proxy has recorded.
Redirecting MERIDIAN_CONFIG_DIR does not save it — telemetry resolves its
path from `env("TELEMETRY_DB")` alone.
Strip the whole namespace in the preload, before any module import. CI runs
with none of it set, so this is what makes a local run mean the same thing
as a CI run; tests that need a knob set it themselves, in-process.
rynfar
marked this pull request as ready for review
September 4, 2026 19:24
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.
Two test-environment problems make the suite unsafe or unreliable: inherited operator configuration can send test cleanup to the operator’s real telemetry database, and the stale-session CAS test cancels its own request after 50 ms while expecting an upstream 500 response.
This preserves Mate Remias’s original #927 fix and authorship in its own commit, then adds two separate maintainer commits:
MERIDIAN_*andCLAUDE_PROXY_*. After the child clears test telemetry, the parent verifies that seeded operator metrics and diagnostics survive. Every potentially affected path is disposable. The test also checks suite-owned settings and per-test overrides.Validation at
cace2af3:npm test: 3,297 pass, 1 existing skip, 0 fail; typecheck and build pass.One separate full-suite run returned 500 for a concurrent priority request after mock SDK completion. Thirty repetitions of the affected file (90 tests) did not reproduce it. This change fixes the demonstrated stale-session timing race, but does not claim that all of #917/#933 is resolved. Kept as a draft first review batch; no runtime code changes.