Skip to content

Fix flaky time of day filter scenario in post.feature - #706

Merged
swissspidy merged 1 commit into
mainfrom
claude/fix-flaky-post-time-filter
Dec 4, 2026
Merged

swissspidy merged 1 commit into
mainfrom
claude/fix-flaky-post-time-filter

Conversation

@swissspidy

@swissspidy swissspidy commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Filtering by meta, time of day and order in features/post.feature fails about once every 60 runs.

Cause: the Locked post and the default Hello world! post got the current time as their date. Whenever either was created at second 7 of a minute, wp post list --second=7 --field=post_title returned it next to Timed. That is how it failed in the PHP 8.6 / WP trunk / SQLite job on #705:

--- Expected
+++ Actual
@@ @@
+Locked
 Timed

The --hour=5 --minute=6 step had the same problem, just less often.

Changes:

  • Locked is created with a fixed --post_date whose hour, minute and second don't match the filters.
  • The default post gets a fixed date too, through wp post update 1 --post_date=....

The expected output is unchanged.

Testing: WP_CLI_TEST_DBTYPE=sqlite composer behat -- features/post.feature:732 passes locally.


Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Updated the filtering scenario to use fixed dates for posts and verify that updating a post succeeds.

The 'Locked' post and the default 'Hello world!' post got the current time
as their date, so `wp post list --second=7` also returned them whenever
they were created at second 7 of a minute.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWTd5n3ZupvgHr4fEBJCGp
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The filtering scenario now sets a fixed date for the password-protected Locked post. It also updates post 1 to a fixed date and checks for the success message.

Changes: Post date scenario

Layer / File(s) Summary
Set and update post dates
features/post.feature
The scenario sets a date when it creates the Locked post, updates post 1’s date, and checks for the success message.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: schlessera, ernilambar

Merge Risk: Minimal · up to 45a6f

This change makes a flaky test deterministic by giving two posts fixed dates. It does not affect production behavior, and I found no merge-blocking risk.

Architecture risk: Low · up to 45a6f

The post-date filtering scenario now uses fixed creation and update dates, making its test inputs reproducible without changing runtime post-update behavior.

Changed areas: features

Review details

Systems and components

  • observed — 1 changed file mapped to features.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: it fixes a flaky time-of-day filter scenario in features/post.feature. The raw summary confirms the feature file changes: the Locked post gets a fixed date and post 1 is up…
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.
Full details: Title check

Explanation

The title names the change: it fixes a flaky time-of-day filter scenario in features/post.feature. The raw summary confirms the feature file changes: the Locked post gets a fixed date and post 1 is updated to another fixed date. The objectives say the flakiness came from both posts receiving the current time. The title is specific and matches the main change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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: fdb750b9-b552-4013-9aa7-93fdec860667
Commits

Reviewing files that changed from the base of the PR and between 2f2baa2 and 45a6f86.

Files selected for processing: 1

  • features/post.feature

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

@github-actions github-actions Bot added bug command:post-list Related to 'post list' command scope:testing Related to testing labels Dec 4, 2026
@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy
swissspidy marked this pull request as ready for review December 4, 2026 21:26
@swissspidy
swissspidy requested a review from a team as a code owner December 4, 2026 21:26
Copilot AI balanced review requested due to automatic review settings December 4, 2026 21:26

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@swissspidy
swissspidy merged commit b510aa1 into main Dec 4, 2026
78 checks passed
@swissspidy
swissspidy deleted the claude/fix-flaky-post-time-filter branch December 4, 2026 22:11
@github-actions github-actions Bot added this to the 3.0.7 milestone Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:post-list Related to 'post list' command scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants