Collapse the byte-identical fga/db embed shims into toolbelt #5
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.
Dependencies
No dependencies set.
Reference
ginjiruu/toolbelt#5
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
Can the byte-identical fga/db embed shims collapse into toolbelt helpers?
internal/fga/embed.go(41 lines) andinternal/db/database.go(28 lines) are byte-identical across both consumers (and near-identical in the example), delegating//go:embedFS access totoolbelt/embeddedfgaandtoolbelt/db. This passes the "example proves it" boundary.Decisions this ticket resolves:
//go:embed-friendly helpers (e.g. anembeddedfga.ModelFS/db.WithMigrationspattern) that make the per-app shim a one-liner or disappear entirely?Resolve with
/grilling+/domain-modeling. On close, write the plan todocs/plans/and reshape the relevantexample/surface.Resolution
Resolved via
/grilling+/domain-modeling(claim: ginjiruu).Decisions:
internal/fga/embed.gobecomes//go:embed model+var ModelFS embed.FS. Deleted:ModelFS(),ModDir,EmbeddedModData,EmbeddedModules,ModelFiles,EmbeddedFGAModelFS(all dead exceptModelFS()/ModDir; the audit found no callers for the rest).app.gopassesModelFS: fga.ModelFS, dropsModelDir(default is already"model").internal/db/database.gobecomes//go:embed migrations/*.sql+var MigrationsFS embed.FS. Deleted:Migrations(),NewDatabase.NewDatabasewrapper is absorbed as a variadic functional-options API — same idiomembeddedfgaalready uses.toolbelt/dbgainstype Option func(*options) error,WithMigrationsDir(default"migrations"),WithLogger(defaultzap.NewNop()); the 5-argNewDatabasebecomesNewDatabase(ctx, dbPath string, fsys fs.FS, opts ...Option). Call sites becomeappdb.NewDatabase(ctx, dbPath, db.MigrationsFS, logger).schema.kfragments declare config values, and embed-dir names are Go-source layout, not a config field. No KCL involvement.example/(out of this map's scope), where the challenges are reassessed against every absorbed surface at once. This ticket closes with the plan doc only.Deliverable:
docs/plans/embed-shims.md(committed to the toolbelt repo).embeddedfga.ModelFilesbecomes fully dead once the shims go (fga-generate usesReadModules/ReadModFileonly) — its deletion rides along in the rewrite.Resolved: bare-variable shims + variadic-option appdb.NewDatabase; plan at docs/plans/embed-shims.md; no code lands (deferred to post-map example rewrite).