Skip to content

Extract ADRs to dedicated tab on card details - #881

Merged
vincentmakes merged 3 commits into
mainfrom
claude/cards-adrs-tab-fsrydg
Jul 27, 2026
Merged

Extract ADRs to dedicated tab on card details#881
vincentmakes merged 3 commits into
mainfrom
claude/cards-adrs-tab-fsrydg

Conversation

@vincentmakes

Copy link
Copy Markdown
Owner

Summary

Moves Architecture Decision Records (ADRs) from the Resources tab into a dedicated ADRs tab on card details. This gives ADRs first-class visibility alongside other card resources and simplifies the Resources tab by removing ADR-specific UI logic.

Type

  • feature
  • fix
  • refactor
  • docs
  • chore
  • security

Changes

  • New AdrsTab component (frontend/src/features/cards/sections/AdrsTab.tsx): Displays all ADRs linked to a card in a table with reference, title, status, linked cards, and last-modified date. Includes quick actions to link existing ADRs, create new pre-linked ADRs, and unlink (when canManageAdrLinks is true).
  • Refactored ResourcesTab: Removed all ADR-related state, dialogs, and rendering logic. Removed cardName, cardType, and canManageAdrLinks props (no longer needed).
  • Updated CardDetailContent: Added ADRs tab to the tab bar with conditional visibility (shows if user can view ADRs and either has ADRs linked or can manage ADR links). Properly indexes subsequent tabs (Risks, Compliance, History) to account for the new tab.
  • Backend event publishing: Added _publish_adr_card_event() helper in backend/app/api/v1/adr.py to fan ADR link/unlink events to the affected card's history timeline, enabling the ADRs tab activity indicator.
  • Tab activity tracking: Updated useCardTabActivity.ts to map adr.linked and adr.unlinked events to the adrs tab.
  • Internationalization: Moved ADR-related i18n keys from resources.* to adrs.* namespace across all 8 locales. Updated delivery docs to reflect the new tab location.
  • Tests: Added comprehensive unit tests for AdrsTab covering load, render, navigation, permissions, link/unlink, and empty states. Updated ResourcesTab tests to remove ADR-related assertions.
  • Version bump: Updated to 2.32.0 and added CHANGELOG entry.

Test Plan

  • Unit tests pass: AdrsTab.test.tsx covers loading, rendering, navigation, permission checks, linking/unlinking, and empty states. ResourcesTab.test.tsx updated to remove ADR assertions.

  • Manual verification:

    1. Navigate to a card with linked ADRs → verify ADRs tab appears and displays all linked decisions in a table with correct reference, title, status, and linked cards.
    2. Click an ADR row → navigates to the ADR editor.
    3. With canManageAdrLinks=true, click "Link ADR" → dialog opens, search filters available ADRs, clicking "Link" associates the ADR and reloads the tab.
    4. Click unlink icon → confirmation dialog, then removes the ADR from the card.
    5. Click "Create ADR" → CreateAdrDialog opens with the card pre-linked.
    6. Without canManageAdrLinks, link/create/unlink buttons are hidden.
    7. Verify Resources tab no longer shows ADRs section.
    8. Verify ADRs tab activity indicator lights up when an ADR is linked/unlinked (event published to card history).
  • All CI checks pass (backend lint, backend tests, frontend lint, frontend build, frontend tests)

  • Manually tested the affected feature

  • Added/updated tests for new or changed behavior

Checklist

  • My changes follow the conventions in CLAUDE.md
  • I added permission checks to any new mutating endpoints (existing ADR endpoints already gated; tab visibility checks can("adr.view"))
  • I created an Alembic migration for any schema changes (no schema changes)
  • I did not introduce hardcoded card types or fields (metamodel is data-driven)
  • I used async def for all new route handlers

https://claude.ai/code/session_017vVfKVF6MUsAjYjAK5MPmR

claude added 3 commits July 27, 2026 17:09
Architecture Decision Records linked to a card were buried in an accordion
inside the Resources tab, sharing space with files, links and diagrams.
Promote them to their own tab next to Resources, mirroring the Risks tab:
reference, title, status, linked cards and last-modified date, with row
click through to the decision.

- New AdrsTab backed by the existing GET /adr/by-card/{id}, carrying the
  Link ADR / Create ADR / unlink actions moved out of ResourcesTab.
- Visible when the card has linked decisions, or when the user may manage
  ADR links so the first decision stays one click away.
- link_card / unlink_card now publish adr.linked / adr.unlinked against the
  affected card, so ADR links show in card History and drive the tab's
  new-activity dot.
- GET /adr/by-card/{id} returns 400 on a malformed card id instead of 500.
- Fix two ADREditor strings that were looked up in the wrong namespace and
  rendered as raw keys.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vVfKVF6MUsAjYjAK5MPmR
Long decision titles ran underneath the trailing "Link ADR" button and
short references wrapped to two lines ("ADR-" / "009"). MUI reserves
exactly 48px of right padding for a ListItem secondaryAction and
positions it absolutely, but the button is ~100px wide, so the text slid
under it; the reference then wrapped because it was a shrinkable flex
child with no flexShrink.

Rebuild the row on the pattern already used by DeliverableSection's
AdrRow: a clickable flex row where every element stays in normal flow,
so the overlap is impossible by construction rather than by padding
arithmetic.

- Whole-row click links the decision; the per-row button is gone.
- Monospace reference chip with flexShrink:0 — can never wrap, and gives
  the references a consistent column.
- Title takes flex:1/minWidth:0 with noWrap; status chip on the right.
- Dialog widened to md so full titles fit instead of ellipsising.
- Rows sorted by reference, matching the tab's own table (GET /adr
  returns updated_at desc).
- Search box gained a clear button; the list scrolls inside a bounded
  container instead of stretching the dialog.
- A spinner replaces the empty state while the fetch is in flight, so
  "nothing available to link" no longer flashes on open, and a search
  matching nothing now says so instead.

Verified in a browser against demo data: every reference renders on one
line and every row keeps an 8px gap between title and status chip, at
both 1440px and 700px and in the RTL locale.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vVfKVF6MUsAjYjAK5MPmR
Whole-row click made the picker one stray click away from attaching a
decision. Hold the clicked ADR and confirm first.

The prompt names both sides of the link — "ADR-002 — «Introduce
Centralized API Gateway» will be linked to «Azure IoT Hub»" — so the
user can see what they are about to attach, and Cancel leaves the picker
open to choose a different one.

Verified against a running backend: opening the confirm writes nothing,
Cancel writes nothing and keeps the picker open, Escape dismisses only
the confirm, and confirming links exactly one decision and closes both
dialogs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vVfKVF6MUsAjYjAK5MPmR
@vincentmakes
vincentmakes merged commit 29d3ed8 into main Jul 27, 2026
19 checks passed
@vincentmakes
vincentmakes deleted the claude/cards-adrs-tab-fsrydg branch July 27, 2026 19:00
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.

2 participants