Skip to content

Fix inverted badge type null check on ticket data import - #568

Closed
JpMaxMan wants to merge 2 commits into
feature/ticket-import-extra-question-answersfrom
fix/ticket-import-badge-creation
Closed

Fix inverted badge type null check on ticket data import#568
JpMaxMan wants to merge 2 commits into
feature/ticket-import-extra-question-answersfrom
fix/ticket-import-badge-creation

Conversation

@JpMaxMan

@JpMaxMan JpMaxMan commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

SummitOrderService::processTicketData badge creation for tickets without a badge had an inverted null check: it returned early when a badge type was provided, and would throw a TypeError on SummitBadgeType::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_nullis_null) plus a regression test that imports a row for a badge-less ticket with badge_type_name set and asserts the badge is created with the right type.

Stacked on #567 (the test reuses its import-test helpers). Retarget to main after that merges, or merge in order.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fbdf69ec-c72b-4e92-a0f9-29829fb72974

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ticket-import-badge-creation

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

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

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

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

JpMaxMan and others added 2 commits July 2, 2026 21:05
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>
@JpMaxMan
JpMaxMan force-pushed the fix/ticket-import-badge-creation branch from 9de9557 to c1a769b Compare July 3, 2026 02:11
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

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

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

@JpMaxMan
JpMaxMan requested review from romanetar and smarcet July 3, 2026 15:56
JpMaxMan added a commit that referenced this pull request Jul 3, 2026
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>
@JpMaxMan

JpMaxMan commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #567: the badge-block restructure there necessarily absorbed this one-line fix, and the regression test now lives in that branch.

@JpMaxMan JpMaxMan closed this Jul 3, 2026
smarcet pushed a commit that referenced this pull request Jul 6, 2026
…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>
smarcet pushed a commit that referenced this pull request Jul 7, 2026
…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>
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.

1 participant