teqo-backup/.cursor/rules
Francisco Ignácio Fontoura Solla c7001b75f0 E14: engagement levels N0-N4 and the first allocationDecision writer.
`municipality.engagementLevel` (staff-only, no default) records what the
campaign decided to invest in a município, next to the E8/E10 metrics that
describe what it knows. Moving it is a reallocation decision, so only
unrestricted staff may, every move carries a rationale plus the signals that
would reverse it, and the write files an `allocationDecision` in the same
transaction under an advisory lock taken before the current level is read —
otherwise the snapshot's `from` is a guess. The enum gains `movimento`: a level
move is neither `aceita` nor `descarta`.

No backfill. Null is "Sem nível", and filtering by it is the triage queue.
That is also why the list sorts `nivel` in memory rather than in the query:
Postgres puts NULLs first on DESC, so a native sort would open "N4 primeiro"
on a page of municípios nobody has decided about yet. The filter stays native.

The hysteresis rules from research §6.8 are pure and client-safe, so the
Popover explains a block before submitting and the server re-runs them anyway;
a blocked move answers 409 with typed violations and the override is recorded
with exactly the rules it contradicted.
2026-07-27 21:19:33 -03:00
..
projects E14: engagement levels N0-N4 and the first allocationDecision writer. 2026-07-27 21:19:33 -03:00
access-control-advanced.md feat: initial commit 2026-02-14 16:11:51 -03:00
access-control.md feat: initial commit 2026-02-14 16:11:51 -03:00
adapters.md feat: initial commit 2026-02-14 16:11:51 -03:00
campanha-action-feedback.mdc Sync all project docs with the deployed remodel and hardening; compile roadmap 2026-07-24 02:04:45 -03:00
campanha-edit-where-you-see.mdc Sync all project docs with the deployed remodel and hardening; compile roadmap 2026-07-24 02:04:45 -03:00
codebase-map.mdc C13: renomeia "Plano de Acao" para "Atividade" em toda a vertical /campanha 2026-07-25 20:50:38 -03:00
collections.md feat: initial commit 2026-02-14 16:11:51 -03:00
components.md Add Post and Tag collections for news and publications 2026-07-15 19:12:11 -03:00
endpoints.md feat: initial commit 2026-02-14 16:11:51 -03:00
engineering-standards.mdc Tooling: pnpm db:doctor + preflight no guard-dev-db (remedios nomeados, deteccao de volume compartilhado pos-corrupcao WAL), madge check:cycles e prettier no CI/pre-push, guard rails de data migration no skill, notas de processo (knip --fix, pipes) e gate atualizado nos docs/rules 2026-07-25 18:02:02 -03:00
field-type-guards.md feat: initial commit 2026-02-14 16:11:51 -03:00
fields.md feat: initial commit 2026-02-14 16:11:51 -03:00
hooks.md feat: initial commit 2026-02-14 16:11:51 -03:00
payload-overview.md feat: initial commit 2026-02-14 16:11:51 -03:00
plugin-development.md feat: initial commit 2026-02-14 16:11:51 -03:00
queries.md feat: initial commit 2026-02-14 16:11:51 -03:00
security-critical.mdc feat: initial commit 2026-02-14 16:11:51 -03:00