Skip to content

BUGFIX: Handle revision publications without change snapshots - #2

Draft
rolandschuetz wants to merge 1 commit into
mainfrom
bugfix-revision-publication-protocol
Draft

BUGFIX: Handle revision publications without change snapshots#2
rolandschuetz wants to merge 1 commit into
mainfrom
bugfix-revision-publication-protocol

Conversation

@rolandschuetz

@rolandschuetz rolandschuetz commented Sep 9, 2026

Copy link
Copy Markdown

🤖 This PR was generated with ChatGPT GPT-6 on behalf of Roland.

Opening the publication protocol after applying a revision throws a TypeError. The revision factory creates an approved publication with a revision reference but no changes snapshot; the model returns null for its empty BLOB, while the detail controller unconditionally calls an array-only hydrator.

Only hydrate snapshots when present. Keep null distinct from an empty array and retain the existing revision reference and page title so the template can show its revision history message. Pending workspace changes and ordinary completed snapshots keep their existing behavior.

Validation in a local Neos 8 / PHP 8.3 DDEV consumer:

  • Reproduced the exact TypeError before the fix using the real publication factory, model, controller and hydrator, with synthetic users/workspaces/revisions and a stream representing Doctrine BLOB hydration. The revision case and an additional missing-snapshot case failed; the other five cases passed.
  • After the fix: all 7 focused tests pass, with 17 assertions. Coverage includes revision metadata/page title, missing versus empty snapshots, approved/declined/withdrawn publications, repeated snapshot reads and pending workspace changes.
  • Consumer style and static-analysis checks pass. Consumer suite: 72 tests, 203 assertions, two existing external-API tests intentionally skipped. However, a separate existing network-dependent integration test was not skipped and made an unintended read-only request to a live public API. The whole-suite run was therefore not isolated and violated the investigation’s no-production-connections constraint. This is separate from the seven focused regression tests, which use synthetic fixtures and make no external requests.
  • Changed files pass PSR-12 checks; controller syntax and focused PHPStan level 0 analysis with the Flow unit-test bootstrap pass. Local homepage smoke check returns HTTP 200.

The fix adds a constant-time null check; existing snapshot traversal and revision-node lookup are unchanged. The revision fixture asserts one node lookup, and repeated-read tests verify stored changes are not modified. No cache configuration, queries, writes or external calls were added; no database performance benchmark was run. This is a deterministic component-level reproduction in the consumer environment, not an authenticated browser replay or a full database persistence test.

Run the focused suite from a Neos consumer root:

ddev exec php bin/phpunit --bootstrap Build/BuildEssentials/PhpUnit/UnitTestBootstrap.php --no-configuration --do-not-cache-result Packages/Application/CodeQ.AdvancedPublish/Tests/Unit/Controller/PublicationBackendModuleControllerTest.php

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.

1 participant