From a99d017d48ac22bff8212f2eb4838be5cb9834fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Fri, 27 Nov 2026 03:04:50 +0100 Subject: [PATCH 1/3] Engineering standards: link the canonical docs/ENGINEERING.md (golang-template) and summarise the non-negotiables for agents --- AGENTS.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index b272baa..306363a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,21 @@ # Instructions for AI coding agents +## Engineering standards (non-negotiable) + +The full text is `docs/ENGINEERING.md` in the golang-template repository (github.com/jetlio/golang-template; locally `~/Work/golang-template/docs/ENGINEERING.md`). Read it before designing or changing code, and say in the plan how the change meets it. References: golang-template, and in backend-mono `apps/monitor` (layout, wiring, lint-enforced layers, apperr) and `apps/assistant` (huma). **Never copy patterns from older services.** + +1. **One source of truth.** Generate from the owner of a fact: OpenAPI → clients, catalogs → constants, migrations → sqlc. Never hand-edit generated code; CI checks for drift. +2. **Clean layers.** handler → service → repo, with dto and mapper beside them, enforced by lint. +3. **Dependency injection.** Use `Deps`/`Options` in one composition root. No global state, no singletons. +4. **Typed vocabularies.** Enums, statuses, events and error codes are typed constants or generated. No magic strings or numbers. Configuration is declared once. +5. **Secure by design.** Deny by default. Guard every route from the permission catalog; scope tenants in the query itself. Hash or seal secrets, wire up validation, send outbound calls through the SSRF-safe client, redact logs, keep an audit trail. +6. **Reliable.** A deadline on every outside call, bounded retries, atomic changes, an outbox for side effects, supervised workers (never a bare `go func()`), graceful shutdown. +7. **Bounded and scalable.** Sizes, pages and concurrency are capped. Nothing assumes a single replica. +8. **Errors.** Domain errors map to RFC 9457 problems with enumerated codes. Internals never leak. +9. **Tested at the boundaries,** including authorization denials. Every security fix gets a regression test. +10. **Process.** Docs ship with the change. Short-lived branches and PRs, commits with explicit paths, pinned tool versions. Spikes are labelled as spikes. + + Before changing anything, read [docs/DESIGN.md](docs/DESIGN.md) (the binding principles, contracts and playbooks) and [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) (the code map). Section 7 of From b18aa7fe7b7dc759cc8ac4d6c07d54f657e4c774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Fri, 27 Nov 2026 03:11:47 +0100 Subject: [PATCH 2/3] Engineering standards: full testing chapter, operations, change safety, supply chain, privacy, design records; per-repo test commands --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 306363a..1c46809 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -12,7 +12,7 @@ The full text is `docs/ENGINEERING.md` in the golang-template repository (github 6. **Reliable.** A deadline on every outside call, bounded retries, atomic changes, an outbox for side effects, supervised workers (never a bare `go func()`), graceful shutdown. 7. **Bounded and scalable.** Sizes, pages and concurrency are capped. Nothing assumes a single replica. 8. **Errors.** Domain errors map to RFC 9457 problems with enumerated codes. Internals never leak. -9. **Tested at the boundaries,** including authorization denials. Every security fix gets a regression test. +9. **Tested and automated.** Unit tests, integration tests (the real server against Postgres), contract tests (the authorization matrix including denials, generated-code drift), component and e2e tests (frontend, Playwright against the seeded stack), and smoke tests after every deploy. Every fix starts with a failing test. CI gates are real: never `|| true`. Change safety: additive APIs, expand → contract migrations, flags, rollback. 10. **Process.** Docs ship with the change. Short-lived branches and PRs, commits with explicit paths, pinned tool versions. Spikes are labelled as spikes. From 893fa4fbe4d60d22b0bef0a7095ec67d1fb820db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Fri, 27 Nov 2026 03:36:38 +0100 Subject: [PATCH 3/3] Engineering standards: no internal references in this public repository --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 1c46809..89cff6e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ ## Engineering standards (non-negotiable) -The full text is `docs/ENGINEERING.md` in the golang-template repository (github.com/jetlio/golang-template; locally `~/Work/golang-template/docs/ENGINEERING.md`). Read it before designing or changing code, and say in the plan how the change meets it. References: golang-template, and in backend-mono `apps/monitor` (layout, wiring, lint-enforced layers, apperr) and `apps/assistant` (huma). **Never copy patterns from older services.** +These are the Norcube team's non-negotiable engineering standards (the full text is an internal document). Check every design and change against them and say in the plan how it meets them. Never copy patterns from older code that breaks them. 1. **One source of truth.** Generate from the owner of a fact: OpenAPI → clients, catalogs → constants, migrations → sqlc. Never hand-edit generated code; CI checks for drift. 2. **Clean layers.** handler → service → repo, with dto and mapper beside them, enforced by lint.