What's wrong
IKeybindingConfiguration (Keybinding/Contracts/IKeybindingConfiguration.cs) and its implementation KeybindingConfiguration (Keybinding/Models/KeybindingConfiguration.cs) are public API that promise behaviour:
AutoSave - "whether to auto-save changes"
AutoSaveIntervalMilliseconds - "the auto-save interval in milliseconds (0 to disable)"
DefaultProfileId - "the default profile ID to use when no profile is active"
DefaultProfileName
No code in the library consumes any of them. grep -rn "AutoSave\|IKeybindingConfiguration\|DefaultProfileId" Keybinding/ finds only the interface and the class itself:
KeybindingManager has no constructor or property that takes an IKeybindingConfiguration; it only ever saves when the caller invokes SaveAsync().
KeybindingManager.CreateDefaultProfile hard-codes "default" / "Default" as parameter defaults rather than reading the configuration.
ServiceCollectionExtensions.AddKeybinding* never registers or resolves IKeybindingConfiguration.
- The default constructor and the constructor both default
AutoSave to true, which suggests saving happens automatically.
Failure scenario
Following USAGE_EXAMPLES.md ("Using Configuration Objects" and "Configuration with Options Pattern"):
var config = new KeybindingConfiguration("./data", autoSave: true, autoSaveIntervalMilliseconds: 3000);
var manager = new KeybindingManager(new CommandRegistry(), new ProfileManager(), new JsonKeybindingRepository(config.DataDirectory));
await manager.InitializeAsync();
manager.CreateDefaultProfile();
manager.Keybindings.BindChord("file.save", Chord.Parse("Ctrl+S"));
// app exits without an explicit SaveAsync()
The caller reasonably expects the binding to have been auto-saved within 3 seconds. Nothing is written to disk, so every change made since start-up is lost on exit. Likewise, a DefaultProfileId of "my-default" is never used: CreateDefaultProfile() still creates "default", and nothing falls back to the configured profile when none is active.
Suggested fix
Pick one, and make the docs match:
- Wire it up: give
KeybindingManager a constructor (and DI registration) that accepts IKeybindingConfiguration; use DefaultProfileId/DefaultProfileName in CreateDefaultProfile when no arguments are passed; when AutoSave is true and the interval is > 0, save after mutations on a debounced timer (disposed in Dispose), or
- Retire it: mark
AutoSave, AutoSaveIntervalMilliseconds, DefaultProfileId and DefaultProfileName [Obsolete] (or remove them in a major release) and drop the auto-save examples from USAGE_EXAMPLES.md.
Acceptance criteria
- Either a configured
AutoSave/interval demonstrably persists changes without an explicit SaveAsync() call (covered by a test), and CreateDefaultProfile() honours DefaultProfileId/DefaultProfileName; or those members are obsolete/removed and no documentation implies they do anything.
What's wrong
IKeybindingConfiguration(Keybinding/Contracts/IKeybindingConfiguration.cs) and its implementationKeybindingConfiguration(Keybinding/Models/KeybindingConfiguration.cs) are public API that promise behaviour:AutoSave- "whether to auto-save changes"AutoSaveIntervalMilliseconds- "the auto-save interval in milliseconds (0 to disable)"DefaultProfileId- "the default profile ID to use when no profile is active"DefaultProfileNameNo code in the library consumes any of them.
grep -rn "AutoSave\|IKeybindingConfiguration\|DefaultProfileId" Keybinding/finds only the interface and the class itself:KeybindingManagerhas no constructor or property that takes anIKeybindingConfiguration; it only ever saves when the caller invokesSaveAsync().KeybindingManager.CreateDefaultProfilehard-codes"default"/"Default"as parameter defaults rather than reading the configuration.ServiceCollectionExtensions.AddKeybinding*never registers or resolvesIKeybindingConfiguration.AutoSavetotrue, which suggests saving happens automatically.Failure scenario
Following
USAGE_EXAMPLES.md("Using Configuration Objects" and "Configuration with Options Pattern"):The caller reasonably expects the binding to have been auto-saved within 3 seconds. Nothing is written to disk, so every change made since start-up is lost on exit. Likewise, a
DefaultProfileIdof"my-default"is never used:CreateDefaultProfile()still creates"default", and nothing falls back to the configured profile when none is active.Suggested fix
Pick one, and make the docs match:
KeybindingManagera constructor (and DI registration) that acceptsIKeybindingConfiguration; useDefaultProfileId/DefaultProfileNameinCreateDefaultProfilewhen no arguments are passed; whenAutoSaveis true and the interval is > 0, save after mutations on a debounced timer (disposed inDispose), orAutoSave,AutoSaveIntervalMilliseconds,DefaultProfileIdandDefaultProfileName[Obsolete](or remove them in a major release) and drop the auto-save examples fromUSAGE_EXAMPLES.md.Acceptance criteria
AutoSave/interval demonstrably persists changes without an explicitSaveAsync()call (covered by a test), andCreateDefaultProfile()honoursDefaultProfileId/DefaultProfileName; or those members are obsolete/removed and no documentation implies they do anything.