From 5a196dd2855d8cab4deca184656b576d374cc881 Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Sun, 31 May 2026 11:43:18 -0400 Subject: [PATCH] fix: register bundle artifact hooks early --- data-machine-code.php | 5 +- ...oke-bundle-artifact-early-registration.php | 69 +++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 tests/smoke-bundle-artifact-early-registration.php diff --git a/data-machine-code.php b/data-machine-code.php index baea0bef..3b083f02 100644 --- a/data-machine-code.php +++ b/data-machine-code.php @@ -25,6 +25,10 @@ // PSR-4 Autoloading. require_once __DIR__ . '/vendor/autoload.php'; +// Bundle artifact types must be registered as soon as the plugin is loaded so +// Data Machine can validate DMC-owned artifacts during early import paths. +( new \DataMachineCode\Bundle\WorkspacePreloadArtifact() )->register(); + /** * Install DMC-owned database tables. */ @@ -99,7 +103,6 @@ function datamachine_code_bootstrap() { new \DataMachineCode\Abilities\CodeTaskAbilities(); new \DataMachineCode\Abilities\WordPressRuntimeAbilities(); \DataMachineCode\SourceInventory\WorkspaceSourceInventory::register(); - ( new \DataMachineCode\Bundle\WorkspacePreloadArtifact() )->register(); // Project active workspace identity into Data Machine's engine_data // snapshot at job init. Requires DM's datamachine_engine_snapshot diff --git a/tests/smoke-bundle-artifact-early-registration.php b/tests/smoke-bundle-artifact-early-registration.php new file mode 100644 index 00000000..352fea64 --- /dev/null +++ b/tests/smoke-bundle-artifact-early-registration.php @@ -0,0 +1,69 @@ +