TenantAtlas/specs/feat/700-bugfix/plan.md
ahmido 558b5d3807 Fix tenant dashboard 500 (missing BaselineCompareRun) (#125)
## Summary
Fixes a tenant dashboard Internal Server Error caused by `App\\Models\\BaselineCompareRun` being referenced but not existing.

## What changed
- Dashboard widget now uses `OperationRun` (`type=baseline_compare`, context baseline_profile_id, ordered by completed_at) instead of the missing model.
- Added regression test ensuring tenant dashboard renders when a baseline assignment exists.

## Tests
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/BaselineCompareNowWidgetTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/TenantDashboardDbOnlyTest.php tests/Feature/Filament/TenantDashboardTenantScopeTest.php`

## Notes
No UX changes; this is a runtime stability fix only.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #125
2026-02-20 21:07:34 +00:00

1005 B

Implementation Plan: BaselineCompareRun model bugfix

Branch: feat/700-bugfix | Date: 2026-02-20 | Spec: specs/feat/700-bugfix/spec.md

Summary

Fix runtime crash caused by a missing Eloquent model referenced by a Filament dashboard widget.

Technical Context

  • PHP 8.4.x, Laravel 12
  • Filament v5, Livewire v4
  • PostgreSQL (Sail locally)
  • Tests: Pest v4 (vendor/bin/sail artisan test --compact)

Approach

  1. Identify intended storage for baseline compare runs:
    • If a baseline_compare_runs table already exists, implement App\Models\BaselineCompareRun mapped to it.
    • If not, align the widget to an existing persistence type (likely OperationRun) without changing UX.
  2. Add a regression test that exercises the tenant dashboard route and asserts a successful response.
  3. Run Pint on dirty files and run the focused test.

Risks

  • Introducing a new model without an existing table could still fail at runtime. Prefer minimal, compatibility-first changes.