Add AI Observer Panel: per-handler test scaffolding - #261
Open
droarty wants to merge 1 commit into
Open
Conversation
Extends the "AI Requests" tab into a testing tool. Adds a `defaults`
action type (server + client) that upserts missing keys onto an
object without clobbering existing ones, used to seed a `tests: {}`
array per ai-routed handler on the artifact's own state whenever the
tab is opened.
New aiObserverPanel component (duplicated/adapted from LogTreePanel)
shows a tree of tests[handlerName] with a right-side detail pane.
"Add Test" scaffolds a new test object via a new get-handler-test-skeleton
query that scans a handler's transform/condition/query fields (not its
AI prompt text, to avoid false positives) for state.*/message.*
references and builds a matching skeleton, appended via the existing
`append` action with a dynamically-computed $state.tests.<handlerName>
path. The new test auto-selects and is editable in a new JsonEditor
component (local edits only for now -- persisting them is separate
follow-up work, per the stated scope of this PR).
Closes #260
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
defaultsaction type (serverDatabasePersistor.tsvia$mergeObjectsaggregation update, clientdocumentModelStore.ts, sharedActionItemtype) — an object-level upsert-if-absent that adds missing keys without touching existing ones.workflow-builder.json's "AI Requests" tab now upserts astate.testsobject (one[]array per currently ai-routed handler) whenever opened, then renders the newaiObserverPanelcomponent bound to@state.tests, replacing the previous read-onlylogTreePanel.aiObserverPanelcomponent (apps/web/src/components/layout/AiObserverPanel.tsx, adapted fromLogTreePanel): left side is a tree of handlers → their tests; selecting any node shows an "Add Test" button.get-handler-test-skeletonquery: scans a handler'stransform/condition/queryfields (deliberately excluding its AI prompt text, to avoid false-positive matches) forstate.*/message.*references and builds a matching skeleton test object.appendaction with a dynamically-computed$state.tests.<handlerName>path, and the new test auto-selects once it appears.JsonEditorcomponent shows the selected test's data, freely editable locally — no save/persist wiring yet, per the intended scope of this PR (follow-up work).Test plan
defaultsupsert adds[]for new ai-routed handlers without clobbering an existing handler's test array (checked directly against MongoDB)testsentries; non-ai handlers do notstate.*/message.*paths referenced by the handler's transform, while excluding decoy references embedded in its AI system promptnpx nx build webandnpx nx build apiboth pass🤖 Generated with Claude Code