Skip to content

feat(delivery): wire ack, success and call sites into the delivery engine (PR 2 of the plan) - #2212

Draft
semen-flamingo wants to merge 1 commit into
feature/delivery-spec-skeletonfrom
feature/delivery-usage
Draft

semen-flamingo wants to merge 1 commit into
feature/delivery-spec-skeletonfrom
feature/delivery-usage

Conversation

@semen-flamingo

Copy link
Copy Markdown
Contributor

Draft, stacked on #2200. Base is the feature/delivery-spec-skeleton branch; the diff shows only the usage of the engine that #2200 introduces. Retarget to main once #2200 merges.

Still behind openframe.delivery.enabled: with the flag off (every environment today) NoopDeliveryRecorder and NoopDeliveryTracker are selected, so every call site behaves exactly as before. Transport is still JetStream — the core-NATS switch is PR 4.

What this PR wires

Ack (PENDING → ACKED). ScriptExecutionAcknowledgeMessage gains type and targetId, both nullable. ScriptExecutionAcknowledgeListener routes:

  • type + targetId present → DeliveryTracker.acknowledge(type, targetId, machineId);
  • type null (legacy agents) or SCRIPT_SCHEDULE → the existing ScriptExecutionAcknowledgeService path, unchanged.

One ack subject for every delivery type; old agents keep working.

Success (→ DONE). No new subject; the signals the agent already sends close the row:

  • InstalledAgentService.addInstalledAgentcomplete(TOOL_INSTALLATION, agentType, machineId)agentType is the toolAgent.getKey() the spec published with;
  • AgentUninstallService.uninstallcomplete(CLIENT_UNINSTALL, machineId, machineId) on the DELETED transition.

Dispatch (→ PENDING + publish).

// ToolInstallationService
ToolInstallationDeliverySpec.Seed seed = new ToolInstallationDeliverySpec.Seed(machineId, toolAgent, tool, reinstall);
deliveryDispatcher.dispatch(seed);

// ForceClientUninstallService
ClientUninstallDeliverySpec.Seed seed = new ClientUninstallDeliverySpec.Seed(machineId);
deliveryDispatcher.dispatch(seed);

Neither service injects a spec or a publisher any more; the seed's type selects the spec.

Tests

ScriptExecutionAcknowledgeListenerTest (legacy ack, typed ack, script-schedule ack hits both, malformed left unacked), InstalledAgentServiceTest, AgentUninstallServiceTest, ForceClientUninstallServiceTest. ToolInstallationService has no unit test because openframe-tool-agent-nats-installation has no test infrastructure at all.

Verification

mvn -pl openframe-machine-delivery,openframe-data-nats,openframe-client-core,openframe-api-service-core -am test -Dtest='Delivery*Test,*DeliverySpecTest,*DeliveryRecorderTest,ScriptExecutionAcknowledgeListenerTest,InstalledAgentServiceTest,AgentUninstallServiceTest,ForceClientUninstallServiceTest,MongoDeliveryTrackerTest,MachineOnlineStatusTest' — 48 tests, build green on JDK 21.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BnYUpYgKvuMw6hB5VZSimY

…gine

Second PR of the plan, on top of openframe-machine-delivery:
- ScriptExecutionAcknowledgeMessage gains type/targetId; the listener routes any
  type to DeliveryTracker.acknowledge (PENDING -> ACKED) and keeps the script path
  for legacy/SCRIPT_SCHEDULE acks.
- InstalledAgentService completes TOOL_INSTALLATION rows on installed-agent,
  AgentUninstallService completes CLIENT_UNINSTALL on /api/agents/uninstall.
- ToolInstallationService and ForceClientUninstallService dispatch through
  DeliveryDispatcher with the specs' Seeds.

Still behind openframe.delivery.enabled; with the flag off every call site
behaves exactly as today.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BnYUpYgKvuMw6hB5VZSimY
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.

1 participant