Skip to content

Hotfix/attendee regenerate qr code#572

Merged
smarcet merged 5 commits into
mainfrom
hotfix/attendee-regenerate-qr-code
Jul 15, 2026
Merged

Hotfix/attendee regenerate qr code#572
smarcet merged 5 commits into
mainfrom
hotfix/attendee-regenerate-qr-code

Conversation

@smarcet

@smarcet smarcet commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

ref: https://app.clickup.com/t/9014802374/86baxuvj3

Summary by CodeRabbit

  • New Features

    • Badge QR codes are now regenerated when tickets are reassigned or updated.
    • Attendee badge QR codes are generated when badge details are requested through the attendee API.
    • QR code generation failures no longer interrupt ticket reassignment or updates.
  • Documentation

    • Updated OpenTelemetry trace-viewing instructions.
  • Chores

    • Adjusted local development ports for messaging, telemetry, and search services.
  • Tests

    • Added coverage for QR code regeneration, persistence, and badge updates.

smarcet added 2 commits July 15, 2026 00:37
…bling stacks

otel-collector, elasticsearch, and rabbitmq_sponsor_services published the same host ports as openstackid's and purchases-api's local stacks (9200/9300, 1888/8888/8889/13133/4317/4318/55679, 5672/15672), which broke docker compose up when multiple FN local stacks ran side by side. Container-internal ports are unchanged; only host-side mappings moved.
…baxuvj3)

GET /summits/{id}/attendees/me?expand=tickets.badge now regenerates the
caller's badge QR code on every read (AttendeeService::regenerateAttendeeBadgesQRCodes),
so "My QR" renders even for never-printed badges.

Fixes badge QR staleness on ticket reassignment across all three writers:
AttendeeService::reassignAttendeeTicket, reassignAttendeeTicketByMember, and
SummitOrderService::updateTicket. A ticket fetched via an exclusive lock does
not populate Doctrine's inverse-side badge association, so hasBadge()/getBadge()
are unreliable afterward - resolved via a shared ResolvesLockedTicketBadge trait
that looks the badge up independently by ticket number and re-attaches it.

Also fixes a latent duplicate-badge-row risk in updateTicket's badge_type_id
branch, and adds try/catch guards around badge generation so one bad badge
(broken legacy ticket/order/summit chain) can't 500 an otherwise-successful
read or abort the rest of a generation batch.

Resolves fntechgit/ftn-docsnsklz#70.
@smarcet
smarcet requested a review from Copilot July 15, 2026 12:52

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 11bedf3c-9991-4b4e-8efd-f55c4b6f1f13

📥 Commits

Reviewing files that changed from the base of the PR and between d1081a4 and f60cd0e.

📒 Files selected for processing (4)
  • app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeesApiController.php
  • app/Services/Model/AttendeeService.php
  • app/Services/Model/Imp/SummitOrderService.php
  • tests/oauth2/OAuth2AttendeesApiTest.php

📝 Walkthrough

Walkthrough

Badge QR codes are regenerated for expanded attendee reads and ticket reassignment flows, with persistence and ownership tests added. Docker Compose service host ports and the OpenTelemetry trace URL are also updated.

Changes

Badge QR regeneration

