GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: add case handover access gate by Storypapst · Pull Request #275 · OpenResilienceInitiative/ORISO-Frontend Conversation
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds case-handover API wrappers and endpoint entries, shared handover predicates and request UI, session-stream gating, batch selection in the sessions list, locked-item controls, and consent actions in notifications, plus supporting localization, registry, and styles. ChangesCase handover workflow
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@coderabbitai review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
✅ Action performedReview finished.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cursor thermonuclear review (vs
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Thermonuclear review (base:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@coderabbitai review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
✅ Action performedReview finished.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 13
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/hooks/useSession.tsx (1)
95-117: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winUnwrapped
awaitin the success path lets a failed candidate lookup fall through to a retry.At line 108 the candidate lookup is awaited without a guard, so a non-abort rejection rejects the whole
.thenand lands in.catch(line 118), which then callsloadCaseHandoverCandidateSessiona second time. This is a redundant network round-trip on the common "no active session" path. Consider guarding it (the.catch(() => false)you already use at line 144) so a failed candidate fetch resolves tofalseand falls through tosetReady(true)instead of re-entering the error flow.♻️ Suggested guard
} else { if ( sessionId && (await loadCaseHandoverCandidateSession( abortController.current?.signal - )) + ).catch(() => false)) ) { return; } } setReady(true);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/hooks/useSession.tsx` around lines 95 - 117, The no-active-session path in useSession should not let a failed loadCaseHandoverCandidateSession call reject the .then chain and trigger the .catch retry path. Update the candidate lookup inside the activeSession else branch in useSession so it is guarded the same way as the later retry logic, returning false on non-abort failures instead of throwing; this lets setReady(true) run once and avoids a second network call.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/api/apiCaseHandover.ts`:
- Around line 5-12: The `CaseHandoverStatusValue` union is widened by the
trailing broad string type, so the named statuses in `apiCaseHandover` no longer
provide useful narrowing for `isCaseHandoverPending` and `isCaseHandoverDenied`.
Update the type definition to keep the literal members as a real union and
replace the broad string fallback with an explicit unknown-value escape hatch,
then make sure the gating helpers still reference `CaseHandoverStatusValue` so
autocomplete and typo protection are preserved.
- Around line 79-122: The case-handover API paths are split between
session-based and static base routes, so verify the backend contract and
consolidate the route definitions in endpoints.ts if they are meant to represent
the same feature; update apiGetCaseHandoverStatus, apiRequestCaseHandoverAccess,
apiRequestCaseHandoverBatchAccess, and apiDecideCaseHandoverClientConsent to use
the same agreed base path source. Also tighten CaseHandoverStatusValue by
removing the broad string fallback unless unknown statuses are expected, and
handle any truly unknown backend values explicitly where the status is consumed.
In `@src/components/notificationsCenter/notificationsCenter.styles.scss`:
- Around line 301-321: The consent button styles in
notificationsCenter.styles.scss are using a one-off approve red instead of the
existing primary-action red, and they are missing a visible keyboard focus
state. Update the `&__consentButton--approve` variant to reuse the same primary
accent color already used by `__openButton` and `__chatComposerSend`, and add a
`:focus-visible` treatment for `&__consentButton` that matches the shared focus
pattern used by `__chip` and `__search` via `list-item-focus-treatment`.
- Line 532: The notifications center stylesheet uses Media Queries Level 4 range
syntax in two `@media (width <= 1200px)` blocks, which breaks IE11 support.
Update both responsive rules in the notifications center styles to use the
standard `@media (max-width: 1200px)` form so the same layout behavior works
with the project’s IE11 target.
In `@src/components/notificationsCenter/NotificationsCenter.tsx`:
- Around line 351-370: The handleCaseHandoverConsentDecision flow is missing
rejection handling, so apiDecideCaseHandoverClientConsent errors become
unhandled and the UI gives no feedback. Update the promise chain in
NotificationsCenter so the request includes a .catch() after the .then() and
before the .finally(), and surface the failure to the user while still resetting
caseHandoverConsentSubmitting. Use the existing
handleCaseHandoverConsentDecision, apiDecideCaseHandoverClientConsent,
markNotificationAsRead, and refreshNotificationFeed symbols to locate the flow.
In `@src/components/session/CaseHandoverGate.tsx`:
- Around line 118-156: Add programmatic accessible names for both controls in
CaseHandoverGate: the div with role="radiogroup" needs an explicit
label/labelledby tied to the reason group, and the explanation textarea needs a
real label instead of relying on placeholder text. Update the JSX around the
reasons.map block and the textarea so screen readers can announce both controls
clearly, while keeping the existing keyboard/radio behavior intact.
In `@src/components/sessionsList/sessionsList.styles.scss`:
- Around line 106-214: The new case-handover batch styles in
sessionsList.styles.scss use several hardcoded hex colors instead of the shared
design tokens already used elsewhere in this file. Update the styles in the
caseHandoverBatch* block to reuse the existing session/theme variables and
tokenized colors, and make the toggle/submit primary action use the same brand
red as the other primary CTAs in sessionsList so the controls match
consistently. Focus on the selectors like __caseHandoverBatchToggle,
__caseHandoverBatchPanel, __caseHandoverBatchReasons,
__caseHandoverBatchExplanation, and __caseHandoverBatchActions.
In `@src/components/sessionsList/SessionsList.tsx`:
- Around line 1995-2026: The batch reason controls in SessionsList need
programmatic accessibility labels. Update the case handover radio container to
expose a group name using role="radiogroup" with aria-label, or replace it with
a fieldset/legend around the caseHandoverReasons mapping. Also add an aria-label
to the caseHandoverExplanation textarea so it has a readable name beyond the
placeholder.
In `@src/components/sessionsListItem/SessionListItemComponent.tsx`:
- Around line 259-288: The `useEffect` in `SessionListItemComponent` is treating
every failure from `apiGetCaseHandoverStatus` as an authoritative denial, which
mislabels transient errors as `DENIED`. Update the `catch` path to distinguish
non-FORBIDDEN/network failures from true access denial, and only set `status:
'DENIED'` when the API explicitly indicates denial; otherwise preserve a
neutral/unknown state (for example `null` or `UNKNOWN`) and keep the existing
cancellation guard and `setCaseHandoverStatus` flow intact.
- Around line 259-288: The case handover status fetch in
SessionListItemComponent is causing an N+1 request pattern because each rendered
item calls apiGetCaseHandoverStatus independently. Move that orchestration into
SessionsList, keep a shared statusBySessionId map in the parent, and pass the
resolved status down to SessionListItemComponent as a prop instead of fetching
in its useEffect. Add deduplication or debouncing in the parent so repeated
renders or fast scrolling do not trigger redundant requests, and update the
child component to only consume the provided status.
- Around line 1586-1620: The batch-mode case handover button in
SessionListItemComponent currently exposes selection only through visual styling
and an aria-hidden span, so add an accessible pressed state to the existing
button. Update the button in the case handover action area to set aria-pressed
based on caseHandoverSelected when caseHandoverBatchMode is active, using the
existing handleCaseHandoverActionClick and
caseHandoverBatchMode/caseHandoverSelected logic.
In `@src/components/sessionsListItem/sessionsListItem.styles.scss`:
- Around line 773-778: Stylelint is flagging the `sessionsListItem.styles.scss`
rules because the `currentColor` keyword casing is not accepted; update the
`sessionsListItem` style block to use the lowercase keyword form in both the
base rule and the `&--selected` modifier so `npm run lint:style` passes.
- Around line 730-781: The `&__caseHandoverButton` and `&__caseHandoverCheckbox`
rules are nested under `&__consultingTypeIcon`, so they compile to the wrong
selectors and never match the rendered elements. Move both blocks out to the
`sessionsListItem` root scope in `sessionsListItem.styles.scss` so they become
direct BEM children like `sessionsListItem__caseHandoverButton` and
`sessionsListItem__caseHandoverCheckbox`, preserving their modifier states
(`--pending`, `--denied`, `--selected`).
---
Outside diff comments:
In `@src/hooks/useSession.tsx`:
- Around line 95-117: The no-active-session path in useSession should not let a
failed loadCaseHandoverCandidateSession call reject the .then chain and trigger
the .catch retry path. Update the candidate lookup inside the activeSession else
branch in useSession so it is guarded the same way as the later retry logic,
returning false on non-abort failures instead of throwing; this lets
setReady(true) run once and avoids a second network call.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e74ce5c0-9384-45ce-8301-d5eedc419018
src/api/apiCaseHandover.tssrc/api/index.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/notificationsCenter.styles.scsssrc/components/session/CaseHandoverGate.tsxsrc/components/session/SessionStream.tsxsrc/components/session/caseHandoverGate.styles.scsssrc/components/session/caseHandoverHelpers.test.tssrc/components/session/caseHandoverHelpers.tssrc/components/sessionsList/SessionsList.tsxsrc/components/sessionsList/sessionsList.styles.scsssrc/components/sessionsListItem/SessionListItemComponent.tsxsrc/components/sessionsListItem/sessionsListItem.styles.scsssrc/hooks/useSession.tsxsrc/resources/i18n/de/common.jsonsrc/resources/i18n/en/common.jsonsrc/resources/scripts/endpoints.ts📄 CodeRabbit inference engine (.understand-anything/ORISO-ECOSYSTEM.md)
When changing API usage under
src/api/, verify API compatibility against the backend contracts outside this graph.
Files:
src/api/index.tssrc/api/apiCaseHandover.ts📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Keep shared behavior in hooks/utilities when multiple screens need the same state, route, selection, or formatting logic.
UI changes must have accessible focus/keyboard behavior and must not rely on color alone.
Files:
src/api/index.tssrc/components/session/caseHandoverHelpers.test.tssrc/components/session/CaseHandoverGate.tsxsrc/components/session/caseHandoverHelpers.tssrc/resources/scripts/endpoints.tssrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/hooks/useSession.tsxsrc/api/apiCaseHandover.tssrc/components/session/SessionStream.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsxsrc/components/sessionsList/SessionsList.tsx📄 CodeRabbit inference engine (AGENTS.md)
Reuse existing design tokens, Sass mixins, and component patterns; avoid one-off hardcoded CSS for controls, active list states, focus rings, and responsive layout.
Files:
src/api/index.tssrc/components/sessionsListItem/sessionsListItem.styles.scsssrc/components/session/caseHandoverHelpers.test.tssrc/components/sessionsList/sessionsList.styles.scsssrc/components/notificationsCenter/notificationsCenter.styles.scsssrc/components/session/CaseHandoverGate.tsxsrc/components/session/caseHandoverHelpers.tssrc/resources/scripts/endpoints.tssrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/hooks/useSession.tsxsrc/api/apiCaseHandover.tssrc/components/session/caseHandoverGate.styles.scsssrc/components/session/SessionStream.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsxsrc/components/sessionsList/SessionsList.tsx⚙️ CodeRabbit configuration file
**: # AGENTS.mdContext First
- Treat
devas the normal integration branch for ORISO feature PRs unless the task says otherwise.- Before non-trivial changes, skim
.understand-anything/README.md,.understand-anything/ARCHITECTURE.md, and.understand-anything/knowledge-graph.jsonfor fast repo context.- Use
CONTEXT.mdfor Activity Timeline and notification vocabulary; avoid inventing parallel terms.Frontend Rules
- Keep behavior in shared hooks/utilities when multiple screens need the same state, route, selection, or formatting logic.
- Reuse existing design tokens, Sass mixins, and component patterns. Avoid one-off hardcoded CSS for controls, active list states, focus rings, and responsive layout.
- Preserve Matrix/chat/draft privacy boundaries. Do not move plaintext previews or draft contents into server-visible state.
- UI changes need accessible focus/keyboard behavior and should not rely on color alone.
Validation
- Prefer red-green TDD for behavior changes: add or update the smallest test that would fail without the fix, then implement.
- Useful commands:
npm run test:unitnpm run lint:scriptsnpm run lint:stylenpm run build- If a full command is too expensive or blocked by existing unrelated failures, run the narrowest relevant command and state the blocker precisely.
Review Expectations
- CodeRabbit and Cursor should compare PRs against
origin/devfor normal ORISO feature work.- Automated review should flag missing tests, duplicated UI architecture, unsafe privacy changes, and mergeability risks.
- Only auto-fix issues that are clearly scoped and testable. Leave architectural or ambiguous changes as review comments.
**: # Activity Timeline & NotificationsThe consultant- and client-facing history of everything that happens around a case: enquiries, accept/deny, messages, drafts, appointments, handovers, calls. It is two things in one surface: an inbox (events that happened *to...
Files:
src/api/index.tssrc/components/sessionsListItem/sessionsListItem.styles.scsssrc/components/session/caseHandoverHelpers.test.tssrc/components/sessionsList/sessionsList.styles.scsssrc/components/notificationsCenter/notificationsCenter.styles.scsssrc/components/session/CaseHandoverGate.tsxsrc/components/session/caseHandoverHelpers.tssrc/resources/scripts/endpoints.tssrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/notificationsCenter/eventDescriptors/registry.tssrc/resources/i18n/en/common.jsonsrc/components/notificationsCenter/NotificationsCenter.tsxsrc/hooks/useSession.tsxsrc/api/apiCaseHandover.tssrc/resources/i18n/de/common.jsonsrc/components/session/caseHandoverGate.styles.scsssrc/components/session/SessionStream.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsxsrc/components/sessionsList/SessionsList.tsx⚙️ CodeRabbit configuration file
src/**/*.{ts,tsx,js,jsx}: Check behavior against the surrounding ORISO flow, not only types.
Flag duplicated route/state logic, missing error/loading handling,
privacy regressions around Matrix/chat/drafts, and changes that should
be expressed through shared hooks or utilities instead of local flags.
Files:
src/api/index.tssrc/components/session/caseHandoverHelpers.test.tssrc/components/session/CaseHandoverGate.tsxsrc/components/session/caseHandoverHelpers.tssrc/resources/scripts/endpoints.tssrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/hooks/useSession.tsxsrc/api/apiCaseHandover.tssrc/components/session/SessionStream.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsxsrc/components/sessionsList/SessionsList.tsx⚙️ CodeRabbit configuration file
src/**/*.scss: Prefer existing design tokens, mixins, and shared component states.
Flag hardcoded one-off styling when the same control/state already
exists elsewhere. Active/focus/list-item behavior should stay shared.
Files:
src/components/sessionsListItem/sessionsListItem.styles.scsssrc/components/sessionsList/sessionsList.styles.scsssrc/components/notificationsCenter/notificationsCenter.styles.scsssrc/components/session/caseHandoverGate.styles.scss📄 CodeRabbit inference engine (.understand-anything/ORISO-ECOSYSTEM.md)
When changing endpoint constants in
src/resources/scripts/endpoints.ts, verify API compatibility against the backend contracts outside this graph.
Files:
src/resources/scripts/endpoints.ts[error] 773-773: Expected "currentColor" to be "currentcolor" (value-keyword-case)
(value-keyword-case)
[error] 778-778: Expected "currentColor" to be "currentcolor" (value-keyword-case)
(value-keyword-case)
src/components/notificationsCenter/eventDescriptors/registry.ts (1)
218-241: LGTM!src/components/notificationsCenter/eventDescriptors/registry.test.ts (1)
82-84: LGTM!Also applies to: 104-117, 177-177
src/components/notificationsCenter/NotificationsCenter.tsx (1)
576-595: 🎯 Functional CorrectnessFalse alarm: Keys
caseHandover.consent.approveandcaseHandover.consent.declineexist in bothde/common.jsonanden/common.jsonand resolve correctly.No raw keys will be rendered in the primary locales. Note that the German text "Zugriff freigeben" ("Grant access") is semantically generic for a
caseHandoverflow compared to the English "Approve access"; consider aligning terminology tobestätigen("Confirm").src/resources/scripts/endpoints.ts (1)
52-54: 🗄️ Data Integrity & IntegrationConfirm these constants match the backend routes.
caseHandoverBatch/Candidates/Reasonsare wired under/service/users/case-handover/*, whereas the per-session status/request/consent calls inapiCaseHandover.tsusesessionBase. Verify both base paths against the deployed service so the gate doesn't 404 in Pre-Dev.As per path instructions: "When changing endpoint constants in
src/resources/scripts/endpoints.ts, verify API compatibility against the backend contracts outside this graph."Source: Path instructions
src/api/index.ts (1)
10-10: LGTM!src/hooks/useSession.tsx (2)
130-152: 🎯 Functional CorrectnessSummary/code mismatch: the
repetitiveIdretry was not removed.The change details for 140-152 state the prior
repetitiveId.current→apiGetChatRoomByIdretry was removed, but that block still exists at lines 130-139 and runs before the new candidate fallback. Behavior to confirm: for a repetitive session that legitimately fails, the hook retries viaapiGetChatRoomById(repetitiveId.current)and never reachesloadCaseHandoverCandidateSession. If the candidate fallback should also apply to repetitive sessions, the ordering is wrong; if not, the summary is simply stale.
26-49: 🎯 Functional CorrectnessConfirm the candidate search resolves the session by
sessionId.
loadCaseHandoverCandidateSessionsearches withquery: String(sessionId)andcount: 1, then exact-matchesitem.session.id === sessionId. This assumes the candidates endpoint's free-textquerymatches on session id and returns that row within the first result. Ifqueryis name/topic-based, a locked session whose id isn't textually searchable will never be found and the hook falls back tosetSession(null). Verify the backend search semantics, or pass a dedicated id filter instead of the text query.src/components/session/SessionStream.tsx (4)
352-364: 🩺 Stability & AvailabilityMapping every
apiGetCaseHandoverStatusrejection to a hardDENIEDstate conflates a genuine 403 with transient/network failures, so a flaky request permanently locks the counsellor out of a case they may be allowed to see until remount. This is already captured in the open review notes (softer handling for transient/network errors), so flagging as duplicate.
219-310: LGTM!
409-412: LGTM!Also applies to: 759-762
889-931: LGTM!src/resources/i18n/en/common.json (2)
1389-1400: LGTM!
2119-2172: LGTM!src/resources/i18n/de/common.json (2)
1413-1424: LGTM!
2185-2238: LGTM!src/components/session/CaseHandoverGate.tsx (1)
70-77: 🎯 Functional CorrectnessVerify the
FORBIDDENerror shape fromfetchData.
fetchDataexplicitly rejects on HTTP 403 withnew Error(FETCH_ERRORS.FORBIDDEN), whereFETCH_ERRORS.FORBIDDENis the string literal'FORBIDDEN'. The checkrequestError?.message === 'FORBIDDEN'correctly matches this specific rejection.src/components/session/caseHandoverGate.styles.scss (1)
1-149: 📐 Maintainability & Code QualityReplace hardcoded tokens with shared design system variables and use the primary button class.
The stylesheet
src/components/session/caseHandoverGate.styles.scsshardcodes colors (e.g.#c4000b,#a5000a,#5c6672) and button styles that violate the rule to reuse existing design tokens.
- Colors: Hardcoded values like
#c4000b(primary/accent) and#a5000a(error) must be replaced with the project tokens found insrc/resources/styles/mui-variables-mapping.scss. Use--m3-primaryfor the submit button background and--m3-errorfor error text/borders.- Button Styling: Do not reimplement the button styles in
.caseHandoverGate__submit. Apply the existing.button__primaryclass fromsrc/components/button/button.styles.scssinstead, which handles the background, hover states, and focus outlines correctly.Ensure the file imports the necessary shared tokens and mixins at the top.
src/components/session/caseHandoverHelpers.ts (1)
9-63: LGTM!src/components/session/caseHandoverHelpers.test.ts (1)
54-122: LGTM!src/components/sessionsList/SessionsList.tsx (1)
1380-1415: LGTM!Also applies to: 1718-1738, 1762-1838
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Cursor Review (gegen
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cursor review (vs
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cursor review (vs
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@coderabbitai review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
✅ Action performedReview finished.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cursor Review (gegen
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@coderabbitai review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
✅ Action performedReview finished.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/components/session/CaseHandoverGate.tsx (1)
70-76: 📐 Maintainability & Code Quality | 🔵 TrivialUse the shared
FETCH_ERRORSconstant instead of a string literal.The codebase defines
FETCH_ERRORS.FORBIDDENas the string'FORBIDDEN'insrc/api/fetchData.ts. Hardcoding the string creates a maintainability risk: if the constant's value ever shifts, the error message fallback triggers silently. Align this check with the rest of the stack by referencing the constant directly rather than the literal.♻️ Apply fix
@@ - const message = - requestError?.message === 'FORBIDDEN' + const message = + requestError?.message === FETCH_ERRORS.FORBIDDEN ? translate('caseHandover.error.forbidden') : translate('caseHandover.error.failed');🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/session/CaseHandoverGate.tsx` around lines 70 - 76, The error handling in CaseHandoverGate uses a hardcoded 'FORBIDDEN' string when mapping the rejected request to a translated message. Update the catch block in CaseHandoverGate to compare against the shared FETCH_ERRORS.FORBIDDEN constant from the fetch layer instead of the literal, so the forbidden branch stays aligned with the rest of the API error handling.src/hooks/useSession.tsx (1)
32-39: 🎯 Functional Correctness | 🟠 Major
count: 1makes the exact-match lookup brittle.You query the candidates endpoint with
count: 1and then apply a client-sidefindfor the specific ID. If the backend treats thequeryas a text search (ranking by relevance, name, or topic) rather than an exact ID match, the correct session might not be returned—or might be ranked second and truncated. This causes the function to returnfalsesilently, dropping a valid handover candidate.Increase the page size (e.g.,
```diff - const { sessions } = await apiGetCaseHandoverCandidates({ - query: String(sessionId), - count: 1, - signal - }); ```count: 15) to ensure the candidate is captured, or verify that the backend treats thequeryparameter as a strict exact-id lookup.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/hooks/useSession.tsx` around lines 32 - 39, The exact-session lookup in useSession.tsx is too brittle because apiGetCaseHandoverCandidates is called with count: 1 and then filtered with a client-side find on item?.session?.id. Update the useSession lookup logic to request a larger candidate set (for example, increase count) or otherwise ensure the query path is an exact ID match so the desired session cannot be truncated before the find runs.src/components/sessionsListItem/SessionListItemComponent.tsx (2)
1596-1620: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winStop button key events from triggering row navigation.
The parent list item handles
Enter/Spaceon keydown. When this nested button has focus, keyboard activation can also callhandleOnClick()on the row, breaking batch selection/navigation. Stop propagation for activation keys on the button. As per coding guidelines, UI changes need accessible focus/keyboard behavior.♿ Proposed fix
)} onClick={handleCaseHandoverActionClick} + onKeyDown={(event) => { + if ( + event.key === 'Enter' || + event.key === ' ' + ) { + event.stopPropagation(); + } + }} disabled={🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/sessionsListItem/SessionListItemComponent.tsx` around lines 1596 - 1620, The nested case handover button in SessionListItemComponent is allowing Enter/Space keydown events to bubble up and trigger the parent row’s navigation handler. Update the button’s keyboard handling near handleCaseHandoverActionClick so activation keys stop propagation before the parent onKeyDown/onClick logic runs, while preserving normal button activation and accessible focus behavior.Source: Coding guidelines
167-174: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winDo not use request eligibility as the privacy gate.
isCaseHandoverCandidatereturns false in the archive tab, butSessionsListcan still fetch archived handover candidates. Those archived locked items skip status loading andcaseHandoverContentLocked, so previews/attachments can render as normal. Split “access-controlled/locked” from “batch-selectable” eligibility. As per coding guidelines, preserve Matrix/chat privacy boundaries; as per path instructions, flag privacy regressions around Matrix/chat/drafts.🔒 Proposed direction
- const caseHandoverCandidate = isCaseHandoverCandidate({ + const caseHandoverAccessControlled = isCaseHandoverCandidate({ + activeSession, + userData, + type + }); + const caseHandoverCandidate = isCaseHandoverCandidate({ activeSession, userData, type, sessionListTab }); const caseHandoverContentLocked = - caseHandoverCandidate && !caseHandoverStatus?.canViewContent; + caseHandoverAccessControlled && !caseHandoverStatus?.canViewContent; @@ - if (!caseHandoverCandidate || !activeSession.item?.id) { + if (!caseHandoverAccessControlled || !activeSession.item?.id) {Also applies to: 259-288
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/sessionsListItem/SessionListItemComponent.tsx` around lines 167 - 174, The privacy gate in SessionListItemComponent is incorrectly tied to isCaseHandoverCandidate, which only covers batch-selection eligibility and returns false for archived handover items even when they are still access-controlled. Update SessionListItemComponent (and the related rendering path around caseHandoverContentLocked / caseHandoverStatus) to separate “locked/access-controlled” from “request eligible,” so archived handover candidates still trigger status loading and content locking before previews or attachments can render. Use the existing caseHandoverCandidate logic only for selection behavior, and introduce or reuse a dedicated access-control check for privacy-sensitive rendering in SessionListItemComponent and the 259-288 related code path.Sources: Coding guidelines, Path instructions
src/components/sessionsListItem/sessionsListItem.styles.scss (1)
116-120: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMake the locked border override win.
The later non-active rule resets
border-color, so the locked card’s#ffd8d4border does not apply for normal non-active items. Move the locked border rule after the generic non-active rule or increase specificity.🎨 Proposed fix
&:not(.sessionsListItem--active) .sessionsListItem__content { border-color: $session-light-border; } + + &--caseHandoverLocked:not(.sessionsListItem--active) .sessionsListItem__content { + border-color: `#ffd8d4`; + }Also applies to: 172-174
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/sessionsListItem/sessionsListItem.styles.scss` around lines 116 - 120, The case-handover locked border on SessionsListItem is being overridden by the generic non-active styling, so the locked state does not keep its intended border color. Update the sessionsListItem.styles.scss rules for the SessionsListItem content so the &--caseHandoverLocked selector wins over the non-active rule, either by moving it after the generic non-active block or by increasing its specificity; make the same adjustment in the other matching block referenced by the comment.src/components/sessionsList/SessionsList.tsx (2)
1454-1467: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winSurface reason-loading failures in the batch panel.
If
apiGetCaseHandoverReasons()fails, the UI renders an empty radiogroup and leaves confirm disabled with no explanation. Set an error/summary state or render a retry/loading message so the batch flow does not silently dead-end. As per path instructions,src/**/*.{ts,tsx,js,jsx}should flag missing error/loading handling.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/sessionsList/SessionsList.tsx` around lines 1454 - 1467, The case handover reason loading in SessionsList is swallowing failures and leaving the batch panel with no feedback. Update the useEffect around apiGetCaseHandoverReasons in SessionsList to set a dedicated error or summary state on rejection and render a retry or loading/failure message in the batch UI, instead of only clearing caseHandoverReasons. Keep the existing reason selection logic, but ensure the batch flow surfaces the failure clearly and does not silently disable confirm.Source: Path instructions
2063-2066: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAnnounce batch results as a live status.
This summary appears after validation/submission, but it is not exposed as a live region. Add
role="status"/aria-live="polite"so keyboard and screen-reader users receive the result without moving focus. As per coding guidelines, UI changes need accessible focus/keyboard behavior.♿ Proposed fix
- <div className="sessionsList__caseHandoverBatchSummary"> + <div + className="sessionsList__caseHandoverBatchSummary" + role="status" + aria-live="polite" + >🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/sessionsList/SessionsList.tsx` around lines 2063 - 2066, The batch summary in SessionsList is rendered visually but not announced to assistive tech, so update the `caseHandoverBatchSummary` container in `SessionsList.tsx` to behave as a polite live region. Add accessible status semantics such as `role="status"` and `aria-live="polite"` on the element that wraps `caseHandoverBatchSummary`, ensuring validation/submission results are announced without changing focus or keyboard flow.Source: Coding guidelines
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/sessionsListItem/sessionsListItem.styles.scss`:
- Around line 775-812: The new case handover button state styles in
sessionsListItem.styles.scss use hardcoded colors for the CTA, pending, denied,
selected, and checkbox-fill states; replace these one-off values with existing
shared design tokens or list-item SCSS variables so the new states stay
consistent with the rest of the component. Update the styles in the
caseHandoverButton block and its state modifiers (&--pending, &--denied,
&--selected, and the checkbox-fill rules) to reference the shared token/mixin
names already used elsewhere in the sessionsListItem styles rather than defining
new fixed hex colors.
In `@src/hooks/useSession.tsx`:
- Around line 96-99: Remove the commented-out debug scaffolding from useSession;
the callback still contains several commented console.log blocks that add noise.
Delete these inactive logs in useSession (including the surrounding commented
sections near the API response, error handling, and exit paths) and keep the
control flow clean, relying on the debugger or structured logging if needed.
---
Outside diff comments:
In `@src/components/session/CaseHandoverGate.tsx`:
- Around line 70-76: The error handling in CaseHandoverGate uses a hardcoded
'FORBIDDEN' string when mapping the rejected request to a translated message.
Update the catch block in CaseHandoverGate to compare against the shared
FETCH_ERRORS.FORBIDDEN constant from the fetch layer instead of the literal, so
the forbidden branch stays aligned with the rest of the API error handling.
In `@src/components/sessionsList/SessionsList.tsx`:
- Around line 1454-1467: The case handover reason loading in SessionsList is
swallowing failures and leaving the batch panel with no feedback. Update the
useEffect around apiGetCaseHandoverReasons in SessionsList to set a dedicated
error or summary state on rejection and render a retry or loading/failure
message in the batch UI, instead of only clearing caseHandoverReasons. Keep the
existing reason selection logic, but ensure the batch flow surfaces the failure
clearly and does not silently disable confirm.
- Around line 2063-2066: The batch summary in SessionsList is rendered visually
but not announced to assistive tech, so update the `caseHandoverBatchSummary`
container in `SessionsList.tsx` to behave as a polite live region. Add
accessible status semantics such as `role="status"` and `aria-live="polite"` on
the element that wraps `caseHandoverBatchSummary`, ensuring
validation/submission results are announced without changing focus or keyboard
flow.
In `@src/components/sessionsListItem/SessionListItemComponent.tsx`:
- Around line 1596-1620: The nested case handover button in
SessionListItemComponent is allowing Enter/Space keydown events to bubble up and
trigger the parent row’s navigation handler. Update the button’s keyboard
handling near handleCaseHandoverActionClick so activation keys stop propagation
before the parent onKeyDown/onClick logic runs, while preserving normal button
activation and accessible focus behavior.
- Around line 167-174: The privacy gate in SessionListItemComponent is
incorrectly tied to isCaseHandoverCandidate, which only covers batch-selection
eligibility and returns false for archived handover items even when they are
still access-controlled. Update SessionListItemComponent (and the related
rendering path around caseHandoverContentLocked / caseHandoverStatus) to
separate “locked/access-controlled” from “request eligible,” so archived
handover candidates still trigger status loading and content locking before
previews or attachments can render. Use the existing caseHandoverCandidate logic
only for selection behavior, and introduce or reuse a dedicated access-control
check for privacy-sensitive rendering in SessionListItemComponent and the
259-288 related code path.
In `@src/components/sessionsListItem/sessionsListItem.styles.scss`:
- Around line 116-120: The case-handover locked border on SessionsListItem is
being overridden by the generic non-active styling, so the locked state does not
keep its intended border color. Update the sessionsListItem.styles.scss rules
for the SessionsListItem content so the &--caseHandoverLocked selector wins over
the non-active rule, either by moving it after the generic non-active block or
by increasing its specificity; make the same adjustment in the other matching
block referenced by the comment.
In `@src/hooks/useSession.tsx`:
- Around line 32-39: The exact-session lookup in useSession.tsx is too brittle
because apiGetCaseHandoverCandidates is called with count: 1 and then filtered
with a client-side find on item?.session?.id. Update the useSession lookup logic
to request a larger candidate set (for example, increase count) or otherwise
ensure the query path is an exact ID match so the desired session cannot be
truncated before the find runs.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: db5ac99c-2a97-4897-a4bd-af4ebae0c72f
src/components/notificationsCenter/NotificationsCenter.tsxsrc/components/session/CaseHandoverGate.tsxsrc/components/sessionsList/SessionsList.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsxsrc/components/sessionsListItem/sessionsListItem.styles.scsssrc/hooks/useSession.tsx📄 CodeRabbit inference engine (AGENTS.md)
Reuse existing design tokens, Sass mixins, and component patterns; avoid one-off hardcoded CSS for controls, active list states, focus rings, and responsive layout.
Files:
src/components/sessionsListItem/sessionsListItem.styles.scsssrc/components/session/CaseHandoverGate.tsxsrc/components/sessionsList/SessionsList.tsxsrc/components/notificationsCenter/NotificationsCenter.tsxsrc/hooks/useSession.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsx⚙️ CodeRabbit configuration file
**: # AGENTS.mdContext First
- Treat
devas the normal integration branch for ORISO feature PRs unless the task says otherwise.- Before non-trivial changes, skim
.understand-anything/README.md,.understand-anything/ARCHITECTURE.md, and.understand-anything/knowledge-graph.jsonfor fast repo context.- Use
CONTEXT.mdfor Activity Timeline and notification vocabulary; avoid inventing parallel terms.Frontend Rules
- Keep behavior in shared hooks/utilities when multiple screens need the same state, route, selection, or formatting logic.
- Reuse existing design tokens, Sass mixins, and component patterns. Avoid one-off hardcoded CSS for controls, active list states, focus rings, and responsive layout.
- Preserve Matrix/chat/draft privacy boundaries. Do not move plaintext previews or draft contents into server-visible state.
- UI changes need accessible focus/keyboard behavior and should not rely on color alone.
Validation
- Prefer red-green TDD for behavior changes: add or update the smallest test that would fail without the fix, then implement.
- Useful commands:
npm run test:unitnpm run lint:scriptsnpm run lint:stylenpm run build- If a full command is too expensive or blocked by existing unrelated failures, run the narrowest relevant command and state the blocker precisely.
Review Expectations
- CodeRabbit and Cursor should compare PRs against
origin/devfor normal ORISO feature work.- Automated review should flag missing tests, duplicated UI architecture, unsafe privacy changes, and mergeability risks.
- Only auto-fix issues that are clearly scoped and testable. Leave architectural or ambiguous changes as review comments.
**: # Activity Timeline & NotificationsThe consultant- and client-facing history of everything that happens around a case: enquiries, accept/deny, messages, drafts, appointments, handovers, calls. It is two things in one surface: an inbox (events that happened *to...
Files:
src/components/sessionsListItem/sessionsListItem.styles.scsssrc/components/session/CaseHandoverGate.tsxsrc/components/sessionsList/SessionsList.tsxsrc/components/notificationsCenter/NotificationsCenter.tsxsrc/hooks/useSession.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsx⚙️ CodeRabbit configuration file
src/**/*.scss: Prefer existing design tokens, mixins, and shared component states.
Flag hardcoded one-off styling when the same control/state already
exists elsewhere. Active/focus/list-item behavior should stay shared.
Files:
src/components/sessionsListItem/sessionsListItem.styles.scss📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Keep shared behavior in hooks/utilities when multiple screens need the same state, route, selection, or formatting logic.
UI changes must have accessible focus/keyboard behavior and must not rely on color alone.
Files:
src/components/session/CaseHandoverGate.tsxsrc/components/sessionsList/SessionsList.tsxsrc/components/notificationsCenter/NotificationsCenter.tsxsrc/hooks/useSession.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsx⚙️ CodeRabbit configuration file
src/**/*.{ts,tsx,js,jsx}: Check behavior against the surrounding ORISO flow, not only types.
Flag duplicated route/state logic, missing error/loading handling,
privacy regressions around Matrix/chat/drafts, and changes that should
be expressed through shared hooks or utilities instead of local flags.
Files:
src/components/session/CaseHandoverGate.tsxsrc/components/sessionsList/SessionsList.tsxsrc/components/notificationsCenter/NotificationsCenter.tsxsrc/hooks/useSession.tsxsrc/components/sessionsListItem/SessionListItemComponent.tsxsrc/components/session/CaseHandoverGate.tsx (1)
121-121: LGTM!Also applies to: 157-159
src/hooks/useSession.tsx (1)
143-154: LGTM!src/components/sessionsListItem/SessionListItemComponent.tsx (1)
274-281: Still collapsing status lookup failures intoDENIED.Previous review feedback still applies: transient/non-FORBIDDEN failures are rendered as authoritative access denial.
src/components/sessionsList/SessionsList.tsx (1)
1995-2034: LGTM!src/components/notificationsCenter/NotificationsCenter.tsx (2)
365-372: 🩺 Stability & Availability | ⚡ Quick winConsent failure is still silent — no user-visible feedback.
The
.catch()now prevents the unhandled rejection (good), but it only keeps the notification unread; the counsellor still gets zero feedback whenapiDecideCaseHandoverClientConsentrejects onBAD_REQUEST/FORBIDDEN/network. The button just re-enables as if it worked. This matches the open PR note on consent-failure error handling — surface a toast/inline error here.Source: Path instructions
144-145: LGTM!Also applies to: 236-244, 351-364, 563-601
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Cursor Review (vs
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cursor Review (vs
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cursor thermonuclear review (vs
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cursor review (vs
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@coderabbitai review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
✅ Action performedReview finished.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Cursor PR ReviewProfile: STDERR: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Avoid marking sessions as read while the handover access gate is still loading or denying message visibility. Co-authored-by: Cursor <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Prevent stale API-injected sessions from lingering after the toolbar search is cleared, including when a person filter remains active. Co-authored-by: Cursor <[email protected]>
Hide list-item aliases, attachments, and video metadata when handover access is blocked. Add accessible labels to the handover gate form. Co-authored-by: Cursor <[email protected]>
Avoid unhandled rejections on consent failures and keep the notification unread. Co-authored-by: Cursor <[email protected]>
Fix handover list button BEM selectors, guard useSession candidate lookup failures, and add batch-mode a11y labels. Co-authored-by: Cursor <[email protected]>
Split access-control from batch eligibility so archived handover sessions still lock previews. Add small a11y, CSS, and lookup fixes. Co-authored-by: Cursor <[email protected]>
SessionStream must use access-control eligibility, not batch-candidate eligibility, so archived handover sessions cannot bypass the chat gate. Co-authored-by: Cursor <[email protected]>
Hide batch handover UI on the archive tab. Show API errors when client consent decisions fail. Co-authored-by: Cursor <[email protected]>
e7aabae to
6b35acf
Compare
There was an error while loading. Please reload this page.
|
Rebased this PR onto current dev and resolved the stale conflicts on the current frontend baseline. What changed during the rescue pass:
Local validation:
Current branch relation: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@coderabbitai review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
✅ Action performedReview finished.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/components/session/caseHandoverGate.styles.scss (1)
1-150: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy liftEntire stylesheet hardcodes colors/radii/shadows instead of reusing tokens; no explicit focus states.
Every value here (
#ffffff,#c4000b,#ffd8d4, border-radius, box-shadow, etc.) is a one-off literal — none reference existing Sass tokens/mixins. Given the "Active item" design language already defines a shared focus-ring treatment app-wide, this gate reimplements colors from scratch rather than reusing it. Additionally, none of the interactive controls (.caseHandoverGate__reason input,.caseHandoverGate__explanation,.caseHandoverGate__submit) define an explicit:focus-visiblestyle, relying entirely on browser defaults that may be stripped by a global reset elsewhere in the app.As per path instructions: "Prefer existing design tokens, mixins, and shared component states. Flag hardcoded one-off styling when the same control/state already exists elsewhere." As per coding guidelines: "avoid one-off hardcoded CSS for controls, active list states, focus rings, and responsive layout."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/session/caseHandoverGate.styles.scss` around lines 1 - 150, The stylesheet for caseHandoverGate hardcodes colors, radii, and shadows instead of reusing shared Sass tokens/mixins, and its interactive controls lack explicit focus-visible styling. Refactor the rules in caseHandoverGate.styles.scss to replace one-off literals with the existing design system tokens and shared “active item”/focus-ring treatment, and add consistent :focus-visible states for .caseHandoverGate__reason input, .caseHandoverGate__explanation, and .caseHandoverGate__submit.Sources: Coding guidelines, Path instructions
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/notificationsCenter/notificationsCenter.styles.scss`:
- Around line 294-299: `__consentActions` is a duplicate of the existing
`__detailActions` flex layout, so avoid keeping two identical style blocks.
Update the notifications center SCSS to reuse the existing `__detailActions`
rule or extract a shared mixin/placeholders for the common flex/gap/wrap/center
layout, then apply it to `__consentActions` so both states stay in sync.
In `@src/components/notificationsCenter/NotificationsCenter.tsx`:
- Around line 588-613: Update the consent UI in NotificationsCenter so the
`caseHandoverConsentError` message is announced by assistive tech by giving the
error container an alert/live-region role, and add fallback default strings to
the `translate` calls for `caseHandover.consent.approve`,
`caseHandover.consent.decline`, and `caseHandover.error.failed` to match the
existing translation pattern used elsewhere in `NotificationsCenter`.
In `@src/components/session/CaseHandoverGate.tsx`:
- Around line 4-10: The import in CaseHandoverGate is using the `../../api`
barrel, which pulls in extra code unnecessarily. Update the imports to use the
specific modules that export `apiGetCaseHandoverReasons`,
`apiRequestCaseHandoverAccess`, `CaseHandoverReason`, and `CaseHandoverStatus`
from `../../api/apiCaseHandover`, and `FETCH_ERRORS` from `../../api/fetchData`.
Keep the rest of the `CaseHandoverGate` component unchanged.
- Around line 17-47: The local form state in CaseHandoverGate is only
initialized once, so switching to a different session can leave stale
reason/explanation/error values in the UI. Update the component’s
sessionId-driven behavior in CaseHandoverGate to reset reasonCode, explanation,
and error whenever sessionId changes, while still preserving the existing
reasons loading logic and selected reason validation. Make the reset happen
alongside the current useEffect-based state management so the form always
reflects the active session.
In `@src/components/session/caseHandoverHelpers.test.ts`:
- Around line 63-79: Add direct negative-path test coverage for
isCaseHandoverAccessControlled in caseHandoverHelpers.test.ts. The current tests
only verify the allowed/access-granted path, so mirror the existing negative
scenarios already used for isCaseHandoverCandidate (asker, group, enquiry-status
cases) and assert isCaseHandoverAccessControlled returns false for each. Use the
existing helper and fixture symbols such as baseSession, consultantUser,
MY_SESSION_TYPE, and the access-control function itself to keep the tests
aligned with SessionStream gating behavior.
In `@src/components/session/caseHandoverHelpers.ts`:
- Around line 19-24: The CaseHandoverCandidateInput interface is using loose any
types for activeSession and userData, which leaves property access in the
session handover helpers unchecked. Replace those any annotations with the
existing typed session/user interfaces from sessionHelpers or globalState, and
update any related function signatures in caseHandoverHelpers to use those
concrete types so accesses like item.status, consultant?.id, isGroup, isSession,
and isEmptyEnquiry are type-safe.
In `@src/components/session/SessionStream.tsx`:
- Around line 376-391: The forced load-and-mark-read sequence is duplicated
between the gate-status effect and handleCaseHandoverStatusChange in
SessionStream. Extract the shared setLoading(true) →
fetchSessionMessagesRef.current(true).then(setSessionRead).catch(setMessagesItem({
messages: [] })).finally(setLoading(false)) flow into a single helper/callback
such as loadAfterCaseHandoverGranted, and call that helper from both places so
the loading and read-marking behavior stays centralized.
- Around line 361-421: SessionStream is retaining the previous session’s gate
and messages state when activeSession.item.id changes because the component
stays mounted, so clear caseHandoverStatus and messagesItem immediately on
session switch. Update the SessionStream effect that references
apiGetCaseHandoverStatus, setCaseHandoverStatus, and setMessagesItem so the old
session state is reset synchronously when the session id changes, or key
SessionStream by activeSession.item.id in the parent SessionView to force a
fresh mount.
---
Outside diff comments:
In `@src/components/session/caseHandoverGate.styles.scss`:
- Around line 1-150: The stylesheet for caseHandoverGate hardcodes colors,
radii, and shadows instead of reusing shared Sass tokens/mixins, and its
interactive controls lack explicit focus-visible styling. Refactor the rules in
caseHandoverGate.styles.scss to replace one-off literals with the existing
design system tokens and shared “active item”/focus-ring treatment, and add
consistent :focus-visible states for .caseHandoverGate__reason input,
.caseHandoverGate__explanation, and .caseHandoverGate__submit.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3c69b905-f654-4ff6-b175-0e40139dbb80
src/api/apiCaseHandover.tssrc/api/index.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/notificationsCenter.styles.scsssrc/components/session/CaseHandoverGate.tsxsrc/components/session/SessionStream.tsxsrc/components/session/caseHandoverGate.styles.scsssrc/components/session/caseHandoverHelpers.test.tssrc/components/session/caseHandoverHelpers.tssrc/components/sessionsList/SessionsList.tsxsrc/components/sessionsList/sessionsList.styles.scsssrc/components/sessionsListItem/SessionListItemComponent.tsxsrc/components/sessionsListItem/sessionsListItem.styles.scsssrc/hooks/useSession.tsxsrc/resources/i18n/de/common.jsonsrc/resources/i18n/en/common.json📄 CodeRabbit inference engine (.understand-anything/ORISO-ECOSYSTEM.md)
When changing API usage under
src/api/, verify API compatibility against the backend contracts outside this graph.
Files:
src/api/index.tssrc/api/apiCaseHandover.ts📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Keep shared behavior in hooks/utilities when multiple screens need the same state, route, selection, or formatting logic.
UI changes must have accessible focus/keyboard behavior and must not rely on color alone.
Files:
src/api/index.tssrc/components/session/caseHandoverHelpers.test.tssrc/components/session/caseHandoverHelpers.tssrc/components/session/CaseHandoverGate.tsxsrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/session/SessionStream.tsxsrc/api/apiCaseHandover.ts📄 CodeRabbit inference engine (AGENTS.md)
Reuse existing design tokens, Sass mixins, and component patterns; avoid one-off hardcoded CSS for controls, active list states, focus rings, and responsive layout.
Files:
src/api/index.tssrc/components/session/caseHandoverHelpers.test.tssrc/components/session/caseHandoverHelpers.tssrc/components/notificationsCenter/notificationsCenter.styles.scsssrc/components/session/caseHandoverGate.styles.scsssrc/components/session/CaseHandoverGate.tsxsrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/session/SessionStream.tsxsrc/api/apiCaseHandover.ts⚙️ CodeRabbit configuration file
**: # AGENTS.mdContext First
- Treat
devas the normal integration branch for ORISO feature PRs unless the task says otherwise.- Before non-trivial changes, skim
.understand-anything/README.md,.understand-anything/ARCHITECTURE.md, and.understand-anything/knowledge-graph.jsonfor fast repo context.- Use
CONTEXT.mdfor Activity Timeline and notification vocabulary; avoid inventing parallel terms.Frontend Rules
- Keep behavior in shared hooks/utilities when multiple screens need the same state, route, selection, or formatting logic.
- Reuse existing design tokens, Sass mixins, and component patterns. Avoid one-off hardcoded CSS for controls, active list states, focus rings, and responsive layout.
- Preserve Matrix/chat/draft privacy boundaries. Do not move plaintext previews or draft contents into server-visible state.
- UI changes need accessible focus/keyboard behavior and should not rely on color alone.
Validation
- Prefer red-green TDD for behavior changes: add or update the smallest test that would fail without the fix, then implement.
- Useful commands:
npm run test:unitnpm run lint:scriptsnpm run lint:stylenpm run build- If a full command is too expensive or blocked by existing unrelated failures, run the narrowest relevant command and state the blocker precisely.
Review Expectations
- Cursor should compare PRs against
origin/devfor normal ORISO feature work.- CodeRabbit is optional/manual and should not be treated as the primary automated reviewer.
- Automated review should flag missing tests, duplicated UI architecture, unsafe privacy changes, and mergeability risks.
- Only auto-fix issues that are clearly scoped and testable. Leave architectural or ambiguous changes as review comments.
**: # Activity Timeline & NotificationsThe consultant- and client-facing history of everything that happens around a case: enquiries, accept/deny, messages, drafts, appointments, handovers, call...
Files:
src/api/index.tssrc/components/session/caseHandoverHelpers.test.tssrc/components/session/caseHandoverHelpers.tssrc/components/notificationsCenter/notificationsCenter.styles.scsssrc/components/session/caseHandoverGate.styles.scsssrc/components/session/CaseHandoverGate.tsxsrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/session/SessionStream.tsxsrc/api/apiCaseHandover.ts⚙️ CodeRabbit configuration file
src/**/*.{ts,tsx,js,jsx}: Check behavior against the surrounding ORISO flow, not only types.
Flag duplicated route/state logic, missing error/loading handling,
privacy regressions around Matrix/chat/drafts, and changes that should
be expressed through shared hooks or utilities instead of local flags.
Files:
src/api/index.tssrc/components/session/caseHandoverHelpers.test.tssrc/components/session/caseHandoverHelpers.tssrc/components/session/CaseHandoverGate.tsxsrc/components/notificationsCenter/eventDescriptors/registry.tssrc/components/notificationsCenter/NotificationsCenter.tsxsrc/components/notificationsCenter/eventDescriptors/registry.test.tssrc/components/session/SessionStream.tsxsrc/api/apiCaseHandover.ts⚙️ CodeRabbit configuration file
src/**/*.scss: Prefer existing design tokens, mixins, and shared component states.
Flag hardcoded one-off styling when the same control/state already
exists elsewhere. Active/focus/list-item behavior should stay shared.
Files:
src/components/notificationsCenter/notificationsCenter.styles.scsssrc/components/session/caseHandoverGate.styles.scss[warning] 4-4: This ships extra code to your users & slows page load. Import directly from: "../../api/apiCaseHandover", "../../api/fetchData".
Import from the direct path: import { Button } from './components/Button' instead of ./components
(no-barrel-import)
[warning] 299-299: This loops over your list twice because .map().filter(Boolean) makes two passes, so use .flatMap() to change & drop items in one pass
Use .flatMap(item => condition ? [value] : []) to change and drop items in one pass, instead of building a throwaway array in between
(js-flatmap-filter)
src/components/notificationsCenter/notificationsCenter.styles.scss (3)
301-321: Reuse the primary-action red and add:focus-visible— still unresolved.
__consentButton--approvehardcodes a third red (#c4000b) distinct from the established primary action red (#e63946used by__openButton/__chatComposerSend), and__consentButtonhas no:focus-visibletreatment while sibling controls (__chip,__search) reuselist-item-focus-treatment.Source: Path instructions
532-532: Range media-query syntax(width <= 1200px)— still unresolved for IE11 target.
745-745: Range media-query syntax(width <= 900px)— still unresolved for IE11 target.src/components/session/SessionStream.tsx (2)
393-405:apiGetCaseHandoverStatusfailure maps to hardDENIEDregardless of cause.Network/timeout errors get the same terminal
DENIEDstatus as an actual authorization refusal, blocking retry via a transient failure.
243-350: LGTM! Gating logic insidefetchSessionMessagescorrectly bails out (clears messages, stops loading) when the handover gate applies and access hasn't been forced/granted, and real-time refresh paths (Matrix timeline, live-message emitter, fallback interval) all funnel through the same gated function.src/api/apiCaseHandover.ts (2)
5-12:| stringstill collapsesCaseHandoverStatusValuetostring— unresolved.
79-122: Mixed endpoint base paths (dynamicsessionBasevs staticcaseHandover*constants) — unresolved.Still worth confirming with the backend contract given this is a new API surface under
src/api/.Source: Coding guidelines
src/api/index.ts (1)
10-10: LGTM!src/components/notificationsCenter/NotificationsCenter.tsx (1)
357-382: LGTM! The previously-flagged missing.catch()is now handled and surfacescaseHandoverConsentError.src/components/session/caseHandoverHelpers.test.ts (1)
9-9: 🎯 Functional CorrectnessNo change needed
SESSION_LIST_TYPESis an enum export, soimport type { SESSION_LIST_TYPES as SessionListType }and theas SessionListTypecast are valid.> Likely an incorrect or invalid review comment.src/components/session/caseHandoverHelpers.ts (2)
26-53: LGTM!
55-72: LGTM!src/components/session/CaseHandoverGate.tsx (1)
118-161: LGTM! Accessibility labels for the radiogroup and textarea are already in place.src/components/notificationsCenter/eventDescriptors/registry.ts (1)
218-239: LGTM! Matches the existing descriptor pattern and correctly targets the conversation per the handover action-target rule.src/components/notificationsCenter/eventDescriptors/registry.test.ts (1)
82-117: LGTM!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Follow-up cleanup on the current head:
Local validation on commit
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.