Skip to content

refactor(workqueue): centralize assignment receipt projections - #67649

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan-work-queue-receipt-projections
Oct 11, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan-work-queue-receipt-projections

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

  • Add payload-free Assignment.ToReceipt() and AssignmentClaim.ToReceipt() projections in pkg/workqueue.
  • Replace hand-duplicated CLI receipt declarations with type aliases, retaining their JSON fields and names.
  • Preserve assignment/origin validation and captured dispatch, claim, and delivery lifecycle enrichment.
  • Add regression coverage for identity mapping, claim order, nil/empty slices, independent receipt storage, omitted payloads/result descriptors, and the complete enriched CLI JSON schema.

Fixes #67200.

Validation

  • make build and make fmt-go passed.
  • Focused workqueue projection and CLI snapshot/report regressions passed.
  • Impacted Go tests from make agent-report-progress passed.
  • golangci-lint run --allow-parallel-runners ./pkg/workqueue ./pkg/cli passed with zero issues.
  • Custom lint reports no new diagnostics in the receipt implementation. The standard gate remains blocked by shared golangci-lint lock contention and the pre-existing ignored file.Close() error in readBoundedWorkQueueArtifact; these are not changed by this PR.
  • make fmt completed Go formatting but failed in the unrelated JavaScript formatting target; incidental JavaScript formatting changes were removed.

Centralize payload-free identity projections in workqueue and retain CLI receipt aliases and captured lifecycle enrichment.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 11, 2026 05:56
Copilot AI balanced review requested due to automatic review settings October 11, 2026 05:56
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #67649

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The refactor preserves validation and output behavior with comprehensive regression coverage.

0 open findings

What changed in this PR

Centralizes payload-free work-queue receipt projections while preserving CLI reporting behavior and validation.

Changes:

  • Adds assignment and claim receipt projections.
  • Replaces duplicated CLI structs with aliases.
  • Adds projection and JSON-schema regressions.
File Description
pkg/​workqueue/​receipts.go Defines receipt types and projections.
pkg/​workqueue/​receipts_test.go Tests identity, isolation, shape, and omission behavior.
pkg/​cli/​logs_work_queue_current.go Uses centralized receipts with lifecycle enrichment.
pkg/​cli/​logs_work_queue_current_test.go Verifies the enriched CLI JSON schema.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't find an actionable blocking issue in the changed lines.

ScopeReviewed the receipt projection refactor in `pkg/workqueue` and the CLI snapshot wiring/tests for correctness, lifecycle enrichment, and schema/regression coverage.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 35 AIC · ⌖ 5.45 AIC · ⊞ 21.2K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (156 new lines in pkg/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/67649-centralize-work-queue-receipt-projections.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

🔍 Evidence used
  • No implementation label; enforcement triggered by code volume: 156 additions in business-logic directories (threshold 100).
  • Files: pkg/workqueue/receipts.go (+47, new), pkg/workqueue/receipts_test.go (+76, new), pkg/cli/logs_work_queue_current.go (+7/-25), pkg/cli/logs_work_queue_current_test.go (+26).
  • No ADR link in the PR body; no ADR for this PR in docs/adr/; linked issue [deep-report] Add ToReceipt() projection on workqueue Assignment/AssignmentClaim instead of hand-duplicating CLI receipt types #67200 contains no ADR sections.
  • Inferred decision: introduce payload-free workqueue.AssignmentReceipt/ClaimReceipt plus ToReceipt() projections and alias the CLI receipt types to them, keeping the published JSON schema unchanged.
📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-67649: Centralize Work-Queue Receipt Projections in pkg/workqueue

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · opus50 · 40.4 AIC · ⌖ 50.5 AIC · ⊞ 1.8K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /codebase-design — this is a clean, well-tested refactor with only minor clarity suggestions, no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Two minor clarity suggestions around the dispatch.ToReceipt() embedding resolution and the implicit index-alignment invariant in currentWorkQueueAssignmentReceipt. Neither is a correctness bug — both are pre-existing patterns (the map-lookup zero-value fallback behavior is unchanged from before this PR) carried forward faithfully by the refactor.

Positive Highlights

  • ✅ ToReceipt() projections are well-scoped: they strip payloads/result descriptors by construction rather than via an allowlist filter, which is a safer default.
  • ✅ Nil vs. empty slice handling is explicitly preserved and tested (TestAssignmentToReceiptPreservesClaimsShape), avoiding a common JSON-shape regression.
  • ✅ The type-alias approach (WorkQueueAssignmentReceipt = workqueue.AssignmentReceipt) is a clean way to centralize the type without breaking the CLI's existing JSON field names/tags.
  • ✅ Good regression coverage added in both packages, including a full enriched JSON schema test and a no-aliasing-of-source-claims assertion.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 77.9 AIC · ⌖ 14.5 AIC · ⊞ 10.3K
Comment /matt to run again

Comment thread pkg/cli/logs_work_queue_current.go
Comment thread pkg/cli/logs_work_queue_current.go
Explain embedded assignment projection at the CLI call site and document source claim order preservation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/cli/logs_work_queue_current.go:220): [/codebase-design] dispatch.ToReceipt() works only because DispatchState embeds Assignment, so this silently reuses Assignment.ToReceipt()/AssignmentClaim.ToReceipt(). That's a non-obvious coupling for a reader of this file alone. - refactor(workqueue): centralize assignment receipt projections #67649 (comment)
  3. Review (pkg/cli/logs_work_queue_current.go:222): [/tdd] This loop's correctness depends on receipt.Claims preserving the same order/indices as assignment.Claims (so member.ClaimID/member.WorkID line up after mutation by index). That invariant is implicit — only guaranteed by ToReceipt()'s current implementation, not enforced by a type contract. - refactor(workqueue): centralize assignment receipt projections #67649 (comment)

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: 9cb0ff4
Sous-chef work: 401c2f51f511e88eccfccdca1d4a0207e1c8debea5559bc74f886c1c977de67f 58e3a69a506bec54e21570d2184e28f6619aa78d50eb589076e7892510cb3ab5
Sous-chef state: 1469d4057b6d995eb56dedf764630b07c8a4c75b15a9f387be4723ecb6e1e66b

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 7.82 AIC · ⌖ 6.56 AIC · ⊞ 1K · ◷
Comment /souschef to run again

…eceipt-projections

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 11, 2026 07:04
@pelikhan
pelikhan merged commit 7c2b9cb into main Oct 11, 2026
2 checks passed
@pelikhan
pelikhan deleted the pelikhan-work-queue-receipt-projections branch October 11, 2026 07:27
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.

[deep-report] Add ToReceipt() projection on workqueue Assignment/AssignmentClaim instead of hand-duplicating CLI receipt types

4 participants