Files
member-console/internal/workflows/domains/activities.go
T
cgalo5758 c4bb1ba585 Harden domain claim expiry and carving
Sweep stranded pending claims at boot and on a Temporal schedule while
preserving evidence-based abandonment semantics.

Apply occupancy and name-policy checks to carves by operator-root owners
without affecting direct operator placements.
2026-07-25 04:10:34 -05:00

44 lines
1.7 KiB
Go

package domains
import (
"database/sql"
"log/slog"
dommod "git.coopcloud.tech/wiki-cafe/member-console/internal/domains"
)
// Activities holds dependencies for the domain-registry workflows.
type Activities struct {
Q dommod.Querier
Logger *slog.Logger
// Registry is the allocation API, needed by the expiry sweep: that pass
// mutates claims and so must run under the registry's advisory lock, which
// only the Registry (holding the *sql.DB) can take. The verification
// activities need none of it — they address one known claim by id.
Registry *dommod.Registry
// ConnectTarget is the deployment's DNS target for external claims (a
// CNAME host or an A-record IP). It backs the connect probe when a
// workflow input carries none; an empty target leaves the connect record
// unchecked, which never blocks verification (the TXT challenge alone
// gates it — design D4).
ConnectTarget string
}
// NewActivities constructs an Activities ready for registration.
//
// It takes no claim policy: every policy-dependent decision (the budgets,
// their windows, the scope width they count under) is made in the registry at
// allocation time, and the writes these activities make are unconditional —
// activation clears the abandonments at the verified name and beneath it,
// which is a fact about the row, not a configured width. The registry built
// here is therefore a default-policy one on purpose: the expiry sweep decides
// nothing policy carries, it acts on a deadline each claim already stores.
func NewActivities(db *sql.DB, logger *slog.Logger, connectTarget string) *Activities {
return &Activities{
Q: dommod.New(db),
Logger: logger,
Registry: dommod.NewRegistry(db),
ConnectTarget: connectTarget,
}
}