Repository navigation
refactor(#9883): let the Jira poller take a set of project keys - #9887
Conversation
The poller assumed one Jira project: Options.JiraProject, one role roster per cycle, and a search JQL the CLI scoped beforehand. This change replaces that with an explicit project set. The config shape does not change: tracker.jira.project is passed as a one-item set. - Options.JiraProjects replaces JiraProject. Options.JQL is now the predicate before scoping. Run checks the set (non-empty, valid keys, no duplicates) and the predicate's parentheses before the auth preflight, so a bad scope makes no Jira request. - The poller scopes every search itself with config.ScopeJQLToProjects, keeping a trailing ORDER BY last. A one-item set gives exactly the JQL PollJQL built before, so the CLI path sends unchanged JQL. Two or more projects use `project in (...)`. - Role rosters are kept per project and loaded lazily. Each issue resolves its actor through its own project's roster. A load failure for any project still fails the cycle with no checkpoint advanced. - The set is searched once, so M, N and pagination apply across it. Repeated rows of the same issue (same ID, or same key when the ID is missing) are dropped before processing. - Key validation uses config.ValidJiraProjectKey, the same rule tracker.jira.project uses. The poller's own default predicate is now config.DefaultJiraPollQuery. Note: pre-commit could not fetch its hook repos (no network). gofmt, go vet ./..., lint-broken-symlinks and a whitespace check passed when run directly. semgrep-scan skipped because its ruleset could not be downloaded. gitleaks was covered by scan-secrets. Closes #9883 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 10:53 AM UTC · Completed 11:04 AM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.79 |
|
Risk Assessment: moderate (2/5) DetailsModerate risk due to large change size refactoring Jira poller internals without a feature flag, mitigated by a high test ratio (57%), zero protected path modifications, and complete alignment with linked issue acceptance criteria. Previous runRisk Assessment: moderate (2/5) DetailsModerate risk due to large change size refactoring Jira poller internals without a feature flag, mitigated by a high test ratio (60%), zero protected path modifications, and complete alignment with linked issue acceptance criteria. |
ReviewFindingsLow
Earlier findings
Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOlt7InNldmVyaXR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sImZpbGUiOiJpbnRlcm5hbC9qaXJhcG9sbC9wb2xsZXIuZ28iLCJpZCI6ImZfN2IyNDg5ZWQ0NTA1YWQzNSIsImxpbmUiOjE3LCJhY3Rpb25hYmxlIjpmYWxzZSwiZGltZW5zaW9uIjoiaW50ZW50LWNvaGVyZW5jZSJ9XX0= --> ReviewFindingsLow
Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 11:07 AM UTC · Completed 11:12 AM UTC Commit: Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.33 |
#9887 Rewrite the stale searchCandidates reference: project-set validation now runs via validateProjectSet on every cycle. Not addressed: the config import in internal/jirapoll is a disclosed interim step until the helpers move to a neutral package. Addresses #9887 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🔧 Fix agent — iteration 1 (bot-triggered)Fixed the stale normative doc passage. Left the interim jirapoll-to-config import as is, since the reviewer defers it to the planned helper move. Fixed (1):
Disagreed (1):
Tests: passed CI inspections (6):
Conflict update: skipped; strategy
|
|
🤖 Review · ❌ Terminated · Started 11:18 AM UTC · Ended 11:25 AM UTC Commit: |
Site previewPreview: https://f3c140ee-site.fullsend-ai.workers.dev Commit: |
Superseded by updated review
|
🤖 Finished Review · ✅ Success · Started 11:18 AM UTC · Completed 11:25 AM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.44 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Changes the Jira poller internals (
internal/jirapoll) to take an explicit, non-empty set of Jira project keys instead of one project. The existingtracker.jira.projectpath passes its project as a one-item set and sends the same JQL as before. No user-facing configuration field is added or changed; #9884 can later supply several projects.Related Issue
Part of #9677. Implements #9883.
Changes
internal/jirapoll/types.go:Options.JiraProjects []stringreplacesOptions.JiraProject.Options.JQLnow means the predicate before scoping. When it is empty, the poller usesconfig.DefaultJiraPollQuery.internal/jirapoll/poller.goRuncallssearchJQL. It checks the project set (non-empty, every key valid perconfig.ValidJiraProjectKey, no duplicates) and the predicate's parentheses. An empty or malformed set fails with zero Jira requests.searchJQLscopes the predicate to exactly the set withconfig.ScopeJQLToProjects, putting the scoping clause outside the predicate's parentheses and keeping a trailingORDER BYlast. A predicate with its ownprojectorORclause cannot widen the search.M,Nand the client's pagination cap apply across the whole set.uniqueIssuesdrops repeated rows of the same issue (by ID, or by key when Jira serves no ID), so each issue is processed, locked, checkpointed and dispatched once per cycle.roleMembership,roleGroups,roleGroupsChecked,rolesLoaded) becomerosters map[string]*projectRoster.internal/jirapoll/auth.go,convert.goexternal, as before.roleLoadErrorthat fails the whole cycle with no checkpoint advanced. The error now names that project.internal/config/issue_targets.go: addsScopeJQLToProjects.ScopeJQLToProjectnow calls it, so its output is unchanged. ExportsValidJiraProjectKeyandJQLParensBalanced(renamed fromjqlParensBalanced) so the poller checks keys and predicates exactly as the config gate does.internal/cli/poll.go:jiraPollOptionspassesJiraProjects: []string{tracker.jira.project}and the predicate before scoping (PollQuery()). The settings fieldjqlis renamed toquery.pkg/behaviourtest/stepsand the existing jirapoll/cli tests now useJiraProjects; gofmt realignment makes up most of the line count.Behaviour notes
project = "PROJ" AND (labels = "fullsend") ORDER BY updated DESC.jirapoll.Newcallers changes slightly. Callers that set noJQL(tests, behaviour steps) used the poller's hard-codedproject = "PROJ" AND statusCategory != Done ORDER BY updated DESC. They now get the config default, which differs only by parentheses:project = "PROJ" AND (statusCategory != Done) ORDER BY updated DESC.validProjectKey(2–10 letters and digits) only ran when no JQL was set, so it never ran on the CLI path. It is replaced by the config rule (^[A-Z][A-Z0-9_]*$), so every key thattracker.jira.projectaccepts keeps working.external) is gone. It was unreachable from the CLI becausetracker.jira.projectis required. An empty set is now an error, as the acceptance criteria require.Run, one search, one lock/checkpoint namespace per target repo.Overlap with the open ADR 0085 / 0160 PR chain
This PR is based on current
mainand is not stacked on that chain (#9758 → #9852 → #9853 → #9854 → #9855 → #9876 → #9878 / #9879). Expected conflicts, all mechanical:searchCandidatesas(<query>) AND updated >= "-24h" <order>, dropOptions.M, and movesplitJQLOrderBy/quotedRanges/inRangesfrominternal/configto a newinternal/jqlpackage so the poller does not importconfig. This PR makes the poller importconfigforScopeJQLToProjects,ValidJiraProjectKey,JQLParensBalancedandDefaultJiraPollQuery. Whichever lands second should move the scoping helper next tojql.SplitOrderByand add the window clause inside the project-set scope.Run,processIssueandtypes.go. This PR changes only the scope check at the top ofRun, thesearchCandidatescall, and the roster fields, so rebasing either way is local.auth.go/types.go(actor-authorization opt-out). The roster changes here are confined toensureRoleStructure,resolveEventRolesandresolveRole.Testing
New
internal/jirapoll/multi_project_test.go:TestSearchJQL,TestSearchJQL_OneProjectMatchesConfigScoping: one-project JQL is identical toconfig.ScopeJQLToProject. Also covers two-projectproject in (...)scoping, a predicate with its ownproject/ORclause, andORDER BYkept last.TestSearchJQL_Rejects,TestRun_InvalidScopeMakesNoJiraRequest: empty, nil, malformed, quote-injection and duplicate keys, and unbalanced predicates all fail. The client panics on any call, which proves zero Jira requests.TestRun_TwoProjectsShareOneSearch: one search with limitMacross the set, and at mostNissues processed across it.TestRun_MixedProjectRoleResolution: each issue resolves through its own project's roster, which loads once per project.TestRun_ProjectRosterFailureFailsClosedThenRetries: a roster failure for one project fails the cycle with no checkpoint advanced; the next cycle retries and dispatches.TestRun_DuplicateCanonicalIssueProcessedOnce,TestUniqueIssues: duplicate rows, by ID and after a move, are processed once.auth_test.go:TestEnsureRoleStructure_ProjectOutsideSetandTestEnsureRoleStructure_LoadsOncePerProject.internal/config:TestScopeJQLToProjectsandTestValidJiraProjectKey.internal/cli: the config tests assert the one-item set and that the poller's scoping reproduces the oldPollJQLoutput.Commands run:
All pass. Every new or changed production function is 93–100% covered except
searchCandidates, at 75% (its search-error return is not hit).make lintpasses: not run as a whole.pre-commitcould not fetch its hook repositories (no network access in the sandbox). gofmt,go vet ./...,lint-broken-symlinksandgit diff --checkwere run directly and pass, and gitleaks was covered byscan-secrets.semgrep-scanskipped because its pinned ruleset could not be downloaded, so CI's semgrep job is the first to scan this change.Checklist
!for breaking changes)🤖 Generated with Claude Code
Closes #9883
Post-script verification
agent/9883-jira-poller-multi-project)d9d65b1daec2fb82763f1babe0e55f3c050e3297..HEAD)