0177: Modules offer the known values of a setting, looked up when Settings shows it¶
- Implementation built
Context and Problem Statement¶
Settings picks each setting's control from its JSON Schema. Values fixed in code are a Literal, and installed
adapters and modules have their own x-options sources (0055,
0161). Many values are only known at run time: the installed
layers, the models an AI access offers, the skills in effect, the handles in the team's roster, the team's contracts,
a plugin's tracker labels. With no way to get them into the schema, these settings were text fields people had to
type into, and a typo saved silently (UI audit, bead hlhg).
The modules that know such values can't be imported by the config module: every module could be a plugin, and modules inject services by type, never import each other (0002). How does a module give Settings the values of a setting, its own or another module's?
Decision Drivers¶
- Never make people type what can be chosen (docs/SETTINGS_UX.md, principle 1).
- Modules and plugins stay independent: a value source is declared, not imported.
- The web app needs no new source names, so an older app keeps working (0072).
- A slow or broken lookup never blocks or breaks Settings.
Considered Options¶
- A let:
@module.options("section.key"), resolved by the config report (chosen) - A class variable of lookups on the settings model: only the owning module could offer values, but the values
of
system.runner.modelandreport.userare known by the AI access and team modules. - A new
x-optionssource per kind of value, resolved by the web app: one web change and one endpoint per source, and an older app shows nothing. - Static lists in the schema only: right for fixed presets, but layers, models, skills and rosters change at run time.
Decision Outcome¶
Chosen option: a let, OptionsLet, declared with @module.options("section.key") and resolved by the config
report, because it keeps modules independent, reuses the values source every app since z348 renders, and lets a
plugin offer values like a built-in module.
OptionsLet(name, provider)is part of the plugin API (heinzel.OptionsLet,Module.options).nameis the setting (team.layer); a nested property or table column issection.key.property(issues.beads.label).- The provider may ask for injected services, as an info provider does, and acts for its own module. It returns the values, or a mapping of each value to its label.
- The consumer is the config report:
hz system config show(the web app's Settings reads it) resolves everyOptionsLetand writes what it finds into the setting's schema asx-options: {source: "values", values, labels, free}. Internal callers of the report (get, set, init) don't look anything up. - A setting whose values come from a lookup declares
x-options: {source: "provider", free: ...};free(default true) says whether a value not listed may still be typed. An installed adapters or modules source is never replaced. - All lookups run one after another in one thread, with the caller's context, within a budget of 2 seconds in total.
A lookup that raises, returns nothing or is not done in time leaves the schema as declared: an app reads source
provideras text, so the field stays editable and the stored value stays shown. - A stored value the list does not offer is always shown and selected, and nothing is saved until the person picks.
Consequences¶
- Good: a lookup is a few lines in the module that knows the values; S1 to S12 of the audit and the plugin settings P1 to P8 need no new web code.
- Good: an older app keeps working: it renders the
valuessource, or text forprovider. - Bad:
hz system config showcan take up to 2 seconds longer while a lookup runs (an AI access status, a roster read); a lookup still running after the budget finishes in the background. - Bad: a new public name: plugins built against it need a core that has it (0026).
Confirmation¶
The settings UX tests fail when a setting declares a lookup that no module registers, when a lookup names a setting
that does not exist, and when a word or list-of-words setting neither declares its values, an enum or a format nor
is on the free-text list with a reason. The config options tests fail when values are not written into the schema,
when a failing or slow lookup changes it, or when the budget is not kept; the public API snapshot fails when the name
changes.
More Information¶
- UI audit for 0.9.59 (bead hlhg): the 37 rows, the renderer gaps G1 to G5 and the plugin-side list.
- Open: a query-driven lookup (a geocoding search for
weather.locations) and input schemas on plugin view actions (G5) are later decisions.