agnes-the-ai-analyst/app/web/templates
ZdenekSrotyr 62336bfd32
fix(rbac): stack-gated analyst access + first-demo polish (#333 follow-up) (#356)
* fix(rbac): stack-gate analyst table access via data_packages exclusively

Previously analysts could see a table in ``agnes catalog`` /
``/api/sync/manifest`` either by:
  1. being in a group with ``resource_grants(group, 'table', id)``, or
  2. being in a group with ``resource_grants(group, 'data_package', …)``
     for a package containing the table.

Path 1 leaked: admins who minted a per-table grant without ever
wrapping the table in a data_package still shipped the table to
analysts — directly contradicting the unified-stack mental model
("the stack is the unit of access"). User report:
"i když to admin nedal do data package tak to by default uživatelé
dostali to by se nemělo stát".

New policy: analyst visibility is strictly stack-gated. A table is
visible iff at least one data_package containing it is in the
analyst's stack (required ∪ subscribed). Admin god-mode and the three
internal data-source tables (agnes_sessions / _telemetry / _audit
with row-level RBAC) keep their existing carve-outs.

Touched surfaces:
* ``src/rbac.can_access_table`` + ``get_accessible_tables`` —
  routed through ``StackResolver.stack(user, DATA_PACKAGE)`` +
  ``data_package_tables`` join instead of ``resource_grants(table)``.
* ``app/api/sync._build_direct_tables_section`` — always returns
  ``[]`` (key kept for older CLI destructuring); per-table grants
  no longer manifest.
* Standardised 403 detail across ``/api/data/*``, ``/api/query``,
  ``/api/v2/sample``, ``/api/v2/scan``, ``/api/v2/schema``:
  ``Table 'X' is not in your stack. Ask an admin to add it to a
  Data Package you have access to (Required or in your stack),
  then run `agnes pull` to refresh.`` Single source of truth lives
  in ``src.rbac.table_not_in_stack_message`` so the wording stays
  consistent across CLI surfaces.

UX side: ``/catalog/t/<id>`` (table detail page) dropped the four
editorial sections (Sample questions, What's inside, Things to know,
Pairs well with) per user feedback — the page's job is now
"what is this table, where do I find it" (hero + parent packages).

Tests:
* ``tests/conftest.grant_table_via_package`` / ``revoke_table_via_package``
  — shared helpers that wrap a table in an auto-named data_package +
  grant the package required to a custom group. Replaces the legacy
  per-test ``_grant_table_to_analyst`` table-grant pattern.
* All 17 previously-failing legacy tests (test_access_control,
  test_journey_rbac, test_audit_gap_*, test_rbac, …) migrated to use
  the new helper; logic stays the same.
* ``tests/fixtures/analyst_bootstrap._grant_table_access`` updated
  to wrap via data_package so the ``test_pat`` fixture's "two table
  grants" semantics still ship parquets through ``agnes init``.
* New ``tests/test_table_not_in_stack_message.py`` locks in the
  standardised 403 detail across the data + check-access endpoints.

5204 tests passing (added 1).

* fix(catalog): first-demo UX feedback — required-first grouping + longer card description

Two minor polish items from the 2026-05-19 stakeholder demo:

1. Required packages cluster at the top of the Browse grid instead of
   being interleaved by ``created_at``. Sort key
   ``(requirement != 'required', name)`` runs before the adapter
   call in both /catalog (data_packages) and /corporate-memory
   (memory_domains) so the required block is visible without
   scrolling. Regression test pins the order via
   ``data-id="…"`` position in rendered HTML.

2. ``.stack-card__desc`` line clamp bumped 2 → 4 lines. Two-line clamp
   trailed almost every admin-authored description off in "…" before
   the second clause, forcing a click-through to read it. The detail
   page (/catalog/p/<slug>) keeps the unclamped body for longer
   content.

* release: 0.55.3 — stack-gated analyst RBAC (BREAKING) + first-demo UX polish + #345 A/B/C/D + #347 UI consistency
2026-05-19 17:01:14 +02:00
..
admin UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
macros feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
_app_header.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
_claude_setup_cta.jinja fix(cta): clipboard fallback + fold Atlassian MCP into connectors (#249) 2026-05-11 21:54:51 +02:00
_claude_setup_instructions.jinja feat(web): rename /install → /setup; nav label 'Setup local agent' 2026-05-03 16:12:13 +02:00
_content_findings.html feat(store-guardrails): per-component description quality + plain-language UX (#276) 2026-05-12 21:48:27 +02:00
_content_howto_fix.html feat(store-guardrails): per-component description quality + plain-language UX (#276) 2026-05-12 21:48:27 +02:00
_flea_versions.html fix(store): surface review failures + harden publish gate (#316) 2026-05-15 15:52:07 +02:00
_home_stats.html feat(home): status frame on /home (operator-gated, onboarded-only) (#297) 2026-05-14 09:28:47 +00:00
_marketplace_video_embed.html Curated marketplace enrichment via agnes-metadata.json + curator metadata (#234) 2026-05-09 17:01:37 +02:00
_message.html feat(auth): password reset & invite flows for web + admin (#34) (#37) 2026-04-22 17:43:57 +02:00
_page_chrome.html feat(home): state-aware /home + /setup-advanced + schema v26 (#228) 2026-05-08 18:28:47 +02:00
_page_hero.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
_posthog.html feat(observability): optional PostHog integration (#231) 2026-05-08 17:57:10 +04:00
_profile_tokens.html feat(web): consolidate the personal /me/* surface — /me/activity + /me/profile (#304) 2026-05-14 21:29:51 +02:00
_profile_troubleshooting.html feat(web): consolidate the personal /me/* surface — /me/activity + /me/profile (#304) 2026-05-14 21:29:51 +02:00
_quarantine_banner.html fix(store): surface review failures + harden publish gate (#316) 2026-05-15 15:52:07 +02:00
_theme.html
_version_badge.html
activity_center.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
admin_access.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_corporate_memory.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
admin_group_detail.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_groups.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_marketplaces.html feat(api): enforce API design rules via pytest + fix DELETE/status-code violations (#338) 2026-05-18 15:25:07 +02:00
admin_scheduler_runs.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_server_config.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_session_detail.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_sessions.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_store_submission_detail.html fix(store): restore reuses prior approved verdict + admin detail surfaces content_quality (#332) 2026-05-16 07:12:29 +02:00
admin_store_submissions.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_tables.html fix(web): UI consistency — code tokens, label-qualifier, radio cards, Keboola edit-modal JS (#347) 2026-05-19 16:30:19 +02:00
admin_tokens.html feat(web): consolidate the personal /me/* surface — /me/activity + /me/profile (#304) 2026-05-14 21:29:51 +02:00
admin_usage.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_user_detail.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_users.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
admin_welcome.html fix(web): UI consistency — code tokens, label-qualifier, radio cards, Keboola edit-modal JS (#347) 2026-05-19 16:30:19 +02:00
admin_workspace_prompt.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
base.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
base_login.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
catalog.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
catalog_package_detail.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
catalog_recipe_detail.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
catalog_table_detail.html fix(rbac): stack-gated analyst access + first-demo polish (#333 follow-up) (#356) 2026-05-19 17:01:14 +02:00
corporate_memory.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
dashboard.html UI design system unification — one stylesheet, canonical primitives, nav fix (#284) 2026-05-14 13:28:03 +02:00
desktop_link.html
error.html feat(observability): request_id end-to-end + dev debug toolbar + centralized logging (#136) 2026-04-29 22:54:21 +02:00
home_not_onboarded.html fix(web): UI consistency — code tokens, label-qualifier, radio cards, Keboola edit-modal JS (#347) 2026-05-19 16:30:19 +02:00
home_onboarded.html fix(web): UI consistency — code tokens, label-qualifier, radio cards, Keboola edit-modal JS (#347) 2026-05-19 16:30:19 +02:00
install.html feat(web): consolidate the personal /me/* surface — /me/activity + /me/profile (#304) 2026-05-14 21:29:51 +02:00
login.html feat(setup): configurable instance brand + connector setup overhaul (#268) 2026-05-12 17:10:08 +02:00
login_email.html feat(auth): password reset & invite flows for web + admin (#34) (#37) 2026-04-22 17:43:57 +02:00
login_magic_link.html
login_magic_link_sent.html
marketplace.html fix(store): promote-on-approve looks up version_no by submission_id (live agnes-development bug) (#330) 2026-05-15 21:21:14 +02:00
marketplace_format_guide.html Curated marketplace enrichment via agnes-metadata.json + curator metadata (#234) 2026-05-09 17:01:37 +02:00
marketplace_guide.html feat(marketplace): rename CTA + expand submit-flow guides (#308) 2026-05-14 19:44:33 +02:00
marketplace_item_detail.html fix(web): UI consistency — code tokens, label-qualifier, radio cards, Keboola edit-modal JS (#347) 2026-05-19 16:30:19 +02:00
marketplace_plugin_detail.html fix(web): UI consistency — code tokens, label-qualifier, radio cards, Keboola edit-modal JS (#347) 2026-05-19 16:30:19 +02:00
me_activity.html fix(web): render <strong> in /me/activity hero subtitle instead of escaping it (#312) 2026-05-14 22:27:34 +02:00
memory_domain_detail.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
news.html feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
password_reset.html feat(auth): password reset & invite flows for web + admin (#34) (#37) 2026-04-22 17:43:57 +02:00
password_setup.html feat(auth): password reset & invite flows for web + admin (#34) (#37) 2026-04-22 17:43:57 +02:00
profile.html feat(web): consolidate the personal /me/* surface — /me/activity + /me/profile (#304) 2026-05-14 21:29:51 +02:00
setup.html feat(setup): configurable instance brand + connector setup overhaul (#268) 2026-05-12 17:10:08 +02:00
setup_advanced.html feat(home): Getting Started + Overview + Usage modes sections (release 0.54.7) (#291) 2026-05-13 21:44:11 +02:00
store_edit.html feat(flea): marketplace refactor — data model, attribution, UI unification (#342) 2026-05-19 02:32:41 +02:00
store_examples.html feat(store-guardrails): admin-configurable content thresholds (#281) 2026-05-13 09:20:55 +00:00
store_upload.html feat(flea): marketplace refactor — data model, attribution, UI unification (#342) 2026-05-19 02:32:41 +02:00