Skip to content

feat(jirapoll): let a poll cover more than one Jira project #9677

Open
1 of 1 issue completed
Open

Description

@Dannyb48

What we run into

tracker.jira.project is a single key, and the poller always conjoins it onto poll.query. A team that splits bugs and planned work across two projects cannot poll both, and the failure is silent rather than loud.

For one of our repositories the query is valid Jira:

(project = TEAMKEY OR (project = PRODUCTKEY AND component = TEAM))
  and type = Bug and statusCategory != Done and updated > -1week and labels = fullsend

Product bugs are filed in a shared product project under a component; planned work lives in the team's own project. Written into tracker.jira.poll.query it becomes:

project = "TEAMKEY" AND (project = TEAMKEY OR (project = PRODUCTKEY AND component = TEAM)) AND ...

The second project's branch can never match. No error, no warning — half the intended coverage disappears, and only the first poll quiet cycle reveals it.

Three places encode the assumption

  1. Schema, one key. Project string validated as ^[A-Z][A-Z0-9_]*$ (internal/config/issue_targets.go:118, :464), documented as "the key of the single Jira project for this repository. It is not a fallback project" (docs/reference/config-reference.md:387). A list precedent already exists in the same mapping: tracker.jira.allowed_targets.projects is []string (issue_targets.go:295-299).
  2. Query construction, pure concatenation. ScopeJQLToProject does not parse the predicate; it emits project = "<project>" AND (<query>) (issue_targets.go:225-244, called from :213; behaviour documented at docs/reference/config-reference.md:415-417 and docs/guides/user/jira-integration.md:999-1003).
  3. Role resolution, one roster per cycle. The project role roster is loaded once for opts.JiraProject, and an issue whose key is in another project is forced to external and dropped (internal/jirapoll/convert.go:282-284). The guide states the coupling directly: "Because the query is always scoped to project, the poller can always resolve Jira project roles for slash commands and label events" (docs/guides/user/jira-integration.md:1001-1003).

So this is not only a JQL wrapper change. (3) is the real work: roles must resolve per issue project, not per config key.

Impact today

Two installs. Each needs its own poll caller workflow, its own copy of the shared Jira token as a repo secret, its own lastCheck/lock entity properties, and its own dispatch path — and when an issue is linked across the two projects, both pollers can dispatch it.

Proposal

Let the poll span a set of projects:

tracker:
  jira:
    base_url: https://example.atlassian.net
    project: TEAMKEY                 # unchanged: creation default and `fullsend issues` default
    poll:
      enabled: true
      projects: [TEAMKEY, PRODUCTKEY]   # new, optional; defaults to [project]
      query: 'type=Bug and statusCategory != Done and updated > -1week and labels=fullsend'
  • Scoping becomes project in ("TEAMKEY","PRODUCTKEY") AND (<query>), with a trailing ORDER BY kept last.
  • tracker.jira.project keeps its current meaning everywhere outside the poller.
  • Role rosters load lazily per project and are keyed by the issue's project; the existing fail-closed check stays, evaluated against the set. A roster load failure keeps failing the whole cycle, as ensureRoleStructure does today.
  • Reject (or warn on) a poll.query that carries its own project = clause, so this shape cannot be written by accident again.
  • M/N caps stay per cycle and are shared across the set.

Acceptance

  • A config with two poll.projects keys produces one poll whose JQL is project in (...).
  • A PRODUCTKEY-* issue resolves roles against the PRODUCTKEY roster and a TEAMKEY-* issue against TEAMKEY, in the same cycle.
  • fullsend repos install / repos status round-trip the new key with no drift, and ValidateConnection rejects an empty or malformed entry.
  • With poll.projects absent, behaviour is byte-identical to today.

Version checked

v0.56.1 and main as of filing both carry all three constraints above.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. ifireball commented on Nov 18, 2026

    @ifireball
    Member

    See #9199 for a counter proposal for the configuration shape.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions