Skip to content

feat: network-scoped USER.md and NETWORK.md for multisite#874

Merged
chubes4 merged 1 commit intomainfrom
feature/816-user-md-network-scoped
Mar 19, 2026
Merged

feat: network-scoped USER.md and NETWORK.md for multisite#874
chubes4 merged 1 commit intomainfrom
feature/816-user-md-network-scoped

Conversation

@chubes4
Copy link
Member

@chubes4 chubes4 commented Mar 19, 2026

Summary

  • USER.md is now network-scoped on multisite — resolves to main site's uploads dir instead of per-site paths. Single-site behavior unchanged.
  • New NETWORK.md — auto-generated multisite topology file (sites table, network plugins, shared resources) at a new network layer.
  • Migration consolidates existing per-site USER.md files to the network location, keeping the richest copy.

Changes across 9 files

File What changed
DirectoryManager.php get_user_directory() uses new get_network_base_directory() on multisite; added get_network_directory()
MemoryFileRegistry.php Added LAYER_NETWORK constant and validation
CoreMemoryFilesDirective.php Network layer in $layer_dirs map
MemoryFilesReader.php Network layer in $layer_dirs map
AgentFileAbilities.php Network layer case in resolveLayerDirectory()
MemoryCommand.php Network layer in CLI agent paths output
bootstrap.php NETWORK.md registration at priority 5, network layer
migrations.php datamachine_get_network_scaffold_content() + datamachine_migrate_user_md_to_network_scope()
data-machine.php Wire migration into datamachine_activate_for_site()

Architecture

datamachine-files/           (main site uploads)
├── shared/SITE.md           (site-scoped — correct)
├── agents/{slug}/SOUL.md    (agent-scoped — correct)
├── users/{id}/USER.md       (NOW network-scoped ✅)
└── network/NETWORK.md       (NEW — network-scoped ✅)

Testing

  • All 9 modified files pass php -l syntax check
  • PHPUnit: 906 tests, same pass/fail ratio as main (5 errors, 24 failures — all pre-existing)
  • Migration is idempotent and skips single-site installs

Closes #816. Closes #873.

On multisite, WordPress users are network-wide but USER.md was stored
per-site via wp_upload_dir(). This caused each subsite to have its own
isolated copy at wp-content/uploads/sites/{id}/datamachine-files/users/.

Changes:
- DirectoryManager::get_user_directory() now resolves to the main site's
  uploads dir on multisite via new get_network_base_directory() helper
- Added LAYER_NETWORK to MemoryFileRegistry for network-scoped files
- Added get_network_directory() for NETWORK.md and future network files
- NETWORK.md scaffold generates multisite topology (sites, themes,
  network plugins, shared resources)
- Migration consolidates per-site USER.md files to network location,
  keeping the richest (largest) copy
- Updated all layer directory consumers: CoreMemoryFilesDirective,
  MemoryFilesReader, AgentFileAbilities, MemoryCommand CLI
- Single-site behavior is completely unchanged

Closes #816. Closes #873.
@github-actions
Copy link

github-actions bot commented Mar 19, 2026

Homeboy Results — data-machine

Lint

⚡ Scope: changed files only

lint (changed files only)

Test

Failure Digest

Test Failure Digest

Autofixability classification

  • Overall: human_needed
  • Autofix enabled: no
  • Autofix attempted this run: no
  • Human-needed failed commands:
    • test
  • Failed commands with available automated fixes:
    • test
  • Automated fixes are disabled for this step. Commands with available fix support in this run: test

Machine-readable artifacts

  • homeboy-lint-summary.json
  • homeboy-test-failures.json
  • homeboy-audit-summary.json
  • homeboy-autofixability.json

⚡ Scope: changed files only

test (changed files only)

Audit

⚡ Scope: changed files only

audit (changed files only)

Tooling versions
  • Homeboy CLI: homeboy 0.81.1+b635feeb
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: unknown
  • Action: Extra-Chill/homeboy-action@v1

Homeboy Action v1

@chubes4 chubes4 merged commit b85bb5c into main Mar 19, 2026
2 of 3 checks passed
@chubes4 chubes4 deleted the feature/816-user-md-network-scoped branch March 19, 2026 02:49
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.

Add NETWORK.md for multisite topology awareness Make USER.md network-scoped on multisite

1 participant