Dev Log: 2026-08-12 - a 96s suite that became 42s, a capability that wasn't a scope, and four steps to a passkey
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. 1. Ninety-six seconds to forty-one 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 half the suite's wall clock. It's now 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 on top of the global hook, which is the sort of thing that accretes when nobody's looking at the total. 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: - pcov had to be built from source (no published build for this PHP version), and a static build silently produces a .so with noget_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 , notphp -d . Paratest spawns workers without the parent's-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. 2. A capability permission is not a scope 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 neither branch of 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 existed, silently skipping thedropUnique() it guarded. The migration reported DONE with the old constraint still in place. Index presence now gets read fromgetIndexes() instead. - down() hits errno 1553 whereup() doesn't, because the new composite unique leading withorganization_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. 3. Passkeys: four steps, not one 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: - Publish (config + migration) - Migrate - Put both the PasskeyAuthenticatable trait and thePasskeyUser contract onUser - Then uncomment the feature 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 fromAPP_URL . A passkey is bound to the RP ID it was registered against. A wrongAPP_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 toAPP_KEY . The WebAuthn user handle is what binds a credential to an account, so rotatingAPP_KEY invalidates every passkey on file, with no error that says so. SetPASSKEYS_USER_HANDLE_SECRET explicitly before any rotation. 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. 4. One seeder per layer 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: - An owner_id column that's a non-nullable FK was being written as$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()]) never did anything: the column is outside the model's fillable list. It appeared to work only becausedb:seed wraps seeding inModel::unguarded() . Call the same seeder from a test and the owner comes out unverified. Now it'smarkEmailAsVerified() . 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. 5. Honest labels and icons that resolve 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 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. 6. Docs that had drifted into lying A full documentation rebuild, and the interesting part is how stale docs go bad. Not gradually vague - specifically wrong: - A root README still listing six documentation links, all six dead, pointing at paths that moved into numbered
Comments
No comments yet. Start the discussion.