lekss361
e5d77b17b7
feat(infra): auto-apply data/sql/*.sql migrations in deploy pipeline ( #150 )
...
Закрывает root cause production 500 на /api/v1/admin/site-finder/weight-profiles
(а также 2 unapplied migrations: #89/#91).
## Why это нужно
После audit обнаружили что:
- backend/alembic/versions/ пустой (Alembic configured но не используется)
- deploy.yml не имеет migration step
- 47+ raw SQL files накопилось без auto-apply
- 3 файла unapplied: 87 (engineering), 89 (drop brin), 90 (weight profiles)
User report: GET weight-profiles → 500 потому что user_weight_profiles
table не существует на prod.
## Changes
### deploy.yml +39 lines
- Path trigger расширен на data/sql/*.sql
- New step 'Apply DB migrations' между compose pull и compose up -d:
- Idempotent CREATE TABLE _schema_migrations
- Loop по data/sql/*.sql sorted → skip applied → psql with ON_ERROR_STOP=on
- Record applied filename в tracking table
- Exit 1 на failure → containers НЕ обновляются (no partial state)
### NN collision fix
- 87_engineering_networks_191fz.sql → 91_engineering_networks_191fz.sql
(collision с 87_on_demand_indexes.sql, мой renumber 85→87 был неудачным)
### CLAUDE.md +32 lines
- Subsection 'Auto-apply' под Migration pattern
- Bootstrap procedure docs
- Idempotency requirement
- Failure recovery
### scripts/bootstrap_schema_migrations.sh +100 lines
- One-time seed _schema_migrations с 48 already-applied files
- 3 файла intentionally NOT seeded: 89/90/91 (auto-apply на first deploy)
- Usage docs + verification query
## Vault
domains/infra/Runbook_Auto_Apply_Migrations.md NEW
infra-MOC.md updated
## Required manual steps ДО merge
1. SSH gendesign (tunnel)
2. POSTGRES creds export
3. bash scripts/bootstrap_schema_migrations.sh — seed 48 already-applied files
4. Verify: SELECT COUNT(*) FROM _schema_migrations → 48
5. После merge → first deploy auto-apply #89/#90/#91 → 500 closes
Closes #150
2026-05-15 07:57:51 +03:00
lekss361
485c221c3b
docs(claude): formalize Auto-review passed as approval signal ( #85 )
...
* docs(claude): formalize "Auto-review passed" as approval signal + polling loop
Per user feedback after PR #84 merge:
- Critical rule 5: "Auto-review passed" / "LGTM" от auto-review bot = approval
(наряду с явным "merge it" / "approved" от human user)
- Add "Polling loop для PR" section: 60s ScheduleWakeup pattern,
decisive states (merged / approved / changes / no-news), cap 30 iters
This formalizes what main session already did: after fixup commit, poll
comments, detect auto-review verdict, and auto-merge if passed.
* fix(claude): address PR #85 auto-review feedback
- Fix cyrillic/latin typo (rule 5 second sub-bullet)
- Add SHA marker validation to polling loop (race condition on stale LGTM after fixup-push)
- Add explicit "Auto-merge scope" rule 6 — allowlist (docs/UI/.claude) vs blocklist (migrations/API/infra/secrets)
- Sync "Когда auto-mode" section with new merge approval signals
- Lower cap to 5 iters for scope-blocked PRs (human required anyway)
- Self-modifying CLAUDE.md rules → always require human
Per auto-review on e66e1ea .
---------
Co-authored-by: lekss361 <claudestars@proton.me>
2026-05-12 00:43:25 +03:00
lekss361
aadf47709b
docs(claude): mandate branch+PR workflow, ban direct push to main ( #84 )
...
* docs(claude): mandate branch+PR workflow, ban direct push to main
* docs(claude): sync TL;DR + Don't-do-these with new PR workflow
Address auto-review feedback:
- TL;DR rule 5 → branch+PR mandate (was: "user commits themselves")
- TL;DR rule 6 → no --no-verify/--force/--amend (split from rule 5)
- Don't-do-these → drop conflicting "no auto-commit" line, add
"no direct push to main" + "no merge without approval"
- Critical workflow rules: add explicit rule 2 — worker-agents don't
commit themselves; main session commits on feature branch
- Restore "Squash on merge" wording in PR section (was dropped)
- Auto-mode section: clarify that main session does commits on feature
branch (worker-agents leave changes staged)
* fix(claude): Code-reviewer diagram had stale 'push origin HEAD:main' — replace with branch+PR flow
---------
Co-authored-by: lekss361 <claudestars@proton.me>
2026-05-12 00:16:06 +03:00
lekss361
053ce29a40
docs(claude): add code-reviewer agent — review workflow before push
2026-05-11 23:44:32 +03:00
lekss361
5b741578e6
feat(claude): add 4 workers + tech-analyst subagents
...
Worker agents (write code):
- backend-engineer (blue, sonnet)
- frontend-engineer (green, sonnet)
- devops-engineer (orange, sonnet)
- database-expert (purple, sonnet)
Analyst/planner (read-only, no code):
- tech-analyst (yellow, sonnet) — decomposes vague/cross-domain
requests into structured plans for workers. Has read-only tools
(Read/Glob/Grep, MCP obsidian/postgres read APIs, WebSearch) but
NO Write/Edit/execute_sql/destructive Bash.
CLAUDE.md updated:
- Workers (4) vs Analyst (1) classification
- Routing rules: trivial → main, single-domain → worker direct,
vague/cross-domain → tech-analyst first
- Cross-domain orchestration pattern with explicit flow
Each agent file:
- Pre-loaded vault MOC pointers for the domain
- Tech stack + conventions specific to the layer
- 5-8 critical pitfalls from real bugs this sprint
- Explicit deny-list of cross-scope operations
2026-05-11 14:36:34 +03:00
lekss361
3e6cddde33
docs(claude): obsidian as the only knowledge store
...
- TL;DR header pin: all memory in Obsidian vault, JSONL deprecated,
no knowledge .md outside vault.
- Workflow: vault-first search step (mcp__obsidian__simple_search)
before any non-trivial task.
- New post-task step: update vault with bug fix / ADR / runbook /
session entry.
- Don't-do-these grouped (knowledge / code-git / schema-migrations).
- MEMORY.md gets matching rule (persists across sessions).
2026-05-11 14:19:48 +03:00