fix(retry): claim due provider writeback retries with SKIP LOCKED - #1654
fix(retry): claim due provider writeback retries with SKIP LOCKED#1654seonghobae wants to merge 21 commits into
Conversation
Concurrent retry workers could select the same pending rows before either committed, processing a provider writeback twice. Claim the batch with FOR UPDATE SKIP LOCKED so each due retry item is owned by one worker, and cover the locking and batch-limit contract.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true✨ 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 |
|
Infrastructure evidence for the shared required-check failures at head 53094e9: trivy-fs job 103096736615 fails after |
|
@coderabbitai review Fresh exact-range review requested for canonical base |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="1252505dd6926b88b8bce72c9377fddfdf8dc8f1"
echo "== Exact commit presence and merge-base =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git merge-base "$base" "$head"
git rev-list --left-right --count "${base}...${head}"
echo "== Changed files in requested range =="
git diff --name-status "$base" "$head"
echo "== Full exact-range diff =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"
echo "== Changed-file outlines =="
while IFS= read -r file; do
case "$file" in
*.py)
echo "--- $file"
ast-grep outline "$file" --items all || true
;;
esac
done < <(git diff --name-only "$base" "$head")
echo "== Production symbol definitions and calls =="
rg -n -C 5 --glob '*.py' \
'\b(process_due_provider_writeback_retries|_due_retry_query)\s*\(' .
echo "== PostgreSQL fixture and retry model references =="
rg -n -C 5 --glob '*.py' \
'\b(postgresql|postgres|PostgreSQL|provider_writeback|ProviderWriteback|writeback_retry)\b' \
.Length of output: 13339 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Retry service structure and implementation =="
ast-grep outline backend/services/provider_writeback_retry_service.py --items all
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,280p'
echo "== Retry item model definition =="
rg -n -C 12 --glob '*.py' \
'class\s+ProviderWritebackRetryItem\b|ProviderWritebackRetryItem\s*=' \
backend
echo "== Scheduling and worker call sites =="
rg -n -C 6 --glob '*.py' \
'\b(schedule_provider_writeback_retry|process_due_provider_writeback_retries)\s*\(' \
backend
echo "== Test configuration and database URL configuration =="
rg -n -C 8 --glob '*.py' \
'(DATABASE_URL|create_async_engine|async_sessionmaker|pytest\.fixture|fixture)' \
backend/tests backend/core 2>/dev/null || true
echo "== Existing PostgreSQL integration-test patterns =="
rg -n -C 10 --glob '*.py' \
'(engine\.dialect\.name.*postgresql|pytest\.skip\("PostgreSQL|asyncio\.wait_for|FOR UPDATE|with_for_update)' \
backend/testsLength of output: 176294 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Production query, scheduling, and transaction lifecycle =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,270p'
echo "== Retry item model location and definition =="
model_file="$(rg -l --glob '*.py' 'class\s+ProviderWritebackRetryItem\b' backend | head -n 1)"
printf '%s\n' "$model_file"
if [ -n "$model_file" ]; then
model_line="$(rg -n 'class\s+ProviderWritebackRetryItem\b' "$model_file" | head -n 1 | cut -d: -f1)"
sed -n "$((model_line-5)),$((model_line+100))p" "$model_file"
fi
echo "== Pytest marker registration and PostgreSQL CI selection =="
rg -n -C 6 --glob 'pytest.ini' --glob 'pyproject.toml' --glob 'tox.ini' --glob 'setup.cfg' \
'markers|postgres|addopts' .
rg -n -C 8 --glob '*.yml' --glob '*.yaml' \
'(pytest|backend/tests|postgres)' .github 2>/dev/null || true
echo "== Existing retry-item database setup or cleanup =="
rg -n -C 8 --glob '*.py' \
'(ProviderWritebackRetryItem|provider_writeback_retry_items|provider_writeback_retry)' \
backend/tests backend/alembic 2>/dev/null || trueLength of output: 55870 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Workflow inventory and PostgreSQL-related definitions =="
fd -t f -e yml -e yaml . .github/workflows -x sh -c '
file="$1"
if rg -q "(postgres|PostgreSQL|DATABASE_URL|alembic|pytest)" "$file"; then
echo "--- $file"
nl -ba "$file" | sed -n "1,260p"
fi
' sh {}
echo "== Backend pytest configuration =="
nl -ba backend/pytest.ini
echo "== Retry migration table definition =="
nl -ba backend/alembic/versions/0002_provider_writeback_retry_queue.py | sed -n '1,110p'
echo "== Exact-head pull request checks and workflow runs =="
gh pr view 1654 --repo ContextualWisdomLab/naruon \
--json number,state,isDraft,baseRefOid,headRefOid,statusCheckRollup
gh run list --repo ContextualWisdomLab/naruon --commit 1252505dd6926b88b8bce72c9377fddfdf8dc8f1 \
--limit 30 --json databaseId,name,status,conclusion,event,headSha,workflowName,urlLength of output: 28114
Finding
Verified
The current exact-head checks are queued. I did not use predecessor receipts as evidence.
|
|
@coderabbitai review 현재 exact range |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="1252505dd6926b88b8bce72c9377fddfdf8dc8f1"
echo "== Exact range topology =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '
git merge-base "$base" "$head"
printf 'left-right count: '
git rev-list --left-right --count "${base}...${head}"
echo "== Exact-range changed files =="
git diff --name-status "$base" "$head"
echo "== Exact-range diff =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"
echo "== Python changed-file outlines =="
git diff --name-only "$base" "$head" | while IFS= read -r file; do
case "$file" in
*.py)
echo "--- $file"
ast-grep outline "$file" --items all || true
;;
esac
done
echo "== Production query and processor definitions =="
rg -n -C 12 --glob '*.py' \
'(^\s*(async\s+)?def\s+(_due_retry_query|process_due_provider_writeback_retries)\b|\b(_due_retry_query|process_due_provider_writeback_retries)\s*\()' \
backend
echo "== PostgreSQL acceptance-test and fixture context =="
rg -n -C 12 --glob '*.py' \
'(ProviderWritebackRetryItem|_due_retry_query|with_for_update|skip_locked|postgresql|PostgreSQL|asyncio\.wait_for)' \
backend/tests
echo "== Doctoring boundary text =="
fd -t f 'provider-writeback-retry-claim\.md' docs -x sh -c '
echo "--- $1"
nl -ba "$1"
' sh {}Length of output: 183932
Finding
Verified
|
|
@coderabbitai review 현재 exact range |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="f345af94f949374c5ee6ce3f48479736d85f4c41"
echo "== Exact topology =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '
git merge-base "$base" "$head"
printf 'range count: '
git rev-list --count "${base}..${head}"
echo "== Changed files =="
git diff --name-status "$base" "$head"
echo "== Exact diff =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"
echo "== Changed Python outlines =="
git diff --name-only "$base" "$head" | while IFS= read -r file; do
case "$file" in
*.py)
echo "--- $file"
ast-grep outline "$file" --items all || true
;;
esac
done
echo "== Production retry service =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,300p'
echo "== Changed retry tests and doctoring =="
for file in \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.md
do
if [ -f "$file" ]; then
echo "--- $file"
nl -ba "$file" | sed -n '1,360p'
fi
done
echo "== Retry model and relevant call sites =="
rg -n -C 8 --glob '*.py' \
'class\s+ProviderWritebackRetryItem\b|\b(process_due_provider_writeback_retries|_due_retry_query)\s*\(' \
backend
echo "== Exact-head PR and workflow state =="
gh pr view 1654 --repo ContextualWisdomLab/naruon \
--json number,state,isDraft,baseRefOid,headRefOid,statusCheckRollup
gh run list --repo ContextualWisdomLab/naruon --commit "$head" --limit 50 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,urlLength of output: 68422 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="ContextualWisdomLab/naruon"
head="f345af94f949374c5ee6ce3f48479736d85f4c41"
echo "== Canonical .github PR `#2073` =="
gh pr view 2073 --repo "$repo" \
--json number,state,isDraft,title,url,baseRefName,baseRefOid,headRefName,headRefOid,body,statusCheckRollup
echo "== Workflows that can execute PostgreSQL retry acceptance =="
fd -t f -e yml -e yaml . .github/workflows -x sh -c '
file="$1"
if rg -q "(postgres|PostgreSQL|DATABASE_URL|provider_writeback_retry_postgres|alembic)" "$file"; then
echo "--- $file"
nl -ba "$file" | sed -n "1,320p"
fi
' sh {}
echo "== Exact-head GitHub check suites and workflow runs =="
gh api --paginate \
"repos/${repo}/commits/${head}/check-suites" \
--jq '.check_suites[] | {app: .app.slug, status, conclusion, head_sha, url}'
gh run list --repo "$repo" --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,urlLength of output: 1383 🏁 Script executed: #!/bin/bash
set -u
head="f345af94f949374c5ee6ce3f48479736d85f4c41"
echo "== Organization .github PR `#2073` =="
gh pr view 2073 --repo ContextualWisdomLab/.github \
--json number,state,isDraft,title,url,baseRefName,baseRefOid,headRefName,headRefOid,body,statusCheckRollup \
|| true
echo "== Organization .github issue `#2073`, if it is not a pull request =="
gh issue view 2073 --repo ContextualWisdomLab/.github \
--json number,state,title,url,body \
|| true
echo "== Exact-head check suites =="
gh api "repos/ContextualWisdomLab/naruon/commits/${head}/check-suites" \
--jq '.check_suites[] | {app: .app.slug, status, conclusion, head_sha, url}' \
|| true
echo "== Exact-head workflow runs =="
gh run list --repo ContextualWisdomLab/naruon --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,url \
|| trueLength of output: 8511
Finding
Verified
I did not treat any predecessor review or check result as current-head approval evidence.
|
|
@coderabbitai review 현재 exact range |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="a8fcba66f7235ac7d8f4a7a29818246f2703e5b3"
repo="ContextualWisdomLab/naruon"
echo "== Exact range topology =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '
git merge-base "$base" "$head"
printf 'range count: '
git rev-list --count "${base}..${head}"
echo "== Exact range changed files =="
git diff --name-status "$base" "$head"
echo "== Exact range diff =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"
echo "== Changed Python outlines =="
git diff --name-only "$base" "$head" | while IFS= read -r file; do
case "$file" in
*.py)
echo "--- $file"
ast-grep outline "$file" --items all || true
;;
esac
done
echo "== Retry service =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,300p'
echo "== Changed tests and doctoring =="
for file in \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.md
do
if [ -f "$file" ]; then
echo "--- $file"
nl -ba "$file" | sed -n '1,420p'
fi
done
echo "== Retry model and production call sites =="
rg -n -C 10 --glob '*.py' \
'class\s+ProviderWritebackRetryItem\b|\b(process_due_provider_writeback_retries|_due_retry_query)\s*\(' \
backend
echo "== Exact-head PR state, check suites, and workflow runs =="
gh pr view 1654 --repo "$repo" \
--json number,state,isDraft,baseRefOid,headRefOid,statusCheckRollup
gh api "repos/${repo}/commits/${head}/check-suites" \
--jq '.check_suites[] | {app: .app.slug, status, conclusion, head_sha, url}' || true
gh run list --repo "$repo" --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,urlLength of output: 72839
Finding
Verified
No additional source-level finding was identified in the requested scope. You are interacting with an AI system. |
|
@coderabbitai review Please review the current exact stacked range |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="a8fcba66f7235ac7d8f4a7a29818246f2703e5b3"
repo="ContextualWisdomLab/naruon"
echo "== Exact topology =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '; git merge-base "$base" "$head"
printf 'base..head commits: '; git rev-list --count "${base}..${head}"
echo "== Changed files =="
git diff --name-status "$base" "$head"
echo "== Exact diff =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"
echo "== Changed Python outlines =="
git diff --name-only "$base" "$head" | while IFS= read -r file; do
case "$file" in
*.py) echo "--- $file"; ast-grep outline "$file" --items all ;;
esac
done
echo "== Production retry service =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,300p'
echo "== Affected tests and doctoring =="
for file in \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.md
do
echo "--- $file"
nl -ba "$file" | sed -n '1,430p'
done
echo "== Retry model and all production processing call sites =="
rg -n -C 10 --glob '*.py' \
'class\s+ProviderWritebackRetryItem\b|\b(process_due_provider_writeback_retries|_due_retry_query)\s*\(' \
backend
echo "== Exact-head PR checks and Actions executions =="
gh pr view 1654 --repo "$repo" \
--json state,isDraft,baseRefOid,headRefOid,statusCheckRollup
gh api "repos/${repo}/commits/${head}/check-suites" \
--jq '.check_suites[] | {app: .app.slug,status,conclusion,head_sha,url}' || true
gh run list --repo "$repo" --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,urlLength of output: 72758
Finding
Verified
No additional source-level finding was identified in the requested scope. You are interacting with an AI system. |
|
@coderabbitai review Fresh current-head review request after a real source/test repair. Please bind review to exact stacked range New focus since the prior request: predecessor |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="3ec872cd38cfcace4d885422af4668ed690ee374"
repo="ContextualWisdomLab/naruon"
echo "== Exact topology =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '; git merge-base "$base" "$head"
printf 'left-right: '; git rev-list --left-right --count "${base}...${head}"
echo
echo "== Effective changed files =="
git diff --name-status "$base" "$head"
echo
echo "== Exact diff =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"
echo
echo "== Changed Python structure =="
git diff --name-only "$base" "$head" | while IFS= read -r file; do
case "$file" in
*.py)
echo "--- $file"
ast-grep outline "$file" --items all
;;
esac
done
echo
echo "== Production retry service =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,340p'
echo
echo "== Affected tests and doctoring =="
for file in \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.md
do
echo "--- $file"
nl -ba "$file" | sed -n '1,500p'
done
echo
echo "== Retry model, transaction management, and worker call sites =="
rg -n -C 10 --glob '*.py' \
'class\s+ProviderWritebackRetryItem\b|\b(process_due_provider_writeback_retries|_due_retry_query|schedule_provider_writeback_retry|dispatch_command|commit|rollback)\s*\(' \
backend
echo
echo "== Exact-head state and workflow evidence =="
gh pr view 1654 --repo "$repo" \
--json state,isDraft,baseRefOid,headRefOid,statusCheckRollup
gh run list --repo "$repo" --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,urlLength of output: 184005 🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="3ec872cd38cfcace4d885422af4668ed690ee374"
echo "== Effective files and compact patch statistics =="
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo
echo "== Retry worker complete processing path =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '185,330p'
echo
echo "== Fake session and per-item transaction regression =="
nl -ba backend/tests/test_provider_writeback_retry_service.py | sed -n '1,80p'
nl -ba backend/tests/test_provider_writeback_retry_service.py | sed -n '220,285p'
echo
echo "== PostgreSQL worker-contention acceptance, cleanup, and cancellation =="
nl -ba backend/tests/test_provider_writeback_retry_postgres.py | sed -n '1,245p'
echo
echo "== Doctoring contract and correction history =="
nl -ba docs/doctoring/provider-writeback-retry-claim.md | sed -n '1,380p'
echo
echo "== Exact patch for the four requested files =="
git diff --no-ext-diff "$base" "$head" -- \
backend/services/provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.mdLength of output: 59301 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Complete transient-reschedule regression =="
nl -ba backend/tests/test_provider_writeback_retry_service.py | sed -n '280,350p'
echo
echo "== Fake-session retryable-failure call sites and surrounding configuration =="
rg -n -C 12 --glob 'test_provider_writeback_retry_service.py' \
'FakeRetrySession\(|runner_response_timeout|retry_delay_seconds=0|batch_limit=' \
backend/tests/test_provider_writeback_retry_service.py
echo
echo "== Current worker configuration validation =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '45,120p'
rg -n -C 6 --glob '*.py' \
'ProviderWritebackRetryWorker\(' backendLength of output: 14276
Finding
Verified
You are interacting with an AI system. |
|
@coderabbitai review Fresh review requested for exact stacked range On Please verify the harness now matches the production due predicate without masking the per-item |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="cf1e6220bcc5ad7f2927d7f0fb86b155dd91a0b3"
repo="ContextualWisdomLab/naruon"
echo "== Exact range topology =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '; git merge-base "$base" "$head"
printf 'left-right: '; git rev-list --left-right --count "${base}...${head}"
echo "== Effective changed files and stat =="
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo "== Exact patch for requested scope =="
git diff --no-ext-diff "$base" "$head" -- \
backend/services/provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.md
echo "== Changed Python structure =="
git diff --name-only "$base" "$head" | while IFS= read -r file; do
case "$file" in
*.py)
echo "--- $file"
ast-grep outline "$file" --items all
;;
esac
done
echo "== Production retry query and per-item processing path =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,360p'
echo "== Fake session and unit regressions =="
nl -ba backend/tests/test_provider_writeback_retry_service.py | sed -n '1,420p'
echo "== Real PostgreSQL concurrency acceptance and cleanup =="
nl -ba backend/tests/test_provider_writeback_retry_postgres.py | sed -n '1,360p'
echo "== Doctoring contract boundary =="
nl -ba docs/doctoring/provider-writeback-retry-claim.md | sed -n '1,440p'
echo "== Relevant production call sites and model fields =="
rg -n -C 8 --glob '*.py' \
'class\s+ProviderWritebackRetryItem\b|\b(process_due_provider_writeback_retries|_due_retry_query|schedule_provider_writeback_retry|dispatch_command|commit|rollback)\s*\(' \
backend
echo "== Exact-head PR and workflow evidence =="
gh pr view 1654 --repo "$repo" \
--json number,state,isDraft,baseRefOid,headRefOid,statusCheckRollup
gh run list --repo "$repo" --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,urlLength of output: 239864
Finding
Verified
No additional source-level finding was identified in the requested scope. You are interacting with an AI system. |
|
@coderabbitai review Fresh independent review requested for exact stacked range New source-order RED Current exact head still has zero PR-triggered workflow runs on the feature base, so no predecessor receipt should be treated as current hosted evidence. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="ffc5df0a40f888cdbfb6003419ffa1efffe80e88"
repo="ContextualWisdomLab/naruon"
echo "== Exact range topology and files =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '; git merge-base "$base" "$head"
printf 'left-right: '; git rev-list --left-right --count "${base}...${head}"
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo "== Exact patch for review scope =="
git diff --no-ext-diff "$base" "$head" -- \
backend/services/provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.md
echo "== Retry service outline and implementation =="
ast-grep outline backend/services/provider_writeback_retry_service.py --items all
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,380p'
echo "== Affected tests and doctoring =="
for file in \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.md
do
echo "--- $file"
nl -ba "$file" | sed -n '1,500p'
done
echo "== Public call sites and scheduling/persistence paths =="
rg -n -C 10 --glob '*.py' \
'\b(schedule_provider_writeback_retry|process_due_provider_writeback_retries|ProviderWritebackRetryWorker|_due_retry_query)\s*\(' \
backend
echo "== Exact-head PR and workflow evidence =="
gh pr view 1654 --repo "$repo" \
--json number,state,isDraft,baseRefOid,headRefOid,statusCheckRollup
gh run list --repo "$repo" --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,urlLength of output: 139486 🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="ffc5df0a40f888cdbfb6003419ffa1efffe80e88"
echo "== Configuration RED, fix, and doctoring commits =="
for commit in \
efd526ad707e7098b4f453a92e414c585e1b0905 \
18c825dbb17905d0f7e2ed54fdbf36f03f1b76a1 \
ffc5df0a40f888cdbfb6003419ffa1efffe80e88
do
echo "--- $commit"
git show --format=fuller --no-ext-diff --stat "$commit"
git show --format= --no-ext-diff "$commit" -- \
backend/services/provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_service.py \
docs/doctoring/provider-writeback-retry-claim.md
done
echo "== Zero-delay coverage in the exact range =="
git grep -n -E 'retry_delay_seconds[[:space:]]*=[[:space:]]*0|retry_delay_seconds.*0' "$base..$head" -- \
'backend/**/*.py' || true
echo "== Pytest selection and PostgreSQL workflow coverage =="
fd -t f -a 'pytest.ini' -a 'pyproject.toml' -a 'tox.ini' -a 'setup.cfg' . -x sh -c \
'echo "--- $1"; rg -n -C 5 "(markers|addopts|postgres|testpaths)" "$1" || true' sh {}
fd -t f -e yml -e yaml .github/workflows -x sh -c \
'echo "--- $1"; rg -n -C 6 "(postgres|DATABASE_URL|alembic|provider_writeback_retry_postgres|pytest)" "$1" || true' sh {}
echo "== Direct scheduling call shapes =="
ast-grep run --lang python \
--pattern 'await schedule_provider_writeback_retry($$$)' backendLength of output: 20347
Finding
Verified
No additional source-level finding was identified in the requested scope. You are interacting with an AI system. |
|
@coderabbitai review Please review the exact current range |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="23b2cae3073df5edba9323abe01c7fd00cb03c0f"
repo="ContextualWisdomLab/naruon"
echo "== Exact topology and effective change set =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '; git merge-base "$base" "$head"
printf 'left-right: '; git rev-list --left-right --count "${base}...${head}"
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo "== Exact diff =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"
echo "== Changed Python structure =="
git diff --name-only "$base" "$head" | while IFS= read -r file; do
case "$file" in
*.py) echo "--- $file"; ast-grep outline "$file" --items all ;;
esac
done
echo "== Retry service and worker =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,420p'
echo "== Unit tests, PostgreSQL tests, and doctoring =="
for file in \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
docs/doctoring/provider-writeback-retry-claim.md \
docs/doctoring/provider-writeback-retry-policy-cadence.md
do
if [ -f "$file" ]; then
echo "--- $file"
nl -ba "$file" | sed -n '1,560p'
fi
done
echo "== Public call sites and retry attempt/state updates =="
rg -n -C 10 --glob '*.py' \
'\b(schedule_provider_writeback_retry|process_due_provider_writeback_retries|ProviderWritebackRetryWorker|_due_retry_query|dispatch_command)\s*\(|\b(attempt_count|next_retry_at|retry_delay_seconds|interval_seconds|max_attempts)\b' \
backend
echo "== Exact-head PR status and workflow evidence =="
gh pr view 1654 --repo "$repo" \
--json number,state,isDraft,baseRefOid,headRefOid,reviews,statusCheckRollup
gh run list --repo "$repo" --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,url
gh api "repos/${repo}/commits/${head}/check-suites" \
--jq '.check_suites[] | {app: .app.slug,status,conclusion,head_sha,url}' || trueLength of output: 245757
Finding
Verified
No additional source-level finding was identified in the requested scope. You are interacting with an AI system. |
|
@coderabbitai review Fresh exact-head review request for |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="23b2cae3073df5edba9323abe01c7fd00cb03c0f"
repo="ContextualWisdomLab/naruon"
echo "== Exact range topology and effective files =="
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf 'merge-base: '; git merge-base "$base" "$head"
printf 'left-right commits: '; git rev-list --left-right --count "${base}...${head}"
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo "== Exact patch =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"
echo "== Changed Python outlines =="
git diff --name-only "$base" "$head" | while IFS= read -r file; do
case "$file" in
*.py) echo "--- $file"; ast-grep outline "$file" --items all ;;
esac
done
echo "== Production retry service =="
nl -ba backend/services/provider_writeback_retry_service.py | sed -n '1,430p'
echo "== Focused unit, PostgreSQL, and worker-policy tests =="
for file in \
backend/tests/test_provider_writeback_retry_service.py \
backend/tests/test_provider_writeback_retry_postgres.py \
backend/tests/test_provider_writeback_retry_worker_policy.py
do
echo "--- $file"
nl -ba "$file" | sed -n '1,560p'
done
echo "== Doctoring boundaries =="
for file in \
docs/doctoring/provider-writeback-retry-claim.md \
docs/doctoring/provider-writeback-retry-policy-cadence.md
do
echo "--- $file"
nl -ba "$file" | sed -n '1,520p'
done
echo "== Definitions and production call sites =="
rg -n -C 10 --glob '*.py' \
'\b(schedule_provider_writeback_retry|process_due_provider_writeback_retries|ProviderWritebackRetryWorker|_due_retry_query|dispatch_command)\s*\(|\b(attempt_count|next_retry_at|retry_delay_seconds|interval_seconds|max_attempts|batch_limit)\b' \
backend
echo "== Exact-head hosted evidence only =="
gh pr view 1654 --repo "$repo" \
--json number,state,isDraft,baseRefOid,headRefOid,reviews,statusCheckRollup
gh run list --repo "$repo" --commit "$head" --limit 100 \
--json databaseId,name,status,conclusion,event,headSha,workflowName,url
gh api "repos/${repo}/commits/${head}/check-suites" \
--jq '.check_suites[] | {app: .app.slug,status,conclusion,head_sha,url}' || trueLength of output: 191596
Finding
Verified
No additional source-level finding was identified in the requested scope. You are interacting with an AI system. |
Current authority — 2026-09-11
develop@042b0c70531b229af3acbd0421a2f23098d848b3#1623@17a7618eda2b212b691f08fa936e042b34258fc975ffe70d...→7b8071fa.../c9fc20b...→5ddb10cf...050e5f00430c31fbae5b6fe031105e7af2c01e8f→cf1e6220bcc5ad7f2927d7f0fb86b155dd91a0b3efd526ad707e7098b4f453a92e414c585e1b0905→18c825dbb17905d0f7e2ed54fdbf36f03f1b76a1df673f778a6963c4a5cb7d129d850ec7d7d868d3088652d57d4dcd9a17bcd9008b8c72fcb915290223b2cae3073df5edba9323abe01c7fd00cb03c0fCurrent finding and causal repair
Fresh review found that
ProviderWritebackRetryWorkerrepresented two different time policies with one field.interval_secondscontrols how often the worker polls for due work, but_sync()also passed that value asretry_delay_secondstoprocess_due_provider_writeback_retries().That coupling made an operational scheduling choice silently rewrite the retry domain policy. With the existing defaults, an initial transient failure is scheduled with the service's 300-second delay, but a later failure processed by the long-running worker used its 60-second polling interval as the backoff base. Tuning worker polling latency therefore also changed provider retry pressure without an explicit retry-policy decision.
Source-order RED
df673f7...adds a focused worker-policy test. It constructs a worker withinterval_seconds=7andretry_delay_seconds=300, executes the real_sync()boundary with controlled session/process doubles, and requires the process function to receive those values independently. The predecessor constructor cannot express that contract. The same RED requires negative worker retry delay to fail closed while preserving explicitretry_delay_seconds=0semantics.Production fix
088652d...adds a distinctretry_delay_secondsworker parameter with the existing service default of 300 seconds, validates only its semantic lower bound, stores it separately, and passes it through_sync().interval_secondsremains solely the polling cadence consumed by_run_loop(). No arbitrary maximum delay, attempt, batch, token, or timeout value is introduced.docs/doctoring/provider-writeback-retry-policy-cadence.mdrecords the problem, RED/fix lineage, rejected alternatives, acceptance boundary, and Python 3.14.7asyncio.sleep()authority. The earlier concurrency doctoring remains unchanged and still owns the PostgreSQL claim/lock contract.Retained concurrency contract
The worker claims one due row at a time with
FOR UPDATE SKIP LOCKED, performs provider I/O while holding only that row's lock, persists the resulting terminal/rescheduled state, commits, and only then claims another row.batch_limitbounds per-item claim cycles in one pass. Real PostgreSQL acceptance verifies both duplicate-claim prevention and that a blocked first dispatch does not lock later independent due rows.The corrected fake-session regression preserves production's
next_retry_at <= current_timepredicate, so a rescheduled future row cannot be spuriously reselected in the same pass. Configuration boundaries still requireinterval_seconds > 0,batch_limit > 0,max_attempts > 0, andretry_delay_seconds >= 0.This PR still does not claim exactly-once remote side effects. A process failure after the provider accepts the write but before the local transaction commits remains a provider-idempotency / conditional-write or durable-lease recovery boundary.
Evidence boundary
Fresh lookup for exact
23b2cae...returns zero PR-triggered workflow runs on the stacked feature base. Therefore the new cadence/backoff regression and production fix, the prior retry unit regressions, and the real PostgreSQL two-session contracts have no current hosted product receipt. Predecessor receipts are historical only.This remains a
.github#2073stacked-verification blocker. Do not manufacture evidence through temporarydevelopretargeting, dummy/no-op commits, copied workflows, synthetic statuses, or stale receipt transfer.No formal post-last-push
APPROVEDreview currently binds to23b2cae.... Request fresh independent review against exact17a7618... → 23b2cae...and keep Draft until executable evidence, zero valid current-head findings/threads, qualifying approval, and #1623 prerequisite integration are all present.Standards traceability
docs/doctoring/provider-writeback-retry-claim.md— PostgreSQL claim/locking, per-item transaction scope, fake-session due-time fidelity, retry configuration validity, crash/idempotency limits.docs/doctoring/provider-writeback-retry-policy-cadence.md— polling cadence and retry-backoff separation.Primary authority remains PostgreSQL 18 Explicit Locking / SELECT locking-clause documentation plus Python Software Foundation (2026), Coroutines and tasks — Python 3.14.7 documentation: Sleeping.
Merge boundary
Keep Draft. Merge is prohibited until the exact current base/head has trustworthy executable product/PostgreSQL evidence, current-head independent approval, zero unresolved valid findings, and the canonical dependency-security prerequisite is integrated or otherwise satisfied through the canonical stacked-verification path. No self-approval, force-push, destructive rebase, dummy requeue, copied central workflow, provider/model workaround, stale evidence transfer, or gate weakening.