Clarify Gitea workflow and ban AI-style unicode markers

This commit is contained in:
2026-04-22 20:47:27 +03:00
parent 1d89a4918e
commit 472b3e10d9
3 changed files with 53 additions and 26 deletions

View File

@@ -2,6 +2,13 @@
Version: 1.1
## Source Text and Comments
- Use plain ASCII in source code and comments by default.
- Do not use em dash, emoji, or other decorative Unicode markers in code, comments, log messages, or user-facing fallback strings unless a feature explicitly requires non-ASCII text.
- Do not leave AI-style markers in the codebase: ornamental phrasing, assistant-like filler, synthetic enthusiasm, or comments that read like generated prose instead of technical documentation.
- Comments must be short, concrete, and technical. Explain intent, invariants, or non-obvious constraints; do not write marketing-style or conversational commentary.
## Logging
See `kit/patterns/go-logging/contract.md` for full rules.
@@ -18,7 +25,7 @@ if err := db.Save(&record).Error; err != nil {
return fmt.Errorf("save component %s: %w", record.ID, err)
}
// WRONG loses context
// WRONG: loses context
return err
```
@@ -35,9 +42,9 @@ return err
Handlers are thin. Business logic belongs in a service layer.
```
Handler validates input, calls service, writes response
Service business logic, calls repository
Repository SQL queries only, returns domain types
Handler -> validates input, calls service, writes response
Service -> business logic, calls repository
Repository -> SQL queries only, returns domain types
```
- Handlers must not contain SQL queries.
@@ -48,7 +55,7 @@ Repository → SQL queries only, returns domain types
```
1. Parse flags / load config
2. Connect to DB fail fast if unavailable (see go-database contract)
2. Connect to DB; fail fast if unavailable (see go-database contract)
3. Run migrations
4. Initialize services and background workers
5. Register routes
@@ -69,14 +76,14 @@ Never reverse steps 2 and 5. Never start serving before migrations complete.
## Template / UI Rendering
- Server-rendered HTML via Go templates is the default.
- htmx for partial updates no full SPA framework unless explicitly decided.
- htmx for partial updates; no full SPA framework unless explicitly decided.
- Template errors must return `500` and log the error server-side.
- Never expose raw Go error messages to the end user in rendered HTML.
## Business Logic Placement
- Threshold computation, status derivation, and scoring live on the server.
- The UI only reflects what the server returns it does not recompute status client-side.
- The UI only reflects what the server returns; it does not recompute status client-side.
- Example: "critical / warning / ok" badge color is determined by the handler, not by JS.
## Dependency Rules