Repository navigation
feat(index): publicar e reverter índices atomicamente - #36
Conversation
Checkpoint de revisão Fase 4Este PR foi revisado na base empilhada exata e permanece draft/mergeável, sem review humano ou thread pendente. A pilha combinada termina em CI combinada: Python 3.10/3.12 e dependency audit/SBOM verdes no run https://github.com/MHX-Digital/agent-architecture-kit/actions/runs/30477544972. Validação local final: 123/123, secret scan 0 matches, compileall/diff check verdes. Correções foram mantidas no PR que introduziu o comportamento: binding explícito do golden corpus ao commit no #32; fronteira autenticada sanitizada do corpus no #37. Nenhum gate foi relaxado. Estado: implementado/testado; aguardando revisão humana; não integrado; não implantado. Rollback por revert dos commits da unidade, sem mutação de índice ou ambiente externo. |
There was a problem hiding this comment.
💡 Codex Review
agent-architecture-kit/src/aak/index_lifecycle.py
Lines 195 to 196 in 39f37d6
When either cancellation check succeeds, _state(..., "cancelled") skips this branch, leaving the earlier requested or indexing marker in place. The MCP freshness path treats any such marker as an active build and blocks every architecture query, so a cancelled run leaves the last valid index unusable indefinitely unless another publication succeeds or someone manually removes the marker.
agent-architecture-kit/src/aak/index_lifecycle.py
Lines 157 to 160 in 39f37d6
If two publishers simultaneously inspect the same dead-PID lock, the first can move it and acquire a fresh lock before the second reaches this os.replace; the second then moves the first publisher's new lock to the orphan path and acquires another lock itself. Both publishers can consequently enter the critical section, and either publisher's unconditional release can also unlink the other's lock, defeating the serialization needed for publication.
agent-architecture-kit/src/aak/index_lifecycle.py
Lines 318 to 320 in 39f37d6
Once this replacement succeeds, several fallible operations still remain, including integrity hashing and atomic manifest/state/audit writes. If any of them fails—for example because the state filesystem is full—the exception path reports the run as failed while leaving the candidate installed as the active index, so callers observe a failed publication even though the previously valid index was replaced; the post-replacement failure path should restore the verified snapshot or recover the run as published.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Integração ordenada concluída — 2026-07-30 UTC
O #40 já havia sido empilhado no #38; portanto seu conteúdo chegou a Validação no SHA finalRun manual exato: https://github.com/MHX-Digital/agent-architecture-kit/actions/runs/30570028307
Artefatos novos, vinculados somente ao SHA final
Os artefatos da RC anterior não foram reutilizados ou reatribuídos. Estado: integrado e validado localmente/na CI; não implantado; canário não executado. Próximo gate: autorização humana explícita para o canário sanitizado. |
…s added since PR #42 PRs #37 (auth) and #32/#36 (index freshness) merged into main after this test file was written. The mcp_repo fixture now inits a real git repo and commits it so ARCHITECTURE_MAP.json's sourceSha can match HEAD, and every tool call passes expectedCommit accordingly. get_adr()'s return shape also changed to a trust-wrapped dict; updated the two assertions that relied on the old plain-string return.
Resultado
Implementa a unidade isolada da LexNotify-Web #793, empilhada sobre o contrato de freshness do PR #32.
Escopo
requested → indexing → validating → ready → publishing → published;failed|cancelled|rolled_back;scanner_builder;os.replace;Fora de escopo
Auth/RBAC/tenant (#792), carga/SLOs (#795), expansão de tools (#794), deploy, rollout e produção.
Evidência
git diff --check: limpo;Cobertura inclui sucesso, candidato inválido, commit/schema divergente, SHA curto/inexistente/outra branch, lock concorrente e órfão, CAS, snapshot, rollback, snapshot corrompido, cancelamento e auditoria sem conteúdo.
Segurança e compatibilidade
O builder nunca recebe o caminho ativo. O worktree isolado pertence à execução e é o único temporário removido. Falhas preservam candidato/snapshot para investigação e não substituem o índice válido. Não altera as sete tools nem o contrato público do MCP.
Rollback
Reverter este PR remove o lifecycle sem tocar em índices existentes. O rollback operacional valida o checksum do snapshot e troca atomicamente o arquivo ativo. Nenhum rollout foi executado.
Dependência
Este PR deve ser revisado depois do PR #32. A base empilhada evita misturar #791 e #793; após integração da #791, poderá ser retarget para
main.