Feat settings cascade (#3)
Some checks failed
CI/CD / detect-changes (push) Successful in 3s
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Failing after 2m24s
CI/CD / test-sqlite (push) Successful in 2m48s
CI/CD / build-and-deploy (push) Has been skipped

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #3.
This commit is contained in:
2026-03-26 18:03:44 +00:00
committed by xcaliber
parent a830ae3684
commit a36be83aaf
15 changed files with 690 additions and 49 deletions

View File

@@ -46,6 +46,10 @@ type RunContext struct {
// ChannelID is the context identifier, if any.
ChannelID string
// TeamID is the team context for settings cascade resolution (v0.2.0).
// When set, team-scoped package settings are included in the cascade.
TeamID string
}
// Runner executes Starlark package scripts with permission-gated modules.
@@ -337,12 +341,14 @@ func (r *Runner) buildModulesWithLibCtx(ctx context.Context, packageID string, m
}
// v0.30.0: settings module — always injected, no permission required.
// A package reads its own admin + user settings.
// A package reads its own admin + team + user settings (v0.2.0 cascade).
userID := ""
teamID := ""
if rc != nil {
userID = rc.UserID
teamID = rc.TeamID
}
modules["settings"] = BuildSettingsModule(ctx, r.stores, packageID, userID)
modules["settings"] = BuildSettingsModule(ctx, r.stores, packageID, userID, teamID)
// v0.38.2: lib module — always injected, no permission required.
// Allows any starlark package to load declared library dependencies.