2.0 KiB
2.0 KiB
spark-server agent notes
This repo is a Go 1.26 modular monolith IM server. Source of truth: docs/architecture-v3.md.
Before writing code:
- Load
.cursor/skills/spark-im-v3/SKILL.md - Follow
.cursor/rules/(always-on V3 invariants + file-scoped rules) - Keep functions within
.golangci.yaml(funlen100,lll240) - HTTP and TCP share Application services under
internal/module/{biz}/logic. Each module isentity/model(one file per table, GORMTableName()→t_*) /logic(one file per function, not per table). Gin handlers only bind and call those services (MVC). REST paths are/v1/{resource}grouped by business; admin ops use/api/admin/…(see skillhttp.md). Request DTOs use go-playground/validator (label/errmsgi18n keys). Context must carryreqctx.RealIPand the user language (zh-CN/en/zh-TW). Errormsgand notification copy come frominternal/pkg/i18n. Table and column COMMENT is required. Messagecontentis serialized bytes, not a string. - MySQL: all tables
t_*; migrations replay-all — details in.cursor/skills/spark-im-v3/mysql.md. After changingmigrations/*.sql, rungo run ./cmd/migrate -config configs/config.yamlyourself. - Before finishing any code change, run
make testat the repo root (runslintfirst, logic coverage ≥65%). Do not report the task as OK until it passes. Missinggo/golangci-lint→ fix toolchain first; never label verification as skipped.make deploychains throughtest. - After edits that touch the repo, load
.cursor/skills/daily-change-list/SKILL.mdand appenddocs/daily/{yyyy}-{mm}-{dd}-change-list.mdbefore handoff. - Before
git commit,make testmust pass; install enforcement withmake install-git-hooksormake setup(see.cursor/rules/git-commit-gate.mdc). Do not use--no-verifyunless the user explicitly asks.
Do not introduce Kafka, K8s, microservices, ConversationSeq, application-layer handshake crypto, or public gnet ports.