fix: derive the model maxlength and document the frame-focus cases
maxlength was hard-coded to 200 in the markup while MAX_MODEL_CHARS lives in lib/defaults.js; lowering the constant would have left the input accepting values mergeSettings() silently discards. It is now set from the constant at render time. Also records the hasFocus() gate's four manual frame cases in AGENTS.md, including the findbar trade-off, and notes that fitToBudget()'s budget guarantee assumes mergeSettings-validated input.
This commit is contained in:
+6
-1
@@ -1,4 +1,4 @@
|
||||
import { DEFAULT_SETTINGS } from "../lib/defaults.js";
|
||||
import { DEFAULT_SETTINGS, MAX_MODEL_CHARS } from "../lib/defaults.js";
|
||||
import { load, save } from "../lib/settings.js";
|
||||
|
||||
const SAVE_DEBOUNCE_MS = 400;
|
||||
@@ -59,6 +59,11 @@ function scheduleSave() {
|
||||
saveTimer = setTimeout(() => persist(collect()), SAVE_DEBOUNCE_MS);
|
||||
}
|
||||
|
||||
// Derived rather than hard-coded in the markup: if the two ever disagreed, the
|
||||
// input would accept a model that mergeSettings() then silently discards,
|
||||
// blanking the setting with no explanation.
|
||||
field("model").maxLength = MAX_MODEL_CHARS;
|
||||
|
||||
// Module scripts are deferred, so the DOM is already parsed here.
|
||||
render(await load());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user