Repository navigation
fix(vis): stop config cache from dropping plugin hooks and going stale - #37
Conversation
The root config cache stored a JSON copy of the merged config, so function values were lost on a cache hit: `plugins[].hooks`/`setup` and `release.plugins` hooks (e.g. `willPublish`) silently stopped running after the first invocation. The key also ignored env vars and imported helpers, so env-dependent configs stayed stale. The chain is executed before the lookup anyway, so the cache saved only the merge; remove it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for following the naming conventions! 🙏 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Walkthrough
ChangesConfiguration Reload
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to
|
commit: |
Merging this PR will not alter performance
|
Problem
loadVisConfigexecuted every file in theextendschain, hashed their contents, and on a hit returned a JSON copy fromnode_modules/.cache/vis/vis-config-cache.jsoninstead of the configs it had just loaded. JSON drops functions, so from the second invocation on:plugins[].hooks/setup(vis run,vis service) silently stopped firing. The cache held[{"name":"marker","hooks":{}}].release.pluginshooks (willPublish,applyDraft,afterPublish, …) were dropped too, so awillPublishguard meant to block a publish was skipped.The key also covered only file bytes. A config that reads
process.env(e.g.CI) or imports a helper module kept returning the first run's result.Reproduced against the published 6.1.3: a plugin hook fired on run 1, then never again until the config file was edited, and then only for one run.
Fix
Remove the root config cache. The chain is already executed before the lookup, so a hit only skipped
mergeVisConfigs+applyDefaults, which is plain-object merging. The per-projectvis.task.tscache is unchanged: it skips executing the file, andVisTaskConfighas no function-valued fields.Tests
setup/hooks["task:before"]remain functions across two loads.process.envon each load.config.test.ts+extends-chain.test.ts: 34 passed.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation