Skip to content

Fix bugs in roles API, avatar state, toast a11y, meta serialization, and session expiry test#164

Merged
taterhead247 merged 2 commits intofeat/mefrom
copilot/sub-pr-163
Mar 5, 2026
Merged

Fix bugs in roles API, avatar state, toast a11y, meta serialization, and session expiry test#164
taterhead247 merged 2 commits intofeat/mefrom
copilot/sub-pr-163

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 5, 2026

Five correctness/quality issues identified in PR review across apps/me.

Changes

  • roles/route.ts: Strip orgName (and any extra fields) from roles before calling updateUser() by mapping to { orgId, roleName } — matches the same pattern used elsewhere and avoids upstream schema rejection.

  • avatar.tsx: Reset imgError via useEffect on src changes so a new valid URL isn't permanently shadowed by a prior load failure.

  • toast.tsx: Add type="button" and aria-label="Dismiss" to the close button — prevents accidental form submits and enables screen reader announcements.

  • profile/route.ts: Serialize mergedMeta with JSON.stringify() before assigning to updateBody.meta, matching UserUpsert.meta: string contract.

    // Before (sends object, fails schema validation)
    updateBody.meta = mergedMeta;
    // After
    updateBody.meta = JSON.stringify(mergedMeta);
  • session.test.ts: Replace the non-functional expired-session test with a real one using vi.useFakeTimers() — advances time past SESSION_COOKIE_MAX_AGE and asserts verifySessionValue returns null.

  • README.md: Correct the security note — authorization is resolved by session.email lookup, not sub → user ID binding.

  • Tests updated (roles.test.ts, profile.test.ts) to reflect new behavior (no orgName in roles payload; meta is a JSON string that must be parsed before asserting on its fields).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
Copilot AI changed the title [WIP] Set up initial configuration for profile manager app Fix bugs in roles API, avatar state, toast a11y, meta serialization, and session expiry test Mar 5, 2026
@taterhead247 taterhead247 marked this pull request as ready for review March 5, 2026 22:56
@taterhead247 taterhead247 merged commit ca2ea4f into feat/me Mar 5, 2026
@taterhead247 taterhead247 deleted the copilot/sub-pr-163 branch March 5, 2026 22:56
taterhead247 added a commit that referenced this pull request Mar 6, 2026
…and session expiry test (#164)

* Initial plan

* Fix all remaining open PR review comments

Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
pstaylor-patrick pushed a commit that referenced this pull request Apr 9, 2026
…and session expiry test (#164)

* Initial plan

* Fix all remaining open PR review comments

Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
pstaylor-patrick pushed a commit that referenced this pull request Apr 9, 2026
…and session expiry test (#164)

* Initial plan

* Fix all remaining open PR review comments

Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

2 participants