Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
e9a9b06
refactor(sports): one loader, one layout shape, shared helpers
anthonysantiago-eng Nov 16, 2026
2a5db84
fix(sports): scoreboard, editor pins, kicker, caching and feed hardening
anthonysantiago-eng Nov 16, 2026
9aab904
fix(sports): clear sport fields outside Sports; update sports docs
anthonysantiago-eng Nov 16, 2026
5d1c7e0
feat(news): curated News page, Student Government timelines
anthonysantiago-eng Nov 13, 2026
68b8a0a
feat(news): Student Government terms, one timeline page, News page se…
anthonysantiago-eng Nov 16, 2026
33b205e
feat(news): "Missed something?" search at the foot of the News page
anthonysantiago-eng Nov 17, 2026
3dde0f6
feat(header): mark the current section in the masthead; drop the News…
anthonysantiago-eng Nov 17, 2026
c89b5b7
fix(header, sports): keep the section bar over the score strip; flush…
anthonysantiago-eng Nov 17, 2026
3b62f12
feat(news): photos on the strips under the lead; keep the lead on the…
anthonysantiago-eng Nov 17, 2026
7896a4a
docs(news): strips under the lead now carry a photo
anthonysantiago-eng Nov 17, 2026
c881431
feat(news): Terms list replaces the shelf; Senate / E-Board switch sl…
anthonysantiago-eng Nov 17, 2026
6685b25
Fix opinion security, layout persistence, archives, and accessibility
anthonysantiago-eng Nov 17, 2026
36bb4c9
fix(deps): match esbuild to the workspace override so frozen installs…
anthonysantiago-eng Nov 17, 2026
0fd4c29
feat(news): Senate / E-Board switch slides the panel and stream like …
anthonysantiago-eng Nov 17, 2026
57dd987
feat(news): plain text link replaces the book on past terms
anthonysantiago-eng Nov 17, 2026
ee5a928
feat(news): strip photos follow the text's height; lead photo grows b…
anthonysantiago-eng Nov 17, 2026
b0f0e17
fix(news): restrict layout writes to News editors
anthonysantiago-eng Nov 17, 2026
dad25cb
fix(news): reject failed layout reads before activation
anthonysantiago-eng Nov 17, 2026
749a293
fix(news): reject concurrent layout activations atomically
anthonysantiago-eng Nov 17, 2026
8729b26
fix(news): preserve edits made during activation
anthonysantiago-eng Nov 17, 2026
4ce310d
fix(news): guard unsaved editor navigation
anthonysantiago-eng Nov 17, 2026
3942a1a
fix(news): link docket updates to their own terms
anthonysantiago-eng Nov 17, 2026
b95dcd4
fix(news): paginate archive queries before selecting stories
anthonysantiago-eng Nov 17, 2026
cc3de97
fix(news): keep government stories out of automatic placements
anthonysantiago-eng Nov 17, 2026
289cf62
fix(news): respect reduced motion in topic navigation
anthonysantiago-eng Nov 17, 2026
95a155b
chore(seed): rebuild the features seed on the news fixture photos
anthonysantiago-eng Nov 18, 2026
7fcdb6d
feat(features): remove Upcoming Events and the Collar City Column
anthonysantiago-eng Nov 18, 2026
9e582cf
feat(features): rebalance the desktop layout around the lead
anthonysantiago-eng Nov 18, 2026
f1756f0
feat(features): one responsive layout, a type scale, a phone design
anthonysantiago-eng Nov 18, 2026
e42f66f
fix(features): topic sections only auto-fill matching stories
anthonysantiago-eng Nov 18, 2026
648aeba
merge: Features cleanup into the December launch
anthonysantiago-eng Nov 18, 2026
e462a53
feat(features): drop the header row, as News did
anthonysantiago-eng Nov 18, 2026
1432a3a
merge: PR #181 Opinion cleanup into the December launch
anthonysantiago-eng Nov 18, 2026
24045e6
merge: PR #180 Sports cleanup into the December launch
anthonysantiago-eng Nov 18, 2026
2189046
fix(header): keep the top bar's date clear of the links at 1024–1080px
anthonysantiago-eng Nov 19, 2026
a95ca31
fix(a11y): name the header controls and add a skip-to-content link
anthonysantiago-eng Nov 19, 2026
0c28e4e
feat(theme): follow the device's dark mode until the reader picks
anthonysantiago-eng Nov 19, 2026
f5893ef
fix(article): keep the drop cap inside a one-line first paragraph
anthonysantiago-eng Nov 19, 2026
c9284d4
fix(article): stop the byline under a photo reading as its credit
anthonysantiago-eng Nov 19, 2026
fe43907
fix(article): include write-in authors in the end-of-article sign-off
anthonysantiago-eng Nov 19, 2026
9003ac7
fix(theme): build the head script without JSON.stringify
anthonysantiago-eng Nov 19, 2026
859fe87
copy(header): reword the dark mode prompt as an offer
anthonysantiago-eng Nov 19, 2026
dfc22cf
chore(lint): remove unused declarations and migration arguments
anthonysantiago-eng Nov 19, 2026
855aa5c
fix(animation): remove unused footsteps callback dependency
anthonysantiago-eng Nov 19, 2026
19b8d55
chore(theme): remove obsolete lint suppression
anthonysantiago-eng Nov 19, 2026
6ea3b16
chore(lint): allow plain images in CMS layout previews
anthonysantiago-eng Nov 19, 2026
1aaa19c
docs(dev): document lint baseline and CMS preview policy
anthonysantiago-eng Nov 19, 2026
68db805
feat(news): make student government panel tint adjustable
anthonysantiago-eng Nov 19, 2026
e6f423f
fix(sports): advance full desktop headline carousel rows
anthonysantiago-eng Nov 19, 2026
86fb076
feat(sports): support touch scrolling and mouse dragging in headlines
anthonysantiago-eng Nov 19, 2026
bf50ad1
feat(sports): add momentum to score and headline swipes
anthonysantiago-eng Nov 19, 2026
1521441
fix(sports): hide scrolling edge overlays on mobile
anthonysantiago-eng Nov 19, 2026
6c4947f
fix(sports): halve the gap below headline images
anthonysantiago-eng Nov 19, 2026
83756f8
feat(sports): enable desktop score strip dragging and coasting
anthonysantiago-eng Nov 19, 2026
d5238ab
fix(sports): default mobile standings to the leftmost sport
anthonysantiago-eng Nov 19, 2026
fc0b281
feat(sports): allow desktop grab scrolling in standings tabs
anthonysantiago-eng Nov 19, 2026
f7d0f9f
style(sports): refine headline arrows with translucent glass
anthonysantiago-eng Nov 19, 2026
8b40b80
fix(sports): halve tablet standings-to-headlines gap
anthonysantiago-eng Nov 19, 2026
d396fb6
fix(sports): extend mobile scores and standings to screen edges
anthonysantiago-eng Nov 19, 2026
ae4b147
fix(sports): remove mobile gap above headlines
anthonysantiago-eng Nov 19, 2026
7f6e7a7
fix(sports): join full-width mobile scores to the date bar
anthonysantiago-eng Nov 19, 2026
ac449c9
fix(sports): fit standings underlines to their labels
anthonysantiago-eng Nov 19, 2026
40f546d
feat(sports): animate the standings selection underline
anthonysantiago-eng Nov 19, 2026
40f89f1
feat(sports): swipe standings content when switching sports
anthonysantiago-eng Nov 19, 2026
b976aa5
fix(sports): add breathing room below mobile standings
anthonysantiago-eng Nov 19, 2026
347f6aa
feat(header): slide the section underline left on logo navigation
anthonysantiago-eng Nov 19, 2026
f35e000
feat(header): slide section underlines in from the homepage
anthonysantiago-eng Nov 19, 2026
ec62bef
fix(ci): backport Payload CLI import and exit handling
anthonysantiago-eng Nov 19, 2026
a0a65be
fix(articles): halve space below the top strip
anthonysantiago-eng Nov 19, 2026
e420bb6
feat(articles): share section and kicker labels across layouts
anthonysantiago-eng Nov 19, 2026
e3a1a09
fix(articles): render article titles at regular weight
anthonysantiago-eng Nov 19, 2026
4816a28
fix(articles): replace tablet masthead with section dropdown
anthonysantiago-eng Nov 19, 2026
96227fd
fix(articles): match phone tablet and desktop scroll behavior
anthonysantiago-eng Nov 19, 2026
6b489fa
fix(articles): reduce opening space by a quarter
anthonysantiago-eng Nov 19, 2026
1d302c4
fix(news): unbold article recommendation headlines
anthonysantiago-eng Nov 19, 2026
dd9e698
fix(news): halve spacing around continue reading
anthonysantiago-eng Nov 19, 2026
74891a0
fix(articles): use shared mobile drawer for tablet menu
anthonysantiago-eng Nov 19, 2026
d0f7635
feat(navigation): redesign shared mobile drawer as accessible modal
anthonysantiago-eng Nov 19, 2026
0f70beb
feat(navigation): reuse section footer search in mobile drawer
anthonysantiago-eng Nov 19, 2026
730819b
feat(navigation): show latest articles in tablet drawer
anthonysantiago-eng Nov 19, 2026
ddbfc0e
fix(navigation): keep drawer open when changing theme
anthonysantiago-eng Nov 19, 2026
783cd55
feat(navigation): add Get involved hub
anthonysantiago-eng Nov 19, 2026
9359b78
fix(get-involved): tighten mobile bottom spacing
anthonysantiago-eng Nov 19, 2026
7620eeb
fix(get-involved): refine tablet and desktop layout
anthonysantiago-eng Nov 19, 2026
5c65ab9
fix(get-involved): group desktop paths into columns
anthonysantiago-eng Nov 19, 2026
c8a350e
fix(get-involved): refine phone and tablet typography
anthonysantiago-eng Nov 19, 2026
7fcacff
feat(get-involved): add event and advertising block
anthonysantiago-eng Nov 19, 2026
c89000b
fix(navigation): link header Submit to Get involved
anthonysantiago-eng Nov 19, 2026
68d75cc
fix(get-involved): remove desktop hero divider and excess space
anthonysantiago-eng Nov 19, 2026
d616991
feat(get-involved): animate desk dropdown transitions
anthonysantiago-eng Nov 19, 2026
4c4d412
fix(get-involved): minimize desktop footer spacing
anthonysantiago-eng Nov 19, 2026
1eafd56
fix(get-involved): use Features email for event inquiries
anthonysantiago-eng Nov 20, 2026
d1901a0
content(get-involved): revise desk descriptions and remove two desks
anthonysantiago-eng Nov 20, 2026
de6c622
fix(get-involved): tighten desktop spacing below news tips
anthonysantiago-eng Nov 20, 2026
74a8754
fix(get-involved): remove tip divider and tighten responsive spacing
anthonysantiago-eng Nov 20, 2026
011a3fd
fix(get-involved): balance phone and tablet introduction
anthonysantiago-eng Nov 20, 2026
27a0865
feat(navigation): show latest story in phone drawer
anthonysantiago-eng Nov 20, 2026
3c1ab22
fix(navigation): give drawer section rows more space
anthonysantiago-eng Nov 20, 2026
81fc08e
fix(navigation): preserve drawer blur during theme reveal
anthonysantiago-eng Nov 20, 2026
38d56b8
feat(navigation): promote get involved in drawer paper links
anthonysantiago-eng Nov 20, 2026
a1aded1
feat(news): simplify opening stories and move topics up
anthonysantiago-eng Nov 21, 2026
7b65c3f
feat(news): show three topic stories and four on tablets
anthonysantiago-eng Nov 21, 2026
beb46fa
feat(news): show six topic stories on desktop
anthonysantiago-eng Nov 21, 2026
00754da
feat(news): add tablet story row above student government
anthonysantiago-eng Nov 21, 2026
5b7a329
feat(news): show under-lead subdecks on tablets
anthonysantiago-eng Nov 21, 2026
59910ad
feat(news): add mobile topic scroll arrow
anthonysantiago-eng Nov 22, 2026
2e44069
feat(news): combine topic dragging with an edge-aware arrow
anthonysantiago-eng Nov 22, 2026
68ec242
feat(news): animate topic arrows in and out from their edges
anthonysantiago-eng Nov 22, 2026
8e42546
fix(news): match opening gap to the mobile date strip
anthonysantiago-eng Nov 22, 2026
822961f
feat(sports): show single-game and weekend scores in recaps and leads
anthonysantiago-eng Nov 22, 2026
9d6d127
fix(sports): give scoreboards more breathing room
anthonysantiago-eng Nov 22, 2026
2dc6253
feat(sports): link scoreboards to teams and game recaps
anthonysantiago-eng Nov 22, 2026
e1101a7
fix(sports): center the score rows on the winner arrow
anthonysantiago-eng Nov 22, 2026
4a2d0d3
fix(sports): tighten article recommendations spacing
anthonysantiago-eng Nov 22, 2026
d700188
fix(articles): keep the menu visible on phones and tablets
anthonysantiago-eng Nov 22, 2026
8082a83
fix(articles): pin desktop toolbar during pinch zoom
anthonysantiago-eng Nov 22, 2026
b3123d7
fix(sports): remove rules around single-game scorebugs
anthonysantiago-eng Nov 22, 2026
99c2e7a
fix(sports): scale inline single-game scorebugs to article typography
anthonysantiago-eng Nov 22, 2026
80a9419
fix(sports): emphasize the inline single-game score
anthonysantiago-eng Nov 22, 2026
bd834fd
fix(sports): prevent standings tabs from resizing desktop columns
anthonysantiago-eng Nov 22, 2026
3ad7388
feat(articles): link section labels to landing pages
anthonysantiago-eng Nov 22, 2026
ee804c5
feat(articles): animate section link underlines
anthonysantiago-eng Nov 22, 2026
027bfc3
fix(news): simplify student government timeline panel headers
anthonysantiago-eng Nov 22, 2026
55c9d5b
fix(news): lift desktop student government panel headings
anthonysantiago-eng Nov 22, 2026
6e82556
docs: bring agent and developer references up to date
anthonysantiago-eng Nov 22, 2026
24dbb50
merge: main into december (short links, #183)
anthonysantiago-eng Nov 22, 2026
55d4ec3
fix(redirects): reserve /get-involved for the site's own page
anthonysantiago-eng Nov 22, 2026
ef38385
feat(get-involved): show a pinned photo through the page's openings
anthonysantiago-eng Nov 24, 2026
e6a53a1
feat(bylines): one byline convention and section date rules
anthonysantiago-eng Nov 24, 2026
83f9176
feat(features): open the page with a cover of the top stories
anthonysantiago-eng Nov 24, 2026
c959516
feat(features): pinned photo band between the cover and the sections
anthonysantiago-eng Nov 24, 2026
a3c7b48
fix(news): show the under-lead subdeck at every width
anthonysantiago-eng Nov 24, 2026
d682e6e
fix(news): drop the overlay lead's photo darkening on hover
anthonysantiago-eng Nov 24, 2026
1ba5c8d
feat(features): section list, Features Index and a second photo window
anthonysantiago-eng Nov 24, 2026
aa91897
fix(types): type static image imports without next-env.d.ts
anthonysantiago-eng Nov 24, 2026
1bc3822
feat(features): design preview page at /features/preview
anthonysantiago-eng Nov 24, 2026
7e2d45f
feat(features): new Features page with sections, photo reel and filte…
anthonysantiago-eng Nov 25, 2026
b050bc5
feat(features): tested story plan, editor pins, Latest row and full-h…
anthonysantiago-eng Nov 25, 2026
0a1e0f1
feat(features): per-screen top layout, pitch photo positions, mobile …
anthonysantiago-eng Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ jobs:
- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Verify Payload CLI backport
run: pnpm test:payload-cli

- name: Run Payload Migrations
# `payload migrate` has exited 0 without applying anything, which only
# surfaced later as missing tables in the build.
run: |
set -o pipefail
echo "y" | pnpm exec payload migrate 2>&1 | tee migrate.log
grep -q 'Done\.' migrate.log || { echo "::error::payload migrate did not finish"; exit 1; }

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ jobs:
-c "SELECT id FROM sports_page_layout LIMIT 0;" \
-c "SELECT id, short_name, athletics_url FROM schools LIMIT 0;" \
-c "SELECT opponent_id, home_away, rpi_score, opponent_score, game_status, sport FROM articles LIMIT 0;" \
-c "SELECT opponent_id, date, home_away, rpi_score, opponent_score, status FROM articles_games LIMIT 0;" \
-c "SELECT _uuid, opponent_id, date, home_away, rpi_score, opponent_score, status FROM _articles_v_version_games LIMIT 0;" \
-c "SELECT id FROM staff_page_layout LIMIT 0;" \
-c "SELECT id FROM theme LIMIT 0;" \
-c "SELECT id FROM seo LIMIT 0;"
Expand Down
24 changes: 16 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For deeper architectural context, see [`docs/`](docs/) (architecture, data model

## Repository Layout

- `app/(frontend)/`: public site routes (`/`, section pages, article pages, staff, search, `/live`, submission forms, `/about`, `/contact`, etc.)
- `app/(frontend)/`: public site routes (`/`, section pages, article pages, staff, search, `/live`, `/get-involved`, submission forms, `/about`, `/contact`, etc.)
- `app/(payload)/`: Payload admin/app API integration routes (`/admin`, `/newsroom`)
- `app/api/`: custom API routes (`/api/health`, search, push, weather, submit, etc.)
- `collections/`: Payload collection + global definitions
Expand All @@ -32,6 +32,7 @@ For deeper architectural context, see [`docs/`](docs/) (architecture, data model
- `migrations/`: Payload-format TypeScript migrations registered via `migrations/index.ts`
- `mobile/`: Capacitor Android + iOS shells (separate `package.json`; install with `pnpm install --ignore-workspace`)
- `scripts/`: deploy/runtime scripts (`run_deploy_sql_migrations.sh`, `deploy-smoke.mjs`, `generate-env.js`)
- `patches/`: pnpm dependency patches (currently a Payload 3.80.0 CLI backport); see `patches/README.md` for provenance and when to remove each
- `middleware.ts`: returns `410 Gone` for matching article URLs whose row is unpublished
- `.github/workflows/`: CI, production deploy, Android release, and iOS simulator build workflows

Expand All @@ -53,16 +54,17 @@ Collections:
- `articles`: drafts/publish enabled (`versions.drafts: true`); `publishedDate` is set on first publish in a `beforeChange` hook; `lastModifiedBy` is stamped on every change; `opinionType` auto-derives from the kicker for opinion pieces
- `live-articles`: live-blog entries with append-only `updates`; mirrors the photo-gallery / carousel rich-text blocks
- `layout`: homepage curation (lead, slots, top-4, layout template, sections, volume/issue) — drafts enabled
- `opinion-page-layout`, `features-page-layout`, `sports-page-layout`, `staff-page-layout`: per-section page composition
- `opinion-page-layout`, `features-page-layout`, `sports-page-layout`, `news-page-layout`, `staff-page-layout`: per-section page composition
- `student-gov-updates`, `student-gov-terms`: Student Senate / Executive Board timeline updates and terms (GM Week to GM Week); see `docs/news-section.md`
- `users`: staff/auth/roles + slug, headshot, retired flag, "one-liner", and seen-newsroom-notice flag
- `media`: uploaded assets (alt, title, caption, source URL, photographer relationship, write-in photographer)
- `job-titles`: staff position metadata
- `submissions`: public op-ed / letter submissions (anonymous create, staff triage)
- `event-submissions`: public event submissions for the calendar
- `event-submissions`: archived event submissions (read-only; the public event form and Features events box were removed)
- `logos`: branded section logos and homepage assets
- `device-tokens`: registered Android and iOS FCM tokens (anonymous create via `/api/push/register`, admin-only read/delete)
- `redirects`: short tracked links at `poly.rpi.edu/<path>` (`path` + `destination`); `middleware.ts` answers with a 302 and captures a `redirect_followed` PostHog event per hit
- `schools`: opponents RPI teams play, each with a logo (upload collection; seeded from RPI Athletics schedules by `pnpm db:seed:schools`). Sports articles link one as `opponent`, alongside `homeAway`, `rpiScore`, `opponentScore` and `gameStatus`
- `schools`: opponents RPI teams play, each with a logo (upload collection; seeded from RPI Athletics schedules by `pnpm db:seed:schools`). Sports articles record up to two results in a `games` array (`opponent`, `date`, `homeAway`, `rpiScore`, `opponentScore`, `status`); the older single-game fields (`opponent`, `homeAway`, `rpiScore`, `opponentScore`, `gameStatus`) are hidden and kept for older articles and revisions

Globals:

Expand Down Expand Up @@ -116,6 +118,8 @@ Optional:
- `pnpm test:smoke`
- `pnpm test:search-limit`
- `pnpm test:deploy-smoke` (manual smoke script; not used by deploy workflow)
- `pnpm test:unit` (Vitest)
- `pnpm test:payload-cli` (checks the Payload CLI patch; also runs in CI)
- `pnpm generate:types`

## CI (Current)
Expand All @@ -126,10 +130,13 @@ Runs on PRs + pushes to `main`:

1. Postgres service (`postgres:16`)
2. `pnpm install --frozen-lockfile`
3. `pnpm exec payload migrate`
4. `pnpm lint`
5. `pnpm typecheck`
6. `pnpm build`
3. `pnpm test:payload-cli`
4. `pnpm exec payload migrate` (fails unless the CLI prints `Done.`)
5. `pnpm lint`
6. `pnpm typecheck`
7. `pnpm build`

Pull-request workflows don't run while a PR has merge conflicts with its base, so a conflicting PR shows no CI result at all.

Playwright is not part of the current CI runtime path.

Expand Down Expand Up @@ -223,6 +230,7 @@ Mixing PM2 users creates split daemons/process lists and inconsistent runtime ow

- **Pre-commit checks:** Always run `pnpm lint` and `pnpm typecheck` before committing. Do not commit code that fails either check.
- **Linting & Code Quality:** Ensure code changes are lint-safe before completing your task. Either review your code rigorously for common ESLint and React purity warnings, or execute `pnpm lint` to automatically verify.
- **Lint baseline and CMS previews:** Expect zero ESLint errors and warnings. Plain images in the five named CMS layout editor files are intentional; `eslint.config.mjs` contains a scoped `@next/next/no-img-element` exception. Public-site image checks and preview alt-text checks remain enabled. See [`docs/local-development.md`](docs/local-development.md#lint-expectations-and-cms-image-previews) for the policy and exact file scope.
- **Database Migrations:** When adding or modifying Payload collection fields that change the DB schema (new fields, new collections, enum changes), you MUST create corresponding migrations in BOTH paths:
1. A TypeScript migration file in `migrations/` and register it in `migrations/index.ts` (used by CI via `pnpm exec payload migrate`)
2. The equivalent SQL in `scripts/run_deploy_sql_migrations.sh` with a tracking INSERT entry (used by production deploy)
Expand Down
87 changes: 53 additions & 34 deletions GEMINI.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# GEMINI.md

This document is the canonical project + operations reference for Gemini/Codex-style agents in this repository. It mirrors `CLAUDE.md` so non-Claude agents have the same operational context.
This document is the canonical project + operations reference for Gemini/Codex-style agents in this repository. It mirrors `CLAUDE.md` so non-Claude agents have the same operational context; when you change one, copy the change to the other.

## Project Overview

Polymer is The Polytechnic's web platform (public newspaper site + Payload CMS admin) built on Next.js + Payload + PostgreSQL, with a Capacitor Android shell that wraps the production site and receives FCM breaking-news pushes.
Polymer is The Polytechnic's web platform (public newspaper site + Payload CMS admin) built on Next.js + Payload + PostgreSQL, with Capacitor Android and iOS shells that wrap the production site and receive FCM breaking-news pushes.

**This project is live in production with a real production database. Exercise caution with schema changes, migrations, and any destructive operations.**

For deeper architectural context, see [`docs/`](docs/) (architecture, data model, migrations, search, push, analytics, deployment, local-development).

Expand All @@ -16,50 +18,53 @@ For deeper architectural context, see [`docs/`](docs/) (architecture, data model
- PostgreSQL
- TypeScript
- Tailwind CSS 4
- PostHog (`posthog-js` + `posthog-node`)
- PostHog (`posthog-js` + `posthog-node`, self-hosted ingest at `t.poly.rpi.edu`)
- pnpm 10

## Repository Layout

- `app/(frontend)/`: public site routes (`/`, section pages, article pages, staff, search, `/live`, etc.)
- `app/(payload)/`: Payload admin/app integration routes (`/admin`, `/newsroom`)
- `app/(frontend)/`: public site routes (`/`, section pages, article pages, staff, search, `/live`, `/get-involved`, submission forms, `/about`, `/contact`, etc.)
- `app/(payload)/`: Payload admin/app API integration routes (`/admin`, `/newsroom`)
- `app/api/`: custom API routes (`/api/health`, search, push, weather, submit, etc.)
- `collections/`: Payload collection + global definitions
- `components/`: UI + article layout + dashboard components
- `lib/`: server helpers (PostHog, FCM, theme, archive, weather)
- `lib/`: server helpers (PostHog, FCM, theme, archive query, weather, homepage slot resolution)
- `migrations/`: Payload-format TypeScript migrations registered via `migrations/index.ts`
- `mobile/`: Capacitor Android shell
- `mobile/`: Capacitor Android + iOS shells (separate `package.json`; install with `pnpm install --ignore-workspace`)
- `scripts/`: deploy/runtime scripts (`run_deploy_sql_migrations.sh`, `deploy-smoke.mjs`, `generate-env.js`)
- `patches/`: pnpm dependency patches (currently a Payload 3.80.0 CLI backport); see `patches/README.md` for provenance and when to remove each
- `middleware.ts`: returns `410 Gone` for matching article URLs whose row is unpublished
- `.github/workflows/`: CI, deploy, and Android release workflows
- `.github/workflows/`: CI, production deploy, Android release, and iOS simulator build workflows

## Core Behavior

- Article URL format: `/:section/:year/:month/:slug`
- Homepage composition comes from `layout` + recent section stories (`app/(frontend)/page.tsx`)
- Homepage composition comes from the `layout` collection + recent section stories (`app/(frontend)/page.tsx`)
- Article layouts:
- standard / news / sports / features → `StandardLayout`
- opinion → `OpinionLayout`
- `#photofeature#` flag in first content paragraph → `PhotofeatureLayout`
- Live blog: `live-articles` collection drives `/live` and the homepage `LiveStrip` widget
- Breaking news: when an article publishes with `breakingNews=true`, the `Articles.afterChange` hook calls `/api/push/send` (with `INTERNAL_PUSH_SECRET`) to fan out FCM messages.
- Breaking news: when an article publishes with `breakingNews=true`, the `Articles.afterChange` hook calls `/api/push/send` (with `INTERNAL_PUSH_SECRET`) which fans out FCM messages to every `device-tokens` row.

## Data Model (Current)

Collections:

- `articles`: drafts/publish enabled (`versions.drafts: true`); `publishedDate` set on first publish; `lastModifiedBy` stamped on every change; `opinionType` derived from kicker
- `live-articles`: live-blog entries with append-only updates
- `articles`: drafts/publish enabled (`versions.drafts: true`); `publishedDate` is set on first publish in a `beforeChange` hook; `lastModifiedBy` is stamped on every change; `opinionType` auto-derives from the kicker for opinion pieces
- `live-articles`: live-blog entries with append-only `updates`; mirrors the photo-gallery / carousel rich-text blocks
- `layout`: homepage curation (lead, slots, top-4, layout template, sections, volume/issue) — drafts enabled
- `opinion-page-layout`, `features-page-layout`, `sports-page-layout`, `staff-page-layout`: per-section page composition
- `users`: staff/auth/roles + slug, headshot, retired flag
- `media`: uploaded assets (alt, title, caption, source URL, photographer)
- `opinion-page-layout`, `features-page-layout`, `sports-page-layout`, `news-page-layout`, `staff-page-layout`: per-section page composition
- `student-gov-updates`, `student-gov-terms`: Student Senate / Executive Board timeline updates and terms (GM Week to GM Week); see `docs/news-section.md`
- `users`: staff/auth/roles + slug, headshot, retired flag, "one-liner", and seen-newsroom-notice flag
- `media`: uploaded assets (alt, title, caption, source URL, photographer relationship, write-in photographer)
- `job-titles`: staff position metadata
- `submissions`: public op-ed / letter submissions
- `event-submissions`: public event submissions
- `logos`: branded section/homepage assets
- `device-tokens`: registered Android FCM tokens
- `schools`: opponents RPI teams play, each with a logo (seeded by `pnpm db:seed:schools`); sports articles link one as `opponent` with the game score
- `submissions`: public op-ed / letter submissions (anonymous create, staff triage)
- `event-submissions`: archived event submissions (read-only; the public event form and Features events box were removed)
- `logos`: branded section logos and homepage assets
- `device-tokens`: registered Android and iOS FCM tokens (anonymous create via `/api/push/register`, admin-only read/delete)
- `redirects`: short tracked links at `poly.rpi.edu/<path>` (`path` + `destination`); `middleware.ts` answers with a 302 and captures a `redirect_followed` PostHog event per hit
- `schools`: opponents RPI teams play, each with a logo (upload collection; seeded from RPI Athletics schedules by `pnpm db:seed:schools`). Sports articles record up to two results in a `games` array (`opponent`, `date`, `homeAway`, `rpiScore`, `opponentScore`, `status`); the older single-game fields (`opponent`, `homeAway`, `rpiScore`, `opponentScore`, `gameStatus`) are hidden and kept for older articles and revisions

Globals:

Expand Down Expand Up @@ -90,29 +95,31 @@ Required:

Optional:

- `LEGACY_DATABASE_URI`
- `LEGACY_DATABASE_URI` (legacy Wagtail archive)
- `NEXT_PUBLIC_SITE_URL`
- `BASE_URL`
- `PLAYWRIGHT_WEB_SERVER`
- `PLAYWRIGHT_WEB_SERVER_COMMAND`
- `NEXT_PUBLIC_POSTHOG_KEY` / `NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN`
- `NEXT_PUBLIC_POSTHOG_HOST`
- `INTERNAL_PUSH_SECRET`
- `FCM_SERVICE_ACCOUNT_JSON` (raw JSON)
- `PAYLOAD_DISABLE_PUSH=1` (disables Payload dev `db.push`)
- `NEXT_PUBLIC_POSTHOG_HOST` (defaults to `https://t.poly.rpi.edu`)
- `INTERNAL_PUSH_SECRET` (required to actually fan out breaking-news pushes)
- `FCM_SERVICE_ACCOUNT_JSON` (raw JSON, not base64 — required for FCM v1)
- `PAYLOAD_DISABLE_PUSH=1` (disables Payload's dev-mode `db.push` schema sync)

`pnpm install` runs `scripts/generate-env.js` to create `.env` if missing.

### Common Commands

- `pnpm dev`
- `pnpm build`
- `pnpm start`
- `pnpm start` (binds to `127.0.0.1`; PM2/nginx fronts it in prod)
- `pnpm lint`
- `pnpm typecheck`
- `pnpm test:smoke`
- `pnpm test:search-limit`
- `pnpm test:deploy-smoke` (manual smoke script; not used by deploy workflow)
- `pnpm test:unit` (Vitest)
- `pnpm test:payload-cli` (checks the Payload CLI patch; also runs in CI)
- `pnpm generate:types`

## CI (Current)
Expand All @@ -123,10 +130,13 @@ Runs on PRs + pushes to `main`:

1. Postgres service (`postgres:16`)
2. `pnpm install --frozen-lockfile`
3. `pnpm exec payload migrate`
4. `pnpm lint`
5. `pnpm typecheck`
6. `pnpm build`
3. `pnpm test:payload-cli`
4. `pnpm exec payload migrate` (fails unless the CLI prints `Done.`)
5. `pnpm lint`
6. `pnpm typecheck`
7. `pnpm build`

Pull-request workflows don't run while a PR has merge conflicts with its base, so a conflicting PR shows no CI result at all.

Playwright is not part of the current CI runtime path.

Expand Down Expand Up @@ -186,6 +196,8 @@ Use a single PM2 control plane: `actions-runner`.
- Allowed: `sudo -u actions-runner pm2 ...`
- Avoid: running app PM2 commands as `poly`

Mixing PM2 users creates split daemons/process lists and inconsistent runtime ownership on port 3000.

### Runtime Process Config

`ecosystem.config.cjs`:
Expand All @@ -204,18 +216,25 @@ Use a single PM2 control plane: `actions-runner`.
- behavior:
- returns `200` with `{ status: "ok" }` when app + Payload/Postgres check succeeds
- returns `503` with `{ status: "error", checks.database: "error" }` on DB/Payload failure
- response is `Cache-Control: no-store`

## Push Notifications (Breaking News)

- registration: `POST /api/push/register` (Android client)
- registration: `POST /api/push/register` (Android + iOS clients; in-memory rate limit + token de-dupe)
- fan-out: `POST /api/push/send` (internal; requires `x-internal-secret` matching `INTERNAL_PUSH_SECRET`)
- transport: FCM HTTP v1 via `lib/fcm.ts` using `FCM_SERVICE_ACCOUNT_JSON`
- transport: FCM HTTP v1 via `lib/fcm.ts` using `FCM_SERVICE_ACCOUNT_JSON`; iOS devices register FCM tokens too (APNs → FCM swap in the app), so there is no separate APNs sender
- trigger: `Articles.afterChange` when an article transitions to published with `breakingNews=true`
- if `INTERNAL_PUSH_SECRET` or `FCM_SERVICE_ACCOUNT_JSON` is unset, the fan-out becomes a no-op so dev/CI is unaffected

## Agent Operations

- **Linting & Code Quality:** Ensure any code changes are lint-safe before completing your task. Either review your code rigorously for common ESLint and React purity warnings, or execute `pnpm lint` to automatically verify. Run `pnpm typecheck` too.
- **Database Migrations:** When changing the DB schema, write BOTH a TypeScript migration in `migrations/` (registered in `migrations/index.ts`) AND the equivalent SQL in `scripts/run_deploy_sql_migrations.sh` with a tracking INSERT. See [`docs/migrations.md`](docs/migrations.md).
- **Pre-commit checks:** Always run `pnpm lint` and `pnpm typecheck` before committing. Do not commit code that fails either check.
- **Linting & Code Quality:** Ensure code changes are lint-safe before completing your task. Either review your code rigorously for common ESLint and React purity warnings, or execute `pnpm lint` to automatically verify.
- **Lint baseline and CMS previews:** Expect zero ESLint errors and warnings. Plain images in the five named CMS layout editor files are intentional; `eslint.config.mjs` contains a scoped `@next/next/no-img-element` exception. Public-site image checks and preview alt-text checks remain enabled. See [`docs/local-development.md`](docs/local-development.md#lint-expectations-and-cms-image-previews) for the policy and exact file scope.
- **Database Migrations:** When adding or modifying Payload collection fields that change the DB schema (new fields, new collections, enum changes), you MUST create corresponding migrations in BOTH paths:
1. A TypeScript migration file in `migrations/` and register it in `migrations/index.ts` (used by CI via `pnpm exec payload migrate`)
2. The equivalent SQL in `scripts/run_deploy_sql_migrations.sh` with a tracking INSERT entry (used by production deploy)
Failing to do this will break production — the site will crash on startup if Payload tries to query columns/tables that don't exist. See [`docs/migrations.md`](docs/migrations.md) for the full step-by-step.

## Incident Guardrails

Expand Down
Loading
Loading