Skip to content

chore(devex): block new schedules at minute zero - #106997

Draft
aspicer wants to merge 2 commits into
aspicer/jitter-basefrom
aspicer/jitter-lint-rule
Draft

aspicer wants to merge 2 commits into
aspicer/jitter-basefrom
aspicer/jitter-lint-rule

Conversation

@aspicer

@aspicer aspicer commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Problem

Nothing stops a new schedule from starting at minute zero, so the pile-up that the other split PRs remove would come back. Split from #106458.

Changes

A devex semgrep rule fails CI on Celery beat, Dagster and Temporal schedules that start at minute zero of every hour or every N hours. Its message explains how to pick a minute or an offset, and when to keep the boundary with a stated exemption.

Batch exports keep their boundaries with an exemption, because each run exports the interval that just closed and batch export jitter already spreads the start. A test pins the rolling-window schedules (trace summarization, evaluation sampling and replay count metrics) to offset zero with no jitter, because a later start would skip data.

Warning

Merge this last. The rule scans the whole tree, so its semgrep-devex check fails until the team PRs land. On this branch it reports 24 schedules, and #106985 #106986 #106987 #106990 #106991 #106993 #106994 #106995 clear all of them.

How did you test this code?

The rule's semgrep test fixture passes. Semgrep 1.167.0 finds no violations with every split PR applied to master. The pinning test passes locally.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Release status

  • No feature flag controls this change
  • This change is behind a feature flag and is not available to users
  • This change makes a previously flagged feature available to everyone

Automatic notifications

  • Publish to changelog?

Docs update

None. The rule message carries the guidance.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, Claude Opus 5.5; Codex, GPT-6 (review fixes on #106458).

Split from #106458 by owning team: the owners.yaml resolver decided ownership, and a team gets its own PR when its owned files clear the reviewer assigner's bar of 10 lines or 3 files. The code is unchanged from the reviewed head of #106458, except that its signals test-fixture fix dropped because #106460 fixed the same bug on master. CodeRabbit CLI ran once with --deep over all the split PRs combined on master 8475a79 and reported no findings. Skills for the split: stacking-prs, establishing-code-ownership, reviewing-with-coderabbit, writing-pr-descriptions. The original change also used qa-team, announcing-behavior-changes, writing-tests, writing-code-comments, writing-ui-components, writing-user-facing-copy, running-ci-preflight and debugging-ci-failures.

A devex semgrep rule fails CI on Celery beat, Dagster, and Temporal
schedules that start at minute zero of every hour or every N hours.
Batch exports keep their boundaries with a nosemgrep reason, because
each run exports the interval that just closed.

A test pins the three rolling-window schedules to offset zero with no
jitter, so a later offset cannot make them skip data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aspicer aspicer self-assigned this Sep 25, 2026
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

🚨 Comment density — 30% of added code lines are comments (31 of 102)

This section warns when comments are more than 3% of the code lines a PR adds, and alerts above 6%. Before agent-assisted PRs, the typical share was about 2%. Only full-line comments count. Docstrings, generated files, snapshots, migrations, and workflow files are left out.

Comments that restate the code, record how the change came about, or narrate the next line add noise for the next reader. Keep the comments that explain a reason the code cannot show, and remove the rest. See .agents/skills/writing-code-comments/SKILL.md for the house rules.

Files with the most added comment lines:

File Comment lines Added lines
.semgrep/rules/devex/schedule-must-avoid-minute-zero.py 30 69
products/batch_exports/backend/service.py 1 1

This check does not block merging. It updates on every push and clears when the share drops.

@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

[Medium risk] Adds a linting rule for schedule timing patterns.

The PR is not ready to merge while the blocking rule fails on existing schedules and misses supported ways to declare new boundary schedules.

Reviews (1) · Last reviewed commit: "chore(devex): block new schedules at min..."

Comment thread .semgrep/rules/devex/schedule-must-avoid-minute-zero.yaml
Comment thread .semgrep/rules/devex/schedule-must-avoid-minute-zero.yaml Outdated
Comment thread .semgrep/rules/devex/schedule-must-avoid-minute-zero.yaml Outdated
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: PostHog/posthog/.coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: a9aafef2-0c57-4da9-b417-79cc78f6dd81

📥 Commits

Reviewing files that changed from the base of the PR and between b486e61 and e099af5.

📒 Files selected for processing (2)
  • .semgrep/rules/devex/schedule-must-avoid-minute-zero.py
  • .semgrep/rules/devex/schedule-must-avoid-minute-zero.yaml

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


📝 Walkthrough

Walkthrough

Adds a Semgrep rule for selected Celery, Dagster, and Temporal schedules, with annotated cases for matches and non-matches. Adds Temporal tests that check fixed-window schedule intervals against lookback windows and verify zero offsets. Adds a suppression comment for the batch export interval schedule; its configuration is unchanged.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to e099a

The rule’s broad cron-string matching matches its intended scope. No identified issue currently blocks merging after normal checks.

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description follows the required structure and clearly explains the problem, user-visible changes, testing, release status, documentation status, and agent context. It includes the merge-order war…
✨ Finishing Touches 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: PostHog/posthog/.coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 69ce5685-08c1-42bf-acf8-5918882ff077

📥 Commits

Reviewing files that changed from the base of the PR and between e107332 and b486e61.

📒 Files selected for processing (4)
  • .semgrep/rules/devex/schedule-must-avoid-minute-zero.py
  • .semgrep/rules/devex/schedule-must-avoid-minute-zero.yaml
  • posthog/temporal/tests/test_schedule.py
  • products/batch_exports/backend/service.py

Included review availability: Your plan provides up to 12 included reviews per hour; 0 remain after this review.

Comment thread .semgrep/rules/devex/schedule-must-avoid-minute-zero.yaml Outdated
Comment thread .semgrep/rules/devex/schedule-must-avoid-minute-zero.yaml Outdated
@trunk-io

trunk-io Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

The rule now matches a minute-zero hourly cron string wherever it is
written, so a constant or environment default in another module is
reported at its definition. A Temporal interval with offset None or a
zero timedelta now counts as having no offset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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