0.4: fix SSR bugs and split placement from sidecar config - #1
Merged
Merged
Conversation
…ail-open footguns. Validate tokens and preset identifiers, forward locale/deviceClass, serve warm cache when the breaker is open, and distinguish client errors from sidecar outages.
Relative or javascript: URLs must not land in canonical or Open Graph tags.
…nly. The host builds one client (transport, cache, breaker, logger) and reuses it for render, purge, health, and warm. The transport returns raw HTTP so the client owns the v1 contract.
Member
Author
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e52b422. Configure here.
$GLOBALS['http_response_header'] is empty on PHP 8.2/8.3, so the no-curl fallback treated successful sidecar replies as transport failures.
…oad. PHP 8.5 emits a deprecation when that identifier is compiled, even if the <8.4 branch never runs. Load it from a sidecar class instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
curl_close()on 8.5, purge-all on blank URLs, CSS without?v=, and the legacy raw-HTML branch.SsrClientholds sidecar URL, timeouts, transport, cache, breaker, and logger;EmbedRequestis placement-only;render()returnsRenderedEmbedwith outcome and fragment parts;SsrPublish::purge()returnsPurgeResult.health()/warm(), PHPStan + CI gates,SECURITY.md.Test plan
composer test(56 tests) on PHP 8.2–8.5composer phpstanandcomposer validate --strictRenderer($transport)tonew Renderer(new SsrClient(...)); replacerenderDocument()/afterFeatureSourcePublish()call sitespurge([''])throws and a failed sidecar purge does not flush PHP cacherequestIdwith CR/LF is rejected before any header is sentNote
High Risk
Breaking public API and SSR/purge/cache semantics for all integrators, plus security-sensitive validation of URLs, headers, and sidecar JSON/HTML.
Overview
Breaking 0.4.0 splits placement (
EmbedRequest) from sidecar wiring (SsrClient, shared byRendererandSsrPublish). Hosts buildSsrClientonce (URL, timeouts, PSR-3 logger, optional PSR-16 cache with TTL);Renderer::render()is the only render entry and returnsRenderedEmbed(outcome, timing, and split fragment parts).renderDocument()/ HTML-onlyrender()andSsrPublish::afterFeatureSourcePublish()are removed in favor ofpurge()→PurgeResult.SSR behavior is tightened: cache is checked before the breaker; only connect/timeout/5xx trip the breaker (4xx/parse errors do not).
requestUrlis host-supplied only (no$_SERVER/getenv/configfallbacks), normalized with a share-param whitelist for cache, sidecar, andpageMeta. v1 responses must be JSON with stricter HTML/containerIdchecks, size caps, and no legacy raw-HTML path. Purge refuses blank URL lists and does not flush PHP cache if the sidecar POST fails.The emitted fragment adds modulepreload, CSS
?v=busting, optional script nonce, and safer boot strings viajson_encode. HTTP goes throughSsrTransport::send()(render/health/purge);NativeSsrPurgeTransportis gone. Tooling: PHPStan max,composer validate --strict, prefer-lowest CI, deprecations fail tests,SECURITY.md.Reviewed by Cursor Bugbot for commit 8cf37b8. Bugbot is set up for automated code reviews on this repo. Configure here.