Repository navigation
Commit 6f26fa9
authored
fix(cdn): stop the lower layer implementing the upper layer's interface (#10)
* fix(cdn): stop the lower layer implementing the upper layer's interface
BunnyStorageService imported two types from dappcore/service — the
HealthCheckable interface it implemented, and HealthCheckResult, which its
healthCheck() body constructed. Neither exists in this package. php requires
laravel/framework, pennant and livewire, and nothing else.
So this package had production source that could not be loaded in this package.
It worked only because every real consumer installs dappcore/service alongside
it, which is why host.uk.com is fine and nobody has felt this.
Adding the dependency was not available: dappcore/service requires
dappcore/php: *, so it would close a loop. The direction composer already
declares is service-depends-on-php, and php reaching up into Core\Service\* was
against that grain. So the health report moves to the layer that is entitled to
build it.
WHAT MOVES, and it is a relocation rather than a removal: healthCheck() goes to a
decorator in dappcore/service, which composes this service and implements
HealthCheckable there. That repo has no session yet and the work is held; until
it lands, health reporting of this service is absent with a named destination.
WHAT STAYS: the zone probing, which never depended on Core\Service at all.
checkZoneHealth() keeps returning its {success, latency_ms, error} array and
isReachable() keeps answering the boolean question. checkZoneHealth() is now
public, because the decorator composes rather than extends — a protected probe
would have made the relocation cost exactly the latency and error detail that
makes a health report worth reading.
Safe to carry with no consumer noticing, checked rather than assumed: nothing in
host.uk.com's app or vendor tree calls healthCheck() on this service, and there
is no `instanceof HealthCheckable` anywhere in it. The only references were this
file and documentation inside dappcore/service.
ALSO HERE, and it is why the numbers move: CdnIntegrationTest built
StorageUrlResolver with its arguments wrong —
__construct(protected BunnyStorageService $bunnyStorage, ?CdnUrlBuilder $urlBuilder = null)
new StorageUrlResolver($this->urlBuilder)
passing the optional second argument into the required first slot and omitting
the required one, so all 30 cases died in setUp on one TypeError. Thirty
failures, one line. Fixed by resolving BunnyStorageService from the container,
which is how Core\Cdn\Boot wires it in production.
That fix was pointless on its own — corrected, the tests failed one line later on
the missing interface — which is why both halves are in one change.
./vendor/bin/pest --testsuite=Feature,Unit 268 passed, 0 failed — unchanged
./vendor/bin/pest --testsuite=Module 448 -> 426 failed, 308 -> 330 passed
CdnIntegrationTest alone 30 failed / 0 assertions
-> 8 failed / 22 passed / 52 assertions
vendor/bin/pint --test pass
vendor/bin/phpstan analyse no errors
The 8 that remain are real assertions against a constructible object rather than
a constructor error: a missing config_resolved table in the test database, a
singular/plural category path, a ?id= versus ?v= query parameter, and four
straightforward expectation mismatches. Each is now a visible disagreement about
behaviour instead of 30 identical crashes hiding one line.
Co-Authored-By: Virgil <virgil@lethean.io>
* chore(psalm): drop the suppression that existed for the dependency now removed
CI's Psalm went red on this branch with
UnusedIssueHandlerSuppression: Suppressed issue type "MissingDependency"
for /src/Core/Cdn/ was not thrown
which is the fix reporting itself. The suppression's own comment said what it was
for — "Pending Core\Service module — referenced by Cdn BunnyStorageService" — so
it was config-level acknowledgement of the upward dependency this branch removes,
pending indefinitely. With the dependency gone there is nothing left to suppress,
and Psalm treats a suppression that never fires as an error in its own right.
Read from the CI job log rather than a local run, deliberately: local and CI
Psalm disagree in this repository — the Laravel plugin resolves differently — and
I got that wrong earlier today by trusting the copy in front of me. CI is the
authority for what CI thinks is unused, and here CI is the one calling it unused.
Co-Authored-By: Virgil <virgil@lethean.io>
* fix(psalm): repair the config I broke, and remove only what should go
The previous commit's regex matched backwards from the wrong comment. Both blocks
I meant to touch begin "Pending Core\Service module", and the pattern anchored on
the first one — inside the UndefinedClass handler — then ran to the closing tag of
the second, taking two unrelated referencedClass entries and a pair of closing
tags with it. psalm.xml became invalid XML, and I pushed it.
Restored and redone against the tags themselves rather than a shared comment
prefix. What goes is exactly:
- referencedClass Core\Service\Contracts\HealthCheckable
- referencedClass Core\Service\HealthCheckResult
- the MissingDependency handler suppressing src/Core/Cdn
all three of which existed for the upward dependency this branch removes. What
stays is what I should never have touched: the Core\Front\Client\Boot and
Illuminate\Foundation\Auth\User entries, which have nothing to do with it.
Fixed forward rather than rewritten — the broken commit is on the remote and
stays there, with this on top.
python3 -c "xml.etree.ElementTree.parse('psalm.xml')" valid
./vendor/bin/pest --testsuite=Feature,Unit 268 passed, 0 failed
vendor/bin/pint --test pass
Co-Authored-By: Virgil <virgil@lethean.io>1 parent 5b9f022 commit 6f26fa9
3 files changed
Lines changed: 31 additions & 88 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | 67 | | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
76 | 73 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 74 | | |
84 | 75 | | |
85 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
| |||
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
30 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | 558 | | |
630 | 559 | | |
631 | 560 | | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
632 | 567 | | |
633 | 568 | | |
634 | 569 | | |
635 | | - | |
| 570 | + | |
636 | 571 | | |
637 | 572 | | |
638 | 573 | | |
| |||
677 | 612 | | |
678 | 613 | | |
679 | 614 | | |
680 | | - | |
| 615 | + | |
| 616 | + | |
681 | 617 | | |
682 | 618 | | |
683 | 619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
71 | 84 | | |
72 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
73 | 89 | | |
74 | 90 | | |
75 | 91 | | |
| |||
0 commit comments