Fix inverted badge type null check on ticket data import - #568
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-568/ This page is automatically updated on each push to this PR. |
The null check on badge_type was inverted, so badge creation for badge-less tickets bailed out exactly when a badge type was provided, and would fatal on buildBadgeFromType(null) otherwise. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…test Every fixture ticket type carries a badge type, so SummitTicketType::applyTo auto-creates a badge for every ticket at setTicketType time. Use a ticket type without a badge type to produce a genuinely badge-less ticket. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9de9557 to
c1a769b
Compare
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-568/ This page is automatically updated on each push to this PR. |
Per review: process badge data before extra questions and flush + evict the badge-features result cache so same-row badge/feature grants are visible to the question permission gates; split the upsert into resolve/merge helpers; ctype_digit for raw value ids; targeted cache forget in tests. Adds regression tests for the same-row feature grant (new + existing attendee), order-scoped skip, locked-answer skip, and badge creation for badge-less tickets (folds in #568). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Folded into #567: the badge-block restructure there necessarily absorbed this one-line fix, and the regression test now lives in that branch. |
…V import (#567) * feat(registration): add order extra question answers to ticket CSV import Adds extra_question:{question name} column support to the ticket data import, template endpoint and OpenAPI docs. Answers are upserted through the existing ExtraQuestionAnswerHolder persistence path; unknown questions, order-scoped questions, disallowed questions, empty values and locked answers are logged and skipped without failing the row. List type questions accept value name/label/id ('|' separated for CheckBoxList) and store value ids. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(registration): fix badge-features import test fixture assumptions The import re-reads tickets with HINT_REFRESH, so it sees DB state: the fixture's assigned tickets share one badge entity whose FK points at only the last of them. Use an unassigned ticket, which gets its own DB-consistent badge from SummitTicketType::applyTo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(registration): normalize list answer ordering + guard import row on answer persistence Per CodeRabbit review: sort list-question value ids so the same selection in a different order is not treated as a changed answer, and catch ValidationException from the extra-question persistence path so one bad payload cannot strand the remaining import rows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(registration): review fixes for extra-question CSV import Per review: process badge data before extra questions and flush + evict the badge-features result cache so same-row badge/feature grants are visible to the question permission gates; split the upsert into resolve/merge helpers; ctype_digit for raw value ids; targeted cache forget in tests. Adds regression tests for the same-row feature grant (new + existing attendee), order-scoped skip, locked-answer skip, and badge creation for badge-less tickets (folds in #568). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(registration): badge-less ticket requires a summit without a default badge type SummitTicketType::getBadgeType falls back to the summit default badge type, so on the main fixture summit applyTo always builds a badge and a badge-less ticket cannot be constructed. Build the scenario on the second fixture summit, which has no badge types — the real case the badge creation fix covers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(registration): set support email on summit2 fixture path SummitAttendeeTicketEmail's constructor requires the summit support email; the second fixture summit never sets one, so the ticket reassignment path threw during the badge-less import test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(registration): dedupe resolved list-question value ids on ticket import Duplicated CSV tokens (drag-fill artifacts, or the same choice spelled as name/label/raw id) resolve to the same value id: they falsely tripped the single-value guard on radio/combo questions and persisted duplicated id strings for CheckBoxList, which also resisted later correction under the answer-change lock. Adds both regression tests from review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…V import (#567) * feat(registration): add order extra question answers to ticket CSV import Adds extra_question:{question name} column support to the ticket data import, template endpoint and OpenAPI docs. Answers are upserted through the existing ExtraQuestionAnswerHolder persistence path; unknown questions, order-scoped questions, disallowed questions, empty values and locked answers are logged and skipped without failing the row. List type questions accept value name/label/id ('|' separated for CheckBoxList) and store value ids. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(registration): fix badge-features import test fixture assumptions The import re-reads tickets with HINT_REFRESH, so it sees DB state: the fixture's assigned tickets share one badge entity whose FK points at only the last of them. Use an unassigned ticket, which gets its own DB-consistent badge from SummitTicketType::applyTo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(registration): normalize list answer ordering + guard import row on answer persistence Per CodeRabbit review: sort list-question value ids so the same selection in a different order is not treated as a changed answer, and catch ValidationException from the extra-question persistence path so one bad payload cannot strand the remaining import rows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(registration): review fixes for extra-question CSV import Per review: process badge data before extra questions and flush + evict the badge-features result cache so same-row badge/feature grants are visible to the question permission gates; split the upsert into resolve/merge helpers; ctype_digit for raw value ids; targeted cache forget in tests. Adds regression tests for the same-row feature grant (new + existing attendee), order-scoped skip, locked-answer skip, and badge creation for badge-less tickets (folds in #568). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(registration): badge-less ticket requires a summit without a default badge type SummitTicketType::getBadgeType falls back to the summit default badge type, so on the main fixture summit applyTo always builds a badge and a badge-less ticket cannot be constructed. Build the scenario on the second fixture summit, which has no badge types — the real case the badge creation fix covers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(registration): set support email on summit2 fixture path SummitAttendeeTicketEmail's constructor requires the summit support email; the second fixture summit never sets one, so the ticket reassignment path threw during the badge-less import test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(registration): dedupe resolved list-question value ids on ticket import Duplicated CSV tokens (drag-fill artifacts, or the same choice spelled as name/label/raw id) resolve to the same value id: they falsely tripped the single-value guard on radio/combo questions and persisted duplicated id strings for CheckBoxList, which also resisted later correction under the answer-change lock. Adds both regression tests from review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Summary
SummitOrderService::processTicketDatabadge creation for tickets without a badge had an inverted null check: it returned early when a badge type was provided, and would throw aTypeErroronSummitBadgeType::buildBadgeFromType(null)when it wasn't. Net effect: import could never create a badge — only tickets that already had one could have their badge updated.One-line fix (
!is_null→is_null) plus a regression test that imports a row for a badge-less ticket withbadge_type_nameset and asserts the badge is created with the right type.Stacked on #567 (the test reuses its import-test helpers). Retarget to
mainafter that merges, or merge in order.🤖 Generated with Claude Code