diff --git a/AGENTS.md b/AGENTS.md index 6dbac65..7067c6a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,7 +10,7 @@ personal wantlist ("crate"). IT2810 (NTNU) Project 2. Group T19: `erikhfj`, `robertky`, `evenkkl`, `rachelks`. -**Status: M3 – Functional beta.** See the README's +**Status: M4 delivered – final polish.** See the README's [implementation status](README.md#implementation-status) for implemented features and planned work. diff --git a/README.md b/README.md index e74274f..5428117 100644 --- a/README.md +++ b/README.md @@ -9,17 +9,17 @@ country and whether an album has reviews. IT2810 (NTNU) Project 2. Group T19: `erikhfj`, `robertky`, `evenkkl`, `rachelks`. -| | | -| ------------------- | -------------------------------------------------------- | -| Current milestone | **M4 – final prototype and test suite**, due 13 November | -| Live prototype | http://it2810-19.idi.ntnu.no/project2 | -| Architecture / ADRs | [`docs/architecture.md`](docs/architecture.md) | -| Data model | [`docs/data-model.md`](docs/data-model.md) | -| UI specification | [`docs/ui-specification.md`](docs/ui-specification.md) | -| Scalability | [`docs/scalability.md`](docs/scalability.md) | -| Workflow | [`docs/WORKFLOW.md`](docs/WORKFLOW.md) | -| AI usage log | [`docs/AI-USAGE.md`](docs/AI-USAGE.md) | -| Running on the VM | [`docs/VM-setup.md`](docs/VM-setup.md) | +| | | +| ------------------- | ---------------------------------------------------------- | +| Current milestone | **M4 delivered – final polish**, final hand-in 27 November | +| Live prototype | http://it2810-19.idi.ntnu.no/project2 | +| Architecture / ADRs | [`docs/architecture.md`](docs/architecture.md) | +| Data model | [`docs/data-model.md`](docs/data-model.md) | +| UI specification | [`docs/ui-specification.md`](docs/ui-specification.md) | +| Scalability | [`docs/scalability.md`](docs/scalability.md) | +| Workflow | [`docs/WORKFLOW.md`](docs/WORKFLOW.md) | +| AI usage log | [`docs/AI-USAGE.md`](docs/AI-USAGE.md) | +| Running on the VM | [`docs/VM-setup.md`](docs/VM-setup.md) | ## Screenshots @@ -321,17 +321,22 @@ We consider sustainability through design choices that reduce unnecessary data t | Bundle budget in CI | CI fails before a dependency quietly doubles the payload | 512 000 bytes per JS chunk | | Indexed prefix search | Uses the existing GIN index, but broad prefixes require more database processing | Better search flexibility, but potentially higher query costs for broad prefixes | -**Bundle size**, production build measured 26 October 2026: +**Bundle size**, production build measured 24 November 2026: | File | Raw | Gzip | | ----------------------- | --------: | --------: | -| `index-*.js` | 430.26 kB | 131.10 kB | -| `index-*.css` | 4.99 kB | 1.77 kB | -| `AlbumDetailPage-*.js` | 8.29 kB | 2.88 kB | -| `AlbumDetailPage-*.css` | 1.94 kB | 0.71 kB | -| `index.html` | 0.51 kB | 0.31 kB | - -The two `AlbumDetailPage` rows represent the separate chunks for the album detail route and are not part of the search page payload. Opening an album uses normal page navigation, while previously downloaded assets may be reused by the browser. Artwork is fetched separately from Cover Art Archive and is not included in these bundle sizes. Browser-native responsive images (`srcSet`/`sizes`) let the browser select an appropriate image size; card images load lazily, while detail artwork loads eagerly. +| `index-*.js` | 390.80 kB | 119.87 kB | +| `index-*.css` | 15.33 kB | 4.15 kB | +| `AlbumCover-*.js` | 55.01 kB | 13.56 kB | +| `AlbumCover-*.css` | 4.17 kB | 1.29 kB | +| `AlbumDetailPage-*.js` | 11.25 kB | 3.71 kB | +| `AlbumDetailPage-*.css` | 5.81 kB | 1.53 kB | +| `CratePage-*.js` | 2.32 kB | 0.99 kB | +| `CratePage-*.css` | 0.23 kB | 0.16 kB | +| `rolldown-runtime-*.js` | 0.58 kB | 0.36 kB | +| `index.html` | 0.78 kB | 0.38 kB | + +`AlbumDetailPage` and `CratePage` are code-split into separate lazy-loaded route chunks, so neither is loaded until the user opens an album or visits Your crate. `AlbumCover` is shared across views that render covers and is loaded eagerly on the initial Discover page (`App` → `ResultsLayout` → `AlbumCard`), so the first-page JavaScript payload is `index` + `AlbumCover` + `rolldown-runtime` (446.39 kB raw / 133.79 kB gzip) rather than `index` alone. Opening an album or crate page uses normal page navigation, while previously downloaded assets may be reused by the browser. Artwork is fetched separately from Cover Art Archive and is not included in these bundle sizes. Browser-native responsive images (`srcSet`/`sizes`) let the browser select an appropriate image size; card images load lazily, while detail artwork loads eagerly. **Requests for a typical search:** An uncached search initially fetches up to 20 albums in one `searchAlbums` request. Infinite scroll loads up to two additional pages automatically, while further pages are loaded using the Load more button. Previously fetched pages are reused from Apollo's cache without new GraphQL requests. No search requests are sent while the user types. Album artwork adds separate external image requests as cards approach the viewport. diff --git a/docs/AI-USAGE.md b/docs/AI-USAGE.md index 2aa9180..aaeff26 100644 --- a/docs/AI-USAGE.md +++ b/docs/AI-USAGE.md @@ -103,6 +103,8 @@ the part that matters most. | 2026-11-13 | rachelks | Codex (ChatGPT) | Assisted with #24 frontend integration, dropdown keyboard navigation, accessibility and tests, as well as debugging React/Apollo warnings and simplifying the SearchForm/DiscoveryPage responsibilities. All changes were thoroughly reviewed and tested before committing. | | 2026-11-13 | robertky | Codex (ChatGPT) | Assisted me with #26: polished the README, added screenshots and project-document links, and verified the local setup from a clean clone. I reviewed the changes and updated the implementation notes to reflect merged browsing and country-filter features. | | 2026-11-17 | erikhfj | Antigravity | #91, E2E search helper fix: updated `e2e/tests/search.spec.ts` to match the `Search` and `Filters` buttons with `exact: true` so `Clear recent searches` does not trigger a strict-mode violation, and cleared `E2E_USER_ID`'s recorded search history during cleanup. Verified locally with two consecutive full `pnpm test:e2e` runs against a throwaway seeded PostgreSQL stack. | +| 2026-11-17 | erikhfj | Antigravity | #93, removed the trailing U+FFFD replacement character from the `SearchForm` placeholder and added a regression test in `SearchForm.test.tsx`. Verified with `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test`. | +| 2026-11-17 to 2026-11-22 | erikhfj | Antigravity | #97, documented how `AGENTS.md`, `schema.graphql`, and issue specs are used as shared context in AI prompts, added recent log rows, synced `AGENTS.md` and `README.md` milestone status, and updated `README.md` bundle measurements (clarifying that `AlbumCover` loads eagerly on the first page) after running `pnpm build` on updated `main`. | | 2026-11-20 | erikhfj | Antigravity | #100, review author privacy: removed `User.id` from `schema.graphql` and the `AlbumDetail` query, replaced `Listener ` with deterministic SHA-256 music pseudonyms in `server/src/userIdentity.ts` (including read-time sanitization of legacy labels in `Review.user`), added `User` cache merge policy, and updated schema/unit/client tests and `docs/architecture.md`. Verified with `pnpm codegen`, `pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm build`. | | 2026-11-20 | erikhfj | Antigravity | #103, search history error visibility and focus: moved the search history error message and Retry button inside the open `RecentSearches` dropdown so closed-state errors cannot overlap page content, returned retry success from `useSearchHistory`, restored focus to the search input after a successful retry in `SearchForm`, and added unit/integration tests. Verified with `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test && pnpm build`. | | 2026-11-20 | erikhfj | Antigravity | #102, floating mobile Back to Top button: positioned `BackToTop` fixed at bottom-right across viewports with a compact 44px circular icon-only layout on mobile (`<= 700px`), preserved the `Back to top` accessible name, added bottom clearance on `.results` so controls such as `Load more` stay unobstructed, and expanded `BackToTop.test.tsx`. Verified with `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test && pnpm build`. | @@ -115,6 +117,7 @@ the part that matters most. | 2026-11-23 | robertky | Codex (ChatGPT) | #121: Preserved the visible search page count and scroll position when opening an album, then restored the saved result pages on return. Added state and pagination regression tests. | | 2026-11-23 | robertky | Codex (ChatGPT) | #122: Split review mutation failures from album refresh failures, added a refresh-only retry, and tested publish, update, and delete behavior. | | 2026-11-23 | robertky | Codex (ChatGPT) | #104 review follow-up: combined the side drawer with the merged country preview, added backdrop dismissal and a keyboard focus loop, corrected the results-status test matcher and component documentation, and expanded the Playwright filter journey. Verified with `pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm test`, `pnpm build`, and `pnpm test:e2e` against an isolated seeded PostgreSQL database. | +| 2026-11-24 | robertky | Codex (ChatGPT) | #97 follow-up: updated Erik's PR branch with current `main`, reran `pnpm build`, and refreshed the README bundle-size measurements and first-page payload after #113, #120, #123, and #124. Verified with `pnpm build` and `pnpm format:check`. | ## Task delegation and verification workflow @@ -126,6 +129,14 @@ The table above records individual sessions; this section summarizes how AI-assi - **Checking, revising, and rejecting suggestions:** Tool output was treated as a draft rather than an authoritative change. Contributors checked proposals against the live codebase and ran automated gates (`pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm test`, `pnpm build`, plus PostgreSQL integration suites, Playwright E2E/axe checks, Lighthouse, or VM smoke tests when applicable). Unsuitable or wrong suggestions were revised or rejected—for example, rejecting the prototype-splitting plan (24 Sep), correcting an overstated security claim on `displayName` (#40), raising dark-mode border contrast after hand-checking WCAG ratios (#18), catching a missing `DateTime` scalar and test-fixture leakage during codegen (#30), fixing microsecond cursor precision in `myCrate` (#77), and replacing a brittle `to_tsquery` prefix suggestion with a TypeScript builder (#55). - **Human responsibility and peer review:** AI tools did not merge code or approve PRs. Every change went through `main` branch protection and was reviewed by a different teammate (`docs/WORKFLOW.md`), with the PR author responsible for understanding the final diff, verifying tests, and resolving review feedback. +## Shared context and prompting + +To keep AI-assisted changes consistent across four contributors and multiple tools (`opencode`, `ChatGPT`, `Codex (ChatGPT)`, `Claude`, `Figma Make`, and `Antigravity`), the repository carries its own shared context: + +- **`AGENTS.md`** acts as the shared harness: it states the non-negotiable architecture rules (SQL sorting/filtering, keyset pagination, per-request DataLoaders, parameterised queries, `X-User-Id` context, plain CSS, accessibility, URL search state), conventions, and verification commands. Repo-aware CLI/IDE agents load it automatically, and we reference the same rules when working in chat tools. +- **`schema.graphql` and `docs/`** (`architecture.md`, `data-model.md`, `ui-specification.md`, `WORKFLOW.md`) define the API contract and UI boundaries before code is written. +- **How tasks were scoped and prompted:** Instead of asking for open-ended features, prompts started from an individual GitHub issue and its acceptance criteria, pointed to the relevant files and `schema.graphql` contract, and required running `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test` (plus PostgreSQL/Playwright/Lighthouse checks when relevant) to verify behavior rather than accepting the first output. + ## Notes - The prototype was never merged. `archive/scaffold-prototype` is a reference to