Layer / File(s) Summary
Attendee read QR regeneration
app/Services/Model/IAttendeeService.php, app/Services/Model/AttendeeService.php, app/Http/Controllers/..., tests/oauth2/*
The attendee endpoint regenerates active-ticket badge QR codes when tickets.badge is expanded, persists generated codes, and leaves them unchanged when the badge relation is not expanded.
Ticket reassignment QR updates
app/Services/Model/AttendeeService.php, app/Services/Model/Imp/SummitOrderService.php, tests/AttendeeServiceTest.php, tests/SummitOrderServiceTest.php
Ticket reassignment flows regenerate badge QR codes for the new owner and log QR-generation exceptions without failing the reassignment.
Ticket badge reassignment validation
tests/SummitOrderServiceTest.php
Tests verify regenerated QR ownership and confirm badge type changes reuse the existing badge row.

Local service port mappings

Layer / File(s) Summary
Container host ports and trace URL
docker-compose.yml, readme.md
RabbitMQ, OpenTelemetry Collector, and Elasticsearch host ports are shifted, and the trace inspection command uses the updated OpenTelemetry zpages port.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant OAuth2SummitAttendeesApiController
  participant AttendeeService
  participant SummitAttendeeBadge
  Client->>OAuth2SummitAttendeesApiController: request attendee with tickets.badge expansion
  OAuth2SummitAttendeesApiController->>AttendeeService: regenerate attendee badge QR codes
  AttendeeService->>SummitAttendeeBadge: lock and generate QR code
  SummitAttendeeBadge-->>OAuth2SummitAttendeesApiController: return persisted badge data
  OAuth2SummitAttendeesApiController-->>Client: serialize attendee profile
Loading
sequenceDiagram
  participant TicketOwner
  participant TicketReassignmentService
  participant SummitAttendeeBadge
  TicketOwner->>TicketReassignmentService: reassign attendee ticket
  TicketReassignmentService->>SummitAttendeeBadge: generate QR code for new owner
  SummitAttendeeBadge-->>TicketReassignmentService: persist QR code
  TicketReassignmentService-->>TicketOwner: complete reassignment
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly matches the main change: attendee badge QR code regeneration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hotfix/attendee-regenerate-qr-code

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

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-572/

This page is automatically updated on each push to this PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Services/Model/AttendeeService.php`:
- Around line 583-598: Update AttendeeService::regenerateAttendeeBadgesQRCodes
to skip badges that already have QR codes before locking and recheck that
condition after getByIdExclusiveLock before generating. In
app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeesApiController.php
lines 187-187, invoke regeneration only when tickets.badge is expanded. In
tests/oauth2/OAuth2AttendeesApiTest.php lines 189-210, verify the QR generation
path is not invoked on the second read rather than relying only on matching
deterministic values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b71a814c-2e57-4252-8608-65e1281fa1de

📥 Commits

Reviewing files that changed from the base of the PR and between 2e169d2 and d1081a4.

📒 Files selected for processing (10)
  • app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeesApiController.php
  • app/Services/Model/AttendeeService.php
  • app/Services/Model/IAttendeeService.php
  • app/Services/Model/Imp/SummitOrderService.php
  • app/Services/Model/Imp/Traits/ResolvesLockedTicketBadge.php
  • docker-compose.yml
  • readme.md
  • tests/AttendeeServiceTest.php
  • tests/SummitOrderServiceTest.php
  • tests/oauth2/OAuth2AttendeesApiTest.php

Comment thread app/Services/Model/AttendeeService.php
The previous commit shipped a trait working around a claimed Doctrine
behavior ("exclusive-lock fetch doesn't populate inverse-side to-one
associations") that does not actually exist. Verified with isolated,
instrumented tests (SQL capture, object-identity checks, UnitOfWork
state checks): $ticket->hasBadge()/getBadge() work correctly on a
ticket fetched via getByIdExclusiveLock(), with no workaround needed.

The earlier misleading result was caused by two unrelated confounds in
diagnostic testing: mixing two different EntityManager instances (the
LaravelDoctrine facade vs a test fixture's own self::$em), and a
pre-existing test fixture bug (InsertSummitTestData reuses one
SummitAttendeeBadge object across 5 tickets, so attendee->getTickets()
->first() is not reliably the ticket that badge's DB row points to).

Reverts all four call sites (AttendeeService::reassignAttendeeTicket,
reassignAttendeeTicketByMember, and both branches of
SummitOrderService::updateTicket) to plain hasBadge()/getBadge().
Keeps the try/catch guard around generateQRCode(), which is unrelated
and still valid. Deletes the ResolvesLockedTicketBadge trait.

Full targeted suite re-verified: 45/46 pass (same pre-existing,
unrelated failure as before).
@github-actions

Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-572/

This page is automatically updated on each push to this PR.

Per CodeRabbit review on PR #572 (discussion_r3587418919): getOwnAttendee
was invoking regenerateAttendeeBadgesQRCodes() unconditionally, exclusively
locking and regenerating every active badge even on requests that never
expand tickets.badge and therefore never serialize badge data at all.

Now only calls it when 'tickets.badge' is present in the expand param.
Keeps the always-regenerate behavior (no skip-if-already-has-QR) per
explicit prior decision - this only scopes *when* it runs, not whether
existing QR codes are trusted.

Added testGetOwnAttendeeDoesNotGenerateBadgeQRCodeWhenBadgeNotExpanded,
verified RED (failed against the unconditional call) before GREEN.
Full targeted suite re-verified: 46/47 pass (same pre-existing failure).
@github-actions

Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-572/

This page is automatically updated on each push to this PR.

@smarcet
smarcet requested a review from romanetar July 15, 2026 13:37

@romanetar romanetar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@smarcet please review

Comment thread app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeesApiController.php Outdated
Per PR #572 review (discussion_r3587772934, @romanetar): "que" was a
Spanish word leaked into the English OpenAPI description. Also updated
the wording to reflect the actual current behavior (regeneration only
happens when tickets.badge is expanded).
@smarcet
smarcet requested a review from romanetar July 15, 2026 13:53
@github-actions

Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-572/

This page is automatically updated on each push to this PR.

@romanetar romanetar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@smarcet
smarcet merged commit a9de92f into main Jul 15, 2026
19 of 20 checks passed
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.

3 participants