Add server-side validation for contribution date range (Dec 1-24)#4857
Add server-side validation for contribution date range (Dec 1-24)#4857
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Adds server-side enforcement of the “Dec 1–24” contribution window to prevent manual date spoofing and hide existing out-of-range contributions from public pages.
Changes:
- Added a model-level
created_atvalidation for manual contributions and introduced avalid_date_rangescope. - Applied date-range filtering to homepage / contributions / language pages and updated contribution count helpers accordingly.
- Added i18n error text and expanded model specs for validation + scope behavior.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
app/models/contribution.rb |
Adds manual-contribution date validation and introduces valid_date_range scope. |
app/controllers/static_controller.rb |
Filters homepage contributions via .valid_date_range. |
app/controllers/contributions_controller.rb |
Filters contributions index/meta listings via .valid_date_range. |
app/controllers/languages_controller.rb |
Filters language contribution listings via .valid_date_range. |
app/helpers/count_helper.rb |
Updates contribution counters to exclude out-of-range contributions. |
config/locales/en.yml |
Adds localized validation error message for invalid date range. |
spec/models/contribution_spec.rb |
Adds validation and scope tests for date range behavior. |
Gemfile / .ruby-version / Gemfile.lock |
Changes Ruby version and introduces unrelated dependency churn. |
db/schema.rb |
Large schema dump churn/version bump unrelated to the described feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9090818f4e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@copilot, review those feedback and apply the necessary changes. |
All feedback has been addressed in commit dc47827. Changes include:
|
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc4782709f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@copilot, review feedback and CI failure, then apply the necessary changes. |
All feedback addressed in commit c8e7b01:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc4782709f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
bad4652 to
2f4b52d
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
2f4b52d to
8f8c88e
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f8c88e833
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
8f8c88e to
9b3a6be
Compare
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 31 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
9b3a6be to
e5627d9
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .to_sql | ||
|
|
||
| User | ||
| .by_language(@language) |
There was a problem hiding this comment.
users_with_valid_date_range_counts builds a relation starting from User.by_language(@language), which joins(:skills) and can return duplicate user rows if a user has multiple skills records for the same language (there’s no uniqueness constraint/validation). This can break pagination (duplicate users across pages) and ordering. Consider adding .distinct (or grouping by users.id) to ensure each user appears once.
| .by_language(@language) | |
| .by_language(@language) | |
| .distinct |
|
Need more effort to polish. |
Replace year-based contribution queries in controllers and helper counts with valid_date_range for December 1-24. Validate manual contribution dates against the current campaign year, and align homepage totals with the same filtered scope. Align the year scope lower bound with validation and valid_date_range by including December 1st at midnight. Use locale-aware date formatting for invalid_date_range interpolation so month names follow I18n.locale. Add created_at validation with an i18n error key and translate invalid_date_range across all locales to keep locale keys consistent for i18n spec checks. Add model specs for in-range and out-of-range dates. Fix #3492 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
e5627d9 to
cd47a71
Compare
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@andrew I think this is ready for you to review! |
Fix: Prevent contributions with dates outside valid range (1-24 December)
Latest Changes (CI Failure Fix)
Fixed CI test failures:
count_helper.rbto useyear_for_countprivate method that checks ifcurrent_yearis available (from controller context) or falls back toTfpullrequests::Application.current_year(in test isolation)invalid_date_rangeerror messageOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.