Trim comments to the non-obvious why
Test and deploy / test (push) Successful in 28s
Test and deploy / deploy (push) Successful in 31s

Drop narration, history and restated-code comments across the repo,
keep short ones for security boundaries, upstream quirks and ordering
constraints, and record the convention in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 20:49:03 +00:00
co-authored by Claude Opus 5.5
parent effddd2794
commit 4530cb8dc4
222 changed files with 1173 additions and 5423 deletions
+4 -14
View File
@@ -18,9 +18,7 @@ type SQLConfig struct {
Port string
}
// connectToPostgreSQL opens the GORM connection. sslmode=disable is safe
// only because Postgres is reachable exclusively on the private Docker
// network, never over the internet.
// sslmode=disable: Postgres is only on the Docker network.
func connectToPostgreSQL(config *SQLConfig) (*gorm.DB, error) {
dsn := fmt.Sprintf(
"user=%s password=%s dbname=%s host=%s port=%s sslmode=disable",
@@ -35,12 +33,8 @@ func connectToPostgreSQL(config *SQLConfig) (*gorm.DB, error) {
return db, nil
}
// migrateDatabase brings the schema up to date. This project has no
// migration files: GORM's AutoMigrate is the only schema source, so it will
// add tables, columns and indexes but never drop or rename anything. Removing
// a field from a model therefore leaves the column behind, and a renamed
// field appears as a brand-new column with no data. Any model added to
// models.go must also be listed here or its table will never be created.
// AutoMigrate never drops or renames, so removed fields leave columns and
// renamed ones start empty. New models must be listed here.
func migrateDatabase(db *gorm.DB) error {
err := db.AutoMigrate(
&models.User{},
@@ -66,11 +60,7 @@ func migrateDatabase(db *gorm.DB) error {
return ensureStpPage(db)
}
// ensureStpPage turns the home page (/stp) into an ordinary canvas Page once.
// It used to be a built-in canvas with its own route; its boxes and
// background were already keyed "stp", so a Page row with that slug is all
// it takes. Unscoped, so that deleting the page on purpose sticks rather than
// bringing it back on the next start.
// ensureStpPage creates the /stp Page row once. Unscoped, so deleting it sticks.
func ensureStpPage(db *gorm.DB) error {
var count int64
if err := db.Unscoped().Model(&models.Page{}).Where("slug = ?", "stp").Count(&count).Error; err != nil {