Skip to content

Release v1.6.61 - #252

Merged
roncodes merged 5 commits into
mainfrom
release/v1.6.61
Sep 9, 2026
Merged

roncodes merged 5 commits into
mainfrom
release/v1.6.61

Conversation

@roncodes

@roncodes roncodes commented Sep 9, 2026

Copy link
Copy Markdown
Member

Prepare Core API v1.6.61 for release.

The branch currently enables PHP CI and Postman checks for release/v* branches. PR #251 targets this branch and will add batched user authorization loading that matches each user's company membership, with database-backed regression coverage.

This release PR is a draft while #251 remains open. Before merging:

The current diff contains only the two workflow branch-filter updates. The authorization patch is not included yet. Its local test suite, style check, and date-drift check passed; its GitHub Actions runs still require fork-workflow approval.

dounisaur and others added 3 commits September 4, 2026 15:12
`User::$role`, `$roles`, `$policies` and `$permissions` each execute a fresh
query on every read, because they call the relation as a query builder
(`$this->companyUser->roles()->first()`) rather than reading the loaded
relation. Eager-loading `companyUser.roles` therefore does nothing: the data is
loaded and the accessor queries anyway.

`Http\Resources\User::toArray()` compounds it by evaluating `$this->role` four
times per row (twice for `role`, twice for `role_name`).

Measured on a real page with `DB::listen`, 5 users:

  today                                              12 queries/row
  resource reads `role` once                          8 queries/row
  + eager-load `companyUser`                          7 queries/row
  + deep eager-load (roles/policies/permissions)      7 queries/row  (no change)
  accessors honour the loaded relation + eager-load   0 queries/row

Each accessor now prefers the loaded relation and falls back to the query when
it is absent, so behaviour is unchanged for callers that do not eager-load. The
`instanceof Model` guard keeps duck-typed pivots working -- the suite's own
UserModelAuthorizationPivotFake is one.

No response shape changes, no memoisation, and nothing new appears in the
model's array output.

Adds a test whose pivot throws from roles()/policies()/permissions(), so the
suite fails loudly if an accessor ever queries past a loaded relation again.
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f4afdc7) to head (dc0dfa0).

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #252   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity      6734      6750   +16     
===========================================
  Files            397       398    +1     
  Lines          22470     22502   +32     
===========================================
+ Hits           22470     22502   +32     
Flag Coverage Δ
backend 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ors-honour-eager-loading

perf(user): let authorization accessors honour eager-loaded relations (12 → 0 queries/row)
@roncodes
roncodes marked this pull request as ready for review September 9, 2026 04:51
@roncodes
roncodes merged commit 3cda45f into main Sep 9, 2026
10 checks passed
@roncodes
roncodes deleted the release/v1.6.61 branch September 9, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants