Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ personal wantlist ("crate").
IT2810 (NTNU) Project 2. Group T19: `erikhfj`, `robertky`, `evenkkl`, `rachelks`.

**Status: M4 delivered – final polish.** See the README's
[implementation status](README.md#implementation-status) for implemented features
and planned work.
[feature overview](README.md#what-you-can-do-in-crate) for implemented features
and the project status section for planned work.

## Commands

Expand Down
49 changes: 21 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ IT2810 (NTNU) Project 2. Group T19: `erikhfj`, `robertky`, `evenkkl`, `rachelks`
| AI usage log | [`docs/AI-USAGE.md`](docs/AI-USAGE.md) |
| Running on the VM | [`docs/VM-setup.md`](docs/VM-setup.md) |

## What you can do in Crate

**Find and narrow albums:** Search by title or artist, or browse the catalog without entering a query. Filter by genre, decade, artist country and whether an album has reviews; sort by relevance, title, release year or average rating.

**Explore results:** The first page shows up to 20 albums. More load as you scroll, up to 60, and a Load more button gives access to further pages. Loading, errors and empty results are clearly shown. Your ten most recent searches are available to revisit or clear.

**Open and review an album:** Album pages show tracks, average ratings and reviews. You can write, edit or delete your own review.

**Save albums for later:** Add albums to or remove them from Your crate in the results or album page. Your crate lists saved albums newest first. It uses an anonymous browser identity, so no sign-in is needed and your saved list is still there when you return in that browser.

**Pick up where you left off:** Search, filters and sorting stay in the URL. Browser Back from an album restores the loaded results and your previous place in the list.

## Screenshots

The screenshots show the catalog on desktop and mobile, plus an album detail
Expand Down Expand Up @@ -299,13 +311,20 @@ explain the measurements and tradeoffs. The benchmark runner is
`server/scripts/benchmark.sh`; the cursor-index benchmark modifies ratings only
in a disposable database whose name ends in `_perf`.

### Accessibility
### Backend search behavior

The API uses PostgreSQL full-text search with prefix matching (e.g. `radi`
matches `Radiohead`). SQL handles sorting, filtering, facet counts and cursor
pagination; see the [architecture decisions](docs/architecture.md#3-sorting-and-filtering-in-sql)
for details.

## Accessibility

The interface supports keyboard navigation, visible focus indicators, labelled form controls and a skip link to the main content. Search results, loading states and errors provide feedback to assistive technologies. The layout adapts to smaller screens and respects reduced-motion preferences.

Automated accessibility tests use axe-core to check key search states, including initial, results, no-results and error views. Component tests also cover keyboard interactions and focus behavior. Since these tests run in jsdom, they cannot verify color contrast or layout. The Playwright tests therefore also run axe-core (WCAG 2.1 A and AA) in a real browser, where contrast is checked, and test a keyboard-only path with visible focus. Zoom and screen reader behavior are still tested manually.

### Sustainability measures
## Sustainability measures

We consider sustainability through design choices that reduce unnecessary data transfer, processing and resource use, while acknowledging performance tradeoffs.

Expand Down Expand Up @@ -358,32 +377,6 @@ We consider sustainability through design choices that reduce unnecessary data t
| `schema.graphql` | GraphQL schema |
| `docs/` | Architecture, data model, UI, workflow, AI log and VM guide |

## Implementation status

**Search and filtering:** Users can search for albums by title or artist using Search or Enter. Results can be sorted by relevance, title, release year or average rating, and filtered by genre, decade, artist country or whether an album has reviews. Search terms, sorting and filters are preserved in the URL.

**Search history:** The ten most recent distinct searches are saved per simulated user across page reloads. Users can select a recent search from the search dropdown or clear their full saved history.

**Results and pagination:** Searches initially display up to 20 albums. Additional results load automatically as the user scrolls, up to 60 albums. Load more is also available before this limit; further pages require the button. The interface provides loading, error and no-results feedback.

**Album details and reviews:** Album pages display tracks, average ratings and reviews. Users can write, edit and delete their own reviews.

**Album artwork:** Discover, My Crate and AlbumDetailPage display Cover Art Archive images when available, with the vinyl placeholder as a fallback.

**Personal crate:** Users can add or remove albums from their crate on both search results and album detail pages, and a crate page lists everything they have saved, newest first, with paging. The API returns only the requesting user's items. User identity is simulated using a locally stored ID rather than a login system.

**Browsing:** Discover displays the catalog even when the search field is
empty. Users can filter and sort those results without first entering a search
term. Search terms, filters and sorting remain in the URL when navigating
between Discover and an album page.

### Backend search behavior

The API uses PostgreSQL full-text search with prefix matching (e.g. `radi`
matches `Radiohead`). SQL handles sorting, filtering, facet counts and cursor
pagination; see the [architecture decisions](docs/architecture.md#3-sorting-and-filtering-in-sql)
for details.

## Try the application

Open http://it2810-19.idi.ntnu.no/project2/ or the local frontend and try these searches. Expected counts assume the 16-album sample catalog; other data may produce different results.
Expand Down
39 changes: 21 additions & 18 deletions docs/AI-USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ shows its own control over the development. The control is visible in the
issues, the pull requests and the reviews. This table is the record of tool
usage behind that work.

## Task delegation and verification workflow

The dated table below records individual sessions. These sections explain how AI-assisted work was scoped, checked, and carried through to reviewed pull requests across the team.

- **Bounded, issue-linked tasks:** After the group overruled an early plan to split a generated prototype into PRs (24 September), all work was divided into milestone-scoped GitHub issues owned by individual contributors. Prompts and delegated work stayed tied to one issue's scope and acceptance criteria (`feat/<issue>-…`, `fix/<issue>-…`, `docs/<issue>-…`) rather than open-ended generation.
- **Different workflows across contributors:** Team members did not use a single uniform AI workflow. Some used chat and design tools (`ChatGPT`, `Figma Make`) mainly for sparring on UI sketches, dataset evaluation, schema/migration ideas, troubleshooting, and review preparation while editing or adapting code directly. Others delegated bounded implementation, test, or debugging tasks to repository-aware agents (`opencode`, `Codex (ChatGPT)`, `Claude`, `Antigravity`).
- **Scope, context, and resulting work:** When delegating a task, the contributor supplied the issue's acceptance criteria alongside the repository's contracts (`schema.graphql`, `docs/architecture.md`, `docs/ui-specification.md`, `AGENTS.md`). Grounding the task in those constraints kept generated changes small enough to audit and aligned with non-negotiable rules (SQL sorting/filtering, keyset pagination, per-request DataLoaders, simulated `X-User-Id` context, plain CSS, accessibility, URL state).
- **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.

## Individual usage log

Everyone adds their own rows. Two rows in the middle have no tool in them on
purpose: they are where a person overruled what the tool proposed, which is
the part that matters most.
Expand Down Expand Up @@ -118,26 +138,9 @@ the part that matters most.
| 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`. |
| 2026-11-24 | robertky | Codex (ChatGPT) | #125: Moved the user-facing functionality summary near the top of README and moved the AI delegation/context guidance before the session log. Verified with `pnpm format:check`. |
| 2026-11-24 | erikhfj | Antigravity | #127, security audit & Dependabot remediation: audited all 19 dev-dependency alerts (0 prod vulnerabilities), upgraded `vite` (`^8.3.8`) and `vitest` (`^4.1.12`), added targeted `pnpm.overrides` (`esbuild`, `minimatch`, `undici`, `zod`), defaulted `server/src/index.ts` to bind `127.0.0.1`, and enforced search query length (200 chars) and filter array size (50 items) caps with unit tests. Verified with `pnpm audit`, `pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm build`. |

## Task delegation and verification workflow

The table above records individual sessions; this section summarizes how AI-assisted tasks were scoped, checked, and carried through to reviewed pull requests across the team.

- **Bounded, issue-linked tasks:** After the group overruled an early plan to split a generated prototype into PRs (24 September), all work was divided into milestone-scoped GitHub issues owned by individual contributors. Prompts and delegated work stayed tied to one issue's scope and acceptance criteria (`feat/<issue>-…`, `fix/<issue>-…`, `docs/<issue>-…`) rather than open-ended generation.
- **Different workflows across contributors:** Team members did not use a single uniform AI workflow. Some used chat and design tools (`ChatGPT`, `Figma Make`) mainly for sparring on UI sketches, dataset evaluation, schema/migration ideas, troubleshooting, and review preparation while editing or adapting code directly. Others delegated bounded implementation, test, or debugging tasks to repository-aware agents (`opencode`, `Codex (ChatGPT)`, `Claude`, `Antigravity`).
- **Scope, context, and resulting work:** When delegating a task, the contributor supplied the issue's acceptance criteria alongside the repository's contracts (`schema.graphql`, `docs/architecture.md`, `docs/ui-specification.md`, `AGENTS.md`). Grounding the task in those constraints kept generated changes small enough to audit and aligned with non-negotiable rules (SQL sorting/filtering, keyset pagination, per-request DataLoaders, simulated `X-User-Id` context, plain CSS, accessibility, URL state).
- **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
Expand Down
2 changes: 1 addition & 1 deletion docs/ui-specification.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Crate user guide and interface specification

Crate helps people find albums, explore details and reviews, and keep a personal list of albums to revisit. This document describes the behavior available in the current application. The README's [implementation status](../README.md#implementation-status) is the source for milestone and project-level status.
Crate helps people find albums, explore details and reviews, and keep a personal list of albums to revisit. This document describes the behavior available in the current application. The README's [feature overview](../README.md#what-you-can-do-in-crate) summarizes the implemented functionality.

## Discover albums

Expand Down