Skip to content

feat(accounts): personal-by-default console with admin Manager Lens (Story 2.2)#1408

Closed
srtab wants to merge 6 commits into
feat/2-1-console-shell-and-dark-visual-foundationfrom
feat/2-2-personal-by-default-with-the-admin-manager-lens
Closed

feat(accounts): personal-by-default console with admin Manager Lens (Story 2.2)#1408
srtab wants to merge 6 commits into
feat/2-1-console-shell-and-dark-visual-foundationfrom
feat/2-2-personal-by-default-with-the-admin-manager-lens

Conversation

@srtab

@srtab srtab commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Stacked on #1407 (Story 2.1). Review the 2-commit diff against feat/2-1-console-shell-and-dark-visual-foundation; merge #1407 first — GitHub will retarget this PR to main automatically once the base branch is gone.

What & why

The post-2.1 console had no personal/admin split: DashboardView still computed the org velocity/total_users (admin-gated) with nothing rendering them, admins had no surface to see org impact, and there was no route-level protection. This delivers the role split (Epic 2, Story 2.2):

  • Personal by default — the org Code-Velocity / DAIV-attribution content is removed from /dashboard/ for everyone (admin and member); the default carries zero org/aggregate content.
  • Admin Manager Lens — a dedicated admin-gated ManagerLensView at /dashboard/manager/ renders the relocated velocity/attribution (reusing the extracted module-level get_velocity_data over MergeMetric, no duplicated query), with a server-side 403 for non-admins via AdminRequiredMixin, and the partial-on-HTMX idiom.
  • Non-persistent toggle — an admin-only Personal | Manager Lens segmented control in the console top bar (topbar_start), HTMX-swapping #console-main with a plain-link fallback; stateless (two routes, nothing persisted), so a fresh landing is always personal.
  • Honest cold-load — a shimmer .skeleton for a genuinely-empty org, never a 0 that reads as "DAIV did nothing".
  • i18n (+ pt) for all new strings; a11y (teal focus ring, aria-current/live announcement, ≥44px touch targets).

Acceptance criteria

AC1 personal-by-default · AC2 toggle present (admin) / absent (member) · AC3 relocated Lens content · AC4 non-persistent · AC5 cold-load skeleton · AC6 server-side 403 — all covered by tests.

Testing

  • make test (full unit suite) → 3916 passed.
  • make lint-fix clean (ruff / ruff-format / djade); make lint-typing adds zero new diagnostics (pre-existing baseline only).
  • New coverage in tests/unit_tests/accounts/test_dashboard_console.py: AC1–AC6 + HTMX fragment + non-persistence + i18n + a regression test for the Lens default window.

Review note

The Manager Lens defaults to the cumulative (all-time) window because org velocity is cumulative — a personal-console-style "today" default would show the cold-load skeleton on any merge-less day. This means one full-table MergeMetric aggregate per load; admin-only and low-traffic, but flagged for a perf sanity-check on very large orgs.

Deferred / follow-ups

  • is_htmx ignores HX-History-Restore-Request, so an HTMX history-restore cache-miss can return a chrome-less fragment on any hx-push-url partial-on-HTMX view (pre-existing pattern — DashboardView / SessionListView too). Best fixed once in the shared idiom.
  • No in-UI range control on the Lens, and no mobile (<640px) entry point, until Epic 3 wires the range switcher (consistent with 2.1's desktop-first top bar).

srtab and others added 6 commits July 17, 2026 11:27
…Story 2.2)

Relocate the org Code Velocity / DAIV-attribution content off the default
dashboard into a dedicated admin-gated Manager Lens at /dashboard/manager/,
reached via a non-persistent, admin-only top-bar toggle.

- Extract get_velocity_data() to module level; both views share one MergeMetric query
- Remove velocity/total_users from the personal default (no org content for anyone)
- ManagerLensView(AdminRequiredMixin, TemplateView) with partial-on-HTMX (403 for non-admins)
- Segmented Personal|Manager Lens toggle in the console topbar_start slot, stateless two-route swap
- Cold-load .skeleton for not-yet-computed org metrics (never a misleading zero)
- i18n: externalize all new strings, add pt catalog entries
- Tests cover AC1-6, HTMX fragment, non-persistence, and i18n
…ry 2.2 review)

Review found the Lens inherited the personal console's "today" default, so it
showed the cold-load skeleton on any day without a merge-today despite abundant
history, with no range control to widen it — defeating its purpose out of the box.

- Manager Lens now defaults to the cumulative "all" window (org velocity is
  cumulative); the cold-load skeleton fires only for a genuinely-empty org
- Drop dead periods/current_period context from ManagerLensView (no range UI yet)
- Strengthen the AC4 non-persistence test to reject any app-level session key
- Add a regression test proving the default Lens shows historical (non-today) velocity
Multi-line {# #} comments leak into rendered HTML; {% comment %} blocks don't.
@srtab

srtab commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #1412, which consolidates Stories 2.1–2.4 (the full Personal Review Console epic) into a single branch (feat/epic-2-review-console) and PR to main. Closing in favour of that; full per-story commit history is preserved there.

@srtab srtab closed this Jul 19, 2026
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