Repository navigation
fix(plan): make ownership explicit and supersede atomic - #34
Closed
NomosLudens wants to merge 2 commits into
Closed
NomosLudens wants to merge 2 commits into
NomosLudens wants to merge 2 commits into
Conversation
Contributor
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
kuan | 588fef0 | Jul 12 2026, 04:56 AM |
NomosLudens
deleted the
codex/integrate-kuan-strategic-plan-functionality-it8k6q
branch
September 4, 2026 00:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
kuanyin_business_planspara evitar resolução incorreta de colunas dentro da subquery da policy.supersede) seja atômica e não possa deixar decisões órfãs nem depender de rollback manual no código de aplicação.Description
public.kuanyin_can_own_plan(p_guardian_id, p_business_context_id)e substitui a policykuanyin_business_plans_owner_allpara usar essa função, removendo referências ambíguas aguardian_id/business_context_idna policy (arquivo:supabase/migrations/20260712002000_create_kuanyin_strategic_plan.sql).public.kuanyin_supersede_plan_decision(...)como PL/pgSQLSECURITY INVOKERque fazFOR UPDATEna decisão antiga, insere a nova decisão e marca a antiga comosupersededdentro da mesma transação, e só concedeEXECUTEdeste RPC paraauthenticated(arquivo:supabase/migrations/20260712002000_create_kuanyin_strategic_plan.sql).supersedeKuanPlanDecisionpara chamar apenas o RPC viasupabase.rpc(...), lançar erro honesto quando a RPC falhar e registrarwriteKuanIntegrityLogsomente após sucesso, removendoinsert/update/deletemanuais e rollback parcial no TypeScript (arquivo:src/lib/kuan-plan.functions.ts).src/lib/kuan-plan.transitions.test.ts,src/lib/kuan-plan.sql-contract.test.tse ajustes emsrc/lib/kuan-plan.transitions.ts).Testing
bun run lint(OK),bun run typecheck(OK),bun run test(OK) ebun run build(OK).bun run startecurl -I http://127.0.0.1:3000/kuan/planoretornaram HTTP 200 (OK).GRANT DELETEemkuanyin_plan_decisions, que o migration definekuanyin_can_own_plane que a server fn usa.rpc("kuanyin_supersede_plan_decision")seminsert/update/deletemanuais (teste criado:src/lib/kuan-plan.sql-contract.test.ts) (OK).Nota final: este commit foi intencionalmente focado nos dois bloqueadores restantes; o merge depende de QA manual com Supabase real para validar RLS e persistência no fluxo de substituição de decisão antes de aprovar a entrega em produção.
Codex Task