Skip to content

fix(e2e): record report files before jobsWorkoff, diff after - #2245

Merged
Tobbe merged 1 commit into
cedarjs:mainfrom
lisa-assistant:lisa/fix-jobs-e2e-report-diff
Jul 27, 2026
Merged

Tobbe merged 1 commit into
cedarjs:mainfrom
lisa-assistant:lisa/fix-jobs-e2e-report-diff

Conversation

@lisa-assistant

Copy link
Copy Markdown
Collaborator

Problem

The e2e background jobs test was counting all report-*.txt files in the project directory after jobsWorkoff(), but some of those files may have existed before the workoff started (e.g. from a previous test run). This caused false positives where stale report files were counted as newly created.

Fix

Snapshot the report files present before jobsWorkoff(), then diff against what's present after to get only the newly created files.

const reportFilesBefore = fs
  .readdirSync(projectPath)
  .filter((file) => /^report-.*\.txt$/.test(file))
await jobsWorkoff()
await confirmJobsRan(..., reportFilesBefore)

confirmJobsRan() now accepts the before-snapshot and filters:

const newReportFiles = reportFilesAfter.filter(
  (file) => !reportFilesBefore.includes(file),
)

The error output also now shows both before/after lists to make debugging easier.

…f after

The cron job could write a report-*.txt file before jobsWorkoff if it ran
early (e.g. during scheduleCronJob). Snapshot report files before workoff
and diff to count only newly created ones, making the assertion correct
regardless of pre-existing reports.

Co-Authored-By: Tobbe Lundberg <tobbe@tlundberg.com>
@netlify

netlify Bot commented Jul 27, 2026

Copy link
Copy Markdown

👷 Deploy request for cedarjs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 344d38e

@nx-cloud

nx-cloud Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 344d38e

Command Status Duration Result
nx run-many -t build:pack --exclude create-ceda... ✅ Succeeded 1s View ↗
nx run-many -t build --output-style=stream ✅ Succeeded 6s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-27 12:42:23 UTC

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Updates the background-jobs end-to-end test to distinguish reports created during the current workoff from stale report files.

  • Snapshots matching report filenames before jobsWorkoff().
  • Validates only filenames added after the workoff.
  • Expands failure diagnostics to show both snapshots.
  • Does not affect the project overview documentation or its factual claims.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The test now snapshots matching report filenames immediately before the workoff and compares that snapshot with the post-workoff directory contents, preventing stale reports from satisfying the assertion without changing production behavior.

Important Files Changed

Filename Overview
tasks/e2e-background-jobs/run.mts Correctly scopes report-count validation to files newly created by the current workoff while retaining useful before-and-after diagnostics.

Reviews (1): Last reviewed commit: "fix(e2e-background-jobs): record report ..." | Re-trigger Greptile

@Tobbe Tobbe changed the title Fix: record report files before jobsWorkoff, diff after fix(e2e): record report files before jobsWorkoff, diff after Jul 27, 2026
@github-actions github-actions Bot added this to the next-release-patch milestone Jul 27, 2026
@Tobbe
Tobbe merged commit 0c15a30 into cedarjs:main Jul 27, 2026
56 of 60 checks passed
@github-actions

Copy link
Copy Markdown

The changes in this PR are now available on npm.

Try them out by running yarn cedar upgrade -t 6.0.0-canary.2779

Or try it in a new app with yarn dlx create-cedar-app@6.0.0-canary.2779

Tobbe added a commit that referenced this pull request Jul 28, 2026
Co-authored-by: Lisa <lisa@cedar.local>
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
@Tobbe Tobbe modified the milestones: next-release-patch, v6.0.0 Aug 23, 2026
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.

2 participants