Repository navigation
test(fetchium): failing repros for dynamic getConfig() subscribe - #19
Closed
jimmy-phantom wants to merge 1 commit into
Closed
jimmy-phantom wants to merge 1 commit into
jimmy-phantom wants to merge 1 commit into
Conversation
getConfig() re-evaluates on every fetch and produces a fresh subscribe value, but setupSubscription in QueryResult only consults config.subscribe at activation, params change, or when no subscriber exists. Once a subscriber is running, later subscribe values from getConfig() are ignored. Adds two failing tests: - A state-dependent interval (poll interval depending on this.response.ok) is captured at activation with response undefined, and never rebuilds once response.ok becomes true. - subscribe: undefined returned from getConfig() after a 404 does not stop the running subscriber. The existing "getConfig subscribe" tests pass because they return a constant poll() value, never exercising the cross-fetch change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jimmy-phantom
force-pushed
the
jimmy/getconfig-subscribe-rebuild-tests
branch
from
May 8, 2026 00:07
fd18085 to
6910a4e
Compare
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
Two failing tests in
poll.test.tsthat reproduce a bug in fetchium's subscribe lifecycle.getConfig()re-evaluates on every fetch and produces a freshsubscribevalue, butsetupSubscriptioninQueryResult.tsonly consultsconfig.subscribeat activation, on params change, or when no subscriber exists. Once a subscriber is running, latersubscribevalues fromgetConfig()are ignored — even thoughthis.configis updated correctly byresolveAndApplyOptionsafter every fetch.The two new failing tests demonstrate:
poll({ interval: this.response?.ok ? 100 : 5000 })captures the falsy branch (5000ms) at activation whenthis.responseis undefined, and continues ticking at 5000ms forever even afterresponse.ok === true.subscribe: undefineddoesn't stop polling after a 404 — switching tosubscribe: undefinedbased onthis.response?.status === 404has no effect; the captured-once subscriber keeps ticking.The existing "getConfig subscribe" tests pass because they return a constant
poll()value fromgetConfig(), never exercising the cross-fetch change. The new tests are added in the same describe block so the contrast is visible.Draft because there's no fix yet — opening to align on the fix shape (rebuild subscriber when
config.subscribereference changes? per-ticksubscribere-evaluation hook? something else?).Test plan
npx vitest run --project=unit src/__tests__/poll.test.ts— both new tests fail; the 6 existing tests still pass🤖 Generated with Claude Code