[patch] Stop the merge-strategy cache letting one call decide a key for every later call - #155
Merged
Merged
Conversation
…or every later call PropertyMerger cached each key's canonical name process-wide, keyed on the property name alone. The name also depends on the strategy and, for Aggressive and Maximum, on the other keys in the document, so an Aggressive run made a later Conservative run drop custom_title, and a key merged in one document was renamed in another that had nothing to merge it with. Drop the cache: the per-call work is a dictionary lookup and a small normalization over a handful of keys. The tests no longer clear it by reflection, and new tests run the strategies back to back without clearing anything. Fixes #130 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KrGyxYxnoFgAkP1ENResCJ
…n tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KrGyxYxnoFgAkP1ENResCJ
|
This was referenced Sep 28, 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.



Fixes #130
Problem
PropertyMerger.PropertyMergeCachewas a process-wide cache keyed only on the property name. But a key's canonical name also depends on the strategy and, for Aggressive and Maximum, on the other keys in the same document. So the first call to reach a key decided how every later call treated it:custom_title.Change
GetCanonicalNameworks out the name on every call. The work is a dictionary lookup plus a small normalization over a handful of keys, which is the lower-risk option the triage recommended.PropertyMergerTests,SingleCharacterKeyTestsandDecorationOnlyKeyTestsno longer clear the cache by reflection. That clearing was what hid the bug.Tests
MergeStrategyIsolationTests, which runs strategies and documents back to back without clearing anything. It covers:CombineFrontmatterlevelPropertyMerger.csreverted, 3 of the 4 new tests fail. The cross-document test passes either way.🤖 Generated with Claude Code
https://claude.ai/code/session_01KrGyxYxnoFgAkP1ENResCJ
Generated by Claude Code