feat(reconciliation): add maker-checker exception resolution command - #47
Conversation
📝 WalkthroughWalkthrough조정 예외 해결 명령과 retained evidence 검증을 추가했습니다. PostgreSQL이 명령·상태·outbox의 원자성과 불변성을 보장합니다. 런 최종화는 해결 명령과 일관된 Changes조정 예외 해결 권한
Estimated code review effort: 5 (Critical) | ~120 minutes Merge Risk: 🟠 High · up to This PR adds a privileged command that can terminally resolve reconciliation exceptions, enable run finalization, and emit accounting events. At the current head, command identity and reviewer authority are not independently bound by the database, matching outbox emission is not enforced, and strict-JSON collisions plus migration preflight gaps create additional merge-readiness risk. Do not merge until these issues and the required exact-head checks are resolved. Sequence Diagram(s)sequenceDiagram
participant Reviewer
participant resolve_reconciliation_exception
participant PostgreSQL
participant Outbox
Reviewer->>resolve_reconciliation_exception: resolve_exception payload 제출
resolve_reconciliation_exception->>PostgreSQL: payload hash와 입력 검증
resolve_reconciliation_exception->>PostgreSQL: lifecycle lock 및 retained evidence 조회
PostgreSQL-->>resolve_reconciliation_exception: 명령 권한 승인
resolve_reconciliation_exception->>PostgreSQL: resolution command와 exception 상태 기록
resolve_reconciliation_exception->>Outbox: 일치하는 resolution event 기록
resolve_reconciliation_exception-->>Reviewer: 불변 resolution receipt 반환
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review Please review exact current head |
|
@codex review Please independently review exact current head |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='48a1857449303e754a928b98828d114ce7ca1669'
head='5a332e59ea4f6e527880eb7e032ed15a13877b66'
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git merge-base --is-ancestor "$base" "$head"
printf '\n== Exact range ==\n'
git diff --stat "$base" "$head"
printf '\n== Changed files ==\n'
git diff --name-status "$base" "$head"
printf '\n== Relevant file candidates ==\n'
fd -t f . | rg '(0020_reconciliation_exception_resolution_command\.sql|reconciliation.*(test|spec)|.*reconciliation.*\.(sql|ts|js|py|go)$|ADR.*0062|0062.*)'
printf '\n== Migration outline/content ==\n'
migration="$(fd -t f '^0020_reconciliation_exception_resolution_command\.sql$' | head -n1 || true)"
if [ -n "$migration" ]; then
nl -ba "$migration"
fi
printf '\n== Exact diff: SQL and reconciliation files ==\n'
git diff --find-renames --find-copies --unified=80 "$base" "$head" -- \
':(glob)**/*reconciliation*' \
':(glob)**/0020_reconciliation_exception_resolution_command.sql' \
':(glob)**/*0062*'Length of output: 7734 🏁 Script executed: #!/bin/bash
set -euo pipefail
base='48a1857449303e754a928b98828d114ce7ca1669'
head='5a332e59ea4f6e527880eb7e032ed15a13877b66'
number() { awk '{printf "%6d %s\n", NR, $0}'; }
printf '\n== 0020 migration ==\n'
git show "${head}:database/migrations/0020_reconciliation_exception_resolution_command.sql" | number
printf '\n== Parent migration: exception evidence (0013) ==\n'
git show "${head}:database/migrations/0013_reconciliation_run_exception_evidence.sql" | \
rg -n -C5 'reconciliation_exception|resolution_status|CREATE.*FUNCTION|CREATE.*TRIGGER|POLICY|GRANT|RLS|outbox'
printf '\n== Parent migration: lock order (0017) ==\n'
git show "${head}:database/migrations/0017_reconciliation_approval_lock_order.sql" | \
rg -n -C5 'FUNCTION|LOCK|reconciliation_run|exception|transition|FOR UPDATE'
printf '\n== Parent migration: command evidence (0019) ==\n'
git show "${head}:database/migrations/0019_reconciliation_run_command_evidence.sql" | \
rg -n -C6 'command|idempot|FUNCTION|outbox|RLS|GRANT|POLICY|reconciliation_run'
printf '\n== Python module outlines ==\n'
ast-grep outline src/accounting_information_platform/reconciliation_exception_resolution.py --items all
ast-grep outline src/accounting_information_platform/reconciliation_lifecycle.py --items all
printf '\n== Changed Python implementations ==\n'
git diff --unified=100 "$base" "$head" -- \
src/accounting_information_platform/reconciliation_exception_resolution.py \
src/accounting_information_platform/reconciliation_lifecycle.py \
src/accounting_information_platform/migration_install.py \
src/accounting_information_platform/__init__.py
printf '\n== Focused PostgreSQL tests ==\n'
git show "${head}:tests/test_reconciliation_exception_resolution_postgres.py" | number
printf '\n== Unit resolution and lifecycle test diffs ==\n'
git diff --unified=80 "$base" "$head" -- \
tests/test_reconciliation_exception_resolution.py \
tests/test_reconciliation_lifecycle.py \
tests/test_migration_install_exception_resolution.pyLength of output: 189828 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='5a332e59ea4f6e527880eb7e032ed15a13877b66'
printf '\n== Persistence session and migration loader ==\n'
ast-grep outline src/accounting_information_platform/persistence.py --items all --match 'PostgresPostingLedger|apply_foundation_migration'
rg -n -C8 'def _session\b|def apply_foundation_migration\b|class PostgresPostingLedger\b|def _acquire_command_lock\b' \
src/accounting_information_platform/persistence.py
printf '\n== Outbox schema, uniqueness, RLS, and triggers ==\n'
rg -n -C8 'CREATE TABLE accounting_integration\.outbox_event|outbox_event|outbox.*guard|FORCE ROW LEVEL SECURITY|REVOKE ALL' \
database/migrations
printf '\n== All 0020 references and PostgreSQL lifecycle acceptance ==\n'
rg -n -C6 'exception_resolution|resolution_command|atomic_pair|reconciliation_exception_resolved|resolution_status_code' \
tests src/accounting_information_platform database/migrations/0020_reconciliation_exception_resolution_command.sql
printf '\n== Reconciliation lifecycle PostgreSQL test outline and relevant blocks ==\n'
ast-grep outline tests/test_reconciliation_lifecycle_postgres.py --items all
rg -n -C12 'exception|reconcile_reconciliation_run|outbox|raw|status|snapshot|command' \
tests/test_reconciliation_lifecycle_postgres.py
printf '\n== Migration 0020 trigger definitions and trigger ordering ==\n'
git show "${head}:database/migrations/0020_reconciliation_exception_resolution_command.sql" | \
rg -n -C4 'CREATE (CONSTRAINT )?TRIGGER|CREATE OR REPLACE FUNCTION|outbox_event|snapshot_hash|resolution.*pair'
printf '\n== Git diff check for outbox enforcement added in exact range ==\n'
git diff --unified=25 \
'48a1857449303e754a928b98828d114ce7ca1669' "$head" -- \
':(glob)database/migrations/**/*.sql' \
':(glob)tests/**/*postgres*.py'Length of output: 232789
I found two database-authority gaps.
The command/status atomicity, maker-checker identity check, tenant/run/exception foreign-key scope, shared idempotency registry, lifecycle locking, and terminal evidence immutability are otherwise implemented consistently in the reviewed range.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a332e59ea
ℹ️ 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".
|
@codex review Please review exact head |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Exact-head refresh after current review repairs: |
|
Additional exact-head self-review found and repaired a migration authority defect after the prior review set: migration 0013 already FORCEs RLS on |
|
@codex review Please review exact current head |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
seonghobae
left a comment
There was a problem hiding this comment.
Current-head blocker at f75d221e00535ffa82cd67a53f75402f8f79c726: this commit changes the authority-bearing lifecycle transaction from PostgreSQL REPEATABLE READ to READ COMMITTED, but the exact current test still requires SET TRANSACTION ISOLATION LEVEL REPEATABLE READ and ADR 0060 still defines one coherent authority snapshot under that isolation level. The queued exact-head Foundation run must therefore not be treated as expected GREEN.
This is not only documentation drift. Under READ COMMITTED, _load_review_control_state(), exception-command reads, _database_owned_close_projection_evidence(), opening-command reads, transition insert, status update, and outbox publication can observe different statement snapshots. The run lifecycle advisory lock serializes the reconciliation review mutations that actually acquire it, but current evidence does not prove every source-population mutation used by the bridge—bank-statement facts and posted cash-journal facts included—shares that lock. Merely changing the assertion and ADR to say READ COMMITTED would weaken the one-snapshot accounting contract.
Add a real PostgreSQL barrier regression before the next repair. One connection must wait for the lifecycle lock while another commits relevant authority evidence, and a second case must attempt a source-population mutation between the lifecycle reader's sequential authority queries. Prove either that every contributing mutation is serialized on the same lock, or that the lifecycle command acquires a session-level/application lock before opening a fresh REPEATABLE READ transaction (or derives the complete authority snapshot in an equivalent single-snapshot boundary). The accepted GREEN must preserve exact replay, atomic transition/status/outbox, database-owned populations, and one coherent source/review snapshot. Update ADR 0060, doctoring, and unit contracts only after the real PostgreSQL concurrency proof agrees with the implementation.
seonghobae
left a comment
There was a problem hiding this comment.
Current-head follow-up at 9721f6d66496efbcc34e0d7f9fb33eb20dcb6657: the new real-PostgreSQL test materially addresses the first half of the prior finding. It uses two connections/threads and PostgreSQL blocking evidence to prove that a finalizer waiting on the run lifecycle lock evaluates an exception resolution committed by the preceding lock holder. ADR 0060 and the concurrency doctoring now consistently describe READ COMMITTED post-wait visibility.
One accounting-consistency acceptance criterion remains unproven. The test patches _database_owned_close_projection_evidence() with a fixed in-memory bridge, so it cannot detect a bank-statement or posted cash-journal source mutation between the lifecycle command's sequential PostgreSQL authority reads. READ COMMITTED still permits a new statement snapshot per query. The current contract assumes every authority-bearing source mutation contributing to the bridge uses the same lifecycle lock, but this head has not demonstrated that for statement and journal source populations.
Keep Draft and add one real PostgreSQL barrier regression that does not mock the close-projection helper: hold or attempt a statement-entry or posted-cash-journal mutation after the finalizer owns the lifecycle lock but before its later population query, and prove the finalizer cannot produce a transition from a mixed source/review snapshot. If those source writers do not share the lifecycle lock, preserve the post-wait visibility fix through a two-phase boundary such as acquiring a session/application lock before opening a fresh REPEATABLE READ transaction, or an equivalent single-snapshot derivation. Do not weaken the source-population authority contract to match READ COMMITTED without that proof.
seonghobae
left a comment
There was a problem hiding this comment.
Current-head documentation/contract blocker at 647ebf6a96749783af2b6fdca6959f7742327d9f: production now acquires a session advisory lock before opening a fresh REPEATABLE READ authority transaction, and the unit double now asserts that protocol. The real PostgreSQL mixed-source regression added at c01fe177... is the correct RED for the former READ COMMITTED split-snapshot defect.
ADR 0060 is still materially stale, however. It repeatedly declares READ COMMITTED to be the final authority-bearing model, states every later query intentionally receives a fresh snapshot, lists READ COMMITTED as the database concurrency invariant, and asks acceptance tests to require READ COMMITTED. Those statements now contradict the code and would teach an operator/reviewer to reintroduce the defect that f666135... fixes.
Update ADR 0060 and all lifecycle concurrency doctoring/traceability to the exact two-phase protocol: acquire tenant/run-scoped session advisory lock outside the authority transaction, commit the lock-acquisition transaction without releasing the session lock, open a fresh REPEATABLE READ transaction, reacquire the transaction-level lock reentrantly for database-trigger parity, derive all run/review/exception/statement/book authority from that one snapshot, commit or roll back, then release the session lock in finally. Preserve the real PostgreSQL RED and add/retain repository contracts that reject stale READ COMMITTED authority wording. Do not weaken the new coherent-snapshot implementation to make the old ADR pass. Revalidate PostgreSQL, exact 100% owned statement/branch coverage, docs/contracts, package/SBOM/provenance and security on the successor exact head before resolving.
seonghobae
left a comment
There was a problem hiding this comment.
Current-head verification at 2519ee2d3ff98c8158a4c4a2c81e1805979b4412: the mixed-source snapshot P1 is source-addressed. The real PostgreSQL RED inserts statement facts after the lifecycle review read; the production repair acquires the tenant/run session advisory lock before opening a fresh REPEATABLE READ authority transaction; the transaction-level lock is reacquired for trigger parity; unit contracts verify commit/rollback/unlock ordering; ADR 0060 and concurrency doctoring now describe the same two-phase protocol. This preserves both post-wait visibility and one coherent run/review/statement/book snapshot.
Do not resolve or promote this finding from source inspection alone. Exact-head Accounting Foundation CI 33574848277 is queued, so PostgreSQL behavior, exact 100% owned statement/branch coverage, public-docstring/repository contracts, package/SBOM/provenance and security evidence remain non-passing. Resolve only after that unchanged SHA executes all applicable gates successfully and no current-head review finding invalidates the model.
|
@codex review Please review exact head |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Current exact head is New RED→repair boundary: migration 0020 now makes resolution-command Exact-head Accounting Foundation @codex review this exact head against the live parent. Please verify specifically that the database-owned recording-time guard cannot be bypassed through direct SQL, that the future-effective rejection is compatible with immediate terminal-state semantics, and that no accounting posting/period-close/policy authority was broadened. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review Review exact head |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@coderabbitai review Please review exact current head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='48a1857449303e754a928b98828d114ce7ca1669'
head='61bb7317f1839b37b25ce83e8bc9c21ae8b90e5f'
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git merge-base --is-ancestor "$base" "$head"
printf '\n== Exact changed files ==\n'
git diff --name-status "$base" "$head"
printf '\n== Relevant file inventory ==\n'
fd -t f . | rg -i '(reconciliation|0020.*resolution|0060|0062|migration_install|outbox|lifecycle)'
printf '\n== Source and test outlines ==\n'
for f in \
src/accounting_information_platform/reconciliation_exception_resolution.py \
src/accounting_information_platform/reconciliation_lifecycle.py \
tests/test_reconciliation_exception_resolution.py \
tests/test_reconciliation_exception_resolution_postgres.py \
tests/test_reconciliation_lifecycle_postgres.py
do
if [ -f "$f" ]; then
echo "--- $f"
ast-grep outline "$f" --items all
fi
done
printf '\n== Exact diff: reconciliation implementation, migrations, and tests ==\n'
git diff --find-renames --unified=50 "$base" "$head" -- \
':(glob)src/accounting_information_platform/*reconciliation*' \
':(glob)database/migrations/*reconciliation*' \
':(glob)tests/*reconciliation*' \
':(glob)docs/**/*0060*' \
':(glob)docs/**/*0062*' \
CHANGELOG.md README.md ARCHITECTURE.md OPERABILITY.md
printf '\n== Strict JSON identity definitions and uses ==\n'
rg -n -C8 --glob '*.py' \
'def _source_payload_hash\b|json\.dumps\(|allow_nan|source_payload_hash|NaN|Infinity|-Infinity' \
src tests
printf '\n== Migration 0020 authority objects ==\n'
migration="$(fd -t f '^0020_reconciliation_exception_resolution_command\.sql$' | head -n1 || true)"
if [ -n "$migration" ]; then
nl -ba "$migration" | sed -n '1,620p'
fiLength of output: 202463 🏁 Script executed: #!/bin/bash
set -euo pipefail
base='48a1857449303e754a928b98828d114ce7ca1669'
head='61bb7317f1839b37b25ce83e8bc9c21ae8b90e5f'
printf '%s\n' '== Exact changed files =='
git diff --name-status "$base" "$head"
printf '%s\n' '== Relevant path names =='
fd -t f . | rg '(^|/)(reconciliation_exception_resolution|reconciliation_lifecycle|0020_reconciliation_exception_resolution_command|0060|0062)'
printf '%s\n' '== Strict JSON change only =='
git diff --unified=35 "$base" "$head" -- \
src/accounting_information_platform/reconciliation_exception_resolution.py \
tests/test_reconciliation_exception_resolution.py \
tests/test_reconciliation_exception_resolution_postgres.py
printf '%s\n' '== Resolution module: hash and transaction code =='
rg -n -C18 --glob 'reconciliation_exception_resolution.py' \
'def _source_payload_hash\b|allow_nan|def resolve_reconciliation_exception\b|BEGIN|REPEATABLE|pg_advisory|outbox|recorded_at|effective_at|replay|Idempotency' \
src/accounting_information_platform
printf '%s\n' '== Lifecycle module: locking and snapshot code =='
rg -n -C18 --glob 'reconciliation_lifecycle.py' \
'def reconcile_reconciliation_run\b|REPEATABLE|pg_advisory|advisory|BEGIN|transaction|snapshot|retry|40001|finally|lock' \
src/accounting_information_platform
printf '%s\n' '== Migration 0020: authority, guards, RLS, outbox =='
sed -n '1,620p' database/migrations/0020_reconciliation_exception_resolution_command.sql | \
grep -nE -C 10 \
'CREATE (OR REPLACE )?FUNCTION|CREATE (CONSTRAINT )?TRIGGER|resolution_command|outbox_event|recorded_at|effective_at|ROW LEVEL|FORCE ROW|POLICY|GRANT|REVOKE|legacy|preflight|snapshot|status'
printf '%s\n' '== Focused strict JSON and PostgreSQL test definitions =='
rg -n -C12 \
'nan|NaN|Infinity|finite|canonical|source.payload.hash|forged.*recorded|future.*effective|outbox|direct.SQL|REPEATABLE|advisory|later.*statement|maker|replay' \
tests/test_reconciliation_exception_resolution.py \
tests/test_reconciliation_exception_resolution_postgres.py \
tests/test_reconciliation_lifecycle_postgres.py
printf '%s\n' '== New migration installation references =='
rg -n -C6 '0020_reconciliation_exception_resolution_command|apply_foundation_migration|MIGRATION' \
src/accounting_information_platform tests/test_migration_install_exception_resolution.pyLength of output: 202867 🏁 Script executed: #!/bin/bash
set -euo pipefail
base='48a1857449303e754a928b98828d114ce7ca1669'
head='61bb7317f1839b37b25ce83e8bc9c21ae8b90e5f'
printf '%s\n' '== Exact range summary =='
git diff --stat "$base" "$head"
git diff --name-status "$base" "$head"
printf '%s\n' '== Migration 0020 remainder =='
sed -n '460,760p' database/migrations/0020_reconciliation_exception_resolution_command.sql
printf '%s\n' '== All outbox constraints or triggers in migration chain =='
rg -n -C8 \
'outbox.*(guard|pair|atomic|required)|outbox_event.*(guard|trigger)|reconciliation_exception_resolved|reconciliation_exception_superseded' \
database/migrations
printf '%s\n' '== All transition snapshot validation code =='
rg -n -C10 \
'reconciliation_snapshot_hash|assign_reconciliation_run_transition_hash|transition_snapshot' \
database/migrations src/accounting_information_platform/reconciliation_lifecycle.py \
tests/test_reconciliation_lifecycle_postgres.py
printf '%s\n' '== Strict JSON regression bodies =='
rg -n -A35 -B5 \
'NaN|Infinity|non.finite|finite.*(hash|canonical)|canonical.*(hash|finite)|JSON.compatible' \
tests/test_reconciliation_exception_resolution.py \
tests/test_reconciliation_exception_resolution_postgres.py
printf '%s\n' '== Resolution direct-SQL and time regression bodies =='
rg -n -A45 -B5 \
'direct.SQL|forged|future.*effective|recorded_at|atomic.*outbox|outbox.*atomic|without.*outbox' \
tests/test_reconciliation_exception_resolution_postgres.py
printf '%s\n' '== Lifecycle concurrency regression bodies =='
rg -n -A65 -B5 \
'post.wait|later.*statement|REPEATABLE|advisory|snapshot|concurrent|ThreadPool|Barrier' \
tests/test_reconciliation_lifecycle_postgres.py
printf '%s\n' '== Exact strict-JSON patch =='
git diff --unified=80 "$base" "$head" -- \
src/accounting_information_platform/reconciliation_exception_resolution.py \
tests/test_reconciliation_exception_resolution.py \
docs/doctoring/2026-09-02-reconciliation-command-strict-json-identity.mdLength of output: 7484 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Resolution authority and pair guard, with source line numbers =='
grep -n -E -A42 -B8 \
'enforce_reconciliation_exception_resolution_authority|enforce_reconciliation_exception_resolution_pair|resolution_status_pair_guard|outbox_event' \
database/migrations/0020_reconciliation_exception_resolution_command.sql || true
printf '%s\n' '== Lifecycle transition trigger, with source line numbers =='
grep -n -E -A140 -B8 \
'assign_reconciliation_run_transition_hash|reconciliation_snapshot_hash|reconciliation_run_transition_command_hash' \
database/migrations/0020_reconciliation_exception_resolution_command.sql || true
printf '%s\n' '== Dedicated strict JSON regressions =='
sed -n '1,240p' tests/test_reconciliation_exception_resolution_json_identity.py
printf '%s\n' '== Dedicated recorded-time regressions =='
sed -n '1,280p' tests/test_reconciliation_exception_resolution_future_effective_postgres.py
printf '%s\n' '== Lifecycle lock-wait regression test names and assertions =='
grep -n -E -A80 -B5 \
'^ def test_|assert|pg_advisory|REPEATABLE|snapshot|statement|Barrier|Event' \
tests/test_reconciliation_lifecycle_lock_wait_postgres.py || true
printf '%s\n' '== Lifecycle snapshot freshness regression test names and assertions =='
grep -n -E -A75 -B5 \
'^ def test_|assert|REPEATABLE|snapshot|statement|Barrier|Event|later' \
tests/test_reconciliation_lifecycle_snapshot_freshness.py || true
printf '%s\n' '== Searches for direct SQL coverage of omitted outbox and forged snapshot =='
rg -n -C4 \
'without.*outbox|omit.*outbox|outbox.*omit|fabricat.*snapshot|stale.*snapshot|snapshot.*(forged|fabricat|stale)|INSERT INTO accounting_core\.reconciliation_run_transition_command' \
tests/test_reconciliation_exception_resolution* tests/test_reconciliation_lifecycle* || true
printf '%s\n' '== Reconciliation modules: prohibited authority call sites =='
rg -n -C2 \
'general_journal|journal_entry|post\(|reverse\(|fiscal_period|close_fiscal|accounting_policy|policy' \
src/accounting_information_platform/reconciliation_exception_resolution.py \
src/accounting_information_platform/reconciliation_lifecycle.py || trueLength of output: 45266 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Public resolution command admission order =='
sed -n '1,245p' src/accounting_information_platform/reconciliation_exception_resolution.py
printf '%s\n' '== Exact source-hash change with line numbers =='
git diff --unified=40 48a1857449303e754a928b98828d114ce7ca1669 61bb7317f1839b37b25ce83e8bc9c21ae8b90e5f -- \
src/accounting_information_platform/reconciliation_exception_resolution.py | \
grep -n -E -C8 'source_payload_hash|allow_nan|json.dumps' || trueLength of output: 18836
I found three authority defects.
The following controls are implemented consistently in the reviewed source:
The supplied exact-head Foundation CI state remains queued and non-passing. You are interacting with an AI system. |
seonghobae
left a comment
There was a problem hiding this comment.
Exact-head review on 4527ca02ff385f3c211976fcf356124e9419c2b1: predecessor 886100a... is no longer a behavior RED. Foundation 34202632635 passed the real-PostgreSQL behavior/repository suite and complete coverage execution, then failed the strict denominator gate because retained coverage had exactly one uncovered production statement and one branch: the post-loop AssertionError after the bounded serialization-retry loop in reconciliation_exception_resolution.py. Source inspection confirms that exit is impossible: success returns, a non-40001 error re-raises, and the third 40001 failure re-raises inside the loop. The current commit removes that dead exit by expressing the same at-most-three retry policy with an explicit counter and while True; it does not add a pragma/exclusion, change the 100% denominator, weaken maker-checker/RLS/snapshot/outbox authority, or alter error translation. Current Foundation 34207629271 is still queued before runner assignment, so this COMMENT is source/RCA review only, not approval or GREEN. Keep Draft and require unchanged-head behavior + exact 100% statement/branch denominator + contracts/package/security/current independent approval before stack advancement.
|
Exact head |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='4527ca02ff385f3c211976fcf356124e9419c2b1'
git cat-file -e "${head}^{commit}"
git checkout --quiet "$head"
echo '== Exact commit =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"
parent="$(git rev-parse "${head}^")"
printf 'parent=%s\n' "$parent"
git diff --stat "$parent" "$head"
git diff --name-status "$parent" "$head"
echo '== Migration identity and installer =='
find database/migrations -maxdepth 1 -type f -name '*.sql' -printf '%f\n' | sort | tail -35
nl -ba src/accounting_information_platform/migration_install.py | sed -n '1,220p'
echo '== Authority source outlines =='
ast-grep outline src/accounting_information_platform/reconciliation_exception_resolution.py --items all
ast-grep outline src/accounting_information_platform/reconciliation_lifecycle.py --items all
echo '== Exact change =='
git diff --unified=100 "$parent" "$head" -- \
src/accounting_information_platform/reconciliation_exception_resolution.py \
tests \
database/migrations \
docs CHANGELOG.md README.md
echo '== Relevant migration constructs =='
for f in \
database/migrations/0021_reconciliation_run_database_snapshot_authority.sql \
database/migrations/0022_reconciliation_exception_resolution_command.sql \
database/migrations/0023_reconciliation_exception_resolution_outbox_pair.sql \
database/migrations/0024_reconciliation_authority_outbox_retention.sql \
database/migrations/0025_reconciliation_authority_outbox_orphan_guard.sql \
database/migrations/0026_reconciliation_control_recording_time_authority.sql \
database/migrations/0027_reconciliation_lifecycle_recording_time_authority.sql \
database/migrations/0028_reconciliation_lifecycle_source_payload_identity.sql \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql \
database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql; do
echo "## $f"
rg -n -C4 'CREATE( OR REPLACE)? FUNCTION|CREATE( CONSTRAINT)? TRIGGER|FORCE ROW LEVEL SECURITY|SECURITY DEFINER|REVOKE|GRANT|outbox|source_payload_hash|snapshot|advisory|resolution|recorded_at|effective_at' "$f"
done
echo '== Focused test inventory =='
fd -t f -e py . tests | rg 'reconciliation.*(postgres|resolution|lifecycle)|migration.*(identity|install)'Length of output: 4422 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='4527ca02ff385f3c211976fcf356124e9419c2b1'
parent='886100a5315ca41b7a8709dd7594df7b7e5b6dd7'
git checkout --quiet "$head"
echo '== Installer =='
sed -n '1,240p' src/accounting_information_platform/migration_install.py
echo '== Exact retry repair with context =='
git diff --unified=140 "$parent" "$head" -- src/accounting_information_platform/reconciliation_exception_resolution.py
echo '== Resolution implementation: JSON, retained evidence, transaction, replay, outbox =='
rg -n -C12 \
'def _require_strict_json_value|def _source_payload_hash|def resolve_reconciliation_exception|40001|REPEATABLE READ|reconciliation_evidence|idempot|outbox|recorded_at|effective_at|INSERT INTO|UPDATE accounting_core\.reconciliation_exception' \
src/accounting_information_platform/reconciliation_exception_resolution.py
echo '== Lifecycle implementation: session lock and snapshot data =='
rg -n -C12 \
'def _coherent_lifecycle_session|acquire_reconciliation_lifecycle_session|release_reconciliation_lifecycle_session|REPEATABLE READ|_transition_snapshot_hash|source_payload_hash|Decimal|population|outbox|40001' \
src/accounting_information_platform/reconciliation_lifecycle.py
echo '== Authority migration definitions and triggers =='
for f in database/migrations/0021_reconciliation_run_database_snapshot_authority.sql \
database/migrations/0022_reconciliation_exception_resolution_command.sql \
database/migrations/0023_reconciliation_exception_resolution_outbox_pair.sql \
database/migrations/0024_reconciliation_authority_outbox_retention.sql \
database/migrations/0025_reconciliation_authority_outbox_orphan_guard.sql \
database/migrations/0028_reconciliation_lifecycle_source_payload_identity.sql \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql \
database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql; do
echo "## $f"
grep -n -E -C 5 \
'CREATE( OR REPLACE)? FUNCTION|CREATE( CONSTRAINT)? TRIGGER|FORCE ROW LEVEL SECURITY|SECURITY DEFINER|REVOKE|GRANT|outbox|source_payload_hash|snapshot|advisory|resolution|recorded_at|effective_at' "$f"
done
echo '== Focused tests: test names and control assertions =='
for f in \
tests/test_reconciliation_exception_resolution.py \
tests/test_reconciliation_exception_resolution_json_identity.py \
tests/test_reconciliation_exception_resolution_postgres.py \
tests/test_reconciliation_lifecycle.py \
tests/test_reconciliation_lifecycle_postgres.py \
tests/test_reconciliation_lifecycle_snapshot_freshness.py \
tests/test_reconciliation_lifecycle_lock_wait_postgres.py; do
echo "## $f"
grep -n -E '^\s*def test_|source_payload_hash|outbox|retained|evidence|advisory|REPEATABLE|RLS|Decimal|population|retry|40001' "$f" | head -220
doneLength of output: 161718 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='4527ca02ff385f3c211976fcf356124e9419c2b1'
git checkout --quiet "$head"
echo '== Lifecycle session lease prerequisite =='
sed -n '225,340p' database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql
echo '== Lifecycle database snapshot and outbox guards =='
sed -n '602,775p' database/migrations/0021_reconciliation_run_database_snapshot_authority.sql
sed -n '107,210p' database/migrations/0023_reconciliation_exception_resolution_outbox_pair.sql
echo '== Resolution evidence, status, and RLS guard bodies =='
sed -n '148,430p' database/migrations/0022_reconciliation_exception_resolution_command.sql
echo '== Lifecycle strict JSON and authority-read sequence =='
sed -n '92,325p' src/accounting_information_platform/reconciliation_lifecycle.py
sed -n '332,390p' src/accounting_information_platform/reconciliation_lifecycle.py
echo '== PostgreSQL regression bodies for direct SQL and atomicity =='
grep -n -A75 -B5 \
-E 'def test_database_rejects_direct_fabricated_resolution_evidence|def test_raw_terminal_status_without_resolution_command_fails|def test_named_command_resolves_exception_and_emits_atomic_outbox|def test_transition_command_cannot_commit_without_reconciled_status|def test_supported_command_persists_transition_outbox_and_freezes_review_state|def test_waiting_finalizer_observes_resolution_committed_before_snapshot' \
tests/test_reconciliation_exception_resolution_postgres.py \
tests/test_reconciliation_lifecycle_postgres.py \
tests/test_reconciliation_lifecycle_lock_wait_postgres.py
echo '== Regression bodies for source identity, retention, and server-owned snapshot =='
rg -n -A55 -B5 \
'source payload|source_payload_hash|outbox.*(omit|required|retain|orphan)|database.*(snapshot|population)|fabricated.*snapshot|direct.*outbox' \
tests/test_reconciliation_exception_resolution_postgres.py \
tests/test_reconciliation_lifecycle_postgres.py \
tests/test_reconciliation_lifecycle_source_snapshot_postgres.py \
tests/test_reconciliation_exception_resolution_review_regressions.py \
tests/test_reconciliation_lifecycle.pyLength of output: 140094
I found no blocking defect in the requested boundaries.
I used the existing constraint context for This review is not an approval. Keep the PR Draft while the required independent-review and merge-process gates are completed. 🧠 Learnings usedYou are interacting with an AI system. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4527ca02ff
ℹ️ 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".
|
/opencode Continue the existing #47 single-source-writer from exact |
Exact-head RCA and source repair — 2026-09-08
|
|
Exact-head successor verification is now terminal for
The PR remains Draft and is not merged: current review disposition, central applicable checks, independent approval, and ordinary integration into #29 remain required. |
|
@codex review Please review exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='12e1a4bb9d8de5e4b6c72e2893107b07c515416b'
head='6f8749c569a60fbd9777b630f53d63df37a12937'
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git merge-base --is-ancestor "$base" "$head"
git checkout --quiet "$head"
echo '== Exact range =='
git show -s --format='head=%H%nparents=%P%nsubject=%s' "$head"
git diff --stat "$base" "$head"
git diff --name-status "$base" "$head"
git diff --unified=100 "$base" "$head" -- database/migrations/0022_reconciliation_exception_resolution_command.sql tests
echo '== Migration identities and installer =='
find database/migrations -maxdepth 1 -type f -name '*.sql' -printf '%f\n' | sort | tail -15
sed -n '1,180p' src/accounting_information_platform/migration_install.py
echo '== Exact P1 migration definitions =='
for f in \
database/migrations/0022_reconciliation_exception_resolution_command.sql \
database/migrations/0023_reconciliation_exception_resolution_outbox_pair.sql \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql \
database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql; do
echo "## $f"
nl -ba "$f" | sed -n '1,520p'
done
echo '== P1 SQL reference map =='
rg -n -C6 \
'reconciliation_evidence_scope_identity|reconciliation_exception_resolution_evidence_scope_fk|reconciliation_lifecycle_session_lease|FORCE ROW LEVEL SECURITY|CREATE POLICY|acquire_reconciliation_lifecycle_session|release_reconciliation_lifecycle_session|SECURITY DEFINER|GRANT|REVOKE' \
database/migrations \
src/accounting_information_platform \
tests
echo '== Lifecycle call sequence =='
ast-grep outline src/accounting_information_platform/reconciliation_lifecycle.py --items all
rg -n -C16 \
'_coherent_lifecycle_session|acquire_reconciliation_lifecycle_session|release_reconciliation_lifecycle_session|REPEATABLE READ|_acquire_command_lock|commit\(' \
src/accounting_information_platform/reconciliation_lifecycle.py
echo '== Focused PostgreSQL test implementations =='
for f in \
tests/test_reconciliation_exception_resolution_scope_fk_postgres.py \
tests/test_reconciliation_lifecycle_session_lease_postgres.py \
tests/test_reconciliation_lifecycle_lock_wait_postgres.py \
tests/test_reconciliation_exception_resolution_postgres.py; do
if [ -f "$f" ]; then
echo "## $f"
ast-grep outline "$f" --items all
rg -n -C10 \
'scope|foreign.key|tenant|session.*lease|FORCE ROW LEVEL SECURITY|advisory|REPEATABLE READ|raw|direct|resolution|outbox' \
"$f"
fi
doneLength of output: 112234 🏁 Script executed: #!/bin/bash
set -euo pipefail
base='12e1a4bb9d8de5e4b6c72e2893107b07c515416b'
head='6f8749c569a60fbd9777b630f53d63df37a12937'
git checkout --quiet "$head"
echo '== Exact migration 0022 delta only =='
git diff --unified=45 "$base" "$head" -- database/migrations/0022_reconciliation_exception_resolution_command.sql
echo '== Evidence scope key and foreign-key declarations =='
rg -n -C8 \
'reconciliation_evidence_scope_identity|reconciliation_exception_resolution_evidence_scope_fk|FOREIGN KEY|UNIQUE' \
database/migrations/0013_reconciliation_run_exception_evidence.sql \
database/migrations/0022_reconciliation_exception_resolution_command.sql
echo '== Resolution command authority function and triggers =='
rg -n -A110 -B12 \
'FUNCTION accounting_core\.(enforce_reconciliation_exception_resolution_authority|assign_reconciliation_exception_resolution_hash|reject_reconciliation_evidence_mutation)|CREATE (CONSTRAINT )?TRIGGER.*reconciliation.*resolution|FORCE ROW LEVEL SECURITY|CREATE POLICY|REVOKE|GRANT' \
database/migrations/0022_reconciliation_exception_resolution_command.sql
echo '== Session lease implementation and RLS =='
rg -n -A120 -B12 \
'FUNCTION accounting_core\.(acquire_reconciliation_lifecycle_session|release_reconciliation_lifecycle_session|require_reconciliation_lifecycle_session_lock)|reconciliation_lifecycle_session_lease|FORCE ROW LEVEL SECURITY|CREATE POLICY|REVOKE|GRANT|CREATE.*TRIGGER' \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql \
database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql
echo '== Application lease ordering =='
sed -n '35,140p' src/accounting_information_platform/reconciliation_lifecycle.py
echo '== Focused tests =='
for f in \
tests/test_reconciliation_exception_resolution_scope_fk_postgres.py \
tests/test_reconciliation_lifecycle_stacked_session_admission_postgres.py \
tests/test_reconciliation_lifecycle_session_lease_postgres.py; do
echo "## $f"
test -f "$f" && sed -n '1,280p' "$f" || true
done
echo '== Lease, scope, and RLS test inventory =='
rg -n \
'def test_.*(scope|session|rls|tenant|lease|stacked)|reconciliation_evidence_scope_identity|reconciliation_exception_resolution_evidence_scope_fk|reconciliation_lifecycle_session_lock_required|FORCE ROW LEVEL SECURITY' \
testsLength of output: 142002 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='6f8749c569a60fbd9777b630f53d63df37a12937'
git checkout --quiet "$head"
echo '== Session lease guard tail =='
sed -n '235,380p' database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql
echo '== Capability migration =='
cat database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql
echo '== Dedicated tenant-RLS regression =='
sed -n '1,260p' tests/test_reconciliation_lifecycle_session_lease_rls_postgres.py
echo '== Direct-lock and reentrancy regressions =='
sed -n '1,280p' tests/test_reconciliation_lifecycle_direct_session_lock_postgres.py
sed -n '1,220p' tests/test_reconciliation_lifecycle_session_lock_reentrancy_postgres.py
echo '== Session-lock contract and migration function privileges =='
sed -n '1,180p' tests/test_reconciliation_lifecycle_session_lock_authority_contract.py
rg -n -C5 \
'acquire_reconciliation_lifecycle_session|release_reconciliation_lifecycle_session|proacl|has_function_privilege|GRANT EXECUTE|accounting_closing_writer|SECURITY DEFINER' \
tests database/migrations src/accounting_information_platform
echo '== Current exact diff for P1 migrations relative to base =='
git diff --unified=25 12e1a4bb9d8de5e4b6c72e2893107b07c515416b "$head" -- \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql \
database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql \
tests/test_reconciliation_lifecycle_session_lease_rls_postgres.py \
tests/test_reconciliation_lifecycle_direct_session_lock_postgres.py \
tests/test_reconciliation_lifecycle_session_lock_reentrancy_postgres.py \
tests/test_reconciliation_lifecycle_stacked_session_admission_postgres.pyLength of output: 136523
I found no current-head actionable defect in the requested P1 boundaries.
I used the retained learning that the canonical evidence identity is unique for tenant, run, evidence type, and evidence reference. This supports the single-row retained-evidence lookup. This review does not approve the PR. 🧠 Learnings usedYou are interacting with an AI system. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f8749c569
ℹ️ 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".
|
@coderabbitai review Fresh exact-head review requested for |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='263e4ffb79607dccee715686d0aa451981c2eeb8'
repo='ContextualWisdomLab/accounting-information-platform'
git cat-file -e "${head}^{commit}"
git checkout --quiet "$head"
parent="$(git rev-parse "${head}^")"
echo '== Exact commit and immediate delta =='
git show -s --format='head=%H%nparents=%P%nsubject=%s' "$head"
printf 'parent=%s\n' "$parent"
git diff --stat "$parent" "$head"
git diff --name-status "$parent" "$head"
git diff --unified=120 "$parent" "$head" -- \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql \
database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql \
src/accounting_information_platform/reconciliation_lifecycle.py \
src/accounting_information_platform/reconciliation_exception_resolution.py \
tests docs README.md CHANGELOG.md
echo '== PR state and exact checks (informational; not predecessor evidence) =='
gh pr view 47 --repo "$repo" \
--json headRefOid,baseRefOid,state,isDraft,mergeable,statusCheckRollup \
--jq '{headRefOid,baseRefOid,state,isDraft,mergeable,checks:[.statusCheckRollup[]|{name,status,conclusion}]}' || true
echo '== Migration 0029 and capability hardening =='
nl -ba database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql
nl -ba database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql
echo '== Lifecycle authority implementation =='
ast-grep outline src/accounting_information_platform/reconciliation_lifecycle.py --items all
rg -n -C14 \
'_coherent_lifecycle_session|acquire_reconciliation_lifecycle_session|release_reconciliation_lifecycle_session|SELECT .*FOR UPDATE|FOR UPDATE|REPEATABLE READ|advisory|lease|commit\(|rollback\(' \
src/accounting_information_platform/reconciliation_lifecycle.py \
database/migrations/0021_reconciliation_run_database_snapshot_authority.sql \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql \
database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql
echo '== Related transition authority and RLS definitions =='
rg -n -C8 \
'reconciliation_lifecycle_session_lock_required|require_reconciliation_lifecycle_session_lock|reconciliation_lifecycle_session_lease|FORCE ROW LEVEL SECURITY|CREATE POLICY|SECURITY DEFINER|REVOKE|GRANT|pg_locks|pg_advisory' \
database/migrations
echo '== Focused PostgreSQL regression inventory and implementations =='
fd -t f -e py . tests | rg 'reconciliation.*(session|lease|lock|lifecycle).*postgres|reconciliation.*resolution.*postgres' | sort
for f in \
tests/test_reconciliation_lifecycle_session_lease_postgres.py \
tests/test_reconciliation_lifecycle_session_lease_rls_postgres.py \
tests/test_reconciliation_lifecycle_direct_session_lock_postgres.py \
tests/test_reconciliation_lifecycle_session_lock_reentrancy_postgres.py \
tests/test_reconciliation_lifecycle_stacked_session_admission_postgres.py \
tests/test_reconciliation_lifecycle_lock_wait_postgres.py \
tests/test_reconciliation_lifecycle_snapshot_freshness.py \
tests/test_reconciliation_exception_resolution_postgres.py; do
if [ -f "$f" ]; then
echo "## $f"
ast-grep outline "$f" --items all
rg -n -C10 \
'def test_|FOR UPDATE|fresh|invalidate|lease|session|advisory|REPEATABLE READ|RLS|tenant|resolution|outbox|maker|checker' \
"$f"
fi
done
echo '== Migration numeric identity =='
find database/migrations -maxdepth 1 -type f -name '*.sql' -printf '%f\n' | sort | tail -20Length of output: 20088 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='263e4ffb79607dccee715686d0aa451981c2eeb8'
git checkout --quiet "$head"
number() { awk '{printf "%6d %s\n", NR, $0}'; }
echo '== Migration 0029 =='
cat database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql | number
echo '== Migration 0030 =='
cat database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql | number
echo '== Lifecycle session and transition implementation =='
sed -n '1,260p' src/accounting_information_platform/reconciliation_lifecycle.py | number
echo '== Relevant transition and authority trigger definitions =='
for f in \
database/migrations/0019_reconciliation_run_command_evidence.sql \
database/migrations/0021_reconciliation_run_database_snapshot_authority.sql \
database/migrations/0022_reconciliation_exception_resolution_command.sql \
database/migrations/0023_reconciliation_exception_resolution_outbox_pair.sql \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql; do
echo "## $f"
rg -n -C8 \
'CREATE( OR REPLACE)? FUNCTION|CREATE( CONSTRAINT)? TRIGGER|AFTER (INSERT|UPDATE|DELETE)|FOR UPDATE|fresh_transaction|required|40001|reconciliation_lifecycle_session_lease|FORCE ROW LEVEL SECURITY|CREATE POLICY|SECURITY DEFINER|REVOKE|GRANT' \
"$f"
done
echo '== All mutation invalidation trigger attachment points =='
rg -n -C5 \
'invalidate.*lifecycle.*lease|lifecycle.*lease.*invalid|reconciliation_lifecycle_session_lease' \
database/migrations/0029_reconciliation_lifecycle_session_lock_authority.sql \
database/migrations/0030_reconciliation_lifecycle_capability_privileges.sql
echo '== Focused PostgreSQL test bodies =='
for f in \
tests/test_reconciliation_lifecycle_stacked_session_admission_postgres.py \
tests/test_reconciliation_lifecycle_session_lease_postgres.py \
tests/test_reconciliation_lifecycle_session_lease_rls_postgres.py \
tests/test_reconciliation_lifecycle_direct_session_lock_postgres.py \
tests/test_reconciliation_lifecycle_session_lock_reentrancy_postgres.py \
tests/test_reconciliation_lifecycle_lock_wait_postgres.py \
tests/test_reconciliation_exception_resolution_postgres.py; do
if [ -f "$f" ]; then
echo "## $f"
sed -n '1,380p' "$f" | number
fi
done
echo '== Test names that cover lease invalidation, freshness, and authority =='
rg -n \
'^\s*def test_.*(lease|session|fresh|stale|invalidation|resolution|outbox|maker|checker|rls|tenant)' \
tests
echo '== Migration identity tail =='
find database/migrations -maxdepth 1 -type f -name '*.sql' -printf '%f\n' | sort | tail -20Length of output: 197811
I found no current-head actionable defect in the requested boundaries.
The exact commit changes only the continuity-repair record. Its documentation matches the installed migration and regression behavior that I inspected. This review is not an approval. You are interacting with an AI system. |
|
@codex review 현재 exact head |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Buyer outcome
Add immutable maker-checker reconciliation-exception resolution while preserving PostgreSQL-owned reconciliation authority. Resolution binds retained review evidence, strict incoming-command identity, reviewer separation, valid/system-time causality, terminal status and matching transactional-outbox authority. It cannot post/reverse journals, close periods, alter accounting policy, or write Billing-owned truth.
Exact current state — 2026-09-08
263e4ffb79607dccee715686d0aa451981c2eeb8;#29@12e1a4bb9d8de5e4b6c72e2893107b07c515416bonfix/reconciliation-multi-match-conservation;0019/0020/0021; feat(reconciliation): add maker-checker exception resolution command #47 owns0022..0030; fix(close): freeze hard-close trial balance evidence #53 remains dependency-blocked and must be renumbered/restacked only after feat(reconciliation): add maker-checker exception resolution command #47 integrates;docs/product-technical-gap-baseline.md, sharedCHANGELOG.md, and shareddocs/doctoring/STANDARD_TRACEABILITY.mdremain PR docs: refresh reconciliation product gap baseline #37's canonical single-writer surfaces.Review RED and causal repair
Fresh review on predecessor
6f8749c569a60fbd9777b630f53d63df37a12937found one P1 in migration 0029: a backend could commit a canonical lease, release the session advisory hold directly while leaving the lease row, establishREPEATABLE READsnapshot S0, let another backend commit a new reconciliation exception, then reacquire both session and transaction advisory locks directly. The old lease could still appear valid and did not prove continuity across the eligibility-changing commit.This was an accounting-authority defect, not a test-only issue. TDD repair remained ordinary/non-force:
4e30115391c1fe05b32d5e115302c22976058bb8— real PostgreSQL RED reproducing canonical lease commit → raw session unlock → S0 pin → late exception commit → raw session+xact reacquire, requiring SQLSTATE40001plusreconciliation_lifecycle_fresh_transaction_required.24c8ca349df06aad1da10370d4302e18359f168f— migration 0029 transactionally invalidates tenant/run session leases after successful candidate/match/statement-allocation/journal-allocation/approval/exception mutations. The transition guard locks the exact lease row withSELECT ... FOR UPDATE; a post-S0 invalidation therefore becomes PostgreSQL serialization failure and fails closed as the typed freshness error. No caller GUC, timestamp heuristic, RLS weakening, lock-gate weakening or accounting-truth relaxation was added.55c0d65f5ba06a152d2957656b5364fb1590f7a1and current263e4ff...— ADR 0066 and direct-session-lock doctoring evidence are code-current, including actual0029/0030migration numbers and the lease-continuity invariant.The lease remains ephemeral coordination evidence. It is not journal, posting, exception-decision, financial-control, or Billing truth. FORCE RLS remains in place, PUBLIC helper execution remains revoked, and issue #44 remains the future purpose-limited database-capability owner.
Exact-head GREEN evidence
Accounting Foundation
34237450022is terminal GREEN on unchanged exact263e4ffb79607dccee715686d0aa451981c2eeb8.102098735789: 1,315 real-PostgreSQL tests / 0 failures / 0 errors; complete owned production coverage 6,211/6,211 statements and 2,330/2,330 branches; strict denominator enforcement, repository contracts, compile/import, reproducible wheel/evidence and package stages all GREEN.102098735619: GREEN.102098735914: GREEN.102098735946: GREEN.102104813344: skipped because this stacked head is not yet protected integration evidence; the skip is not promoted to GREEN.Retained exact-head artifacts:
10061043416,sha256:efd4e6f904d9c82796e7e361b28be5335dd2c15c5f6d19e949bd4559a1f24e09;10061189106,sha256:c33ae1a32bf3e2a8c28431fac05c9732c94848853b0f82c714950b02ad32ac81;10061193521,sha256:2bfd05395fccaf1a6404ac247baff1e15f50f05c19067dfcce10224fe4992de7;10060933382,sha256:6ba6073d9480c9983674b6d621ddad59e55761717f15617cac7cdbaadda0751f.The exact P1 attack regression passed in the hosted PostgreSQL behavior suite, so its review thread is resolved on evidence rather than source inspection alone. Fresh CodeRabbit review comment
5586974629then inspected exact263e4ff...and reported no current-head actionable defect in migration-0029 lease invalidation/freshness, lifecycle authority, maker-checker, retained-evidence, strict source identity, FORCE RLS and outbox boundaries. That review explicitly states that it is not an approval.Review / merge boundary
No qualifying independent
APPROVEDreview is established by the CodeRabbit comment. Parent #29 also retains its separate central CodeQL publication/approval gate. Keep #47 unmerged until applicable review protection is satisfied; only then integrate normally and derive #53's new parent exact head before non-force restack.No self-approval, bypass, force-push, destructive rebase, coverage exclusion, synthetic status, no-op queue churn, normal merge, tag or release before the applicable gates are satisfied.