Repository navigation
feat(jirapoll)!: remove the per-issue lock and check write access first - #9853
Conversation
A lastCheck entity property that is not a timestamp made loadLastCheck return an error, so processIssue failed the issue on every pick and never saved a valid value. The activity filter keeps such an issue active, so when it was the only active candidate every quiet cycle ended in "all 1 selected issues failed to process". Treat a value that is not a JSON string holding an RFC 3339 timestamp as unset, as a future value already is. The issue gets one first-poll look bounded by the backfill window, which saves a valid lastCheck. Processing logs a WARNING naming the issue without the stored value, and the filter's per-cycle line names such candidates. A failed read is still an error. Amend ADR 0160 Decision item 1, which said the per-issue error path reports such a value, and update the Jira guide's security note. Fixes fullsend-ai#9766 Signed-off-by: guy oron <goron@redhat.com>
Implements ADR 0085 Decision item 1. The managed GitHub workflow and the managed GitLab schedule run one poll cycle at a time per repository, so the lock never coordinated anything there. - The driver neither reads nor writes the lock property and ignores locks left by earlier versions. filterLocked becomes filterActive, the activity filter alone. attemptLock, releaseLock, readLock, isLockStale, LockValue, Options.StaleThreshold and the jitter sleep go. - Before reading an issue's comments and history, processIssue writes a writeCheck entity property to confirm the credential can write, as the lock write did. An issue that fails yields no records and the driver warns and goes on; a cycle in which every selected issue fails ends in the existing all-failed error. Idle candidates still cost no write. - The "poll complete" line drops its unlocked count. - The Jira guide, architecture overview and custom poller example describe the one-cycle-per-repository rule; the example gains a concurrency group. BREAKING CHANGE: the jira-poll driver no longer locks issues. A scheduler other than the managed GitHub workflow or GitLab schedule must keep two poll cycles for one repository from overlapping, for example with a GitHub Actions concurrency group; overlapping cycles dispatch the same requests twice. Lock properties left by earlier versions are ignored and can be deleted. Signed-off-by: guy oron <goron@redhat.com>
PR Summary by Qodofeat(jirapoll)!: remove per-issue lock and check write access first
AI Description
Merge Risk
|
Code Review by Qodo
1. Accepted ADR 0160 edit lacks an explicit notice
|
Site previewPreview: https://399496d6-site.fullsend-ai.workers.dev Commit: |
jflowers
left a comment
There was a problem hiding this comment.
Verdict: Approve with advisories. My current read: this implements ADR 0085 Decision item 1 cleanly. The breaking change is marked with ! and a BREAKING CHANGE trailer, the guide documents the property contract, and the PR body names the writeCheck trade-off. The council consolidated 14 findings, 5 medium and 9 low; none read as blocking to me. Details inline; the medium items are mostly test-depth and example-doc scoping questions.
Verification (this PR is stacked on feat/jirapoll-skip-idle, so lint.yml's pull_request jobs do not run until the retarget to main):
go test -race -count=1 ./internal/jirapoll/ ./pkg/behaviourtest/drivers/jiramock/: passgo test -race -count=1 -run 'Jira|jira' ./internal/cli/ ./pkg/behaviourtest/... ./internal/poll/ ./internal/config/ ./internal/scaffold/: passSKIP=check-gateway-doc-configs,semgrep make lint-all: pass- CI on head: behaviour-github-emulator (shards a through p plus playback), dispatch/Route, dispatch/Harness dispatch, build, DCO: all pass; dispatch-gated jobs skipped pending merge order
Medium advisories (inline with details):
- Example concurrency group keys on the workflow name, not the target repository (
docs/guides/user/custom-poller-example.md:38); with the lock gone, two workflow files polling one repository can run concurrently and dispatch duplicates. This matches the qodo-code-review observation on the same line. TestRunWriteAccessCheck"one issue denied" never asserts the denied issue's lastCheck stays unset (internal/jirapoll/poller_test.go:1529); the retry-not-drop contract is unpinned.TestRunIgnoresLegacyLockasserts writeCheck presence only (internal/jirapoll/poller_test.go:1487); the RFC3339 value and write count go unchecked.- The Run contract moves the no-overlap invariant to the caller (
internal/jirapoll/poller.go:93), and no test pins the scaffolded caller's concurrency block.
Low advisories (inline with details): writeCheck properties accumulate with no reaper (internal/jirapoll/lock.go:78); the guide does not state the leftover is intentional (docs/guides/user/jira-integration.md:1440); stale lock terminology in test names and the mock counter comment (internal/jirapoll/poller_idle_test.go, poller_test.go:67); internal/jirapoll patch coverage is unmeasured until the retarget, local race runs pass.
Non-inline note: the curator flagged a blog opportunity, the ADR 0085 before-and-after dispatch-rate story, once the remaining epic items land (AISDLC-877 through 882).
Provenance: review council, 7 agents (adversary, architect, curator, fullsend, gaze-testing, guard, testing), all runs successful, 14 findings consolidated, correlation 6f27d589-22da-4341-8532-7f41a4e36e99. Parent issue #9751, criterion 2 of 4.
This review was generated by /uf.review-pr (AI-assisted).
Review follow-up for the unparseable lastCheck fix. - TestRunGarbageLastCheckTreatedAsUnset runs a full cycle for each way a stored value can fail: a string that is not a time, JSON that is not a string, and bytes that are not JSON. The first only reaches the time.Parse branch; the other two reach the json.Unmarshal branch. - It asserts the saved lastCheck equals the issue's updated value instead of only being set. - TestRunAllSelectedIssuesFailedFailsCycle restores coverage of Run's all-failed guard, which the replaced test was the only one to reach. Signed-off-by: guy oron <goron@redhat.com>
Review follow-up for the lock removal. - A denied issue keeps its lastCheck unset, so its request is retried; the served issue's lastCheck is committed. - The write-check property holds an RFC 3339 time, and a served issue costs two property writes: the check and the lastCheck. - TestRenderJiraPollCaller asserts the managed poll job's concurrency group and cancel-in-progress: false. With no per-issue lock, that group is what keeps two cycles from overlapping. - The two filter tests are renamed from FilterLocked to FilterActive, and the mock's counter comment no longer refers to a lock. Signed-off-by: guy oron <goron@redhat.com>
…heck Review follow-up for the lock removal. - Restore docs/architecture.md. main already describes the lock removal there (ADR 0085), and the edit here conflicted with it. - The Jira guide says the write-check property stays on the issue and why it is not deleted, and that the poll job's concurrency group covers one workflow file, so a repository must not be polled from a second workflow. The custom poller example says the same. - Three code comments no longer mention a Jira lock. Signed-off-by: guy oron <goron@redhat.com>
|
@jflowers follow-up for your comments is in 71112a5 (tests) and 5d27b04 (docs):
Not changed: the concurrency group key. The example and the guide now say the group covers one workflow file, so a repository must not be polled from a second workflow. The managed template uses the same key, so I left the key itself for a separate decision. One change you did not ask for: I dropped my |
jflowers
left a comment
There was a problem hiding this comment.
Re-review since e0d3663 (prior review: #9853 (review)). Light check: 9 files, 60 lines.
All 8 advisory inline findings from the prior round read as resolved at 5d27b04:
docs/guides/user/custom-poller-example.md(line 36) andjira-integration.md(line 993): the concurrency group's single-workflow-file scope is now stated in both places, with the warning not to poll the same repository from a second workflow file.internal/jirapoll/poller_test.goTestRunWriteAccessCheck (lines 1551 to 1556): the denied issue's lastCheck pins to zero, so its request retries; the served issue's lastCheck pins as committed.internal/jirapoll/poller_test.goTestRunIgnoresLegacyLock (lines 1485 to 1494): the write-check property unmarshals and parses as RFC 3339, and propertySetCalls pins at exactly two writes, one write check plus one lastCheck.internal/scaffold/jira_poll_test.goTestRenderJiraPollCaller (lines 48 to 53): the managed caller's concurrency group and cancel-in-progress:false are pinned.internal/jirapoll/poller_idle_test.go: the filter tests are renamed to FilterActive, and the mock counter comment matches the new behavior.docs/guides/user/jira-integration.md(line 1440): the guide now states the writeCheck property stays on the issue, overwritten each look, and why a delete was declined.
One advisory outside this diff, worth a look before the stack lands:
TestApplyCIServerTLSCA_TrustsPrivateCAAndRejectsUntrusted in internal/forge/gitlab/ca_test.go fails deterministically on this head and on the base 0ee5575d (4 of 4 runs; "x509: certificate signed by unknown authority"), and passes on current main (1249bf4ea). This PR's diff contains no forge/gitlab files, so the failure arrives with the stacked branch; would #9758, or something beneath it, be the place to check whether the private-CA append still preserves pre-existing pool CAs?
Local verification: go test ./internal/jirapoll/ ./internal/cli/ and SKIP=check-gateway-doc-configs,semgrep pre-commit run --all-files pass on this head. Full go test ./... fails only in packages this PR does not touch: two scaffold kill-switch tests fail identically on main (host python3 here lacks PyYAML; CI installs it), plus the TLS test above. make check reports ruff errors only in the experiments submodule, which this PR does not modify.
This review was generated by /uf.review-pr (AI-assisted).
…remove-lock Signed-off-by: guy oron <goron@redhat.com> # Conflicts: # docs/guides/user/jira-integration.md
…seable-lastcheck Signed-off-by: guy oron <goron@redhat.com>
Signed-off-by: guy oron <goron@redhat.com> # Conflicts: # internal/jirapoll/poller.go # internal/jirapoll/poller_test.go
…in merge The project-set refactor on main describes a processed issue as read under the lock and its lock as kept single. The lock is gone on this branch, so the test comment names the write-check property and the uniqueIssues comment no longer lists a lock. Signed-off-by: guy oron <goron@redhat.com>
dhshah13
left a comment
There was a problem hiding this comment.
Validated on a local merge of main (a5d0fb6), #9852 and 9c87e7e: build, vet, go test -race for jirapoll and jiramock plus the Jira and poll tests in cli, behaviourtest, poll, config and scaffold, and golangci-lint on the new lines all pass. Dropping the write check, moving it after the reads, skipping a denied issue silently, honouring a live legacy lock, or removing the caller's concurrency group each fails a test. Independent review found no MEDIUM+ in the code.
Meets ADR 0085 item 1. Both managed schedulers serialize the poll (the caller's concurrency group and GitLab's fullsend-poll-$FULLSEND_POLL_MODE resource group), and checkpoints commit inside the poll job, so they cover what the lock did. Jira Cloud leaves updated alone on property writes (checked live for #9758), so the write check doesn't make an issue active again.
Non-blocking:
TestRunIgnoresLegacyLockdoesn't check that the lock goes unread: a filter that reads it and skips the issue on a read error passes the package. This catches it:Nothing callsmc.getPropertyHook = func(issueKey, propKey string) { if propKey == legacyLockKey { t.Errorf("read the legacy lock of %s", issueKey) } }
DeleteEntityPropertynow, so dropping it fromJiraClientmakes a delete fail to compile.- No test pins the GitLab poll job's
resource_group(fullsend-poll.yml:15), which is now the only thing keeping GitLab cycles apart. docs/architecture.md:563-567still describes the locks and calls their removal a target state (only #9918 fixes it), anddocs/normative/normalized-entity/v1/README.md:343still names the operational lock.- The
lock.gorename the review bot asks for can wait until the stack lands, since every later PR edits that file.
The ADR 0160 and bundling threads come from #9852's hunk and leave this diff once #9852 merges. As on #9852, CI against main starts with the next push.
…ble-lastcheck Signed-off-by: guy oron <goron@redhat.com>
…remove-lock Signed-off-by: guy oron <goron@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 11:45 PM UTC · Completed 11:54 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.75 |
|
Risk Assessment: moderate (2/5) DetailsWhile the PR introduces a breaking lock removal across 15 files in a high-churn component without a feature flag, the established author, absence of protected or CI path changes, solid test coverage, and clean issue alignment keep overall risk moderate. |
ReviewFindingsLow
Earlier findings
Next steps:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Every unparseable row of the filter's decision table had updated one hour ago, inside the backfill window, where "treated as unset" and "floored to the window start" give the same answer. The new row has updated three days ago: unset keeps the issue active, while a floor would drop it and leave the bad value stored. Signed-off-by: guy oron <goron@redhat.com>
…remove-lock Signed-off-by: guy oron <goron@redhat.com>
With the lock gone the driver deletes no entity property, so DeleteEntityProperty leaves the JiraClient interface and the test mock. A delete now fails to compile, which replaces the mock's delete counter. TestRunIgnoresLegacyLock also fails if the legacy lock is read: until now a filter that read it and skipped the issue on a read error passed. Signed-off-by: guy oron <goron@redhat.com>
The jira-poll driver keeps no per-issue lock, so on GitLab the poll job's resource group is what keeps two cycles apart. Nothing failed if the template lost it. Signed-off-by: guy oron <goron@redhat.com>
docs/architecture.md called the lock's removal a target state, and the normalized-entity spec listed an operational lock among the properties Fullsend keeps on an issue. The driver now writes a write-check property instead. Signed-off-by: guy oron <goron@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 2:23 PM UTC · Completed 2:31 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.59 |
|
Risk Assessment: moderate (2/5) DetailsWhile the PR introduces a breaking lock removal across 18 files in a high-churn component without a feature flag, the established author, absence of protected or CI path changes, solid test coverage, and clean issue alignment keep overall risk moderate. |
ReviewFindingsLow
Earlier findings
|
Superseded by updated review
There was a problem hiding this comment.
Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:
internal/jirapoll/lock.go(file-level): Line 1 ·
[low] code-organization
The file no longer holds any locking logic after the per-issue lock removal; it now contains property-key helpers, checkWriteAccess and the lastCheck read/clamp/advance logic, so the lock.go filename is misleading.
Suggested fix: Optionally rename it to reflect its contents (for example properties.go or checkpoint.go).
Summary
The
jira-polldriver stops reading and writing the per-issue lock and instead confirms it can write to an issue before reading its comments and history. Implements ADR 0085 Decision item 1. The managed GitHub workflow and GitLab schedule already run one cycle at a time per repository, so the lock never coordinated anything there.Stacked on #9852. #9758 has merged, so the base is now
main. #9852 is merged into this branch because the two edit the same paragraphs of the Jira guide, so merge #9852 first. Jira: AISDLC-876. The rest of the AISDLC-826 main path (877–882) builds on this.Related Issue
Part of #9751
Changes
internal/jirapoll/lock.go:attemptLock,releaseLock,readLock,isLockStaleand the lock key go. NewcheckWriteAccesswritesfullsend.poll.{owner}.{repo}.writeCheck(GitLab: thefullsend.poll.gitlab.*namespace) with the check time; nothing reads it.internal/jirapoll/poller.go:filterLockedbecomesfilterActive, the ADR 0160 activity filter alone; it no longer returns an error or an unlocked count.processIssueruns the write check first; a failure returnscheck write access to <KEY>: ..., soRunwarns and goes on, and the existing all-failed guard fails a cycle in which every selected issue fails. The cycle UUID, jitter sleep anduuidimport go;poll completedrops itsunlockedcount.internal/jirapoll/types.go:Options.StaleThresholdandLockValuego. No CLI flag or config key set either.TestRunIgnoresLegacyLock(a live lock from an older version is not honoured, not modified, not deleted) andTestRunWriteAccessCheck(one denied issue: no reads, no records, a WARNING, the other issue dispatched; all denied: the all-failed error). Key tests now check thewriteCheckkey.TestRunSkipsIdleCandidatesstill asserts idle candidates cost no property write.concurrencygroup, since overlapping cycles now dispatch twice. The Troubleshooting table gains a row for duplicate dispatches from overlapping cycles and a row for a failed write check, with the permission and the token scope the write needs (from the review of 30 November).docs/architecture.mdis not touched:mainalready describes the lock removal there (ADR 0085).lastCheckunset; the write-check property holds an RFC 3339 time and a served issue costs two property writes;TestRenderJiraPollCallerpins the managed poll job's concurrency group; the filter tests are renamed toFilterActive; the guide says the write-check property stays on the issue and that the concurrency group covers one workflow file.main(chore(jirapoll): merge main into feat/jirapoll-skip-idle #9899): two comments that came with the merge still named the lock (uniqueIssuesand a multi-project test); they no longer do. Nor does the Jira row of the capability table indocs/normative/entity-execution-cli/v1/README.md, which also came withmain, or the comment ofTestPropertyKey_DottedSlugsDoNotCollide.maina second time (2 December): the merge keeps the no-match warning thatmainadded to the poller (fix(#9503)!: dispatch built-in agents from Jira without registration #9831). Nothing else changes here.mainis merged in, through fix(jirapoll): treat an unparseable lastCheck as unset #9852, so that the checksmainrequires run on this branch. No conflicts, and nothing else changes here.DeleteEntityPropertyleaves the poller'sJiraClientinterface, so a delete no longer compiles;TestRunIgnoresLegacyLockfails if the legacy lock is read;TestPollJobResourceGrouppins the GitLab poll job's resource group;docs/architecture.mdno longer calls the lock's removal a target state, and the normalized-entity spec names the write-check property instead of the lock.Notes for review:
GET /mypermissions?permissions=EDIT_ISSUES: a scoped or OAuth token can hold the permission and still lack the write scope, which is the case the check exists to catch (dispatch, then fail the checkpoint commit). Atlassian's API spec givesread:jira-workas the OAuth scope formypermissionsandwrite:jira-workfor setting an issue property. The cost is one write per selected issue, down from the lock's write, read-back, delete and 0.5–1.5 s sleep. The trade-off is one leftover property per processed issue, overwritten on each look; deleting it would cost a second call per issue every cycle.!: a scheduler other than the managed ones that lets cycles for one repository overlap now dispatches the same requests twice. The commit carries aBREAKING CHANGE:trailer; the adopter notice is AISDLC-884 (docs(jira-poll): say what changes when an adopter upgrades the poller #9918).main) records which parts it supersedes. Code comments cite ADR 0085 by number; the ADR file came to this branch withmain(chore(jirapoll): merge main into feat/jirapoll-skip-idle #9899).Testing
make lintpasses (stage changes first, then run)All pass.
Checklist
!for breaking changes)