• Mahmoud Aglan's avatar
    test(branch): check the records a screen is handed, not the markup it prints · 20c5cf15
    Mahmoud Aglan authored
    Reported: the weekly schedule shows a schedule on a branch that was never
    scheduled. Investigated against a restored tenant and the component is correct —
    branch 2 gets only branch 2's sessions, and a branch with nothing gets an empty
    grid. But chasing it found a real hole in the suite.
    
    BranchScopedScreensTest searches rendered HTML for another branch's uuids. The
    weekly schedule grid prints group names and times and no uuid at all, and
    training_sessions was not even among the tables it collected uuids for. A
    foreign session sitting in that grid would have left nothing in the markup to
    search for, and the suite would have stayed green while the screen was wrong.
    Several other grids and calendars are the same shape.
    
    So this asserts one level earlier, on the objects rather than the markup. Every
    component reachable at a parameterless URL is mounted under every branch, the
    data handed to its views is captured through a view composer, and every model in
    it that carries a branch_id must belong to the active branch — or be null only
    where null still means "every branch" (people and the academy calendar), or
    belong to a model that declares BRANCH_SCOPE_EXEMPT. It reads that declaration
    rather than keeping a second list that would drift away from it.
    
    Components come from the router rather than a hand-written list, so a screen
    added next month is covered without anyone remembering.
    
    1,188 component mounts across nine branches, 9.5M records inspected, no screen
    handing its view another branch's record.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    20c5cf15
BranchScopedComponentDataTest.php 8.74 KB