fix: invalidate retired AGENTS.md sections across multisite snapshots - #3531
Merged
Merged
Conversation
MultisiteSectionAggregator merges per-site snapshots by union. A section retired from shared code (mu-plugin / network plugin) stayed in the root file until every site recomposed, because each compose only rewrites the current site's snapshot. On extrachill.com that turned unregistering homeboy-codebox-agent-tasks into an 11-site manual loop, and one unreachable blog (domain-mapped onto another) could never refresh itself. When a slug leaves this site's previous snapshot, strip it from every other site's stored snapshot via update_blog_option. switch_to_blog() cannot rediscover the other site's plugins, but the stored arrays are writable. Site-specific sections this site never rendered are absent from the previous snapshot, so they are not dropped. Also adds `wp datamachine memory compose --all-sites` to recompose each public site through a fresh WP-CLI process with that site's --url, and records generated_at on snapshots without bumping the payload version (a version bump would blank the root file until every site reseeds). Refs #3529
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.
Fixes #3529
The gap
MultisiteSectionAggregatormerges per-site snapshots by union. A compose only rewrites the current site's snapshot, becauseswitch_to_blog()does not load the other site's plugins. That design is correct and stays.What it did not do: invalidate. Retire a section from a mu-plugin, compose on one site, and every other site's stored copy of that section is merged back into the shared
AGENTS.md. On extrachill.com that was 10 stale snapshots resurrectinghomeboy-codebox-agent-tasksafter wp-coding-agents#610 unregistered it. One blog (13,extrachill.link) is domain-mapped onto blog 4 bysunrise.phpand can never recompose itself.The fix
When a slug leaves this site's previous snapshot, strip it from every other site's stored snapshot via
update_blog_option. The other site's plugins never need to load.Site-specific sections this site never rendered are absent from
$previous, so they are not in$droppedand survive. The existing smoke assertion still holds: refreshing site 2 does not erase site 1's provider.Also:
generated_aton snapshots (no version bump — bumpingVERSIONwould failvalid_snapshot()for every existing site and blank the root file until the whole network reseeds, which is the bug we're fixing).wp datamachine memory compose AGENTS.md --all-sites— one subprocess per public site with that site's--url, so new site-specific sections still get a honest full refresh. Duplicate hosts are skipped with a warning.Test
php tests/agents-md-multisite-composition-smoke.php— existing cases plus: both sites rendershared-retired, site 1 drops it, merged file and site 2's stored snapshot no longer contain it.Not in this PR
--all-sitesis the operator lever; automatic fan-out is a later scheduler.sunrise.phpmappingextrachill.link→ blog 4 while blog 13 still exists. That's Extra Chill config, not Data Machine. Drop-propagation still converges that zombie snapshot without loading it.