Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/php-transformer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ jobs:
php tests/unit/captured-dialog-dropdown-panel.php
PLAYWRIGHT_MODULE="$PWD/tools/visual-parity/node_modules/playwright/index.mjs" node tests/unit/captured-dialog-dropdown-panel-browser.mjs

- name: Verify native dialog parity with the recognized capture disclosure runtime
working-directory: php-transformer
run: |
php tests/unit/capture-runtime-ancestor-parity.php
PLAYWRIGHT_MODULE="$PWD/tools/visual-parity/node_modules/playwright/index.mjs" node tests/unit/capture-runtime-ancestor-parity-browser.mjs

- name: Verify native button default background neutralization
working-directory: php-transformer
run: PLAYWRIGHT_MODULE="$GITHUB_WORKSPACE/php-transformer/tools/visual-parity/node_modules/playwright/index.mjs" node tests/unit/native-button-default-background-browser.mjs
Expand Down
1 change: 1 addition & 0 deletions php-transformer/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"php tests/unit/captured-dialog-projector.php",
"php tests/unit/captured-dialog-dropdown-panel.php",
"php tests/unit/scoped-mixed-dropdown.php",
"php tests/unit/capture-runtime-ancestor-parity.php",
"php tests/unit/captured-selectable-set-projector.php",
"php tests/unit/captured-collection-filter.php",
"php tests/unit/captured-choice-group-projector.php",
Expand Down
27 changes: 25 additions & 2 deletions php-transformer/docs/contracts/capture-evidence.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,31 @@ allowed.

| Name | Kind | Meaning |
| ---- | ---- | ------- |
| `3d350f5508bed44c931291f9f38e5d8d7c361d5d3ea729c51f1fe11b70ce75dc` | sha256 of the disclosure interpreter | Body: [`tests/fixtures/capture-disclosure-runtime.js`](../../tests/fixtures/capture-disclosure-runtime.js), marker `data-blocks-engine-capture-disclosure-runtime` (value `true`), in `<head>`. |
| `0a6bf62a6d9d6a04faf10e933d2362bbbdf3b5c8351c6452174f98bf29f723aa` | sha256 of the gallery helper | Body: [`tests/fixtures/capture-gallery-runtime.js`](../../tests/fixtures/capture-gallery-runtime.js), marker `data-blocks-engine-capture-gallery-runtime`, in `<head>`. |
| `b545f43a77b79d075373048431101fe11d7ff8cdfe7987de6d7971512763d88f` | sha256 of the disclosure interpreter | Body: [`tests/fixtures/capture-disclosure-runtime.js`](../../tests/fixtures/capture-disclosure-runtime.js), marker `data-blocks-engine-capture-disclosure-runtime` (value `true`), in `<head>`. |
| `456af76323601e51d851d3a4d6fe4ff6e3989c9969562f425fd72103c5c57c6b` | sha256 of the gallery helper | Body: [`tests/fixtures/capture-gallery-runtime.js`](../../tests/fixtures/capture-gallery-runtime.js), marker `data-blocks-engine-capture-gallery-runtime`, in `<head>`. |

Blocks Engine recognizes one body per runtime: the producer's current one.
When the producer changes a body, Blocks Engine checks that its native
replacement does what the new body does, then publishes the new body and
digest in place of the old ones. An earlier body is no longer recognized: a
page that carries it keeps its captured runtime wherever recognition is
required (below).

What the native replacement reproduces:

- **Disclosure interpreter.** Opening and closing a dialog, and the ancestor
bindings in `data-blocks-engine-capture-dialog-ancestor-state`. A `class`
binding is replayed as tokens: tokens of the other state that the target
state lacks are removed, the target state's tokens are added, and every
other class on the ancestor is kept. The native dialog finds the ancestor by its tag and closed tokens.
`tests/unit/capture-runtime-ancestor-parity-browser.mjs` compares the two in
Chromium.
- **Gallery helper.** Frame galleries become native carousels. A src-swap
gallery (`data-blocks-engine-capture-gallery-sequence` with
`data-blocks-engine-capture-gallery-slot` images) becomes a native src-swap
carousel. It starts at index 0, wraps in both directions, sets each slot to
the sequence image at the current index plus the slot's offset, and removes
the slot's `srcset`.

**How Blocks Engine verifies them.** For each page with captured dialog
scopes, `CapturedDialogProjector` scans every `<script>`:
Expand Down
4 changes: 2 additions & 2 deletions php-transformer/src/Contract/CaptureEvidence.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ final class CaptureEvidence
// Recognized capture runtimes: sha256 of the trimmed `<script>` body.

/** The site-independent disclosure interpreter (DISCLOSURE_RUNTIME). */
public const DISCLOSURE_RUNTIME_SHA256 = '3d350f5508bed44c931291f9f38e5d8d7c361d5d3ea729c51f1fe11b70ce75dc';
public const DISCLOSURE_RUNTIME_SHA256 = 'b545f43a77b79d075373048431101fe11d7ff8cdfe7987de6d7971512763d88f';
/** The gallery helper (GALLERY_RUNTIME) that may coexist with a replaced disclosure interpreter. */
public const GALLERY_RUNTIME_SHA256 = '0a6bf62a6d9d6a04faf10e933d2362bbbdf3b5c8351c6452174f98bf29f723aa';
public const GALLERY_RUNTIME_SHA256 = '456af76323601e51d851d3a4d6fe4ff6e3989c9969562f425fd72103c5c57c6b';

// Published for downstream importers; Blocks Engine does not read these.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ private static function rootless(mixed $value, array $roots, bool $lengthNeutral
foreach ( $value as $key => $item ) {
if ( is_string($key) && str_ends_with($key, '_duration_ms') ) {
$value[$key] = 0;
} elseif ( 'engine_version' === $key && is_string($item) ) {
$value[$key] = '<engine-version>';
} elseif ( $lengthNeutral && is_string($key) && ( is_int($item) || is_bool($item) ) && 1 === preg_match('/bytes|length|size|offset|truncated/i', $key) ) {
$value[$key] = '<length>';
} else {
Expand Down
2 changes: 2 additions & 0 deletions php-transformer/tests/fixtures/capture-disclosure-runtime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading