Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
527843f
fix(jirapoll): treat an unparseable lastCheck as unset
guyoron1 Nov 25, 2026
e0d3663
feat(jirapoll)!: remove the per-issue lock and check write access first
guyoron1 Nov 25, 2026
c060643
refactor(jirapoll): return an issue's records with its checkpoint as …
guyoron1 Nov 25, 2026
f2c408c
feat(jirapoll): limit reading to 5 minutes per cycle and 2 per issue
guyoron1 Nov 25, 2026
a8cfc1c
feat(jirapoll): take each candidate's lastCheck from the search results
guyoron1 Nov 26, 2026
95d4ad7
feat(jirapoll)!: search the whole backfill window, oldest change first
guyoron1 Nov 26, 2026
c999cae
test(jirapoll): cover both bad lastCheck forms and the all-failed guard
guyoron1 Nov 26, 2026
71112a5
test(jirapoll): pin the write check, the retry and the poll queue
guyoron1 Nov 26, 2026
5d27b04
docs(jira-poll): leave architecture.md alone and describe the write c…
guyoron1 Nov 26, 2026
6635f32
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Nov 26, 2026
ea42aab
Merge branch 'refactor/jirapoll-issue-records-unit' into feat/jirapol…
guyoron1 Nov 26, 2026
a85a142
fix(jirapoll): report a cancelled poll cycle as cancelled, not as tim…
guyoron1 Nov 26, 2026
34f1a18
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Nov 26, 2026
fa9fcb0
fix(jiramock): serve a search whose body cannot be read, as before
guyoron1 Nov 26, 2026
094cc3b
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Nov 26, 2026
afeda2c
docs(jira-poll): say what the window search no longer reports after a…
guyoron1 Nov 26, 2026
2d83300
Merge branch 'fix/jirapoll-unparseable-lastcheck' into feat/jirapoll-…
guyoron1 Nov 26, 2026
a772539
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Nov 26, 2026
01d47ae
Merge branch 'refactor/jirapoll-issue-records-unit' into feat/jirapol…
guyoron1 Nov 26, 2026
ede31d1
fix(jirapoll): exit normally at the cycle time limit, as ADR 0085 says
guyoron1 Nov 26, 2026
0d65b81
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Nov 26, 2026
5847e8c
refactor(jirapoll): parseLastCheck cannot fail, so it returns no error
guyoron1 Nov 26, 2026
870f3e7
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Nov 26, 2026
07a34db
docs(jira-poll): put the default-query sentence back with the query p…
guyoron1 Nov 27, 2026
2fa4335
Merge branch 'chore/jirapoll-skip-idle-merge-main' into restack/unpar…
guyoron1 Nov 27, 2026
5814593
Merge branch 'restack/unparseable-lastcheck' into restack/remove-lock
guyoron1 Nov 27, 2026
d94f734
Merge branch 'restack/remove-lock' into restack/issue-records-unit
guyoron1 Nov 27, 2026
bf9f4b2
Merge branch 'restack/issue-records-unit' into restack/time-limits
guyoron1 Nov 27, 2026
abd309f
Merge branch 'restack/time-limits' into restack/search-checkpoint
guyoron1 Nov 27, 2026
ca2a217
Merge branch 'restack/search-checkpoint' into restack/window-oldest-f…
guyoron1 Nov 27, 2026
f32dd09
docs(jirapoll): drop the lock from two comments that came with the ma…
guyoron1 Nov 27, 2026
3607b26
Merge branch 'restack/remove-lock' into restack/issue-records-unit
guyoron1 Nov 27, 2026
c5bc2b0
Merge branch 'restack/issue-records-unit' into restack/time-limits
guyoron1 Nov 27, 2026
ff8b695
Merge branch 'restack/time-limits' into restack/search-checkpoint
guyoron1 Nov 27, 2026
ed3327b
Merge branch 'restack/search-checkpoint' into restack/window-oldest-f…
guyoron1 Nov 27, 2026
d073774
refactor(jirapoll): use config's ORDER BY splitter instead of a jql p…
guyoron1 Nov 27, 2026
0a619f0
fix(jirapoll): hold the issue time limit when it passes inside the ma…
guyoron1 Nov 30, 2026
cd9d329
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Nov 30, 2026
c696b96
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Nov 30, 2026
abef7cc
Merge branch 'feat/jirapoll-time-limits' into restack/time-limits
guyoron1 Nov 30, 2026
cfd8196
Merge branch 'restack/time-limits' into restack/search-checkpoint
guyoron1 Nov 30, 2026
875ac79
Merge branch 'feat/jirapoll-search-checkpoint' into restack/search-ch…
guyoron1 Nov 30, 2026
423d60c
Merge branch 'restack/search-checkpoint' into restack/window-oldest-f…
guyoron1 Nov 30, 2026
9905ace
Merge branch 'feat/jirapoll-window-oldest-first' into restack/window-…
guyoron1 Nov 30, 2026
1216ae9
Merge branch 'chore/jirapoll-skip-idle-merge-main' into restack/unpar…
guyoron1 Nov 30, 2026
bf8aafc
Merge branch 'restack/unparseable-lastcheck' into restack/remove-lock
guyoron1 Nov 30, 2026
191c0d7
Merge branch 'restack/remove-lock' into restack/issue-records-unit
guyoron1 Nov 30, 2026
ee0693e
Merge branch 'restack/issue-records-unit' into restack/time-limits
guyoron1 Nov 30, 2026
a81de2a
Merge branch 'restack/time-limits' into restack/search-checkpoint
guyoron1 Nov 30, 2026
b56a622
Merge branch 'restack/search-checkpoint' into restack/window-oldest-f…
guyoron1 Nov 30, 2026
b3b6024
Merge branch 'feat/jirapoll-skip-idle' into fix/jirapoll-unparseable-…
guyoron1 Dec 1, 2026
194ca1f
Merge branch 'fix/jirapoll-unparseable-lastcheck' into feat/jirapoll-…
guyoron1 Dec 1, 2026
94672e4
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Dec 1, 2026
29f4acc
Merge branch 'refactor/jirapoll-issue-records-unit' into feat/jirapol…
guyoron1 Dec 1, 2026
1fb717e
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Dec 1, 2026
2340925
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Dec 1, 2026
d226986
docs(jira-poll): add troubleshooting rows for overlapping cycles and …
guyoron1 Dec 1, 2026
f9a7ed2
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Dec 1, 2026
9f04b42
Merge branch 'refactor/jirapoll-issue-records-unit' into feat/jirapol…
guyoron1 Dec 1, 2026
b5e4b01
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Dec 1, 2026
22151d0
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Dec 1, 2026
820d2b8
docs(jira-poll): count a slow issue as failed in the write-check trou…
guyoron1 Dec 1, 2026
61aa0df
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Dec 1, 2026
277a2c8
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Dec 1, 2026
8827fae
docs(jira-poll): name the token scope the write check needs
guyoron1 Dec 1, 2026
48c7b23
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Dec 1, 2026
4f0e8d7
Merge branch 'refactor/jirapoll-issue-records-unit' into feat/jirapol…
guyoron1 Dec 1, 2026
57ef4f1
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Dec 1, 2026
c177c77
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Dec 1, 2026
07582e1
docs(jirapoll): drop the lock from the entity execution table and a t…
guyoron1 Dec 1, 2026
8ff4790
fix(jirapoll): leave a discarded issue out of the cycle's event counts
guyoron1 Dec 1, 2026
dff9273
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Dec 1, 2026
50cdf0a
Merge branch 'refactor/jirapoll-issue-records-unit' into feat/jirapol…
guyoron1 Dec 1, 2026
d80f8ba
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Dec 1, 2026
2030ac4
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Dec 1, 2026
9c87e7e
Merge branch 'feat/jirapoll-skip-idle' into feat/jirapoll-remove-lock
guyoron1 Dec 2, 2026
96699c2
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Dec 2, 2026
473e176
Merge branch 'refactor/jirapoll-issue-records-unit' into feat/jirapol…
guyoron1 Dec 2, 2026
eb0498f
fix(jirapoll): keep a timed-out issue out of the no-match warning
guyoron1 Dec 2, 2026
59289b6
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Dec 2, 2026
352b540
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Dec 2, 2026
42af816
test(config): expect the default poll query without an ordering
guyoron1 Dec 2, 2026
b66e01c
docs(jira-poll): wrap the time-limit paragraphs at 80 columns
guyoron1 Dec 2, 2026
6df1f09
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Dec 2, 2026
5140bb0
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Dec 2, 2026
96805f5
docs(jira-poll): wrap the backfill-window paragraph at 80 columns
guyoron1 Dec 2, 2026
2ec3341
Merge remote-tracking branch 'origin/main' into fix/jirapoll-unparsea…
guyoron1 Dec 2, 2026
1c73a81
Merge branch 'fix/jirapoll-unparseable-lastcheck' into feat/jirapoll-…
guyoron1 Dec 2, 2026
50a8999
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Dec 2, 2026
20982f4
test(jirapoll): pin that an unparseable lastCheck is unset, not floored
guyoron1 Dec 3, 2026
42a15a0
Merge branch 'fix/jirapoll-unparseable-lastcheck' into feat/jirapoll-…
guyoron1 Dec 3, 2026
e1bf398
refactor(jirapoll): drop the unused delete from the poller's Jira client
guyoron1 Dec 3, 2026
5ffdb8e
test(scaffold): pin the GitLab poll job's resource group
guyoron1 Dec 3, 2026
f821b61
docs(jira-poll): say the lock is gone in two places that still expect it
guyoron1 Dec 3, 2026
c964f48
Merge branch 'feat/jirapoll-remove-lock' into refactor/jirapoll-issue…
guyoron1 Dec 3, 2026
e247b90
Merge branch 'refactor/jirapoll-issue-records-unit' into feat/jirapol…
guyoron1 Dec 3, 2026
ead3b82
Merge branch 'feat/jirapoll-time-limits' into feat/jirapoll-search-ch…
guyoron1 Dec 3, 2026
77b2215
Merge branch 'feat/jirapoll-search-checkpoint' into feat/jirapoll-win…
guyoron1 Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,20 @@ their own discovery and are unaffected. Forgejo has no Jira poll target.
- Starvation beyond the top M stays documented and unmitigated: the filter
neither widens nor narrows the window, and the clearance bound above
applies only to candidates inside it.

## Amendments

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] architectural-conflict

ADR 0160 has status Accepted on main. This PR appends a '## Amendments' section ('2026-11-25: A checkpoint that is not a timestamp is treated as unset (#9766)') that changes the behaviour Decision item 1 prescribes. docs/contributing/adrs.md allows only minor annotations on accepted ADRs and asks that a changed decision go in a new or superseding ADR; it also requires the PR description to call out any edit to an accepted ADR, and the PR body does not mention ADR 0160. The amendment covers #9766, outside this PR's stated scope. Advisory: linked issue #9751 itself refers to planned amendments to ADR 0160, so a maintainer should decide whether this form is acceptable.

Suggested fix: Either record the decision in a superseding ADR (or ADR 0085) and keep only a short cross-reference note in ADR 0160, or call out the ADR 0160 edit in the PR description and get maintainer agreement for the amendment form.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] architectural-conflict

ADR 0160 is Accepted. The added ## Amendments section changes the behaviour in Decision item 1 (an unparseable checkpoint is treated as unset instead of going down the per-issue error path). docs/contributing/adrs.md allows only minor annotations such as cross-references to newer decisions on accepted ADRs, so a substantive decision change belongs in a new or superseding ADR.

Suggested fix: Move the changed decision into ADR 0085 or a new superseding ADR and reduce the ADR 0160 edit to a short cross-reference.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] architectural-conflict

ADR 0160 on main has status Accepted and was already partially superseded by ADR 0085. This PR appends an "Amendments" section that revises Decision item 1 (how an unparseable checkpoint is handled) inside the accepted ADR. docs/contributing/adrs.md treats an Accepted ADR as a point-in-time record and asks for a new superseding ADR when circumstances change. The section is appended and leaves the Decision text alone, so this is borderline and advisory.

Suggested fix: Record the revision in a superseding ADR (or in ADR 0085) instead of amending ADR 0160, or reduce the amendment to a short note that links to the newer decision.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] architectural-conflict

The diff appends a dated ## Amendments section to ADR 0160, which is Accepted on main. The edit only appends text, and ADRs 0038 and 0070 already carry the same kind of section. The amendment appears to come from stacked PR #9766, and this PR description does not call the ADR edit out as docs/contributing/adrs.md asks.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] architectural-conflict

ADR 0160 is already Accepted on main. The PR adds an Amendments section that changes how Decision item 1 treats a non-timestamp checkpoint. docs/contributing/adrs.md treats Accepted ADRs as point-in-time records, says changed circumstances call for a superseding ADR, and asks that edits to an accepted ADR be called out in the PR description. The description does not mention ADR 0160.

Suggested fix: Record the change in a new ADR that supersedes or refines 0160 and leave a short cross-reference in 0160. Or keep the amendment as a minor annotation and call out the edit in the PR description.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] architectural-conflict

ADR 0160 still records as a consequence that starvation beyond the top M stays documented and unmitigated. This change removes M and searches the whole 24-hour window with no row limit (ADR 0085 Decision item 2), so the stated consequence no longer matches the active design. The new amendment section does not mention it.


### 2026-11-25: A checkpoint that is not a timestamp is treated as unset (#9766)

Decision item 1 sends a checkpoint that cannot be parsed to processing,
where "the existing per-issue error path reports it as today". That path
fails the issue on every pick and never saves a new checkpoint, so the
issue is never processed again, and when it is the only active candidate
every quiet cycle ends in the all-failed error. The driver now treats a
stored value that is not a timestamp as unset, as it already treats one
dated in the future: the issue stays active, gets one first-poll look
bounded by the backfill window, and that look saves a valid checkpoint.
Processing logs a WARNING naming the issue without the stored value, and
the filter's one line per cycle names such candidates. A failed read is
still an error. Replay stays bounded by one backfill window, the same as
deleting or forward-dating the checkpoint today.
4 changes: 2 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ The existing design principle is that [the repo is the coordinator](problems/age
input drivers to discover work from remote systems (Jira first), coordinates
via source-native write-then-verify locks, and feeds the same dispatch pipeline
as webhooks ([ADR 0063](ADRs/0063-polling-based-work-discovery.md)). Initial
scope is per-repo mode only. In the target state the `jira-poll` driver no
longer uses those locks (see the next item).
scope is per-repo mode only. The `jira-poll` driver no longer uses those
locks (see the next item).
- Jira poll candidate selection (target state): one poller per repository
reads every issue that changed within the backfill window
(`tracker.jira.poll.backfill_window_hours`, default 24), oldest change
Expand Down
6 changes: 6 additions & 0 deletions docs/guides/dev/behaviour-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2203,4 +2203,10 @@ deliberately not treated as a breaking change: no function or signature
changed, and a scenario that adds activity after creating the issue sees
`updated` move with it.

**`jiramock` search properties change:** the search endpoint now returns the
entity properties named in the request's `properties` list that an issue
has, in each row's `properties` object, as Jira does. The Jira poller reads
each candidate's `lastCheck` from there, so the mock must serve it. A search
that names no properties is served as before.

Bump the pinned version when behaviour step vocabulary or `pkg/behaviourtest` APIs change.
12 changes: 10 additions & 2 deletions docs/guides/user/custom-poller-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ permissions:
jobs:
poll:
runs-on: ubuntu-24.04
# The jira-poll driver keeps no per-issue lock: two overlapping cycles
# for one repository dispatch the same requests twice. This group queues
# the runs of this workflow; do not poll the same repository from a
# second workflow.
concurrency:
group: ${{ github.workflow }}-poll
cancel-in-progress: false
outputs:
matrix: ${{ steps.dispatch.outputs.matrix }}
steps:
Expand Down Expand Up @@ -99,7 +106,8 @@ jobs:

The poller reads the Jira site, project, and query from `tracker.jira` in
`.fullsend/config.yaml`, and polls only when `poll.enabled` is `true`. It
always scopes the query to the project:
always scopes the query to the project and to the issues that changed within
the last 24 hours, oldest change first:

```yaml
tracker:
Expand All @@ -108,7 +116,7 @@ tracker:
project: MYPROJECT
poll:
enabled: true
query: 'statusCategory != Done AND updated > -1w AND type = Bug'
query: 'statusCategory != Done AND type = Bug'
```

See [Jira Integration § Custom JQL](jira-integration.md#custom-jql).
Expand Down
119 changes: 83 additions & 36 deletions docs/guides/user/jira-integration.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/normative/entity-execution-cli/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ A provider/kind pair becomes eligible when it has all four capabilities:
| GitHub issue, pull request | Mapped | Covered | Bounded GitHub filter subset for both kinds, with GraphQL advanced search for combined discovery and selective acquisition | A selective-acquisition adapter exists (`internal/forge/github.EntityAdapter`), but source membership and snapshot staging remain pending under [#9598](https://github.com/fullsend-ai/fullsend/issues/9598), so the pair stays ineligible. The existing GitHub `forge.Client` already reads issues, pull requests, comments, label events, reviews, and review threads. No `fullsend poll` driver uses GitHub, so entity discovery competes with no driver |
| GitHub Discussion | Mapped | Covered | None. The GitHub subset guards only `is:issue` and `is:pr` | No Discussion ingress or conversation client under [ADR 0086](../../../ADRs/0086-conversation-surface-for-agent-participation.md) |
| GitLab issue, merge request | Mapped. Reviews, reactions, issue type, and close reason are `unsupported` | Covered | Only the `open`, `closed`, and `all` presets | No entity adapter. The `--forge gitlab` poller and the webhook fast path own dispatch through shared poll state ([ADR 0125](../../../ADRs/0125-gitlab-hybrid-webhook-poller-dispatch.md), [ADR 0132](../../../ADRs/0132-occurrence-aware-shared-poller-state.md)). Cutover needs a plan for that state |
| Jira issue | Mapped. Complete `label_applications` needs full changelog coverage | Covered | Native JQL within a project guard | No entity adapter. The `jira-poll` driver owns dispatch through checkpoints and lock properties. The source project is separate from the target code repository |
| Jira issue | Mapped. Complete `label_applications` needs full changelog coverage | Covered | Native JQL within a project guard | No entity adapter. The `jira-poll` driver owns dispatch through checkpoints. The source project is separate from the target code repository |

#### Why GitHub issues and pull requests come first

Expand Down
2 changes: 1 addition & 1 deletion docs/normative/normalized-entity/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ change attribution can retain it for host-side diagnostics, but binds its CEL
can attribute selected field changes when its relevant history is complete;
the issue and comment property read APIs return keys and values without a
writer, so a property needs independent trusted provenance before becoming an
actionable known CEL value. Fullsend's operational lock, checkpoint, and
actionable known CEL value. Fullsend's operational write-check, checkpoint, and
comment-marker properties stay in host-side coordination state by default;
their API visibility does not establish trustworthy authorship or a dispatch
grant.
Expand Down
21 changes: 14 additions & 7 deletions docs/reference/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ tracker: # Issue tracker. At most one provider block
# projects: [OTHER] # Jira project keys for cross-project issue creation or moves
# poll:
# enabled: true # Managed poll workflow switch (see the tracker.jira section)
# query: 'labels = "fullsend" ORDER BY updated DESC' # JQL; always scoped to project
# query: 'labels = "fullsend"' # JQL; always scoped to project

# ── Authorization ────────────────────────────────────────────
authorization: # Extra sources of permission for triggering agents
Expand Down Expand Up @@ -535,7 +535,7 @@ tracker:
projects: [OTHER]
poll:
enabled: true
query: 'labels = "fullsend" AND statusCategory != Done ORDER BY updated DESC'
query: 'labels = "fullsend" AND statusCategory != Done'
```

- **`tracker.jira.base_url`** — The Jira site URL. It must be an `https` URL
Expand Down Expand Up @@ -591,11 +591,18 @@ tracker:
`fullsend jira poll` pipeline schedule. See
[Jira polling](../cli/repos.md#jira-polling).
- **`tracker.jira.poll.query`** — The JQL the poller runs. It defaults to
`statusCategory != Done ORDER BY updated DESC`. The query is always scoped
to `project`: the poller runs `project = "<project>" AND (<query>)` and
keeps a trailing `ORDER BY` after the closing parenthesis. The parentheses
in the query must be balanced. For example, the query above runs as
`project = "PROJ" AND (labels = "fullsend" AND statusCategory != Done) ORDER BY updated DESC`.
`statusCategory != Done`. The query is always scoped to `project` and to
the 24-hour backfill window: the poller runs
`(project = "<project>" AND (<query>)) AND updated >= "-24h"` and keeps a
trailing `ORDER BY` at the end. The parentheses in the query must be
balanced. For example, the query above runs as
`(project = "PROJ" AND (labels = "fullsend" AND statusCategory != Done)) AND updated >= "-24h" ORDER BY updated ASC`.
Without an `ORDER BY` the poller sorts oldest change first
(`ORDER BY updated ASC`), which is recommended. A query with its own
`ORDER BY` is searched in that order, and `ORDER BY updated DESC` logs a
WARNING every cycle: when more issues changed within the window than the
search reads, newest change first leaves the oldest requests out. See
[Custom JQL](../guides/user/jira-integration.md#custom-jql).

`base_url` and `project` are required once `base_url`, `api_url`, `project`,
a nonempty `run_label`, or `poll` is set. A mapping that only selects Jira (`jira: {}`) or only sets
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ type jiraPollArgs struct {

// validTargetRepo matches "owner/repo" slugs (subgroup segments allowed,
// matching splitOwnerRepo). Validated up front because a slash-less value
// would otherwise flow into a silently malformed Jira entity-property lock
// would otherwise flow into a silently malformed Jira entity-property
// namespace and into NormalizedEvent.Repo.
var validTargetRepo = regexp.MustCompile(`^[^/\s]+(/[^/\s]+)+$`)

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/poll_jira_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestLoadJiraPollSettings_Defaults(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, config.DefaultJiraAPIURL, got.apiURL)
assert.Equal(t, config.DefaultJiraPollQuery, got.query)
assert.Equal(t, `project = "PROJ" AND (statusCategory != Done) ORDER BY updated DESC`,
assert.Equal(t, `project = "PROJ" AND (statusCategory != Done)`,
config.ScopeJQLToProjects(got.projects, got.query))
assert.False(t, got.enabled, "an omitted poll mapping leaves polling disabled")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/poll_jira_gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func runJiraPollGitLab(cmd *cobra.Command, f jiraPollGitLabFlags) error {
return fmt.Errorf("create GitLab client: %w", err)
}
pollClient := gitlab.NewPollClient(glClient)
// Authenticate to GitLab before any Jira lock or checkpoint is touched,
// Authenticate to GitLab before any Jira issue property is touched,
// so a bad Poller credential fails the cycle up front.
if _, err := pollClient.GetAuthenticatedUserID(cmd.Context()); err != nil {
return wrapGitLabAuthFailure(sel, fmt.Errorf("resolve GitLab poller identity: %w", err))
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/poll_jira_gitlab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TestPollCmd_JiraPollGitLabPreflight(t *testing.T) {

// TestPollCmd_JiraPollGitLabAuthFailure drives the GitLab target through
// client construction to the GitLab identity preflight, which runs before
// any Jira lock or checkpoint is touched.
// any Jira issue property is touched.
func TestPollCmd_JiraPollGitLabAuthFailure(t *testing.T) {
var gitlabCalls int
srv := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion internal/config/entity_sources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ func TestEffectiveYAML_NormalizedTracker(t *testing.T) {
connection: jira
projects:
- PROJ
query: statusCategory != Done ORDER BY updated DESC
query: statusCategory != Done
discovery: true
origin: translated
command_default:
Expand Down
11 changes: 6 additions & 5 deletions internal/config/issue_targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ const DefaultJiraAPIURL = "https://api.atlassian.com"

// DefaultJiraPollQuery is the JQL predicate the Jira poller uses when
// tracker.jira.poll.query is unset. It is always scoped to the configured
// project (see JiraTrackingConfig.PollJQL).
const DefaultJiraPollQuery = "statusCategory != Done ORDER BY updated DESC"
// project (see JiraTrackingConfig.PollJQL). It carries no ORDER BY, so the
// poller serves the oldest change first (ADR 0085, Decision item 2).
const DefaultJiraPollQuery = "statusCategory != Done"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-config

The exported constant config.DefaultJiraPollQuery is now statusCategory != Done, with no sort clause. An adopter that leaves tracker.jira.poll.query unset gets a different default query, read order and candidate pool without editing any config. The PR already carries the breaking marker.

Suggested fix: Keep the breaking ! marker and call out the default change in the release notes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-config

The comment above DefaultJiraPollQuery documents the changed default query semantics (no ORDER BY, oldest change first). It is the same concern as the default-query finding at line 105 and stays open with it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-config

DefaultJiraPollQuery changed from statusCategory != Done ORDER BY updated DESC to statusCategory != Done, so the default now serves oldest change first. The PR title carries the ! marker.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-config

The effective Jira poll query changes for existing deployments. DefaultJiraPollQuery loses its ORDER BY updated DESC. The poller now always appends AND updated >= "-24h" and adds ORDER BY updated ASC when the query has no ordering. A user query ordered updated DESC is still honoured but logs a WARNING, and older requests can go unserved once they leave the window. The ! marker and the Jira guide declare the change.

Suggested fix: Optionally add an upgrade note for deployments with a custom poll.query or that relied on newest-first order. No code change is required.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-config

DefaultJiraPollQuery is now statusCategory != Done with no sort clause. Adopters on the default query see a different read order and pool without editing config. The PR title carries the ! marker.

Suggested fix: Call out the changed default in release notes / migration docs.


// JiraTrackingConfig holds Jira issue-tracking settings: the Jira site and

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-config

DefaultJiraPollQuery changed from 'statusCategory != Done ORDER BY updated DESC' to 'statusCategory != Done'. Consumers relying on the default tracker.jira.poll.query now get a 24h-window search sorted oldest change first, and a custom query ending in 'ORDER BY updated DESC' logs a WARNING every cycle. The '!' marker and the docs cover this behavioural break.

Suggested fix: Call out the default-query change in the release notes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-config

DefaultJiraPollQuery changed from statusCategory != Done ORDER BY updated DESC to statusCategory != Done, so adopters who leave poll.query unset now get the oldest change first. Poller.windowJQL also applies to explicit queries: it adds the backfill-window clause, removes the row limit, and adds ORDER BY updated ASC when the query has no ORDER BY. Explicit queries with ORDER BY updated DESC keep their order and log a WARNING each cycle. No config edit is required, and the title carries !.

Suggested fix: State the new default, the oldest-first ordering and the window clause applied to all poll queries, including explicit ones, in the release notes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] breaking-config

Default read order is now oldest change first, applied only when the query has no ORDER BY; a custom query with its own ORDER BY keeps that order, so ordering depends on whether the query carries one.

Suggested fix: Document the ordering rule for tracker.jira.poll.query in the config reference.

// project this repository is connected to, the cross-project issue
Expand Down Expand Up @@ -239,7 +240,7 @@ func ScopeJQLToProject(project, query string) string {
// keys and the predicate's parentheses (see ValidJiraProjectKey and
// JQLParensBalanced): this function only formats.
func ScopeJQLToProjects(projects []string, query string) string {
predicate, orderBy := splitJQLOrderBy(query)
predicate, orderBy := SplitJQLOrderBy(query)
predicate = strings.TrimSpace(predicate)
// Quote each key so a reserved-word key (AND, OR, IN) stays a value.
quoted := make([]string, len(projects))
Expand All @@ -261,9 +262,9 @@ func ScopeJQLToProjects(projects []string, query string) string {
return scoped
}

// splitJQLOrderBy splits query at its last ORDER BY that is outside a
// SplitJQLOrderBy splits query at its last ORDER BY that is outside a
// quoted string, returning the predicate and the ORDER BY clause.
func splitJQLOrderBy(query string) (string, string) {
func SplitJQLOrderBy(query string) (string, string) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] design-smell

The PR body describes a new 'internal/jql' package (SplitOrderBy, QuotedRanges, InRanges, TestSplitOrderBy) and a 'go test ./internal/jql/' command. No internal/jql package exists in the PR head; the function is exported as config.SplitJQLOrderBy instead. The PR description is stale against the implementation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved by the review agent: this is an older copy of a finding that a newer review thread also carries: #9878 (comment)

The finding is still open. Follow up in the newer thread.

Resolving this duplicate. Unresolve it if you disagree.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] design-smell

SplitJQLOrderBy, which holds JQL string handling, is now exported from the config package so that jirapoll can use it. This is a minor placement question. The function already lived in config as an unexported helper.

query = strings.TrimSpace(query)
quoted := quotedRanges(query)
matches := jqlOrderByRe.FindAllStringIndex(query, -1)
Expand Down
2 changes: 1 addition & 1 deletion internal/config/jira_tracking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestJiraTracking_Defaults(t *testing.T) {
assert.Equal(t, DefaultJiraAPIURL, jira.EffectiveAPIURL())
assert.False(t, jira.PollEnabled(), "omitted poll does not install the poll workflow")
assert.Equal(t, DefaultJiraPollQuery, jira.PollQuery())
assert.Equal(t, `project = "PROJ" AND (statusCategory != Done) ORDER BY updated DESC`, jira.PollJQL())
assert.Equal(t, `project = "PROJ" AND (statusCategory != Done)`, jira.PollJQL())

var nilJira *JiraTrackingConfig
assert.Equal(t, DefaultJiraAPIURL, nilJira.EffectiveAPIURL())
Expand Down
23 changes: 17 additions & 6 deletions internal/forge/jira/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ type searchRequest struct {
MaxResults int `json:"maxResults"`
Fields []string `json:"fields"`
NextPageToken string `json:"nextPageToken,omitempty"`
Properties []string `json:"properties,omitempty"`
}

// searchFields lists the issue fields SearchIssues requests. The poller
Expand All @@ -544,14 +545,24 @@ var searchFields = []string{"summary", "status", "labels", "reporter", "assignee
// from overly broad JQL queries.
const maxSearchPages = 200

// ErrSearchTruncated is returned by SearchIssues, together with the issues
// it read, when the search still had results after maxSearchPages pages.
var ErrSearchTruncated = errors.New("search stopped at the page limit with results remaining")

// SearchIssues executes a JQL search and returns up to limit matching
// issues, using the POST /rest/api/3/search/jql endpoint with cursor-based
// pagination (nextPageToken + isLast). Pagination stops as soon as limit
// issues have been collected, so a limit smaller than the full match set
// bounds API cost rather than fetching everything and truncating
// afterward. A limit <= 0 fetches all matching issues, capped at
// maxSearchPages pages (10,000 issues at 50 per page) to prevent unbounded
// memory growth.
// memory growth. A search cut short by that cap returns the issues read so
// far with ErrSearchTruncated, so the caller can tell a cut from a complete
// result.
//
// properties names issue entity properties to return with each issue in
// Issue.Properties (Jira returns at most five), so a caller that needs one
// property per issue does not read it with a call per issue.
//
// This endpoint is eventually consistent: Atlassian documents that recent
// updates might not be immediately visible in results. For the poller that
Expand All @@ -563,7 +574,7 @@ const maxSearchPages = 200
// relies on them being at least as fresh as the row; if they lag it, an
// entry can be skipped. Do not "fix" ordering assumptions by trusting
// search freshness.
func (c *LiveClient) SearchIssues(ctx context.Context, jql string, limit int) ([]Issue, error) {
func (c *LiveClient) SearchIssues(ctx context.Context, jql string, limit int, properties ...string) ([]Issue, error) {
var all []Issue
var nextPageToken string
for page := 0; page < maxSearchPages; page++ {
Expand All @@ -576,6 +587,7 @@ func (c *LiveClient) SearchIssues(ctx context.Context, jql string, limit int) ([
MaxResults: 50,
Fields: searchFields,
NextPageToken: nextPageToken,
Properties: properties,
}
bodyJSON, err := json.Marshal(body)
if err != nil {
Expand All @@ -587,15 +599,14 @@ func (c *LiveClient) SearchIssues(ctx context.Context, jql string, limit int) ([
}
all = append(all, result.Issues...)
if limit > 0 && len(all) >= limit {
all = all[:limit]
break
return all[:limit], nil
}
if result.IsLast || len(result.Issues) == 0 || result.NextPageToken == "" {
break
return all, nil
}
nextPageToken = result.NextPageToken
}
return all, nil
return all, ErrSearchTruncated
}

// GetIssue fetches a single issue by ID or key.
Expand Down
65 changes: 65 additions & 0 deletions internal/forge/jira/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,71 @@ func TestSearchIssues_Pagination(t *testing.T) {
assert.Equal(t, "PROJ-120", issues[119].Key)
}

// A search that still has results after maxSearchPages pages returns what
// it read with ErrSearchTruncated; one that ends on its last allowed page
// does not.
func TestSearchIssues_TruncatedAtPageCap(t *testing.T) {
t.Parallel()
for _, tc := range []struct {
name string
lastIsLast bool
wantErr error
}{
{name: "more results remain", wantErr: ErrSearchTruncated},
{name: "ends on the last page", lastIsLast: true},
} {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux := setupTest(t)
pages := 0
mux.HandleFunc("/rest/api/3/search/jql", func(w http.ResponseWriter, r *http.Request) {
pages++
writeJSON(t, w, http.StatusOK, SearchResult{
Issues: []Issue{{ID: fmt.Sprintf("%d", pages), Key: fmt.Sprintf("PROJ-%d", pages)}},
NextPageToken: "more",
IsLast: tc.lastIsLast && pages == maxSearchPages,
})
})

issues, err := client.SearchIssues(context.Background(), "project = PROJ", 0)
require.ErrorIs(t, err, tc.wantErr)
assert.Len(t, issues, maxSearchPages)
assert.Equal(t, maxSearchPages, pages)
})
}
}

// SearchIssues asks for the named entity properties on every page and
// decodes them into Issue.Properties; without names it asks for none.
func TestSearchIssues_Properties(t *testing.T) {
t.Parallel()
client, mux := setupTest(t)
ctx := context.Background()

var asked [][]string
mux.HandleFunc("/rest/api/3/search/jql", func(w http.ResponseWriter, r *http.Request) {
var body map[string]json.RawMessage
require.NoError(t, json.NewDecoder(r.Body).Decode(&body))
var props []string
if raw, ok := body["properties"]; ok {
require.NoError(t, json.Unmarshal(raw, &props))
}
asked = append(asked, props)
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"issues":[{"id":"1","key":"PROJ-1","fields":{},"properties":{"fullsend.poll.acme.platform.lastCheck":"2026-11-25T10:00:00Z"}},{"id":"2","key":"PROJ-2","fields":{}}],"isLast":true}`))
})

issues, err := client.SearchIssues(ctx, "project = PROJ", 0, "fullsend.poll.acme.platform.lastCheck")
require.NoError(t, err)
require.Len(t, issues, 2)
assert.JSONEq(t, `"2026-11-25T10:00:00Z"`, string(issues[0].Properties["fullsend.poll.acme.platform.lastCheck"]))
assert.Nil(t, issues[1].Properties)

_, err = client.SearchIssues(ctx, "project = PROJ", 0)
require.NoError(t, err)
assert.Equal(t, [][]string{{"fullsend.poll.acme.platform.lastCheck"}, nil}, asked)
}

// ---------------------------------------------------------------------------
// ListComments pagination
// ---------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions internal/forge/jira/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ type Issue struct {
Key string `json:"key"`
Self string `json:"self"`
Fields IssueFields `json:"fields"`
// Properties holds the issue entity properties SearchIssues was asked
// to return, keyed by property key. A property the issue does not have
// is absent.
Properties map[string]json.RawMessage `json:"properties,omitempty"`
}

// CreatedIssue is the response from POST /rest/api/3/issue.
Expand Down
Loading
Loading