Skip to content

Prepare 7.7.15: imported fields, page-sync safety and performance - #209

Merged
dnnsjsk merged 30 commits into
mainfrom
7.7.15
Nov 18, 2026
Merged

dnnsjsk merged 30 commits into
mainfrom
7.7.15

Conversation

@dnnsjsk

@dnnsjsk dnnsjsk commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #208.
Fixes #212.

  • Preserve imported flat block fields through rendering, editor hydration, editing, saving and reload, while keeping explicit nested values and WordPress attribute schemas intact.
  • Refuse hierarchical child writes when no usable parent post exists. Report the parent identity instead of creating root-level duplicates or detaching an existing child.
  • Preserve locked-page behavior and leave non-hierarchical types independent of parent posts.
  • Show reconciliation error codes and messages in CLI table output, including the missing parent's name.
  • Add regression coverage for the reported folder/slug collision, descendants, retry, existing-child preservation, stale parent IDs, flat post types and CLI diagnostics.
  • Update page-sync docs, changelog and bundled LLM documentation.
  • Preserve the existing prerender/cache, Markdown and Tailwind performance commits already on this branch.

Compatibility

The nested blockstudio.attributes object remains the canonical saved block format. Registered WordPress field schemas are unchanged and no database migration runs. Direct WordPress block-renderer REST requests must use the canonical nested payload.

A failed parent does not create or reparent a hierarchical child. Resolve the parent conflict and run explicit sync again. Non-authoritative locked pages remain locked. No automatic page sync is introduced.

Deferred

Icon issue #8 and PRs #210/#211 remain untouched at the owner's request. Bundled icon delivery is unchanged.

Validation

Latest candidate: 3b4486ad684cdbd5bbcb18d791b7b93c02dd5840.

Release Status

Preparation only. No merge, tag or release is authorized.

Normalize declared flat fields at render and editor parse boundaries while preserving nested values and native schemas. Add issue #208 save/reload regression coverage, docs, and release metadata. Tests run in CI only as requested.
Address CI type checks without raising the browser target. Full tests remain CI-only.
@dnnsjsk
dnnsjsk marked this pull request as ready for review November 11, 2026 23:42
dnnsjsk and others added 21 commits November 13, 2026 00:23
Every cache publish pruned its scope by sorting the whole directory with two filemtime calls per comparison. On a 16,000-file static prerender namespace that is about 465,000 stats per write; concurrent live misses from a crawl saturated php-fpm in production on 2026-11-12. Pruning now lists the scope without stats, returns when it is within its bound, takes a non-blocking eviction lock, stats each candidate once and evicts the same oldest objects as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
persist_built_response recomputed the theme-wide shared snapshot, with its directory scans and engine asset inventory, for every route a build shard rendered. The files cannot change within one request or build process, so the snapshot is computed once per theme root and cleared with the content hasher.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Graph builds wrote every render into the capped runtime store and activation then copied and hashed each one into the artifact scope. A build of more routes than the store bound, plus the live misses written beside it, evicted its own renders before promotion, which blocked prerendering large sites. Batch renders now publish into the artifact scope under their content-addressed keys, route maps accept them there, and promotion keeps them in place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The HTTP transport paid a full WordPress boot, a loopback request and a php-fpm child for every route. The fork transport boots once per batch process and renders each route in a child forked from that state: the child runs the normal front-end request with the warm and dependency headers, its output, status, redirect and theme-reported headers return over a socket, and the parent persists them exactly as the HTTP transport does. A child ends without destructors so the parent's database connection survives, routes the child cannot render fall back to HTTP, and processes without pcntl keep the HTTP transport.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fork transport fires blockstudio/static_prerender/fork_prepare with the batch's URLs before the first fork, so a host can load request-independent data once in the parent for every child, and blockstudio/static_prerender/fork_child at the start of each child before its request runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
…ster the fork hooks with the hook rule

Build plans treated a graph record whose document lives only in the artifact scope as a cache miss, so every route stayed affected after a build; they now accept either location, like route maps. The unit tests read build documents and headers from the artifact scope, and HookCallbackRule accepts the child_headers, fork_child and fork_prepare hooks the batch renderer fires.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
The blockstudio/tailwind/sources filter names source files and directories. Every page links the stylesheet of their candidates, cached under a file signature, and a page with utilities outside them links that set plus its own extras.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
Localized docs converted their Markdown and the English source for heading anchors with a fresh GFM converter on every render, then ran the docs sanitizer. Results are now content addressed by the input and the identity of the converter, sanitizer and bundled dependencies, in memory and in the page-markdown runtime scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
Every graph record repeated its full dependency maps, about 240 KB per
route on a localized site, so a 50,000-route build wrote 12 GB of state.
Records now name a content-addressed dependency set that routes of one
family share, readers restore the maps transparently, and garbage
collection drops sets no record names once they are an hour old.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
Readers keep the set hash on the restored record, so garbage collection no
longer encodes and hashes every record's maps, and the hour cutoff is a
literal because the constant is missing outside WordPress.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
Whole dependency sets were unique per route (each names its own page source
and locale), so storing them once saved nothing. Records now split their
hashes by directory into content-addressed chunks that a site's routes
share, derive paths from the portable IDs, keep only paths that differ from
that derivation, and leave virtual hashes inline. On 2,000 blockstudio.dev
routes the state drops from 535 MB to 24 MB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
Route maps, garbage collection, the removed-route scan and status read
URLs, cache keys and chunk hashes only, so the bulk reader now returns
records as stored. Restoring one record merges its chunks' hashes and the
paths derived once per chunk, instead of deriving every path again for every
record, which kept a 59,000-route activation on one core for minutes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
… fell back

The request cache held every record a plan read with its dependency maps
restored, about 1,700 entries per route, so planning a site whose 59,000
routes already had records ran out of memory. It now holds records as
stored and restores each one from the shared chunk cache when read, and it
never caches records in the old inline format. A route that falls back from
the fork transport to HTTP keeps the fork error in its result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CKNXHwrSt7SZbX9RJvqJZJ
Fix #212 without creating root-level duplicates or detaching existing children. Include parent errors in CLI output, add hierarchy and report regressions, and document retry behavior. Full testing runs in CI only.
@dnnsjsk
dnnsjsk marked this pull request as draft November 16, 2026 08:43
@dnnsjsk dnnsjsk changed the title 7.7.15: preserve imported block fields through editing and saving Prepare 7.7.15: imported fields, page-sync safety and performance Nov 16, 2026
@dnnsjsk
dnnsjsk marked this pull request as ready for review November 16, 2026 09:12
…s artifact

A full render that reproduces production rewrote every artifact document
and header file anyway: on blockstudio.dev 51,215 files through a temporary
file and a rename, each with a new inode. A build render now keeps a
document whose bytes and headers equal the stored ones and only moves its
modification time, which early serve measures the TTL by, and header files
are only rewritten when their content changes.

Each rendered route in a batch report names how it reached the artifact:
unchanged, new (no document under its key) or rewritten (a document under
the same key held different bytes, so something the dependency graph does
not record moved the page). The report totals them under artifacts, which
gives a deploy the signal to verify a selective plan and to distrust route
hashes that read the same file before and after the render.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dnnsjsk and others added 4 commits November 16, 2026 22:32
Activation validated and promoted every route of a site while holding both
the site's build lock and the map lock every site shares, so the sites a
deploy activates together waited for each other's route files. Validation
and promotion only touch the site's own store and artifact directory and
now run under its build lock alone; the map lock is held just to write the
map, activate the identity and collect the site's unreferenced documents.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A plan over blockstudio.dev's 51,330 routes took about 150 seconds, and the
artifact assembly repeats it, because every route restored its chunked
dependency maps and rehashed and compared about 1,300 dependencies. A record
without path overrides, virtual hashes or inline maps whose chunks all still
hash as recorded now skips that work: each chunk is checked once per process
and the page hash is the content hash of its chunks, so every reason and the
plan itself stay what the full comparison reports. Chunk results follow the
content hasher's resets. Cache scope directories resolve once per plan and
route map instead of several times per route, the shared hashes are compared
only when they differ, file hashes are looked up before their path is
normalized, and the removed scan reuses records the plan already read. On a
fixture of 2,000 routes with 1,200 dependencies each the plan drops from 5.5
to 0.8 seconds with an identical result for fresh, changed, tampered, expired,
evicted, missing-chunk and forced routes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A plan over 51,330 routes with about 1,280 dependencies each still spent
most of its CPU time per route: merging, sorting and encoding every file
hash for the page hash, sanitizing three file names through the mime type
scan, and checking directories and readability before each record read.
The large chunks routes share are now merged, sorted and joined once per
chunk list once a list repeats, and the hashes of the small route-specific
chunks are inserted in order, which yields the same bytes the encoder
writes whenever no ID repeats and every hash is plain; anything else takes
the full merge. SHA-256 names skip sanitize_file_name() while no filter can
change its result, state, chunk and artifact directories and the home path
resolve once per pass, a record is read with one stat and one read, the
artifact is checked before the cache file, dependency ID roots normalize
once per theme root, and the public URL filter reads the dynamic prefixes
and home path once per list. On a 51,330 route fixture the plan's CPU time
drops from 24 to 11 seconds cold and from 12.9 to 2.3 seconds with records
and chunks already read, with byte-identical plans for fresh, unchanged,
changed, deleted, volatile, tampered record, tampered chunk, expired,
evicted, missing chunk, removed, added and forced routes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant