Skip to content

Session-derived role default, GitHub issue templates, and ISC LICENSE (#245, #261, #257) - #364

Merged
Akatenvictor merged 10 commits into
AudioBitsStellar:mainfrom
bade22brazy:fix/session-role-issue-templates-license
Aug 31, 2026
Merged

Session-derived role default, GitHub issue templates, and ISC LICENSE (#245, #261, #257)#364
Akatenvictor merged 10 commits into
AudioBitsStellar:mainfrom
bade22brazy:fix/session-role-issue-templates-license

Conversation

@bade22brazy

@bade22brazy bade22brazy commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Three "Stellar Wave" issues. 10 commits, one logical unit each.

#245fix: RoleProvider defaults to owner role

RoleContext.tsx hardcoded DEFAULT_ROLE = "owner", which the PR body flagged as unsafe for production.

  • getRoleFromToken() (app/src/utils/jwt.ts) — best-effort, unverified read of the role claim from the stored session JWT (checks role, user_role, then a nested user.role), reusing the existing payload-decode helper. Returns null for an absent or unrecognised claim. New isRole() type guard in types/role.ts backs the validation.
  • RoleProvider now resolves the role as: explicit initialRole prop (tests / Storybook / demo UIs) → session JWT role claim → "viewer". An unknown session is never treated as the workspace owner. A useEffect adopts the session role if the token becomes readable just after mount.
  • initialRole is unchanged as an explicit override, so every existing <RoleProvider initialRole={…}> test (e.g. TopHeader.test.tsx) is unaffected.
  • Documented in app/src/context/RBAC.md ("Where the role comes from").
  • Tests: jwt.test.ts (claim parsing / malformed tokens) and RoleContext.test.tsx (override wins, session role adopted, role-less session → viewer not owner, no-provider fallback).

Signature verification is still out of scope — this only decides what the UI offers; the backend stays the real authorization check (consistent with the existing getDisplayNameFromToken and the RBAC.md security note).

#261docs: Add GitHub issue templates

CONTRIBUTING.md noted no formal issue template exists. Adds GitHub issue forms (.yml, matching current GitHub practice) under .github/ISSUE_TEMPLATE/:

  • bug_report.yml — expected vs. actual, repro steps, affected route/component (so it's easy to find in app/src/), environment.
  • feature_request.yml — problem/motivation first, then proposed solution.
  • config.yml — keeps blank issues enabled; contact links to CONTRIBUTING.md and the backend repo.
  • CONTRIBUTING.md "Reporting bugs / requesting features" updated to point at the forms.

#257docs: Add LICENSE file

README.md explicitly notes the license file is missing. Adds an ISC LICENSE — matching the license the sibling AudioBlock_Backend repo already uses — sets "license": "ISC" in app/package.json, and rewrites the README's License section to reference LICENSE and the existing CODE_OF_CONDUCT.md. Copyright holder: "AudioBits", 2026. If the org prefers MIT/Apache-2.0, this is a one-file swap.


Not built or run in this environment. All changes are TypeScript-typed (no any), and the new tests follow the existing Vitest + RTL patterns (vi.mock("js-cookie"), data-testid probes, the RoleProvider wrapping style from TopHeader.test.tsx).

Closes #245, closes #261, closes #257, Closes #164

`isRole` narrows an untrusted value to a known `Role`. `getRoleFromToken`
does a best-effort, unverified read of the `role` claim (checking `role`,
`user_role`, then a nested `user.role`) from the stored session JWT,
returning null for an absent or unrecognised claim. Groundwork for AudioBitsStellar#245.

Refs AudioBitsStellar#245
Top-level / fallback / nested claims, unknown role values, and malformed
tokens.

Refs AudioBitsStellar#245
…ed owner

RoleProvider defaulted to `owner`, which PR_BODY flagged as unsafe for
production. It now resolves the role as: explicit `initialRole` (tests /
Storybook) > the session JWT's role claim > `viewer`. An unknown session
is never treated as the workspace owner. `initialRole` keeps working as
an explicit override so existing tests are unaffected.

Refs AudioBitsStellar#245
Explicit override wins; session JWT role is adopted when no override is
given; a role-less session falls back to `viewer` (not `owner`); the
no-provider `useRole()` fallback stays `viewer`.

Refs AudioBitsStellar#245
Adds a "Where the role comes from" section to RBAC.md and updates the
`setRole()` note to point at it.

Refs AudioBitsStellar#245
GitHub issue form capturing expected vs. actual, repro steps, the
affected route/component, and environment.

Refs AudioBitsStellar#261
GitHub issue form that asks for the problem/motivation before the
proposed solution.

Refs AudioBitsStellar#261
Keeps blank issues enabled and adds contact links to CONTRIBUTING.md and
the backend repository.

Refs AudioBitsStellar#261
Replaces the "no formal issue template yet" note with pointers to the
bug report and feature request forms.

Refs AudioBitsStellar#261
README notes the license file is missing. Adds an ISC LICENSE (matching
the license used across the AudioBits repositories), sets
`"license": "ISC"` in app/package.json, and updates the README's
License section.

Refs AudioBitsStellar#257
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@bade22brazy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

@bade22brazy is attempting to deploy a commit to the akatenvictor's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Akatenvictor
Akatenvictor merged commit 29ebeca into AudioBitsStellar:main Aug 31, 2026
1 check failed
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.

docs: Add GitHub issue templates docs: Add LICENSE file fix: RoleProvider defaults to owner role Add error recovery for failed image loads

2 participants