Skip to content

refactor(jirapoll): return an issue's records with its checkpoint as one unit - #9854

Draft
guyoron1 wants to merge 37 commits into
fullsend-ai:mainfrom
guyoron1:refactor/jirapoll-issue-records-unit
Draft

guyoron1 wants to merge 37 commits into
fullsend-ai:mainfrom
guyoron1:refactor/jirapoll-issue-records-unit

Conversation

@guyoron1

@guyoron1 guyoron1 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

processIssue now returns an issue's dispatch records together with its checkpoint, and Run adds both to the cycle as one unit, instead of processIssue appending records to the cycle's list and Run slicing them back out by index. No behaviour change. The per-cycle and per-issue limits of ADR 0085 Decision item 3 build on it: an issue that does not fit in the room left must be left out whole, records and checkpoint, for the next cycle.

Draft because it is stacked on #9853 → #9852. #9758 has merged, so the base is now main. Its own change is the commit refactor(jirapoll): return an issue's records…; everything else in the diff belongs to the PRs below it. It becomes ready for review as they merge. Jira: AISDLC-877.

Related Issue

Part of #9751

Changes

  • internal/jirapoll/poller.go: processIssue returns pendingCheckpoint (issue key, checkpoint, records) instead of a bare checkpoint, collecting matched records into it rather than into p.dispatches. Run appends pc.records to p.dispatches and pc to pending in one place; the index-and-three-index-slice pairing goes. Doc comments on pendingCheckpoint, processIssue and Step 4 say the result is taken or left whole.
  • internal/jirapoll/poller_test.go: the two tests that call processIssue directly read pc.t and pc.records.
  • internal/jirapoll/poller_idle_test.go: TestProcessIssueReturnsRecordsAsOneUnit checks that processIssue hands back both records with the checkpoint and adds nothing to the cycle itself.

Event counters (eventsSeen, eventsInvalid, eventsMatchErrors) still count every examined event, as today. How an issue left for the next cycle counts toward the all-dropped guard belongs to the selection change (AISDLC-882).

Testing

  • make lint passes (stage changes first, then run)
  • Tests added/updated for new or modified logic
go test -race -count=1 ./internal/jirapoll/

All pass. Patch coverage on changed production lines: 18/19 (the uncovered line is the existing detect changes error return, retyped).

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — human and human-directed agent sessions only
  • I wrote this contribution myself and can explain all changes in it

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>
…one unit

processIssue appended its dispatch records straight to the cycle's
list, and Run sliced them back out by index to pair them with the
issue's checkpoint. processIssue now returns a pendingCheckpoint that
holds both, and Run adds the records and the checkpoint to the cycle
together.

No behaviour changes. The per-cycle and per-issue limits of ADR 0085
Decision item 3 need this: an issue that does not fit in the room left
must be left out whole, records and checkpoint, for the next cycle.

Signed-off-by: guy oron <goron@redhat.com>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://78296811-site.fullsend-ai.workers.dev

Commit: c964f48c7f0f5a87eeab2dfcbaf150e7eb0b0764

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>
…-records-unit

Signed-off-by: guy oron <goron@redhat.com>
…remove-lock

Signed-off-by: guy oron <goron@redhat.com>

# Conflicts:
#	docs/guides/user/jira-integration.md
…-records-unit

Signed-off-by: guy oron <goron@redhat.com>
…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>
…seable-lastcheck

Signed-off-by: guy oron <goron@redhat.com>
…lastcheck

Signed-off-by: guy oron <goron@redhat.com>
@fullsend-ai-review fullsend-ai-review Bot added the go Pull requests that update go code label Dec 2, 2026
@dhshah13
dhshah13 deleted the branch fullsend-ai:feat/jirapoll-skip-idle December 2, 2026 14:43
@dhshah13 dhshah13 closed this Dec 2, 2026
@dhshah13 dhshah13 reopened this Dec 2, 2026
@dhshah13
dhshah13 changed the base branch from feat/jirapoll-skip-idle to main December 2, 2026 14:46
…ble-lastcheck

Signed-off-by: guy oron <goron@redhat.com>
…remove-lock

Signed-off-by: guy oron <goron@redhat.com>
…-records-unit

Signed-off-by: guy oron <goron@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:45 PM UTC · Completed 12:04 AM UTC

Commit: 50a8999 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.87

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk reflects a substantial refactor (15 files, 1,045 lines) modifying polling behavior without a feature flag, anchored to the prior score of 2 and balanced by zero protected or security-sensitive paths touched, strong test coverage (40%), and absence of dependency or CI workflow changes.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Low

  • [code-organization] internal/jirapoll/lock.go:1 — lock.go keeps its name although the lock mechanism was removed. The file now holds only key helpers, checkWriteAccess, readLastCheck, loadLastCheck and advanceLastCheck.
    Remediation: Rename it to checkpoint.go (or state.go).
  • [code-organization] internal/jirapoll/poller_idle_test.go:628 — TestProcessIssueReturnsRecordsAsOneUnit tests general processIssue behaviour in a file scoped to ADR 0160 idle-candidate filtering, using that file's fixtures. The other TestProcessIssue_* tests live in poller_test.go.
    Remediation: Move it into internal/jirapoll/poller_test.go and use the standard helpers (newTestPoller, jira.Issue).
  • [stale-doc] docs/normative/normalized-entity/v1/README.md:343 — The line still refers to the operational "lock, checkpoint, and comment-marker properties". The lock is removed by this PR, and the matching sentence in docs/normative/entity-execution-cli/v1/README.md was already updated, so the two normative docs now disagree.
    Remediation: Say "operational write-check, checkpoint, and comment-marker properties".

Earlier findings

  • docs/architecture.md:567, stale-doc — resolved: the file is no longer part of this PR's diff.
  • docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md:288, architectural-conflict — reclassified to info: docs/contributing/adrs.md does not forbid a dated Amendments section, and ADRs 0038 and 0070 already use one.
  • internal/jirapoll/poller_idle_test.go:616, code-organization — merged into the misplaced-test finding above (duplicate of the same concern).

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

1 finding(s) below the low severity threshold were not posted.

fullsend-ai-review[bot]

This comment was marked as outdated.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

Copy link
Copy Markdown

Finding threads left open (7):

  1. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  2. Thread: the explanation was posted, but the thread could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  3. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  4. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  5. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  6. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  7. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

Outdated review threads left open (2):

  1. Thread: the review bot could not resolve this outdated thread. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  2. Thread: the review bot could not resolve this outdated thread. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/jirapoll/poller.go 96.15% 1 Missing ⚠️

📢 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>
…-records-unit

Signed-off-by: guy oron <goron@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:24 PM UTC · Completed 2:35 PM UTC

Commit: c964f48 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.06

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk reflects a substantial refactor (18 files, 1,098 lines) modifying polling behavior without a feature flag, anchored to the prior score of 2 as Tier 1 signals remain within the same ranges, balanced by zero protected or security-sensitive paths touched, test coverage (39%), and no dependency or CI workflow changes.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Low

  • [code-organization] internal/jirapoll/lock.go:1 — The file is named lock.go, but the lock mechanism is gone. What remains is the write-check and lastCheck property-key helpers and the checkpoint readers, so the name is misleading.
    Remediation: Rename internal/jirapoll/lock.go to a name that matches its contents (e.g. checkpoint.go or properties.go). This can be done in a follow-up so the stacked diff stays small.

Earlier findings

  • docs/normative/normalized-entity/v1/README.md:343, stale-doc — resolved; the sentence now says "operational write-check, checkpoint, and comment-marker properties" instead of "lock".
  • internal/jirapoll/poller_idle_test.go:628, code-organization — reclassified to info; the file already holds direct unit tests of single poller functions (e.g. TestDetectChangesMaxSeenReachesUpdated), and the test uses this file's helpers and its CamelCase naming, so the placement is a preference rather than a defect.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

2 finding(s) below the low severity threshold were not posted.

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 is named lock.go, but the lock mechanism is gone. What remains is the write-check and lastCheck property-key helpers and the checkpoint readers, so the name is misleading.

Suggested fix: Rename internal/jirapoll/lock.go to a name that matches its contents (e.g. checkpoint.go or properties.go). This can be done in a follow-up so the stacked diff stays small.

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

@fullsend-ai-review

Copy link
Copy Markdown

Finding threads left open (5):

  1. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  2. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  3. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  4. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  5. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

Outdated review threads left open (2):

  1. Thread: the review bot could not resolve this outdated thread. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  2. Thread: the review bot could not resolve this outdated thread. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

This branch was successfully deployed

1 active deployment
site-preview — c964f48c Deployed Dec 3, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants