Feat v0.6.3 dead code sweep (#38)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-sqlite (push) Successful in 2m46s
CI/CD / test-go-pg (push) Successful in 2m47s
CI/CD / build-and-deploy (push) Successful in 26s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #38.
This commit is contained in:
2026-03-31 12:37:47 +00:00
committed by xcaliber
parent a887b4c78b
commit 3d4228f868
130 changed files with 522 additions and 1215 deletions

View File

@@ -1,6 +1,5 @@
// Package sandbox — connections_module.go
//
// v0.38.1: Connections module for Starlark extensions.
// Requires permission: connections.read
//
// Starlark API:

View File

@@ -1,6 +1,5 @@
// Package sandbox — db_module.go
//
// v0.29.2 CS1: Structured db module for Starlark extensions.
//
// Permissions:
// db.read → db.query(), db.view(), db.list_tables()

View File

@@ -1,6 +1,5 @@
// Package sandbox — http_module.go
//
// v0.29.1 CS0: HTTP outbound module for Starlark extensions.
// Requires permission: api.http
//
// Starlark API:

View File

@@ -1,6 +1,5 @@
// Package sandbox — lib_module.go
//
// v0.38.2: Library loading module for Starlark extensions.
// No permission required — any starlark package can use lib.require().
//
// Starlark API:

View File

@@ -1,6 +1,5 @@
// Package sandbox — modules.go
//
// v0.29.0 CS3: Module factories for Starlark sandbox.
// Each factory returns a starlarkstruct.Module that the runner
// injects into the script namespace based on granted permissions.
package sandbox

View File

@@ -1,6 +1,5 @@
// Package sandbox — realtime_module.go
//
// v0.5.0: Starlark realtime.publish() module.
//
// Allows extensions to publish events to WebSocket channels.
// Events are scoped to rooms — only clients subscribed to the

View File

@@ -1,19 +1,14 @@
// Package sandbox — runner.go
//
// v0.29.0 CS3: Runner loads a package's Starlark script, assembles
// the module set based on granted permissions, and executes it.
//
// v0.29.1 CS0: Wires api.http permission to BuildHTTPModule with
// network_access config from package manifest.
//
// v0.29.1 CS2: Adds RunContext for per-invocation state (user_id),
// vault for provider key decryption, and provider.complete module.
//
// v0.29.2 CS1: Adds db *sql.DB for the db module. SetDB() wires it
// at startup. db.read grants query/view/list_tables; db.write adds
// insert/update/delete. If both are granted, db.write wins (superset).
//
// v0.38.2: Adds lib.load() for library packages. Libraries run with
// their own permission context. Per-invocation lib cache + cycle detection.
//
// The runner is the bridge between the package/permission system
@@ -48,7 +43,7 @@ type RunContext struct {
// ChannelID is the context identifier, if any.
ChannelID string
// TeamID is the team context for settings cascade resolution (v0.2.0).
// TeamID is the team context for settings cascade resolution.
// When set, team-scoped package settings are included in the cascade.
TeamID string
}
@@ -57,13 +52,13 @@ type RunContext struct {
type Runner struct {
sandbox *Sandbox
stores store.Stores
packagesDir string // v0.38.0: disk path for load() support
packagesDir string
notifier NotificationSender // nil = notifications module unavailable
connResolver ConnectionResolver // nil = connections module unavailable (v0.38.1)
connResolver ConnectionResolver // nil = connections module unavailable
db *sql.DB // nil = db module unavailable
dbPostgres bool // true = use $N placeholders; false = use ?
allowPrivateIPs bool // v0.38.5: disable SSRF private IP check
bus *events.Bus // v0.5.0: event bus for realtime module
allowPrivateIPs bool
bus *events.Bus
}
// NewRunner creates a runner with the given sandbox and dependencies.
@@ -79,7 +74,7 @@ func (r *Runner) SetNotifier(n NotificationSender) {
r.notifier = n
}
// SetConnectionResolver attaches the connection resolver for the connections module (v0.38.1).
// SetConnectionResolver attaches the connection resolver for the connections module.
func (r *Runner) SetConnectionResolver(cr ConnectionResolver) {
r.connResolver = cr
}
@@ -94,12 +89,11 @@ func (r *Runner) SetDB(db *sql.DB, isPostgres bool) {
// SetPackagesDir sets the disk path where package archives are extracted.
// Required for load() support — scripts are read from disk at runtime.
// v0.38.0.
func (r *Runner) SetPackagesDir(dir string) {
r.packagesDir = dir
}
// SetBus attaches the event bus for the realtime module (v0.5.0).
// SetBus attaches the event bus for the realtime module.
func (r *Runner) SetBus(bus *events.Bus) {
r.bus = bus
}
@@ -114,7 +108,6 @@ func (r *Runner) SetAllowPrivateIPs(allow bool) {
// ExecPackage loads a package's script from disk (primary) or manifest
// (legacy) and executes it with modules gated by granted permissions.
//
// v0.38.0: Disk-based loading + package-scoped load() support.
//
// The RunContext carries per-invocation state (user_id for provider
// resolution). Pass nil if no per-invocation context is needed.
@@ -136,7 +129,6 @@ func (r *Runner) ExecPackage(ctx context.Context, pkg *store.PackageRegistration
return nil, err
}
// v0.38.2: per-invocation lib context for lib.load() caching + cycle detection
lc := newLibContext()
// Build modules based on granted permissions
@@ -288,7 +280,7 @@ func (r *Runner) buildModules(ctx context.Context, packageID string, manifest ma
// The manifest is passed through so modules can read their config
// (e.g., http module reads network_access, provider reads requires_provider).
// The RunContext carries per-invocation state for user-scoped modules.
// The libContext enables lib.load() caching and cycle detection (v0.38.2).
// The libContext enables lib.load() caching and cycle detection.
func (r *Runner) buildModulesWithLibCtx(ctx context.Context, packageID string, manifest map[string]any, rc *RunContext, lc *libContext) (map[string]starlark.Value, error) {
if r.stores.ExtPermissions == nil {
return nil, nil
@@ -352,8 +344,7 @@ 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 + team + user settings (v0.2.0 cascade).
// A package reads its own admin + team + user settings.
userID := ""
teamID := ""
if rc != nil {
@@ -362,7 +353,6 @@ func (r *Runner) buildModulesWithLibCtx(ctx context.Context, packageID string, m
}
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.
if lc != nil {
modules["lib"] = BuildLibModule(ctx, r, packageID, rc, lc)

View File

@@ -1,6 +1,5 @@
// Package sandbox — sandboxed Starlark interpreter.
//
// v0.29.0 CS1: Provides execution with timeout, step limits,
// captured output, and injectable predeclared modules.
//
// The sandbox is intentionally restrictive:

View File

@@ -1,6 +1,6 @@
package sandbox
// settings_module.go — v0.2.0
// settings_module.go
//
// The settings module lets extensions read their resolved settings via
// the three-tier cascade: global → team → user, respecting the

View File

@@ -1,6 +1,5 @@
// Package sandbox — unicode_scan.go
//
// v0.5.1: Invisible Unicode scanning gate.
//
// Defends against GlassWorm (variation selector payloads), Trojan Source
// (bidi override attacks / CVE-2021-42574), and other invisible Unicode

View File

@@ -1,6 +1,6 @@
package sandbox
// workflow_module.go — v0.30.2 CS1, v0.3.2 instance API
// workflow_module.go
//
// The workflow module lets extensions read workflow definitions,
// manage instances, and programmatically advance workflow stages.
@@ -27,7 +27,6 @@ import (
// BuildWorkflowModule creates the "workflow" Starlark module for a package.
// Requires the workflow.access permission.
//
// v0.3.2: added get_instance and list_instances for read-only instance access.
// Mutating operations (start/advance/cancel) are available via HTTP API;
// Starlark builtins for them will be added when the engine interface is
// extracted to a shared package to avoid circular imports.
@@ -87,7 +86,7 @@ func workflowGetDef(ctx context.Context, stores store.Stores) func(*starlark.Thr
}
}
// ── Instance Read API (v0.3.2) ──────────────
// ── Instance Read API ──────────────
func workflowGetInstance(ctx context.Context, stores store.Stores) func(*starlark.Thread, *starlark.Builtin, starlark.Tuple, []starlark.Tuple) (starlark.Value, error) {
return func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
@@ -187,5 +186,5 @@ func goValToStarlark(v interface{}) starlark.Value {
}
}
// workflowRoute routes the workflow to a named stage (v0.35.0).
// workflowRoute routes the workflow to a named stage.
// Starlark: workflow.route(channel_id, target_stage, reason)