Repository navigation
Pr 10 - #11
Merged
Merged
Pr 10#11
Conversation
…ly time ctx.effect(() => fileSource.dispose(), ...) calls dispose while the fiber is being built and registers undefined as the disposer: the file source is dead before its first read, so pricing.json is never applied and the change watcher never fires. Return a disposer instead. Test mocks now follow cordis semantics (run setup, keep the returned disposer, release it in after()) and a /pricing route regression test covers the override path - it fails against the old form.
Max-Samson
added a commit
that referenced
this pull request
Sep 23, 2026
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
Fixes a bug where custom
pricing.jsonfile overrides were never applied and the file change watcher never fired (PR #10), and bumps the releaseversion to
1.1.6:User-visible change:
/dsh-usage-chart/pricingreportedsource: "builtin"for every model even when a custompricing.jsonwas present and valid, and file editsnever triggered automatic recalculation.
src/index.ts:ctx.effect(() => fileSource.dispose(), ...)invokeddispose()synchronously at plugin registration time while the fiber was being created andregistered
undefinedas the disposer. This prematurely killedfilePricingSourcebefore its initial async read resolved and closed the directory watcher. Changing this to return a disposer function(
ctx.effect(() => () => fileSource.dispose(), ...)) ensures the file source remains active throughout the fiber lifecycle and is released only when the plugin is unloaded.tests/core.test.mjs,tests/pricing.test.mjs, andtests/rounds.test.mjswith Cordis lifecycle semantics (collecting disposers and running them inafter())./pricingroute with userpricing.jsonoverrides enabled.1.1.6acrosspackage.json,package-lock.json,README.md,README_ZH.md,CHANGELOG.md, andCHANGELOG_ZH.md.Why it belongs in this plugin:
pricing.jsonoverride → Built-in official pricing → Conservative fallback. Premature disposalbroke the first and highest-priority tier entirely for users configuring custom or enterprise rates.
Verification
npm run verify(typecheck + 41/41 tests pass)npm pack --dry-run(successfully builtdsh-usage-chart-1.1.6.tgzwith zero warnings)/dsh-usage-chart/pricingcorrectly reportssource: "file"and serves user-defined prices)lib/files includedCHANGELOG.mdupdated for user-visible changes (bothCHANGELOG.mdandCHANGELOG_ZH.mdupdated under[1.1.6] - 2026-09-19)