Skip to content

Add redirect links, Pages deployment, and analytics publishing - #179

Open
flufflycthu1u wants to merge 8 commits into
masterfrom
redirect-system-v1
Open

flufflycthu1u wants to merge 8 commits into
masterfrom
redirect-system-v1

Conversation

@flufflycthu1u

@flufflycthu1u flufflycthu1u commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Posts now link to https://www.cutepetsboston.com/r/?id=<slug> rather than directly to shelter listings. Redirect mappings are append-only on gh-pages, and the Pages interstitial safely resolves them.

Changes

  • Add stable, collision-resistant redirect slug minting with HTTP(S)-target validation and safe fallbacks.
  • Split Pages publishing into a reusable workflow with read-only posting and separately scoped publishing permissions.
  • Persist redirect mappings on gh-pages and deploy the site through GitHub Pages.
  • Carry engagement metrics into the generated dashboard.html analytics page and persist the latest page on gh-pages.
  • Move website assets into src/; keep docs/ for project specifications.
  • Add redirect, analytics, and orchestration coverage.
  • Add the project Land skill, which prepares this PR for manual review and merge without merging to master.

Verification

  • pytest: 167 passed, 1 skipped.
  • Workflow YAML parsing and Pages-source assembly validated locally.

Review and merge into master remain manual.

flufflycthu1u and others added 6 commits September 18, 2026 17:42
Posts now link to cutepetsboston.com/r/?id=<slug> rather than straight to the
shelter listing, so click-through can be attributed per pet (RFC 0001). The
slug -> adoption URL mapping is append-only and lives on the gh-pages branch;
docs/r/index.html resolves it client-side and falls back to the homepage when
a slug is unknown or the fetch fails.

Pages publishing moves into a reusable workflow, publish-pages.yml, called by
both prod.yml and deploy-pages.yml:

- prod.yml splits into two jobs so the job that posts pets runs with a
  read-only token; only the publish job holds contents/pages/id-token write.
  A composite action could not do this, as it inherits the calling job's token.
- Both callers share the pages-publish concurrency group, so a docs push and
  the 4-hourly cron can no longer deploy Pages at the same time.
- The mapping is merged rather than copied (jq -s '.[0] * .[1]' with gh-pages
  winning conflicts), so a failed fetch can no longer wipe existing redirects.
- The deploy job declares environment: github-pages, which actions/deploy-pages
  requires and prod.yml previously lacked.

Fixes in redirects.py and the interstitial:

- a corrupt mapping no longer blocks posting; it logs and posts the raw URL,
  leaving the damaged file untouched rather than silently rebuilding it
- slugs are injective, so two distinct pet ids can no longer collapse onto one
  slug and point a post at the wrong pet's listing
- load_redirects/save_redirects resolve the default path at call time rather
  than binding it at import
- only http(s) targets are followed or recorded, so a javascript: URL coming
  from the RescueGroups API cannot execute on our own origin
- redirects.json is gitignored; the gh-pages commit therefore uses git add -f

docs/specs/redirect-pipeline.md diagrams the pipeline as built and how the
planned analytics page attaches to it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@flufflycthu1u flufflycthu1u changed the title Add redirect link system and scope Pages publishing to its own job Add redirect links, Pages deployment, and analytics publishing Sep 22, 2026

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