refactor(models): split Site into SiteConfig + SiteState #109
Reference in New Issue
Block a user
Delete Branch "refactor/site-split"
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?
Summary
Phase 5c — the root-cause architectural fix.
models.Sitefused 22 persistent config fields with 11 ephemeral runtime state fields in one struct, causing the lost-update race (Phase 3), the 11-line field-by-field copy inUpdateSiteConfig, and ~12 manual sync points per new field.Design: embedded composition via
type Site struct { SiteConfig; SiteState }. Field access unchanged —site.Nameandsite.Statusstill work via promotion.Changes:
SiteConfig— DB never sees runtime state (compiler-enforced)UpdateSiteConfigreduced from 11-line field-by-field copy toexisting.SiteConfig = cfgRunChecktakesSiteConfig— statically prevented from reading/writing stateBackup.Siteschanged to[]SiteConfig— exports no longer carry zero-valued runtime fieldsliveStatekeeps fullSitecomposites with both config + stateTest plan
go test -race ./...— all passgolangci-lint— 0 issuesUpdateSiteConfigbody is 3 lines instead of 14SiteConfigonlyRunChecktakesSiteConfig, notSite