Skip to content

Commit 5a681ec

Browse files
authored
merge: PR #81 from sameboat-platform/docs/week-5-prep
This pull request documents the release of frontend v0.3.0, closes out the Week 4 milestone, and sets up planning and issue templates for future work (v0.3.1 and v0.4.0). It adds comprehensive release notes, updates badges and status docs, and introduces detailed implementation plans and issue drafts for upcoming features, including the Stories feed and profile editing. The changes also improve issue templates to support new release targets.
2 parents c364d15 + 102e717 commit 5a681ec

File tree

16 files changed

+853
-5
lines changed

16 files changed

+853
-5
lines changed

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ body:
3838
attributes:
3939
label: Target Release
4040
options:
41-
- 0.2.0
41+
- v0.3.1
42+
- v0.3.2
43+
- v0.3.3
44+
- v0.4.0
4245
- Future
4346
validations:
4447
required: false

.github/ISSUE_TEMPLATE/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@ body:
2424
attributes:
2525
label: Target Release
2626
options:
27-
- 0.2.0
27+
- v0.3.1
28+
- v0.3.2
29+
- v0.3.3
30+
- v0.4.0
2831
- Future

.github/ISSUE_TEMPLATE/tooling.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@ body:
2424
attributes:
2525
label: Target Release
2626
options:
27-
- 0.2.0
27+
- v0.3.1
28+
- v0.3.2
29+
- v0.3.3
30+
- v0.4.0
2831
- Future

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Project: Vite + React 19 + TypeScript (strict), using SWC React plugin. Auth sta
44

55
Big picture
66

7-
- SPA bootstrapped by Vite. Entry `src/main.tsx` mounts `src/App.tsx` into `#root` in `index.html`.
7+
- SPA bootstrapped by Vite. Entry `src/main.tsx` mounts `src/App.tsx` into `root` in `index.html`.
88
- Build is type-first: `npm run build` executes `tsc -b` before `vite build`. CI fails on any TS errors.
99
- Flat ESLint config with React Hooks and React Refresh rules; focus on `.ts/.tsx` files; `dist/` ignored.
1010
- ESM-only repository (`"type": "module"`, TS `moduleResolution: bundler`, `verbatimModuleSyntax: true`). Prefer `import type` for types.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Frontend CI](https://github.com/sameboat-platform/frontend/actions/workflows/frontend-ci.yml/badge.svg)](https://github.com/sameboat-platform/frontend/actions/workflows/frontend-ci.yml)
22
[![Release](https://img.shields.io/github/v/tag/sameboat-platform/frontend?label=release&sort=semver)](https://github.com/sameboat-platform/frontend/releases)
3+
[![Changelog 0.3.0](https://img.shields.io/badge/changelog-0.3.0-blue)](CHANGELOG.md#030---2025-10-29)
34
[![License](https://img.shields.io/github/license/sameboat-platform/frontend.svg)](LICENSE)
45
[![Dependencies](https://img.shields.io/github/actions/workflow/status/sameboat-platform/frontend/frontend-ci.yml?label=build)](https://github.com/sameboat-platform/frontend/actions)
56
[![Coverage](./.github/badges/coverage.svg)](https://github.com/sameboat-platform/frontend/actions/workflows/coverage-badge.yml)

docs/status/done-to-date--10-08.md renamed to docs/status/done-to-date.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
1+
# SameBoat – Progress Summary (through 10‑30-2025)
2+
3+
This snapshot captures what’s shipped through frontend v0.3.0 and the current backend status; Week 5 focus is stories v1 and minimal profile edit.
4+
5+
## Frontend
6+
- Releases:
7+
- v0.1.0 (2025‑10‑02) – initial auth/pages/health, CI baseline.
8+
- v0.2.0 (2025‑10‑04) – health stability, coverage pipeline, security policy.
9+
- v0.3.0 (2025‑10‑30) – Zustand auth store + effects, visibility‑based session refresh (30s cooldown), intendedPath preservation, dependency‑audit workflow, bundle analyzer, docs sweep.
10+
- Health aligned to `/actuator/health`; ProtectedRoute preserves full intended path; tests and build/lint pass on main; security audit 0 vulns at release time.
11+
12+
## Backend (high‑level)
13+
- Java 21 + Spring Boot 3.5.x; Flyway migrations; Postgres (Neon) in prod.
14+
- Auth endpoints: `POST /api/auth/{login,register,logout}` and `GET /api/me` for session bootstrap (cookie `SBSESSION`).
15+
- Users API: `GET /api/users/{id}`, `PATCH /api/users/{id}`; Actuator health at `/actuator/health`.
16+
- Tests: service + controller; Jacoco ≥ 70%.
17+
18+
## Week 5 focus (next)
19+
- Frontend: Stories feed `/stories`, create `/stories/new` with spoiler shields; profile edit (name/role/bio) via `PATCH /api/me`.
20+
- Backend: Stories endpoints (`GET /api/stories`, `POST /api/stories`, `GET /api/stories/{id}`) and extend profile fields.
21+
22+
Links: Frontend release v0.3.0 → https://github.com/sameboat-platform/frontend/releases/tag/v0.3.0; Week 5 plan → `docs/weekly-reports/week-5-frontend-plan.md`.
23+
124
# SameBoat Backend – Progress Summary
225

3-
## Completed Work (as of [date])
26+
## Completed Work (10-08-2025)
427

528
### 1. Project Setup
629
- **Tech stack selected:** Java 21, Spring Boot 3.5.x, Maven, PostgreSQL (Neon for prod, H2/Testcontainers for tests).
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Overview (Week 4 – Oct 6 – Oct 30)
2+
3+
Milestone focus: Auth store migration to Zustand with stable public API, visibility‑based session refresh, intendedPath polish, CI hardening, and release v0.3.0.
4+
5+
### Highlights
6+
7+
- Shipped release v0.3.0 (tagged) with CHANGELOG and compare links; milestone closed and post‑release triage completed.
8+
- Migrated auth store from custom Context to Zustand while preserving the `useAuth()` public contract; introduced `AuthEffects` for bootstrap + visibility listeners.
9+
- Implemented visibility‑driven session refresh with a 30s cooldown via pure helper `shouldRefreshOnVisibility`; replaced brittle integration test with deterministic unit tests.
10+
- Preserved full `intendedPath` (pathname + search + hash) through login redirects; added tests and fixed edge cases.
11+
- Standardized auth debug flags (`VITE_DEBUG_AUTH`, `VITE_DEBUG_AUTH_BOOTSTRAP`) and cleaned console noise; added a console hygiene test.
12+
- CI: added dependency audit workflow (fails on High/Critical) and documented policy; added bundle analysis script and notes.
13+
14+
### What Went Well
15+
16+
- Store migration landed without breaking changes—public `useAuth` remained stable; consumers required no edits.
17+
- Visibility refresh logic is isolated, testable, and deterministic; fewer flakes and clearer logs gated by flags.
18+
- Release preparation was smooth: CHANGELOG first, then version bump and tag; PR/CI stayed green.
19+
20+
### What We Struggled With
21+
22+
- Initial attempt at an integration test for visibility events proved flaky; resolved by extracting a pure helper and unit‑testing cooldown semantics.
23+
- A few React Hooks lint violations in dev‑only debug components required refactoring (early return before any hooks, inner component pattern).
24+
25+
### Completed vs Planned
26+
27+
- Zustand migration + effects: Done.
28+
- IntendedPath preservation and error mapping: Done.
29+
- Visibility‑based refresh with cooldown: Done (unit‑tested).
30+
- Console hygiene and test add‑ons: Done.
31+
- CI dependency audit and docs: Done.
32+
- Release 0.3.0: Done; tag pushed; milestone closed; next milestones opened.
33+
34+
Deferred / Next trains
35+
- Post‑MVP end‑to‑end test for actual visibility + cooldown using a browser runner (Playwright).
36+
- Minor UI polish (logout affordance surfacing, user summary tweaks) slated for 0.3.1/0.4.0 as needed.
37+
38+
### Notable PRs/Commits
39+
40+
- feat(auth): migrate context store → Zustand; add AuthEffects for bootstrap + visibility
41+
- feat(auth): preserve intendedPath end‑to‑end; tests
42+
- chore(ci): dependency audit workflow + docs
43+
- chore(tooling): bundle analyzer script and docs; soft perf budget
44+
- docs: RFC for Zustand store; README/architecture updates
45+
- docs: CHANGELOG 0.3.0; release notes
46+
47+
### Metrics & Quality Gates
48+
49+
- Typecheck: PASS
50+
- Lint: PASS (React Hooks clean; no unused disables)
51+
- Tests: PASS (unit + RTL; deterministic visibility tests)
52+
- Build: PASS (tsc -b && vite build)
53+
- Security audit: 0 known vulnerabilities after npm audit fix
54+
55+
### Follow‑ups (queued for 0.3.1/0.4.0)
56+
57+
- Playwright E2E for visibility refresh cooldown
58+
- Small UX polish on Me/UserSummary and debug toggles
59+
- Optional: auto‑generated release notes via gh, fed by CHANGELOG sections
60+
61+
### Appendix
62+
63+
- Week 4 plan updated with "v0.3.0 shipped" status and links.
64+
- Opened milestones: v0.3.1 (patches), v0.4.0 (next minor).
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Post‑MVP – Future Issues Backlog
2+
3+
This file collects pre‑scoped issue drafts you can copy/paste into new GitHub issues. Each draft includes labels, milestone, acceptance criteria, and a small test plan.
4+
5+
---
6+
7+
## Draft: Playwright E2E – Visibility‑based session refresh cooldown
8+
9+
Title
10+
- E2E(auth): visibility‑based session refresh respected with 30s cooldown
11+
12+
Milestone
13+
- v0.4.0
14+
15+
Labels
16+
- area:auth, e2e, type:test, roadmap
17+
18+
Background
19+
- The app refreshes session state on `visibilitychange` when a tab becomes visible, provided:
20+
- no auth request is currently in flight, and
21+
- the last successful fetch was ≥ 30 seconds ago.
22+
- The cooldown logic lives in a pure helper `shouldRefreshOnVisibility(lastFetchedMs: number, nowMs: number, minIntervalMs = 30000)` and is exercised by unit tests. We want a browser‑level E2E to validate the real visibility lifecycle and interaction with the app shell.
23+
24+
Goals
25+
- Confirm that switching a tab from hidden→visible triggers a session refresh only when past the 30s threshold.
26+
- Confirm that repeated visibility events within the 30s window do not trigger additional refreshes.
27+
- Confirm that a refresh is skipped when already in‑flight.
28+
29+
Acceptance Criteria
30+
- Given an authenticated session and last refresh < 30s ago, when the tab becomes visible, then no network call to `/api/me` is made.
31+
- Given an authenticated session and last refresh ≥ 30s ago, when the tab becomes visible, then exactly one network call to `/api/me` is made and store `lastFetched` updates.
32+
- Given `refresh()` is currently in‑flight, when the tab becomes visible, then no additional `/api/me` call is made until the current one completes.
33+
- Test runs headless and passes in CI (GitHub Actions) with Playwright’s Chrome channel.
34+
35+
Out of scope
36+
- Backend behavior beyond returning a static user JSON.
37+
- Full login UI flow; use API seeding or cookie injection for session state.
38+
39+
Implementation Notes
40+
- Use Playwright test runner with `chromium`.
41+
- Seed an authenticated state by stubbing `/api/me` with a route handler (Playwright `page.route`) and setting a cookie if needed.
42+
- Control time via Playwright’s `page.addInitScript(() => { Date.now = () => FIXED; })` or by injecting a time shim. Alternatively, wait using `page.waitForTimeout(30000)` but prefer time control to keep tests fast.
43+
- Use the document visibility API to flip visibility:
44+
- Either open a second tab (Page 2) to cover the current tab, then bring Page 1 to front, or
45+
- Programmatically dispatch `visibilitychange` by toggling `document.hidden` via a stub (requires page init script to override the getter) and dispatching the event.
46+
- Spy on fetch calls by intercepting `/api/me` and counting invocations; assert using expect counters.
47+
48+
Test Plan (Playwright pseudo‑code)
49+
```ts
50+
import { test, expect } from '@playwright/test';
51+
52+
const USER = { id: 'u1', email: 'a@b.com' };
53+
54+
function mockMe(page, countRef) {
55+
page.route('**/api/me', async route => {
56+
countRef.count++;
57+
await route.fulfill({
58+
status: 200,
59+
contentType: 'application/json',
60+
body: JSON.stringify(USER),
61+
});
62+
});
63+
}
64+
65+
test.describe('visibility refresh cooldown', () => {
66+
test('does not refresh within 30s window; refreshes after 30s', async ({ page }) => {
67+
const calls = { count: 0 };
68+
await mockMe(page, calls);
69+
70+
// Start app
71+
await page.goto('http://localhost:5173');
72+
73+
// Bootstrap fires once
74+
await expect.poll(() => calls.count).toBe(1);
75+
76+
// Within cooldown: simulate visible event → no extra call
77+
await page.evaluate(() => document.dispatchEvent(new Event('visibilitychange')));
78+
await page.waitForTimeout(200); // settle
79+
expect(calls.count).toBe(1);
80+
81+
// Move time forward ≥30s and trigger again
82+
await page.addInitScript(() => {
83+
const start = Date.now();
84+
Date.now = () => start + 31_000;
85+
});
86+
await page.reload();
87+
await expect.poll(() => calls.count).toBeGreaterThanOrEqual(2);
88+
});
89+
});
90+
```
91+
92+
Risks & Mitigations
93+
- Dispatching `visibilitychange` in real browsers may be gated—inject a visibility getter shim if needed or use multi‑page focus handoff.
94+
- Time manipulation must be consistent across app and test; prefer overriding `Date.now()` early via `addInitScript`.
95+
96+
Estimation
97+
- Small (0.5–1d) including CI wiring.
98+
99+
Definition of Done
100+
- Playwright test checked in under `e2e/` and passing locally and on CI.
101+
- Docs updated (testing section) with a short note on the E2E and how to run it.
102+
- Milestone v0.4.0 linked and labels applied.
103+
104+
---
105+
106+
## Draft: Automate README “Changelog” badge to latest section on release
107+
108+
Title
109+
- chore(tooling): auto‑update README “Changelog” badge to latest section on release
110+
111+
Milestone
112+
- v0.3.1 (tooling)
113+
114+
Labels
115+
- area:tooling, type:chore, docs, release
116+
117+
Background
118+
- README currently includes a static badge linking directly to the 0.3.0 section of `CHANGELOG.md`. After each release we must update this anchor manually. We can automate this as part of the release flow so the badge always points at the newest version section.
119+
120+
Goals
121+
- Ensure the README “Changelog” badge link targets the most recent version section in `CHANGELOG.md` immediately after a release is cut/tagged.
122+
123+
Approach (pick one)
124+
1) Script integration:
125+
- Enhance `scripts/release.mjs` to compute the anchor for the new section header `## [x.y.z] - YYYY-MM-DD` using GitHub’s slug rules (lowercase, strip punctuation like brackets/dots, spaces→`-`).
126+
- Update or insert the badge link in `README.md` to `CHANGELOG.md#<computed-anchor>` as part of the release commit.
127+
2) GitHub Action:
128+
- On `release` (published), run a tiny Node step that reads `CHANGELOG.md`, finds the latest `## [x.y.z] - YYYY-MM-DD` header, computes the anchor, updates README, and opens a PR (or pushes with a workflow token).
129+
3) Fallback (if anchor calc is brittle):
130+
- Link badge to the Releases page or to `[Unreleased]` and keep the deep link optional. Prefer (1) or (2) for true deep‑linking.
131+
132+
Acceptance Criteria
133+
- After running the release flow for a new version, README’s “Changelog” badge points to the new section anchor (e.g., `CHANGELOG.md#040---2025-11-15`).
134+
- No manual edits required post‑release; changes are part of the release commit or an automated PR.
135+
- If the badge is missing, the automation inserts it below the Release badge.
136+
137+
Test Plan
138+
- Dry run locally by pretending to cut a test version (e.g., bump to `0.3.1` in a throwaway branch) and confirm README link updates to the computed anchor.
139+
- Validate anchor by clicking through in GitHub UI.
140+
141+
Risks & Mitigations
142+
- GitHub slug rules nuance: prefer deriving the anchor by reading the exact header text and applying the same slug transform used for headings (remove `[]()`, replace spaces with `-`, drop punctuation like `.`). Add a small unit test for the slug helper.
143+
- Workflow token push permissions: if using an Action, use a PAT or set `permissions: contents: write` on the workflow.
144+
145+
Definition of Done
146+
- Automation implemented via script or Action.
147+
- README badge reliably targets the latest CHANGELOG section after release.
148+
- Documented in `docs/developer-workflow-checklist.md` under the Release steps.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)