TenantAtlas/specs/124-inventory-coverage-table/tasks.md
ahmido 3971c315d8 feat: add inventory coverage interactive table (#151)
## Summary
- replace the static Inventory Coverage HTML tables with a Filament native searchable, sortable, filterable table on the existing tenant page
- normalize supported policy types and foundations into one runtime dataset while preserving centralized badge semantics and the documented read-only action-surface exemption
- add the full spec kit artifact set for feature 124 and focused Pest coverage for rendering, search, sort, filters, empty state, and regression-sensitive page copy

## Testing
- `vendor/bin/sail bin pint --dirty --format agent`
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryCoverageTableTest.php tests/Feature/Filament/InventoryPagesTest.php tests/Feature/Filament/InventoryHubDbOnlyTest.php`

## Filament Notes
- Livewire v4.0+ compliance: yes, this uses Filament v5 table APIs on the existing page and does not introduce any Livewire v3 patterns
- Provider registration: unchanged; Laravel 11+ provider registration remains in `bootstrap/providers.php`
- Globally searchable resources: none changed in this feature; no Resource global-search behavior was added or modified
- Destructive actions: none; the page remains read-only and only exposes a non-destructive clear-filters empty-state action
- Asset strategy: no new panel or shared assets were added, so no `filament:assets` deployment change is required for this feature
- Testing plan delivered: focused Filament/Pest coverage for the page table surface plus existing page-load regressions

## Follow-up
- Manual dark-mode and badge-regression QA from task `T018` is still pending and should be completed before merge if that check remains mandatory in your review flow.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #151
2026-03-08 18:33:00 +00:00

12 KiB

Tasks: Inventory Coverage Interactive Table

Input: Design documents from /specs/124-inventory-coverage-table/ Prerequisites: plan.md (required), spec.md (required for user stories), research.md, data-model.md, contracts/

Tests: Tests are REQUIRED for this runtime behavior change. Pest feature/component coverage must verify table rendering, search, filtering, and regression-sensitive presentation. Operations: No OperationRun work is required because this feature is read-only and does not introduce long-running, remote, queued, or scheduled behavior. RBAC: No new authorization behavior is introduced. Existing tenant membership and tenant-view capability checks on the page remain the enforcement path. Filament UI Action Surfaces: This feature modifies a Filament page and keeps the explicit inspection-affordance exemption documented in the spec because coverage rows are runtime-derived metadata, not first-class records. Filament UI UX-001: This feature must deliver a native Filament table, an explicit zero-results empty state with exactly one reset CTA, and dark-mode-safe presentation. Badges: Badge semantics must stay centralized through the existing badge catalogs; no ad-hoc mappings are allowed.

Organization: Tasks are grouped by user story to enable independent implementation and testing of each story.

Phase 1: Setup (Shared Alignment)

Purpose: Confirm implementation boundaries and target files before refactoring the page

  • T001 Reconcile the explicit table-surface exemption and page contract in specs/124-inventory-coverage-table/spec.md and specs/124-inventory-coverage-table/contracts/inventory-coverage-page.openapi.yaml against the final target files app/Filament/Pages/InventoryCoverage.php and resources/views/filament/pages/inventory-coverage.blade.php
  • T002 [P] Review existing coverage page and regression-test touchpoints in app/Filament/Pages/InventoryCoverage.php, resources/views/filament/pages/inventory-coverage.blade.php, and tests/Feature/Filament/InventoryPagesTest.php

Phase 2: Foundational (Blocking Prerequisites)

Purpose: Introduce the shared table infrastructure that all user stories build on

⚠️ CRITICAL: No user story work can begin until this phase is complete

  • T003 Refactor app/Filament/Pages/InventoryCoverage.php to implement HasTable / InteractsWithTable and build a unified runtime coverage dataset from supported policy types and foundation types
  • T004 Update resources/views/filament/pages/inventory-coverage.blade.php to replace duplicated raw HTML tables with a Filament page shell that renders the native table surface

Checkpoint: Foundation ready - search, filters, and polish can now be added to the shared table surface


Phase 3: User Story 1 - Find Supported Policy Types Quickly (Priority: P1) 🎯 MVP

Goal: Deliver an interactive coverage table that supports first-class rendering, type-name search, and primary-column sorting

Independent Test: Load the Inventory Coverage page as a Livewire table, verify rows render, search by type or label narrows the table correctly, and sorting reorders the main column deterministically

Tests for User Story 1 ⚠️

  • T005 [P] [US1] Create table-rendering, search, and sort tests in tests/Feature/Filament/InventoryCoverageTableTest.php
  • T006 [P] [US1] Update tenant coverage page-load assertions for the interactive table surface in tests/Feature/Filament/InventoryPagesTest.php

Implementation for User Story 1

  • T007 [US1] Implement searchable and sortable primary columns, default ordering, and custom-data pagination in app/Filament/Pages/InventoryCoverage.php
  • T008 [P] [US1] Add first-load table framing and search-oriented summary copy in resources/views/filament/pages/inventory-coverage.blade.php

Checkpoint: User Story 1 should now provide a credible searchable coverage table that can be demoed independently


Phase 4: User Story 2 - Filter Coverage by Meaningful Dimensions (Priority: P2)

Goal: Add category filtering and conditional restore-mode filtering without changing the current coverage data model

Independent Test: Apply a category filter and verify only matching rows remain; when restore metadata exists, apply a restore filter and verify the filtered result set updates correctly; when restore metadata is absent, verify the restore filter is not exposed

Tests for User Story 2 ⚠️

  • T009 [US2] Extend tests/Feature/Filament/InventoryCoverageTableTest.php with category-filter assertions plus deterministic restore-mode-present and restore-mode-absent coverage branches

Implementation for User Story 2

  • T010 [US2] Implement source-driven category filter options and conditional restore-mode filter registration in app/Filament/Pages/InventoryCoverage.php
  • T011 [P] [US2] Add explicit zero-results empty-state copy and a single reset CTA in resources/views/filament/pages/inventory-coverage.blade.php

Checkpoint: User Story 2 should now let users narrow coverage by the dimensions called out in the spec without weakening existing semantics


Phase 5: User Story 3 - Present Coverage as a Product-Grade Surface (Priority: P3)

Goal: Preserve badge semantics and upgrade the page presentation so it reads like a finished Filament product surface in light and dark mode

Independent Test: Verify badge labels, colors, icons, and dependency indicators still render from shared semantics; verify the page loads with polished table framing and no dark-mode readability regressions

Tests for User Story 3 ⚠️

  • T012 [P] [US3] Extend tests/Feature/Filament/InventoryCoverageTableTest.php with badge and dependency-indicator regression assertions
  • T013 [P] [US3] Add interactive-surface regression coverage in tests/Feature/Filament/InventoryPagesTest.php for polished page framing and dark-mode-safe markup expectations

Implementation for User Story 3

  • T014 [US3] Move type, category, restore, risk, dependency, and segment presentation into Filament table columns in app/Filament/Pages/InventoryCoverage.php using the shared badge catalogs and existing dependency semantics
  • T015 [P] [US3] Polish resources/views/filament/pages/inventory-coverage.blade.php for enterprise-grade section framing, scannable explanatory copy, and dark-mode-safe spacing around the Filament table

Checkpoint: All user stories should now be independently functional, and the page should read as a finished product surface instead of a raw implementation table


Phase 6: Polish & Cross-Cutting Concerns

Purpose: Validate the complete feature and finish cross-story verification

  • T016 [P] Run focused verification from specs/124-inventory-coverage-table/quickstart.md with vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryCoverageTableTest.php and vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryPagesTest.php
  • T017 Run vendor/bin/sail bin pint --dirty --format agent after the page and test changes affecting app/Filament/Pages/InventoryCoverage.php, resources/views/filament/pages/inventory-coverage.blade.php, and tests/Feature/Filament/
  • T018 [P] Complete manual dark-mode QA and badge-regression review using specs/124-inventory-coverage-table/quickstart.md and record any follow-up fixes before merge

Dependencies & Execution Order

Phase Dependencies

  • Setup (Phase 1): No dependencies - can start immediately
  • Foundational (Phase 2): Depends on Setup completion - blocks all user stories
  • User Stories (Phases 3-5): Depend on Foundational completion
  • Polish (Phase 6): Depends on all desired user stories being complete

User Story Dependencies

  • User Story 1 (P1): Starts immediately after Foundational and is the MVP slice
  • User Story 2 (P2): Starts after Foundational and reuses the shared table infrastructure from Phase 2
  • User Story 3 (P3): Starts after Foundational and layers presentation polish on the same table surface

Within Each User Story

  • Tests must be written and fail before implementation changes are considered complete
  • app/Filament/Pages/InventoryCoverage.php changes land before final view polish when a story spans both files
  • Existing regression coverage in tests/Feature/Filament/InventoryPagesTest.php stays green while new story-specific assertions are added

Parallel Opportunities

  • T001 and T002 can run in parallel once the branch is ready
  • T005 and T006 can run in parallel because they touch different test files
  • T007 and T008 can run in parallel after Phase 2 because they touch different files
  • T010 and T011 can run in parallel after T009
  • T012 and T013 can run in parallel because they touch different test files
  • T014 and T015 can run in parallel after the test expectations for US3 are established
  • T016 and T018 can run in parallel once implementation is complete

Parallel Example: User Story 1

# Launch both regression updates for the MVP slice together:
Task: "T005 [US1] Create table-rendering, search, and sort tests in tests/Feature/Filament/InventoryCoverageTableTest.php"
Task: "T006 [US1] Update tenant coverage page-load assertions in tests/Feature/Filament/InventoryPagesTest.php"

# After the foundation is in place, split code changes across page class and view:
Task: "T007 [US1] Implement searchable and sortable primary columns in app/Filament/Pages/InventoryCoverage.php"
Task: "T008 [US1] Add first-load table framing and search-oriented summary copy in resources/views/filament/pages/inventory-coverage.blade.php"

Parallel Example: User Story 2

# After filter tests are defined, split page logic and empty-state polish:
Task: "T010 [US2] Implement source-driven category and restore filters in app/Filament/Pages/InventoryCoverage.php"
Task: "T011 [US2] Add zero-results empty-state reset CTA in resources/views/filament/pages/inventory-coverage.blade.php"

Parallel Example: User Story 3

# Split regression coverage and final polish work across test and UI files:
Task: "T012 [US3] Extend badge and dependency regression assertions in tests/Feature/Filament/InventoryCoverageTableTest.php"
Task: "T013 [US3] Add polished-surface regression coverage in tests/Feature/Filament/InventoryPagesTest.php"
Task: "T014 [US3] Move badge and dependency presentation into Filament table columns in app/Filament/Pages/InventoryCoverage.php"
Task: "T015 [US3] Polish section framing and dark-mode-safe copy in resources/views/filament/pages/inventory-coverage.blade.php"

Implementation Strategy

MVP First (User Story 1 Only)

  1. Complete Phase 1: Setup
  2. Complete Phase 2: Foundational
  3. Complete Phase 3: User Story 1
  4. Validate table rendering, search, and sort independently
  5. Demo the searchable Filament-native coverage table before adding filters and polish

Incremental Delivery

  1. Finish Setup + Foundational to establish the native table surface
  2. Add User Story 1 and validate the searchable MVP
  3. Add User Story 2 and validate filter behavior independently
  4. Add User Story 3 and validate badge semantics and polish independently
  5. Finish with focused automated verification, formatting, and manual QA

Suggested MVP Scope

  • Deliver through Phase 3 / User Story 1 for the first merge candidate
  • Defer advanced filtering and final polish until the searchable table foundation is accepted

Notes

  • All tasks follow the required checklist format: checkbox, task ID, optional [P], required story label for story phases, and exact file paths
  • No database, API, queue, or Graph work is included because the feature is read-only and runtime-derived
  • The explicit Filament inspection-affordance exemption stays documented in the spec because coverage rows do not map to navigable records