Skip to content

fix(vis): stop config cache from dropping plugin hooks and going stale - #37

Merged
prisis merged 1 commit into
mainfrom
t3/rust-port-plan
Oct 20, 2026
Merged

prisis merged 1 commit into
mainfrom
t3/rust-port-plan

Conversation

@prisis

@prisis prisis commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Problem

loadVisConfig executed every file in the extends chain, hashed their contents, and on a hit returned a JSON copy from node_modules/.cache/vis/vis-config-cache.json instead 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.plugins hooks (willPublish, applyDraft, afterPublish, …) were dropped too, so a willPublish guard 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-project vis.task.ts cache is unchanged: it skips executing the file, and VisTaskConfig has no function-valued fields.

Tests

  • New: plugin setup / hooks["task:before"] remain functions across two loads.
  • New: an env-dependent config reflects the current process.env on each load.
  • Both fail on the old code and pass on the fix. config.test.ts + extends-chain.test.ts: 34 passed.
  • Removed the three tests that asserted the cache file existed, was reused, or recovered from corruption.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Configuration loading now consistently reflects plugin changes, environment-variable updates, and configuration-file edits across repeated loads.
    • Configuration chains are resolved and merged reliably without relying on stale root-level cache data.
    • Per-package task caching remains available for efficient repeated operations.
  • Documentation

    • Updated cache-related guidance to accurately describe current configuration and task behavior.

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>
@github-actions github-actions Bot added size:M Size of the change, tests and generated files excluded. package: vis labels Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf9ae815-9969-4209-9c4f-b5b7080d369a
📥 Commits

Reviewing files that changed from the base of the PR and between 957fb70 and e6ff381.

📒 Files selected for processing: 4
  • packages/tooling/vis/__tests__/config/config.test.ts
  • packages/tooling/vis/__tests__/config/extends-chain.test.ts
  • packages/tooling/vis/__tests__/release/commands/release-ci-release-generate.test.ts
  • packages/tooling/vis/src/config/config.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

loadVisConfig no longer caches the merged root configuration. It resolves and merges the configuration chain on each call, then applies defaults. Content-hash caching for task overlays remains.

Changes

Configuration Reload

Layer / File(s) Summary
Load configuration on each call
packages/tooling/vis/src/config/config.ts, packages/tooling/vis/__tests__/config/config.test.ts, packages/tooling/vis/__tests__/config/extends-chain.test.ts, packages/tooling/vis/__tests__/release/commands/release-ci-release-generate.test.ts
The loader resolves and merges the configuration chain on every call. Tests cover plugin hook functions, environment-variable changes, and config-file edits across repeated loads. Fixture comments now describe the remaining vis task cache behavior.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to e6ff3

The configuration reload change is ready to merge after normal checks; no concrete blocking issue remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: removing the stale root config cache that dropped plugin hooks.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each config anew,
The merged settings come into view.
Env flags shift; the tests take note,
While task overlays keep their cache afloat.
I hop along, with nothing stale to chew.

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list. label Oct 20, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@visulima/vis@37
npm i https://pkg.pr.new/@visulima/vis-mcp@37

commit: e6ff381

@codspeed

codspeed Bot commented Oct 20, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 7 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 12 untouched benchmarks
⏩ 101 skipped benchmarks1


Comparing t3/rust-port-plan (e6ff381) with main (957fb70)

Open in CodSpeed

Footnotes

  1. 101 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@prisis
prisis merged commit b59ffc0 into main Oct 20, 2026
34 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎊 Great job, @prisis! You've merged your 15th PR! 🎊

Your contributions to vis are making a real difference. Keep up the fantastic work! 💪
Remember, every PR counts and helps improve the project. What will you tackle next? 🤔

@prisis is here if you need any guidance. Onward and upward! 🚀

@prisis
prisis deleted the t3/rust-port-plan branch October 20, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vis size:M Size of the change, tests and generated files excluded. vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant