Skip to content

feat(fleet-queue): carry issue labels from the GitHub mirror at enqueue (#12744) - #12755

Merged
dezren39 merged 3 commits into
mainfrom
felix/12744-producer-labels
Nov 23, 2026
Merged

dezren39 merged 3 commits into
mainfrom
felix/12744-producer-labels

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Closes #12744

Problem

Slice 1 of #7030 (PR #12464) made the stored row priority derive from payload.labels (expedite ⇒ 15, next-up ⇒ 25) at task_from_packet. Verified live during the #7030 re-band: no producer writes payload.labels — 0 of 70 tasks created after the merge carry a labels array — so the selection never fires in production and bands reach the store only via manual re-bands.

Fix: the broker carries the labels

Rather than depending on every present and future producer's discipline, the broker fills the labels at the single source of truth, from the GitHub mirror it already shares a store with (github_mirror_issues, maintained by the github-ci Worker; its labels column is the issue's GitHub label names as a JSON array — the exact shape every payload.labels reader already consumes).

  • New module turso_queue/label_enrich.rs — payload_issue_ref (the issue a payload identifies: repo + issue.number, with the repo-health dedupe key as the repo fallback), mirror_issue_labels (the one PK lookup), enrich_payload_labels (fill only when the payload carries no labels array of its own), band_or_inherited (the follow-on's priority selection).
  • verb_enqueue enriches the packet after validation and before task_from_packet, so the stored payload and the band selection see the labels together. This also makes the claim filter's label field match on real labels for the first time.
  • The triage completion follow-on (admin.rs — the broker's own fix producer, which previously copied the triage row's payload and priority verbatim) enriches its payload the same way and stores the label band when one applies, the triage row's priority otherwise. A legacy triage row enqueued at 30 for an expedite issue now produces a fix follow-on at 15.
  • validate::label_band_priority becomes pub(crate) so the follow-on selects through the same function; the validation-contract note in validate.rs records the carriage.

Semantics, deliberately narrow (documented in label_enrich.rs):

  • A producer-supplied labels array stands untouched — it is that producer's own enqueue-time read of GitHub. The mirror fills only an absent/non-array key.
  • The mirror is a read model and never gates work (Design: one door, one home per fact — the fleet tool owns every route and every fallback #8575): a missing table or failed lookup makes the enqueue warn and proceed exactly as before this change.
  • No mirror row, or a row with no labels: the payload is left untouched (absence already reads as "no band labels" to every consumer; no empty array is written).
  • Dedupe behaviour, payload fields, and all other row construction are unchanged. No new dependencies.

Evidence (laptop, fleet-build-lock, cargo test -p fleet-queue --all-features)

  • Pass-after: 509 passed / 0 failed (full crate suite), including six new tests named for this issue: the verb-level acceptance oracle (stub pipeline server answering the mirror query: packet with stated 30 and no labels returns at priority 15 with the mirror's labels on the payload, and the captured request shows the github_mirror_issues lookup for the packet's repo), producer-labels-stand, mirror-miss, mirror-error-warns-and-proceeds, plus pure oracles for the identity shapes and the follow-on selection.
  • Fail-before (the four verb tests spliced onto pristine main): enqueue_mirror_labels_select_band_12744 and enqueue_mirror_error_warns_and_proceeds_12744 fail (priority stays 30, no labels, no warning); the two regression guards pass on both sides, as designed.
  • rustfmt applied (the one unrelated fmt deviation cargo fmt reports is pre-existing on main in work/sqlite_replica.rs; untouched here).

Readback demonstration

The live store's broker still runs the pre-fix build, so the acceptance readback was run against a scratch store through the real verb stack (validation → enrichment → dedupe → insert) over a real SQL engine (a python3 stdlib pipeline server on sqlite3, speaking the Turso wire protocol), with the mirror row carrying #12228's real labels copied from the live mirror (mirrored_at 2026-11-23T00:53:26Z). A production-shaped packet (stated priority 30, no labels) stored as:

STORED ROW priority=15 labels=["app/fleet","area/infra","effort/m","expedite","kind/bug","priority/critical","queue/queued","source/agent"]

No manual update. The remaining step is deployment: once the broker runs a build with this change, the same readback against the live store closes the acceptance loop, and manual re-bands become unnecessary.


Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

felix added 3 commits November 23, 2026 01:04
…ue (#12744)

Slice 1 of #7030 (PR #12464) made the stored row priority derive
from payload.labels, but no producer writes payload.labels, so the
selection never fired on a live packet (0 of 70 post-merge tasks).

The broker now fills payload.labels from github_mirror_issues —
the GitHub mirror in the same store — whenever an enqueue packet
identifies an issue and carries no labels array of its own, so the
ratified bands (expedite 15, next-up 25) apply at the single
source of truth regardless of producer discipline. A producer-
supplied array stands untouched; a mirror miss or lookup failure
leaves the packet exactly as before (the enqueue warns and
proceeds — the mirror never gates work).

The triage completion follow-on, the broker's own fix producer,
gets the same carriage: its payload is enriched the same way and
its stored priority is the label band when one applies, the
triage row's priority otherwise.
@dezren39
dezren39 requested a review from a team as a code owner November 23, 2026 01:22
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 765947c4-894d-49bb-bd45-43eaebbe6830
Commits

Reviewing files that changed from the base of the PR and between c72a930 and fef962f.

Files selected for processing: 5

  • pkgs/fleet/crates/fleet-queue/src/turso_queue.rs
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/admin.rs
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/claim.rs
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/label_enrich.rs
  • pkgs/fleet/crates/fleet-queue/src/validate.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit f01eef7 into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the felix/12744-producer-labels branch November 23, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet-queue: producers never write payload.labels — #7030's label-band selection (PR #12464) is inert at enqueue

1 participant