Skip to content

fix(mysql): make stats and promo code queries compatible with ONLY_FULL_GROUP_BY - #658

Open
romanetar wants to merge 1 commit into
mainfrom
fix/only-full-group-by-queries
Open

romanetar wants to merge 1 commit into
mainfrom
fix/only-full-group-by-queries

Conversation

@romanetar

@romanetar romanetar commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

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

Summary

  • Order the check-ins and tickets-bought stats by `MIN()` of the raw date column instead of the non-aggregated column, keeping chronological order.
  • Wrap the non-grouped sponsor/tier names in `ANY_VALUE()` in the promo code listing query, without adding joins (the query is already at MySQL's 61-table join limit).

Dev and CI override `sql_mode`, so these queries had never run with `ONLY_FULL_GROUP_BY`. This removes the dependency on the `sql_mode` pin.

Testing

  • Ran the three queries against a local MySQL 8.4 session with `ONLY_FULL_GROUP_BY` enabled: the previous versions fail with error 1055, the new ones run without errors (local DB is empty, so results were not compared).
  • The final check is the MySQL 8.4 CI leg.

The fourth query (`summit-reports-api`, `reports_api/reports/schema.py`) is in another repo and is not part of this PR.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Attendee check-in and ticket-purchase groups are now ordered by their earliest recorded timestamps.
    • Sponsor promo-code and discount-code results now handle sponsor tier and company-name values more consistently.

…LL_GROUP_BY

Order check-in and ticket stats by MIN() of the raw date and wrap non-grouped sponsor/tier names in ANY_VALUE() so the queries run with stock sql_mode.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
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: 3213be74-93e7-41ec-bfbf-7b3f9ce6c7fd
Commits

Reviewing files that changed from the base of the PR and between 0eac852 and 3f0332a.

Files selected for processing: 2
  • app/Models/Foundation/Summit/SummitRegistrationStats.php
  • app/Repositories/Summit/DoctrineSummitRegistrationPromoCodeRepository.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The changes update ordering in two grouped registration queries and adjust sponsor-field selection in a grouped promo-code query.

Changes: Registration group ordering

Layer / File(s) Summary
Order groups by earliest timestamp
app/Models/Foundation/Summit/SummitRegistrationStats.php
The grouped attendee check-in query orders by the earliest check-in timestamp. The grouped purchased-ticket query orders by the earliest ticket-purchase timestamp.

Promo-code grouped selection

Layer / File(s) Summary
Aggregate sponsor fields
app/Repositories/Summit/DoctrineSummitRegistrationPromoCodeRepository.php
The grouped query uses ANY_VALUE() for sponsor tier and company name in the specified promo-code and discount-code classes. The null fallbacks and aliases remain unchanged.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: smarcet

Merge Risk: Minimal · up to 3f033

No actionable merge-blocking risk remains in the reviewed query changes.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: fixing the statistics and promo-code queries for MySQL ONLY_FULL_GROUP_BY compatibility.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.
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
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

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-658/

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

@romanetar

Copy link
Copy Markdown
Collaborator Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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