• Mahmoud Aglan's avatar
    test(branch): watch the SQL a dashboard runs, not just the records it renders · 73a61a77
    Mahmoud Aglan authored
    The two existing suites cannot catch a leaking dashboard. BranchIsolationTest
    proves the scope narrows a model; BranchScopedScreensTest looks for another
    branch's records in the rendered HTML. But a dashboard renders totals, not
    records — a revenue widget quietly summing every branch shows a number that is
    simply wrong, with no uuid anywhere to give it away, and both suites pass.
    
    Dashboards are also where the raw query builder lives, because that is what
    aggregates are written in, and a raw DB::table() goes straight past every global
    scope. So this asserts at the only layer that sees both: the wire.
    
    Two checks:
    
      - Every SQL statement each of sixteen dashboards runs is captured with
        DB::listen, and any query reading a branch-owned table without mentioning
        `branch_id` anywhere — its own WHERE, a join, a subquery the scope added —
        is a failure. Deliberately crude, because a strict SQL parse would be worse
        than useless here: a query that never says the word never asked.
    
      - The per-branch figures for participants, enrolments, invoices, payment
        totals, attendance and groups must add up to the academy-wide figure. A
        widget ignoring the branch returns the whole academy for every branch, so
        the sum comes out a multiple of the truth.
    
    Current state: all sixteen render, 1,354 queries captured, 902 of them touching
    branch-owned tables, and every one names a branch.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    73a61a77
Name
Last commit
Last update
Screenshots Loading commit data...
app Loading commit data...
bootstrap Loading commit data...
config Loading commit data...
database Loading commit data...
docker Loading commit data...
docs Loading commit data...
docs-site Loading commit data...
flutter_shell Loading commit data...
gap-filling-plans Loading commit data...
lang Loading commit data...
marketing-site Loading commit data...
plans Loading commit data...
public Loading commit data...
reference/oc-sport Loading commit data...
resources Loading commit data...
routes Loading commit data...
scripts Loading commit data...
storage Loading commit data...
tests Loading commit data...
.dockerignore Loading commit data...
.editorconfig Loading commit data...
.env.example Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.npmrc Loading commit data...
Beanding Guide.txt Loading commit data...
CLAUDE.md Loading commit data...
Dockerfile Loading commit data...
README.md Loading commit data...
artisan Loading commit data...
captain-definition Loading commit data...
composer.json Loading commit data...
composer.lock Loading commit data...
deploy.sh Loading commit data...
elcaptain-sportsonly-db.md Loading commit data...
one-click-app.yml Loading commit data...
package-lock.json Loading commit data...
package.json Loading commit data...
phpunit.xml Loading commit data...
system info.txt Loading commit data...
vite.config.js Loading commit data...
نادى الشيخ زايد كشف بيانات اللاعبين (2).html Loading commit data...