Absorb the config reexport layer into toolbelt/config #3
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
ginjiruu/toolbelt#3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Question
Should
toolbelt/configship a standard app-config bootstrap so apps stop hand-writing the reexport layer?Consumers and the example all wrap
toolbelt/configwith a reexport layer:reexports.go(~68-76 lines re-exportingInit/ReadField*/WriteField/Save/BuildLogger/PrintConfig/Validate*/Fields()/Register),consts.go(17-21 lines, byte-identical incl. a staleGO_TEMPLATEprefix in ttrpg),validate.go(58-65 lines, KCL schema validation),fields_meta.go(47 lines:ResolveDBPath/ResolveTupleFilePath). This passes the "example proves it" boundary.Decisions this ticket resolves:
toolbelt/config— the reexport shim, the universal-field set, the KCL validation entry?schema.k→kcl-generate), ttrpg hand-writesfields_app.goand has no schema. What does a shared bootstrap assume about that?BuildLoggermove here (it's re-exported in both) or stay in the composition-root ticket?Resolve with
/grilling+/domain-modeling. On close, write the plan todocs/plans/and reshape the relevantexample/surface.Resolution (grilling + domain-modeling; full plan:
docs/plans/config-bootstrap.md)Decisions:
config.New(Options{...})returns an object; the reexport shim is deleted. (toolbelt/configgoes instance-owned: theFields/ConfigEnvPrefix/AppName/AppVersionglobals die;Init/ReadField*/WriteField/Save/PrintConfig/Validatebecome methods;Register/Fields()wrappers die.)schema.k;kcl-generateemits the field registry and the bootstrap (var App = config.New(...)withAppName/AppVersion/EnvPrefix/SchemaPath/field list + the_ ".../config/kcl"blank import).internal/configbecomes 100% generated;consts.go/validate.go/reexports.godisappear.toolbelt/appand is removed fromtoolbelt/config(composition-root concern; every app already has its ownBuildLogger(logLevel, logFormat)).cfg.Validate()does KCL schema validation (the app'svalidate.gofilter/reflection boilerplate is deleted).cfg.Fields()exposesField.ValidValuesfortoolbelt/cmd(ticket #9) cobra completion.kcl-generatemerges N fragments; this ticket's bootstrap is agnostic to where defaults came from.ResolveDBPath/ResolveTupleFilePathruled out of scope — fail the "example proves it" boundary;toolbelt/db.NewDatabasealready resolves (filepath.Abs).Consumer migration (go-template, ttrpg) is a separate later project per the map.
Example reshape (implemented in a later session): delete the three hand-written files, regenerate, mechanically switch call sites to
config.App.X, run root + tools tests.Resolved via grilling. Plan: docs/plans/config-bootstrap.md. Service-owned defaults graduated to #12. See resolution comment.