Skip to content

Add manual workflow to mark all syndication cache entries as sent#176

Merged
aarongustafson merged 4 commits intomainfrom
copilot/update-syndication-cache-to-sent
May 6, 2026
Merged

Add manual workflow to mark all syndication cache entries as sent#176
aarongustafson merged 4 commits intomainfrom
copilot/update-syndication-cache-to-sent

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

  • Create .github/scripts/mark-all-sent.js — marks all cache entries (and optionally live feed items) as sent for all platforms
  • Create .github/workflows/mark-all-sent.yml — manual workflow_dispatch action that restores cache, runs the script, and saves the updated cache
  • Fix: defensively initialize cache[type] and cache[type][itemId].platforms in markAllPlatformsSuccessful to handle partial/corrupt cache files
  • Fix: use a Set per content type to track unique item IDs, preventing double-counting when alsoFetchFeeds overlaps with existing cache entries
  • Fix: readCache() now distinguishes ENOENT (bootstrap fresh) from a corrupt/unparseable file (throw with a clear message) to prevent silent data loss
  • Fix: feed fetch failures are now hard errors (re-throw) when alsoFetchFeeds is enabled so the workflow exits non-zero instead of silently succeeding with incomplete data

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for aaron-gustafson ready!

Name Link
🔨 Latest commit bc17dd3
🔍 Latest deploy log https://app.netlify.com/projects/aaron-gustafson/deploys/69fae493cc9b0a0008c1e3d0
😎 Deploy Preview https://deploy-preview-176--aaron-gustafson.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@aarongustafson aarongustafson marked this pull request as ready for review May 6, 2026 06:04
@aarongustafson aarongustafson requested a review from Copilot May 6, 2026 06:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a manual, dispatch-only GitHub Actions workflow plus a companion script to bulk-update the syndication cache (.github/cache/syndication-status.json) so existing posts/links are treated as already sent across supported platforms, with optional live-feed fetching and a dry-run mode.

Changes:

  • Introduces .github/scripts/mark-all-sent.js to stamp cache entries (and optionally feed items) as successful across the relevant platforms with a markedManually flag.
  • Adds .github/workflows/mark-all-sent.yml to run the script via workflow_dispatch, reusing the existing syndication cache restore/save and concurrency patterns.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/mark-all-sent.yml New manual workflow to restore the syndication cache, run the “mark all sent” script (optionally fetching feeds), then save the updated cache.
.github/scripts/mark-all-sent.js New script to update all cache entries (and optionally feed items) to { success: true, markedManually: true } across configured platforms.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/scripts/mark-all-sent.js
Comment thread .github/scripts/mark-all-sent.js
@aarongustafson
Copy link
Copy Markdown
Owner

@copilot please review the PR feedback and adjust the PR

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 6, 2026

@copilot please review the PR feedback and adjust the PR

Done in e0981a5. Two fixes were applied to mark-all-sent.js:

  1. Defensive initializationmarkAllPlatformsSuccessful now checks that cache[type], cache[type][itemId], and cache[type][itemId].platforms each exist and are objects before writing to them, so a partial or corrupt cache file won't cause an uncaught TypeError.

  2. Accurate unique-item counts — replaced the separate cacheCount/feedCount integers with a per-type Set of item IDs. Both the existing-cache pass and the live-feed pass add to the same set, so overlapping items are counted exactly once and the dry-run totals reflect the real number of unique items changed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread .github/scripts/mark-all-sent.js Outdated
Comment thread .github/scripts/mark-all-sent.js Outdated
@aarongustafson
Copy link
Copy Markdown
Owner

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 6, 2026

@copilot apply changes based on the comments in this thread

Done in 5470f49. Both reviewer comments from that thread are addressed:

  1. readCache() no longer swallows all errors — it now catches only ENOENT (file absent → bootstrap fresh) and re-throws any other I/O error. If the file exists but cannot be parsed, it throws with a clear message identifying the cache path, so the workflow fails rather than silently overwriting recoverable state.

  2. Feed fetch failures are now hard errors — when alsoFetchFeeds is true the try/catch around fetchFeed is gone; the error propagates to main() and then to the top-level .catch(), causing the process to exit non-zero. The workflow will fail visibly instead of succeeding with only the existing cache entries marked.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread .github/scripts/mark-all-sent.js Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@aarongustafson aarongustafson merged commit 3efe239 into main May 6, 2026
4 of 5 checks passed
@aarongustafson aarongustafson deleted the copilot/update-syndication-cache-to-sent branch May 6, 2026 06:50
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.

3 participants