Fifteen commits, three repos, and the bulk of it in one: a control plane that got an MCP surface, a much faster test suite, and a handful of things that turned out to be quietly wrong once I looked properly.
The MCP work has its own write-up — sixty tools, four servers, and a long argument with myself about what a refusal should say. This is everything else.
The suite was six minutes on a full run and about 96s in parallel, which is exactly the range where you stop running it before you push. Three separate problems, and each one hid the next.
A seeder in beforeEach. The access-control seeder ran before every feature test: 645 queries, ~110ms a pop, roughly
protected $seeder
on the base TestCase
, so RefreshDatabase
seeds it once per process during migrate:fresh
. Every test still runs inside a transaction that rolls back, so the visible state is identical — the per-test call was buying nothing at all. Nine test files were also re-seeding it The general lesson: per-test setup that RefreshDatabase already preserves is pure tax. Worth auditing your Pest.php
for anything that could move to $seeder
.
Xdebug costing 3x on every run. conf.d
sets xdebug.mode = coverage
and nothing overrode it. Pest's own Xdebug handling only drops it when the impact-analysis run is replaying a valid graph — a plain run was never covered. Every composer test script now pins the mode via @putenv
, using the array form so @php
and argument forwarding still work.
And test impact analysis that had never once finished. --tia
records a dependency graph, then replays it and re-runs only what your change touched. Great idea. It was dying at Composer's default 300s process timeout partway through recording, leaving worker-edge files and no graph — an unusable artifact, so the next run re-recorded from scratch and hit the same wall. Forever. Under Xdebug a cold record is about ninety minutes.
Composer\Config::disableProcessTimeout
plus pcov instead of Xdebug took the cold record to ~75s and a replay to ~5s.
Two things fell out of that which cost more time than the fix:
.so
with no get_module
symbol. PHP reports that as "Invalid library (maybe not a PHP library)" — indistinguishable from a version mismatch, so you go and debug the wrong thing. The build script now configures it shared, asserts the symbol exists before installing, and verifies the extension loads.PHP_INI_SCAN_DIR
, not php -d
.-d
flags, so only an environment variable reaches them.Final: parallel run 96.2s → 41.1s, impact-analysis replay ~5s, ~15s after an edit. 1451 passing, 1 skipped — unchanged, which is the number that makes the rest of it trustworthy.
And --tia
stays out of CI deliberately. The point of CI is a full suite against a clean checkout; the point of TIA is your laptop between commits.
One page in the app had no tenant isolation at all, sitting behind the same can:viewAny,SomeModel
middleware as the correctly-scoped page next to it. The middleware was doing its job — it just isn't the job people assume it is.
** can:viewAny says the user may do this kind of thing. It never says they may do it to this row.** In an app with no global scopes (this one has none, by design), nothing downstream catches the difference. Every list, every bulk action, every delete, and one
is_default
reset all ran unscoped, and the reset in particular reached beyond the caller's own tenant.Fixes, in order of how much I'd repeat them:
Every lookup goes through one scoped finder. Ownership enforced at five call sites is ownership forgotten at the sixth. This keeps coming up and I keep re-learning it.
Don't give a child table its own tenant column when the parent already knows. The job rows here already carry a provider id, and a provider already knows its organisation. Two copies of one fact are two chances for them to disagree.
A nullable-owner + is_system pair for shared catalogue rows — same shape as elsewhere in the app, so the visibility rule reads the same everywhere. Which immediately surfaced a factory bug: the old default produced rows matching
visibleTo()
, so tests were "creating" records the UI could never list. When a model gains a two-branch visibility rule, the factory default has to land inside one of the branches.Two migration gotchas, both found the hard way:
Schema::hasIndex()
returned false mid-migration for an index that plainly existeddropUnique()
it guarded. The migration reported DONE with the old constraint still in place. Index presence now gets read from getIndexes()
instead.`down()`
hits errno 1553 where `up()`
doesn'torganization_id
becomes the only index backing that foreign key. Drop the FK first.Round-tripped migrate → rollback → migrate on MySQL, because SQLite rebuilds the table on ALTER and proves none of it. If your migrations touch indexes, testing them on SQLite is testing a different program.
Fourteen new tests, and each was checked to fail without the scope rather than merely pass with it. A test that passes for the wrong reason is worse than no test — it's a green tick standing where a check should be.
The scaffold this app came from shipped Features::passkeys()
in the Fortify config, commented out with a note, because the packages weren't installed. Both are here now, and enabling it is genuinely four steps:
PasskeyAuthenticatable
trait PasskeyUser
contract on User
Step 3 is the trap. The trait without the interface fails static analysis with class.missingImplements
and nothing at runtime, so if you don't run analyse
you'll find out later and further away.
Two config values are load-bearing and derived rather than set, which is the dangerous combination:
relying_party_id
comes from APP_URL
.APP_URL
in production is not a misconfiguration you can quietly correct later — every credential registered under the wrong one stops resolving.user_handle_secret
falls back to APP_KEY
.APP_KEY
invalidates every passkey on filePASSKEYS_USER_HANDLE_SECRET
explicitly That's the second thing this month where APP_KEY
turned out to be permanent in practice rather than in theory. Anything deriving a secret from it deserves an explicit value.
A seeder doing four jobs at once — platform catalogue, tenancy, a provider, and sample workloads — meant nothing could be seeded without the rest, and db:seed
on a fresh install produced data a real customer would have to delete. Split by responsibility: catalogue only, owner-and-organisation, and development sample data hanging off the dev command rather than the prepare path.
Two latent bugs fell out of the move, both the sort that only surface once code runs somewhere new:
owner_id
column that's a `$owner?->id`
. So the catalogue seeder silently depended on the owner seeder having run first. The nullsafe operator is doing you no favours where the schema says the value is required — it converts "this must exist" into "let's find out later."`$user->update(['email_verified_at' => now()])`
db:seed
wraps seeding in Model::unguarded()
. Call the same seeder from a test and the owner comes out unverified. Now it's markEmailAsVerified()
.That second one is worth sitting with. unguarded()
in the seeding path means mass-assignment bugs in seeders are invisible until someone runs the seeder outside db:seed. If you have seeders invoked from tests, that's a real gap.
Also: the owner seeder now re-asserts roles on an existing account holding the configured email, instead of returning early. Otherwise a fresh install where someone registered that address first gives you a superadmin nobody can use, and nothing on screen to explain it.
A template library rendering as text-only cards, and two things behind it were wrong rather than merely plain.
Thirteen templates were labelled Custom — the enum case meaning "free-form, no enforced structure" — while being an exact edge → app → database. That put most of the library in one bucket and made the topology filter useless. They're now labelled by the shape their layers actually form. A few stay
Custom
on purpose: a gateway over its own store isn't microservices until there are services.An icon column populated on all 63 rows and rendered by nothing at all. Now resolved through a small Blade component with a deliberate fallback, drawing from a brand-icon set committed to the repo — nothing fetched at runtime.
The test I'm happiest with walks every seeded icon key and fails on one that resolves to nothing, and asserts the <svg>
actually reaches the rendered markup. A missing icon is invisible in the UI, never loud. And a Blade component that swallowed the SVG entirely would pass every other assertion you'd think to write.
Also eager-loaded the component relation on the index — fifteen cards each drawing a mark per component is fifteen pages of queries otherwise.
A full documentation rebuild, and the interesting part is how stale docs go bad. Not gradually vague — specifically wrong:
125 markdownlint issues → 0. 8 broken internal links → 0. Every file reachable from the index.
The through-line with everything else today: a document that names a command that doesn't exist isn't slightly out of date, it's actively sending people the wrong way. Same failure mode as a checklist claiming coverage it lacks, or a deploy that reports success it didn't verify. Wrong is worse than absent, because absent makes you go and look.
On a second product: a dependency refresh, and a documentation pass across the planning set. Nothing structural — but worth saying that keeping planning docs current is the same discipline as item 6, just applied before the drift rather than after it.
Today divided into making the loop faster and making things say what's true. Both matter, and the second one showed up in five different costumes: a permission that guards a capability but reads like a scope, a seeder call that never ran, an icon column nothing rendered, a topology label describing a shape it wasn't, and a README pointing at six pages that had moved.
None of them errored. Which is the whole reason they survived.