From 07b79edc02beb3ca6f2b5607cec8077f5e09c66e Mon Sep 17 00:00:00 2001 From: "Mr. Mak" Date: Tue, 17 Nov 2026 10:22:25 -0800 Subject: [PATCH] fix(mods): engine.create in the validator's form; claude plugin validate passes on Claude Code 2.1.323+ (0.17.1) (#5017) * fix(mods): engine.create in the validator's form; claude plugin validate passes on Claude Code 2.1.323+ (0.17.1) hooks/noun.ts returned { ...added, ...beneath } from engine.create. Claude Code 2.1.323 and later refuse that in `claude plugin validate` ("this engine.create hook is outside its form: a spread of anything but the value of next(e)"), for 0.16.2 and 0.17.0 alike; 2.1.319 accepted it. Reading beneath.ruflo to keep an earlier step's noun is refused as well ("$.ruflo is used as a value"), so the hook now returns { ...beneath, ruflo }. No other plugin defines engine.create, so $.ruflo is unchanged in practice. The mod loaded and ran on those versions already; only validation failed. Tests: claude plugin test plugins/ruflo-mods 209/209 before and after; claude plugin validate fails before, passes after (2.1.323, 2.1.325, 2.1.326); headless `claude -p --plugin-dir` probe loads it with plugin_errors null. Co-Authored-By: ruflo * test(mods): smoke.sh expects 0.17.1 Step 1 pins the plugin.json version; the 0.17.1 bump needs it too (same as the 0.17.0 bump in 1acb1fc98). smoke.sh: 17 passed, 0 failed. Co-Authored-By: ruflo --------- Co-authored-by: ruflo --- plugins/ruflo-mods/.claude-plugin/plugin.json | 2 +- plugins/ruflo-mods/CHANGELOG.md | 3 +++ plugins/ruflo-mods/hooks/noun.ts | 7 ++++--- plugins/ruflo-mods/scripts/smoke.sh | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/ruflo-mods/.claude-plugin/plugin.json b/plugins/ruflo-mods/.claude-plugin/plugin.json index 60292e5eb8..c0e61ae55a 100644 --- a/plugins/ruflo-mods/.claude-plugin/plugin.json +++ b/plugins/ruflo-mods/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-mods", "description": "ruflo as a Claude Code mod (function hooks, ADR-404): in-process prompt routing, edit learning signals, tighten-only tool checks from ruflo policy, the cost-tracker budget ladder, a mod trust gate for newly installed mods, and the $.ruflo noun other mods compose their status with. Opt-in and removable: the classic hook-handler hooks stay the default and take every event back whenever the mod is not loaded.", - "version": "0.17.0", + "version": "0.17.1", "repository": "https://github.com/ruvnet/ruflo", "author": { "name": "ruvnet", diff --git a/plugins/ruflo-mods/CHANGELOG.md b/plugins/ruflo-mods/CHANGELOG.md index 2d1b52badd..40b7eb4ba5 100644 --- a/plugins/ruflo-mods/CHANGELOG.md +++ b/plugins/ruflo-mods/CHANGELOG.md @@ -2,6 +2,9 @@ Newest first. One `## — ` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; older versions: `git log -- plugins/ruflo-mods`. +## 0.17.1 — 2026-11-17 +- fix: `claude plugin validate` passes again on Claude Code 2.1.323 and later. `hooks/noun.ts` returned `{ ...added, ...beneath }` from `engine.create`, which the validator refuses ("this engine.create hook is outside its form: a spread of anything but the value of next(e)"); it now returns `{ ...beneath, ruflo }`. No other plugin defines `engine.create`, so `$.ruflo` is unchanged in practice. The mod already loaded and ran on those versions; only validation failed. + ## 0.17.0 — 2026-11-11 - feat: `routeJudge` option (off by default, ADR-530). Each prompt is routed by one no-tools haiku completion that must answer with exactly one of the 11 ADR-391 labels; an off-label reply, a refusal, a timeout (4 s) or an error keeps the keyword route, and slash commands and `<…>` envelopes never reach the model. The route carries `reason: "model-judge"` (the vendored `$.ruflo` route contract is unchanged) and the context box says so. On the ADR-391 dev split it agreed with the labels on 70–71 of 84 prompts, against 27 for the keyword table. diff --git a/plugins/ruflo-mods/hooks/noun.ts b/plugins/ruflo-mods/hooks/noun.ts index 70198f73b2..e680c1fe8f 100644 --- a/plugins/ruflo-mods/hooks/noun.ts +++ b/plugins/ruflo-mods/hooks/noun.ts @@ -60,8 +60,9 @@ export function registerNoun(on: On, state: ModState) { snapshot: async () => snapshotOf(state), } - // Beneath wins: if another step already added `ruflo`, ours never replaces it. - const added = { ruflo } - return { ...added, ...beneath } + // Claude Code's validator (2.1.323+) accepts an engine.create hook only in its form: spread the value of + // next(e), then add this mod's own noun. Reading beneath.ruflo to let an earlier step win is refused too + // ("$.ruflo is used as a value"). No other plugin defines engine.create, so nothing else adds `ruflo`. + return { ...beneath, ruflo } }) } diff --git a/plugins/ruflo-mods/scripts/smoke.sh b/plugins/ruflo-mods/scripts/smoke.sh index 61a4b25339..7bb43fbfc5 100755 --- a/plugins/ruflo-mods/scripts/smoke.sh +++ b/plugins/ruflo-mods/scripts/smoke.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Structural + security smoke for ruflo-mods v0.17.0 (ADR-404, ADR-447). +# Structural + security smoke for ruflo-mods v0.17.1 (ADR-404, ADR-447). # Static only: CI has no Claude Code, so the hooks module's behaviour is held # by v3/@claude-flow/cli/__tests__/mods/*.test.ts and, where function hooks are # on, by `claude plugin test plugins/ruflo-mods`. @@ -12,9 +12,9 @@ ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } HOOKS="$ROOT/hooks" -step "1. plugin.json declares ruflo-mods 0.17.0" +step "1. plugin.json declares ruflo-mods 0.17.1" grep -q '"name": "ruflo-mods"' "$ROOT/.claude-plugin/plugin.json" \ - && grep -q '"version": "0.17.0"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version" + && grep -q '"version": "0.17.1"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version" step "2. hooks.json names exactly one module and no classic hook commands" grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \