Skip to content

Commit 2c15146

Browse files
authored
Merge pull request #13 from sameboat-platform/pr/12
chore(release): 0.1.1 – consolidate health polling, add env template, dependabot config
2 parents ff8ad3b + fb2966d commit 2c15146

File tree

15 files changed

+533
-1667
lines changed

15 files changed

+533
-1667
lines changed

.env.example

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
VITE_API_BASE_URL=http://localhost:8080
2+
# Enable verbose auth logs (set to any non-empty value). Recommended to keep blank by default.
3+
# VITE_DEBUG_AUTH=1
4+
# Additional bootstrap debug logs (rarely needed now that heartbeat removed)
5+
# VITE_DEBUG_AUTH_BOOTSTRAP=1
6+
7+
# Health check polling interval (ms). Must be > 1000. Defaults to 30000 if unset or invalid.
8+
VITE_HEALTH_REFRESH_MS=30000
9+
10+
# Optional build metadata (injected via tooling / CI)
11+
# VITE_APP_VERSION=0.1.1
12+
# VITE_COMMIT_HASH=abcdef1
13+
14+
# Feedback / issue reporting URL (shown in footer + debug panel)
15+
VITE_FEEDBACK_URL=https://github.com/sameboat-platform/frontend/issues/new
16+
17+
# Add any future feature flags below (must start with VITE_ to be exposed to client)
118
# (frontend doesn’t talk to Postgres)
219
# Place future public config here, e.g. VITE_API_BASE_URL
320
VITE_API_BASE_URL=http://localhost:8080

.github/dependabot.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,41 @@
11
version: 2
22
updates:
3-
# Keep npm packages up to date
4-
- package-ecosystem: npm
5-
directory: "/" # location of package.json
3+
# Single npm config (Dependabot requires unique ecosystem+directory). We use groups to manage cadence.
4+
# NOTE: We cannot have separate schedules for security vs tooling without a different target-branch, so we
5+
# choose a daily cadence; tooling noise is minimized via grouping.
6+
- package-ecosystem: "npm"
7+
directory: "/"
68
schedule:
7-
interval: weekly
8-
day: sunday # optional: choose a day
9-
time: "05:00" # optional: UTC time
10-
timezone: "America/Chicago"
11-
open-pull-requests-limit: 5
12-
groups: # optional: group related bumps to reduce PR noise
9+
interval: daily
10+
time: "06:00"
11+
open-pull-requests-limit: 8
12+
labels: ["deps"]
13+
groups:
14+
security-critical:
15+
applies-to: security-updates
16+
patterns:
17+
- "*"
18+
dev-tooling:
19+
patterns:
20+
- "@types/*"
21+
- "eslint*"
22+
- "vitest"
23+
- "@testing-library/*"
24+
- "typescript*"
1325
vite-minors:
1426
patterns:
1527
- "vite"
1628
- "@vitejs/*"
1729
update-types:
1830
- "minor"
1931
- "patch"
20-
ignore: # optional: avoid sudden breaking major bumps
32+
ignore:
33+
- dependency-name: "react"
34+
update-types: ["version-update:semver-major"]
2135
- dependency-name: "typescript"
2236
update-types: ["version-update:semver-major"]
2337

24-
# Keep your GitHub Actions up to date
38+
# GitHub Actions updates (weekly)
2539
- package-ecosystem: "github-actions"
2640
directory: "/"
2741
schedule:
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Coverage Badge
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch: {}
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
coverage-badge:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Use Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: npm
23+
24+
- name: Install deps
25+
run: npm ci
26+
27+
- name: Run tests with coverage
28+
run: |
29+
npm test -- --coverage --reporter=default
30+
31+
- name: Parse coverage percentage
32+
id: coverage
33+
run: |
34+
# Look for line coverage in lcov report or summary
35+
PCT=$(grep -E "^Statements" coverage/coverage-summary.json || true)
36+
if [ -f coverage/coverage-summary.json ]; then
37+
PCT=$(node -e "console.log(require('./coverage/coverage-summary.json').total.statements.pct)")
38+
else
39+
echo "coverage summary not found" && exit 1
40+
fi
41+
echo "coverage=$PCT" >> $GITHUB_OUTPUT
42+
43+
- name: Generate badge
44+
run: |
45+
PCT=${{ steps.coverage.outputs.coverage }}
46+
COLOR=yellow
47+
if [ "${PCT%.*}" -ge 80 ]; then COLOR=green; elif [ "${PCT%.*}" -ge 65 ]; then COLOR=yellowgreen; elif [ "${PCT%.*}" -lt 50 ]; then COLOR=red; fi
48+
echo "Generating badge for $PCT% -> $COLOR"
49+
mkdir -p .github/badges
50+
cat <<'SVG' > .github/badges/coverage.svg
51+
<svg xmlns='http://www.w3.org/2000/svg' width='120' height='20' role='img' aria-label='coverage: $PCT%'><linearGradient id='s' x2='0' y2='100%'><stop offset='0' stop-color='#bbb' stop-opacity='.1'/><stop offset='1' stop-opacity='.1'/></linearGradient><mask id='m'><rect width='120' height='20' rx='3' fill='#fff'/></mask><g mask='url(#m)'><rect width='62' height='20' fill='#555'/><rect x='62' width='58' height='20' fill='$COLOR'/><rect width='120' height='20' fill='url(#s)'/></g><g fill='#fff' text-anchor='middle' font-family='Verdana,Geneva,DejaVu Sans,sans-serif' text-rendering='geometricPrecision' font-size='11'><text x='31' y='14'>coverage</text><text x='90' y='14'>$PCT%</text></g></svg>
52+
SVG
53+
54+
- name: Commit badge
55+
run: |
56+
git config user.name 'github-actions'
57+
git config user.email 'actions@github.com'
58+
git add .github/badges/coverage.svg
59+
git commit -m "chore: update coverage badge" || echo "No changes"
60+
git push

CHANGELOG.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,35 @@ Format loosely follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
77
## [Unreleased]
88

99
### Added
10-
- Nothing yet.
10+
- SECURITY policy (`SECURITY.md`).
11+
- MIT license file (`LICENSE`).
12+
- Coverage badge workflow (`coverage-badge.yml`) generating `coverage.svg` on main pushes.
13+
- `.env.example` template enumerating supported environment variables.
14+
- Dependabot configuration skeleton (`.github/dependabot.yml`) grouping security vs tooling updates.
15+
- Smoke test for `HealthCheckCard` component.
1116

1217
### Changed
13-
- Nothing yet.
18+
- Replaced ad-hoc inline Home page health logic with reusable `<HealthCheckCard />` component.
19+
- Removed transient auth bootstrap "heartbeat" interval (was only for earlier debugging) to reduce console noise.
20+
- Stabilized health polling implementation (single interval; eliminated status-driven re-subscribe loop).
1421

1522
### Fixed
16-
- Nothing yet.
23+
- Excessive `/actuator/health` polling spam caused by effect dependency loop and duplicate Home page implementation.
1724

1825
### Documentation
19-
- Nothing yet.
26+
- Added minimal security policy document.
27+
- README badges (release, coverage, security, license).
28+
29+
### Security
30+
- Bump esbuild to 0.25.10 resolving moderate advisory.
31+
- Upgrade vitest to 3.2.4 (dev dependency; no runtime impact).
2032

2133
### Internal
22-
- Nothing yet.
34+
- Removed legacy .eslintignore by migrating ignore patterns to flat config.
35+
- Silenced auth debug logs during Vitest via `isVitest` guard.
36+
- Automated coverage badge generation.
37+
- Refactored health polling to use stable callback + ref tracking (`statusRef`) preventing rapid interval churn.
38+
- Consolidated health checks (Home now delegates to `HealthCheckCard`).
2339

2440
### Notes
2541
- Nothing yet.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 SameBoat Platform Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
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)
2+
[![Release](https://img.shields.io/github/v/tag/sameboat-platform/frontend?label=release&sort=semver)](https://github.com/sameboat-platform/frontend/releases)
3+
[![License](https://img.shields.io/github/license/sameboat-platform/frontend.svg)](LICENSE)
4+
[![Dependencies](https://img.shields.io/github/actions/workflow/status/sameboat-platform/frontend/frontend-ci.yml?label=build)](https://github.com/sameboat-platform/frontend/actions)
5+
[![Coverage](https://img.shields.io/badge/coverage-≥50%25-informational)](./CHANGELOG.md)
6+
[![Security Policy](https://img.shields.io/badge/security-policy-blue)](./SECURITY.md)
27

38
# SameBoat Frontend (Vite + React + TS)
49

@@ -45,6 +50,33 @@ src/
4550
public/ # Static assets served at root (/favicon, /vite.svg)
4651
```
4752

53+
### Health Monitoring Component
54+
55+
`HealthCheckCard` centralizes backend liveness/health polling with:
56+
57+
- Configurable interval via prop or `VITE_HEALTH_REFRESH_MS`.
58+
- Minimum skeleton duration to reduce UI flicker.
59+
- Manual refresh button.
60+
- Status + message extraction from Spring Boot Actuator style responses.
61+
- Stable polling loop (no re-subscribe on status changes).
62+
63+
Usage:
64+
65+
```tsx
66+
import HealthCheckCard from './components/HealthCheckCard';
67+
68+
export default function Home() {
69+
return (
70+
<div>
71+
{/* other content */}
72+
<HealthCheckCard />
73+
</div>
74+
);
75+
}
76+
```
77+
78+
If you need a one-off health check somewhere else, prefer reusing this component to avoid duplicate intervals.
79+
4880
Add components under `src/components/` and import into pages or `App.tsx`.
4981

5082
## Development Workflow

SECURITY.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | --------- |
7+
| 0.1.x | ✅ Active |
8+
| < 0.1.0 ||
9+
10+
Pre-1.0 versions may receive security dependency bumps and critical patches only.
11+
12+
## Reporting a Vulnerability
13+
14+
Please open a private advisory via GitHub Security Advisories ("Report a vulnerability" in the repo *Security* tab) **or** email the maintainer listed in `package.json`.
15+
16+
Include (when possible):
17+
- Affected route or component
18+
- Reproduction steps / PoC
19+
- Impact assessment (confidentiality, integrity, availability)
20+
- Suggested fix or mitigation (if known)
21+
22+
You will receive an acknowledgement within 2 business days. We aim to provide an initial remediation plan within 5 business days.
23+
24+
## Disclosure Process
25+
1. Receive & validate report.
26+
2. Assign CVSS-like internal severity (low / moderate / high / critical).
27+
3. Patch on a protected branch; add tests where feasible.
28+
4. Release patched version (e.g. `0.1.(n+1)`) and update CHANGELOG under **Security**.
29+
5. Public disclosure after fix is available (or coordinated timeline for high severity).
30+
31+
## Dependency Vulnerabilities
32+
Automated tools (e.g., Dependabot) generate PRs for vulnerable packages. These are merged after:
33+
- Lint + type + test + build gates pass.
34+
- CHANGELOG updated under **Security**.
35+
36+
## Hardening Roadmap
37+
- Add CI job to scan for secret leaks.
38+
- Add CSP & security headers doc section before 0.2.0.
39+
- Expand automated dependency diff labeling.
40+
41+
If you have suggestions for further hardening, please open an issue tagged `enhancement` + `security`.

TTD.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
- Add a custom CI step that fails if no test files were touched for a PR containing `feat:` or `fix:` commits.
3333
- Script/guard to fail if a `feat:` commit lands without any matching diff in `src/__tests__/` (heuristic; allow override via `[skip-test-guard]`).
3434
- GitHub Action to auto-assign PR label based on first conventional commit type (feat/fix/docs/chore/refactor/test/perf).
35+
36+
### Dependency / Security Automation
37+
38+
- Create Dependabot config groups separating critical/security deps from test/tooling deps (distinct PR labels & visibility).
39+
- Add CI job for dependency audit (e.g. `npm audit --audit-level=moderate` or Snyk) highlighting severity delta between main and PR.
40+
- Add GitHub Action guard: fail Dependabot PR if it modifies > N (configurable) devDependencies without a CHANGELOG entry under Security or Internal.
3541

3642
## Notes
3743

eslint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import tseslint from 'typescript-eslint'
66
import { defineConfig, globalIgnores } from 'eslint/config'
77

88
export default defineConfig([
9-
globalIgnores(['dist']),
9+
// Migrate legacy .eslintignore entries here (ESLint flat config)
10+
globalIgnores(['dist', 'build', 'coverage', 'node_modules']),
1011
{
1112
files: ['**/*.{ts,tsx}'],
1213
extends: [

0 commit comments

Comments
 (0)