Skip to content

Deploy: remove pages of code_ids and list_ids that no longer exist - #461

Open
valbert4 wants to merge 1 commit into
mainfrom
fix/remove-stale-pages
Open

valbert4 wants to merge 1 commit into
mainfrom
fix/remove-stale-pages

Conversation

@valbert4

Copy link
Copy Markdown
Member

The site's deploy step (yarn s3-deploy) uploads files but never deletes them. Pages of codes whose YAML was deleted, or whose code_id was renamed, therefore stay online. The same holds for code lists.

A check of every code_id that ever appeared in this repository's history (1,292) found two such pages still live: /c/golden_code (its YAML was removed on 2026-04-22) and /list/single (removed on 2024-04-29). The other 114 retired ids already return 404.

This PR adds one step to build-and-deploy-site.yml and devsite-build-and-deploy.yml, before the main upload:

  • list the S3 objects under c/ and list/;
  • delete each object that the fresh build did not produce, and print what was deleted;
  • abort without deleting if the build has fewer than 10 files under a prefix, or if more than 50 objects would be deleted (a guard against an empty build or a different S3 key layout).

The deploy step that follows invalidates the CloudFront cache, so the removed pages return 404 afterwards. Nothing is redirected: only current code_id and list_id pages stay on the site.

Tested: YAML loads, the shell passes bash -n, and a simulation with a stub aws command deletes exactly c/golden_code.html and list/single.html. Not tested against the real bucket. The first run's log lists every deleted key, and the step needs s3:ListBucket and s3:DeleteObject for the deploy credentials (the earlier deploy action used delete-removed: true, so they likely have them).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NyJvrSZfCdKrfziCXK643Q

s3-deploy uploads files but never deletes them, so pages of deleted or
renamed codes and code lists stay online (e.g. /c/golden_code, /list/single).
Before the main upload, delete every S3 object under c/ and list/ that the
build did not produce. Abort if the build has fewer than 10 files under a
prefix or if more than 50 objects would be deleted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NyJvrSZfCdKrfziCXK643Q
@valbert4

Copy link
Copy Markdown
Member Author

@phfaist

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