Skip to content

test(worker): await terminal retry completion before asserting - #454

Open
seonghobae wants to merge 4 commits into
mainfrom
test/worker-retry-completion-race-20260815
Open

test(worker): await terminal retry completion before asserting#454
seonghobae wants to merge 4 commits into
mainfrom
test/worker-retry-completion-race-20260815

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Objective

Remove a deterministic asynchronous test race that can fail otherwise-correct worker and delivery-receipt PRs. The retry test previously unblocked as soon as the conversion task incremented its attempt counter, but DefaultConversionWorker publishes SUCCEEDED only after that converter call returns and the state store completes its terminal transition.

Exact test-first repair

  • protected base: eb0a32e87e7470469c8fa0f8c67d9583654bef57;
  • exact candidate head: 23ba9a34e24d62de7974a6e1707dc53f6f69b4ac;
  • changed path: DefaultConversionWorkerTest.java only;
  • one-shot verification workflow run 31879285024: terminal-success;
  • the workflow executed full mvn -B --no-transfer-progress verify, authoritative test-report verification, and git diff --check, then removed itself before publishing this candidate.

Contract

workerReschedulesWhenRetryAtIsInTheFuture now waits until both the converter has executed once and the observed job state is SUCCEEDED. Assertions still require exactly one converter call, one attempt, terminal success, cleared retry time, and the expected converted resource path. Production behavior is unchanged.

Scope boundary

Test synchronization only. This does not weaken timeouts, add sleeps, retry assertions after failure, modify worker/state-store code, change scheduling, or alter delivery-receipt semantics.

Dependency outcome

PR #373 failed only because this shared test observed PROCESSING between converter execution and terminal publication. After this repair reaches protected main, #373 must update to the new exact base and regenerate all checks/reviews; predecessor evidence does not transfer.

Merge gate

Keep this exact head unchanged. Require current-head CI, Security Scan, SAST Semgrep, fuzz where emitted, zero valid unresolved findings, and qualifying independent non-author approval before protected merge.

Summary by CodeRabbit

  • 테스트
    • 비동기 재시도 테스트가 재시도 횟수뿐 아니라 작업 상태가 성공으로 완료되었는지도 확인하도록 개선되었습니다.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2011f24b-9960-46ff-bd11-3eb7e7fc0ff8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 850fc5d5-96f9-479b-b252-0141d70dd0bf

📥 Commits

Reviewing files that changed from the base of the PR and between eb0a32e and 23ba9a3.

📒 Files selected for processing (1)
  • src/test/java/com/clearfolio/viewer/service/DefaultConversionWorkerTest.java

📝 Walkthrough

Walkthrough

비동기 재시도 테스트가 재시도 횟수와 변환 작업의 SUCCEEDED 상태를 함께 확인하도록 변경되었습니다.

Changes

변환 재시도 검증

Layer / File(s) Summary
재시도 성공 조건 검증
src/test/java/com/clearfolio/viewer/service/DefaultConversionWorkerTest.java
재시도 대기 조건에 변환 작업의 SUCCEEDED 상태 확인을 추가했습니다.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 23ba9

This localized test-only change removes an asynchronous assertion race without changing production behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 재시도 완료를 기다린 후 어설션하는 테스트 변경을 정확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/worker-retry-completion-race-20260815

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae enabled auto-merge (squash) August 15, 2026 10:50

Copy link
Copy Markdown
Collaborator Author

@opencode-agent review
@coderabbitai review
@cwl-noema-review review
@strix review

Review exact head 23ba9a34e24d62de7974a6e1707dc53f6f69b4ac only. Exact-head CI, Security Scan, SAST Semgrep, and fuzz are terminal-success; unresolved inline findings are zero. Validate that the asynchronous retry test waits for both converter execution and terminal SUCCEEDED publication without sleeps, production changes, or weakened assertions.

Review read-only; preserve independent reviewer identity. Do not mutate the branch, synthesize author approval, weaken protection, or merge.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

expected_head='23ba9a34e24d62de7974a6e1707dc53f6f69b4ac'
base='eb0a32e87e7470469c8fa0f8c67d9583654bef57'
repo='ContextualWisdomLab/clearfolio'
pr='454'

echo '== Checked-out commit =='
git rev-parse HEAD
git status --short
echo '== Commit identity =='
git show -s --format='%H%n%P%n%s' "$expected_head"

echo '== Changed paths and diff check =='
git diff --name-status "$base" "$expected_head"
git diff --check "$base" "$expected_head"
echo '== Exact diff =='
git diff --no-ext-diff --unified=80 "$base" "$expected_head" -- src/test/java/com/clearfolio/viewer/service/DefaultConversionWorkerTest.java

echo '== Test file outline =='
ast-grep outline src/test/java/com/clearfolio/viewer/service/DefaultConversionWorkerTest.java --items all --view expanded
echo '== Retry test and synchronization usages =='
rg -n -C 12 -e 'workerReschedulesWhenRetryAtIsInTheFuture' -e '\bawait\b' -e 'Thread\.sleep|TimeUnit\..*sleep' src/test/java/com/clearfolio/viewer/service/DefaultConversionWorkerTest.java

echo '== Pull request metadata =='
gh pr view "$pr" --repo "$repo" --json number,headRefOid,baseRefOid,changedFiles,mergeStateStatus,reviewDecision,statusCheckRollup,reviews
echo '== Review threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='clearfolio' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          path
          line
          comments(first: 20) {
            nodes { author { login } body url }
          }
        }
      }
    }
  }
}'

Length of output: 29071


@seonghobae Review complete for exact head 23ba9a34e24d62de7974a6e1707dc53f6f69b4ac.

Finding: workerReschedulesWhenRetryAtIsInTheFuture does not assert that job.getRetryAt() is cleared after success. The test retains assertions for one converter call, one attempt, SUCCEEDED, and the converted path, but it does not verify the cleared retry time specified for this scenario.

Add:

assertNull(job.getRetryAt());

The new await condition correctly waits for both converter execution and SUCCEEDED publication. The target test has no direct sleep. Only the shared polling helper uses Thread.sleep(25).

The exact-head diff changes one test file only. git diff --check is clean. CI, Security Scan, SAST Semgrep, and the listed fuzz checks are successful. No unresolved review threads exist. Strix Security Scan is still in progress, and coverage-source-tree is queued.

You are interacting with an AI system.

Copy link
Copy Markdown
Collaborator Author

Exact-current-head independent review request for 23ba9a34e24d62de7974a6e1707dc53f6f69b4ac over protected main eb0a32e87e7470469c8fa0f8c67d9583654bef57.

CI, Security Scan, SAST Semgrep, and fuzz are terminal-success; unresolved inline review threads are zero. The change is test synchronization only and leaves production behavior unchanged.

@opencode-agent review
@coderabbitai review
@cwl-noema-review review
@strix review

Review this exact head read-only. Do not mutate the branch, synthesize author approval, weaken protection, or merge.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='23ba9a34e24d62de7974a6e1707dc53f6f69b4ac'
base='eb0a32e87e7470469c8fa0f8c67d9583654bef57'
repo='ContextualWisdomLab/clearfolio'
pr='454'
file='src/test/java/com/clearfolio/viewer/service/DefaultConversionWorkerTest.java'

echo '== Exact commit =='
git rev-parse HEAD
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"
git merge-base --is-ancestor "$base" "$head" && echo 'base-is-ancestor=yes'

echo '== Changed paths and whitespace =='
git diff --name-status "$base" "$head"
git diff --check "$base" "$head"

echo '== Target file diff =='
git diff --no-ext-diff --unified=100 "$base" "$head" -- "$file"

echo '== Target file structure =='
ast-grep outline "$file" --items all --view expanded

echo '== Retry test, await predicates, assertions, and sleep references =='
rg -n -C 15 \
  -e 'workerReschedulesWhenRetryAtIsInTheFuture' \
  -e '\bawait\b' \
  -e 'assert(Equals|Null|That)' \
  -e 'Thread\.sleep|TimeUnit\..*sleep' \
  "$file"

echo '== PR metadata and check status =='
gh pr view "$pr" --repo "$repo" \
  --json number,headRefOid,baseRefOid,changedFiles,mergeStateStatus,reviewDecision,statusCheckRollup \
  --jq '{number,headRefOid,baseRefOid,changedFiles,mergeStateStatus,reviewDecision,statusCheckRollup:[.statusCheckRollup[]|{name,conclusion,status}]}'

echo '== Review thread counts =='
gh api graphql -F owner='ContextualWisdomLab' -F name='clearfolio' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved isOutdated path line }
      }
    }
  }
}' --jq '
  [.data.repository.pullRequest.reviewThreads.nodes[]] as $t |
  {
    total: ($t|length),
    unresolved: ([$t[]|select(.isResolved|not)]|length),
    unresolvedCurrent: ([$t[]|select((.isResolved|not) and (.isOutdated|not))]|length),
    unresolvedCurrentThreads: [$t[]|select((.isResolved|not) and (.isOutdated|not))|{path,line}]
  }'

Length of output: 52176


@seonghobae Review complete for exact head 23ba9a34e24d62de7974a6e1707dc53f6f69b4ac.

Finding — src/test/java/com/clearfolio/viewer/service/DefaultConversionWorkerTest.java, Line 403: workerReschedulesWhenRetryAtIsInTheFuture does not assert that success clears retryAt.

Add this assertion after the success-state assertion:

assertNull(job.getRetryAt());

The new await predicate correctly waits for both converter execution and terminal SUCCEEDED publication. The target test has no direct sleep. The shared polling helper uses Thread.sleep(25).

The diff changes one test file only. git diff --check is clean. The listed required checks are successful. No unresolved review threads exist. opencode-review is still queued.

⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Collaborator Author

Exact-current-head independent review request for 23ba9a34e24d62de7974a6e1707dc53f6f69b4ac over protected main eb0a32e87e7470469c8fa0f8c67d9583654bef57.

Freshly rechecked: CI, Security Scan, SAST Semgrep, and fuzz are terminal-success; mergeable is true; unresolved inline review threads are zero. This is a one-file test-synchronization repair with no production-code change. Review this exact head only; predecessor evidence does not transfer.

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@seonghobae have exceeded the limit for the number of chat messages per hour. Please wait 26 minutes and 15 seconds before sending another message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant