Skip to content

feat: add status badge modal and fix local dev auth bypass#29

Merged
tbjers merged 1 commit into
mainfrom
feat/status-badge
Jun 27, 2026
Merged

feat: add status badge modal and fix local dev auth bypass#29
tbjers merged 1 commit into
mainfrom
feat/status-badge

Conversation

@tbjers

@tbjers tbjers commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a Status Badge modal to the repo detail view: metric dropdown (all 6 badge metrics), live shields.io preview, copyable URL / Markdown / rSt snippets, and an inline enable/disable toggle that calls PATCH /api/admin/projects/:id/badge
  • Fix local dev 401s by migrating wrangler.jsoncwrangler.json, adding a named dev environment that declares DEV_BYPASS_SECRET as a required secret, and updating npm run dev to use wrangler dev --env dev
  • Simplify requireAccess() bypass: any non-empty DEV_BYPASS_SECRET skips Access JWT verification (no header required), and add structured logging at each decision point for easier debugging

Changes

Area What changed
BadgeModal.svelte New component — metric picker, live badge preview, copy snippets, enable/disable toggle
+page.svelte "Create status badge" button right-aligned on controls row; conditional modal mount
wrangler.jsoncwrangler.json Renamed; added env.dev overlay with DEV_BYPASS_SECRET required secret and D1 binding
package.json dev script uses --env dev; local DB scripts also pass --env dev
src/middleware/access.ts Bypass on env var presence (no header check); structured logging on every auth decision
worker-configuration.d.ts Regenerated after wrangler typesDEV_BYPASS_SECRET is now optional in base env, required in DevEnv
dashboard/.env.example Deleted — was a leftover from the old Pages architecture; the SPA never used it
CLAUDE.md Updated all wrangler.jsonc refs, new "Local dev" section, corrected DB commands
CI workflows Added FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 to both action-test.yml and deploy.yml

Test plan

  • Open a repo detail page — "Create status badge" button appears right-aligned next to branch field
  • Click button → modal opens with entrance animation, focus traps inside
  • Metric dropdown defaults to Coverage; changing it updates all three snippets and the badge preview reactively
  • Copy buttons show "Copied!" feedback for 2 s, then revert
  • If badge_enabled = 0: notice is shown with "Enable public badge" button; clicking it enables and shows the live badge
  • If badge_enabled = 1: checkmark + "Disable" link shown; clicking it disables and hides the preview
  • Escape / clicking backdrop closes modal and returns focus to the trigger button
  • npm run dev (with DEV_BYPASS_SECRET=dev in .dev.vars) no longer returns 401 on /api/projects
  • wrangler deploy --dry-run passes cleanly

🤖 Generated with Claude Code

- Add BadgeModal component with metric dropdown (all 6 badge metrics),
  live shields.io preview, copyable URL/Markdown/rSt snippets, and an
  inline enable/disable toggle (PATCH /api/admin/projects/:id/badge)
- Add "Create status badge" button to the repo detail view controls row
- Fix local dev 401s: migrate wrangler.jsonc → wrangler.json, add named
  `dev` environment declaring DEV_BYPASS_SECRET as a required secret,
  update dev script to use `wrangler dev --env dev`
- Simplify requireAccess() bypass: any non-empty DEV_BYPASS_SECRET skips
  Access JWT verification (no header match required)
- Add structured logging to requireAccess() for auth debugging
- Update CLAUDE.md, .dev.vars.example, and dashboard env files to
  reflect the new dev environment setup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tbjers tbjers merged commit fbd99b2 into main Jun 27, 2026
5 checks passed
@tbjers tbjers deleted the feat/status-badge branch June 27, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant