Edit the binding filter in the canvas bind panel #145

Closed
opened 2026-10-27 13:35:08 +00:00 by sam · 2 comments
Owner

Goal

BindEvent edits the CEL filter and shows whether the selected capture is admitted.

Evidence

ui/src/workflows/BindEvent.vue passes the existing filter through with no field.

Rules

Read CLAUDE.md. Do only what the Goal and Stop when need. File anything else you notice as a bead; do not fix it. Run task check once at the end; if it fails twice on the same problem, comment on this bead and stop.

Stop when

  • Filter field with live admitted/excluded result.
  • Playwright check.
    Then commit (Conventional Commits, scoped by package), bd close this bead and stop.

Imported from beads archie-core-bdb5.13 · GitHub #1374 · type feature · priority P3 · created 2026-10-05

## Goal BindEvent edits the CEL filter and shows whether the selected capture is admitted. ## Evidence ui/src/workflows/BindEvent.vue passes the existing filter through with no field. ## Rules Read CLAUDE.md. Do only what the Goal and Stop when need. File anything else you notice as a bead; do not fix it. Run `task check` once at the end; if it fails twice on the same problem, comment on this bead and stop. ## Stop when - [ ] Filter field with live admitted/excluded result. - [ ] Playwright check. Then commit (Conventional Commits, scoped by package), `bd close` this bead and stop. --- _Imported from beads `archie-core-bdb5.13` · GitHub #1374 · type feature · priority P3 · created 2026-10-05_
sam added the lowfeature labels 2026-10-27 13:35:08 +00:00
sam self-assigned this 2026-10-27 13:35:08 +00:00
Author
Owner

archie's PRD is ready -- awaiting your go/no-go.

PRD — Edit the binding filter in the canvas bind panel (issue #145)

Problem

The canvas Start node's bind panel (WorkflowEditor.vue:495 → TriggerSettings.vue:31 → ui/src/workflows/BindEvent.vue) round-trips the binding filter untouched (BindEvent.vue:221: filter: props.binding?.filter ?? ""). There is no filter field and no whole-binding verdict — only per-field resolve results. Dispatch compiles the filter and records "filtered" on exclusion (internal/daemon/daemon.go:644-651); binding save refuses one that does not compile (internal/webui/bindings.go:362). So an operator editing from the canvas saves blind. "Shows whether the selected capture is admitted" is not UI-only: CEL evaluation exists only server-side (internal/domain/binding/filter.go:23,51); ui/package.json has no CEL library.

Proposed solution

Extend the existing preview route rather than add one.

  • internal/webui/mappings.go: mappingPreviewRequest (:234) gains Filter string \json:"filter"`; handleMappingPreview (:239) runs binding.CompileFilter(req.Filter, req.Fields)after the existingmapping.Resolve. Compile error → 200 with filter_error(inline while typing, not 400); compiles → 200 withadmittedfromf.Admits(values)`. Filter empty → neither key, response unchanged. Evaluation errors mean excluded, as at dispatch.
  • ui/src/lib/api.ts:386: mappingPreview(captureId, fields, filter = "").
  • ui/src/mappings/state.ts:62: Preview gains admitted?: boolean, filter_error?: string.
  • ui/src/workflows/BindEvent.vue: filter ref from binding.filter; the watch (:133) becomes [fields, captureId, filter] (existing 250 ms debounce covers typing); the !fields.value.length half of the early return (:135) goes; staleness becomes a generation counter instead of id === captureId.value (:142); a Filter section after Inputs with the destructive Alert for filter_error and one text-ok/text-warn line for admitted/excluded; blockers gains a compile blocker so Save is disabled while filter_error is set (save() PATCHes the mapping before the binding, so a refused filter would leave the mapping rewritten); save() sends filter.value.trim().
  • e2e/checks/workflow-bind-filter.cjs: new check driving new source + posted capture → pr-review (only shipped workflow with declared inputs) → filter pr_number > 100 (Excluded) → < 100 (Admitted) → typo (compile error, Save disabled) → save → assert trigger row and GET /api/bindings carries the filter → delete in finally.

Acceptance criteria

Preview accepts optional filter and returns admitted / filter_error / unchanged shape; semantics identical to dispatch (same function, same field list, same values); filter field shown and saved; verdict within ~250 ms, distinct admitted/excluded states, inline compile message, nothing when empty; no stale response overwrites a newer one; Save disabled while the filter does not compile; no console/page error and task check plus pnpm run typecheck pass; the Playwright check passes against task e2e:up.

Non-goals

No verdict in the /bindings dialog (BindingEditor.vue:200-209, separate bead); no client-side CEL, new dependency, new endpoint, or change to dispatch/internal/domain/binding; no fix for filter-only parameters being unreachable; no preservation of filter-only mapping fields; no header-based filters.

Files and estimated diff

internal/webui/mappings.go ~15, ui/src/lib/api.ts ~3, ui/src/mappings/state.ts ~4, ui/src/workflows/BindEvent.vue ~35, e2e/checks/workflow-bind-filter.cjs ~55 → ~110 lines. Right at AGENTS.md's "past about 100 lines, stop and assess" line; assessed — a new endpoint or client CEL is larger and duplicates server semantics.

Known limitations to file as beads

  1. Filter-only parameters are unreachable from this panel: mappingFields (bind-event.ts:34) rebuilds the mapping from declared inputs plus the repository path and save() PATCHes it, so a binding like the seeded e2e-binding (field title, workflow feasibility with no inputs) fails CompileFilter at save. The new field at least names it before Save.
  2. A no-input workflow with a blank repository path cannot be bound from the canvas at all: the rebuilt field list is empty and mapping.Mapping.Validate refuses it.
  3. Same verdict in the /bindings dialog.

Risks

Preview is a filter verdict, not a dispatch simulation — it does not check m.EventTypeID == c.EventType; accept and note in a handler comment. The e2e check cannot reuse the seeded issue-opened type (schema from its example lacks issue.number), hence a fresh source and capture. Add a ### archie-ui line under ## [Unreleased] in CHANGELOG.md (newsgen skips Unreleased, so docs/news stays untouched). Two commits scoped by package (feat(webui), feat(ui)), task check once, then bd close.

Verification

Read this run: BindEvent.vue, bind-event.ts, bindings/binding-draft.ts, BindingEditor.vue, mappings/state.ts, workflow-triggers.ts, TriggerSettings.vue, internal/webui/mappings.go, bindings.go, authorization_surfaces_test.go, internal/domain/binding/{filter,binding,inputs}.go, internal/domain/mapping/mapping.go, internal/domain/eventtype/eventtype.go, daemon.go:590-807, e2e/{README.md,seed.sh,run.cjs}, e2e/checks/org-schedule-trigger.cjs, pr-review.yaml, Taskfile.yml, Newsgen sources, ui/package.json, AGENTS.md/CLAUDE.md. Not verified: exact cel-go error strings, the two limitation chains by execution, and whether Node/pnpm/Chromium exist here (preflight reported only Go 1.27.3; e2e/node_modules absent), so the Playwright stop-condition may not be producible in this environment.

Decide in chat or on the dashboard.

**archie's PRD is ready -- awaiting your go/no-go.** ## PRD — Edit the binding filter in the canvas bind panel (issue #145) ### Problem The canvas Start node's bind panel (`WorkflowEditor.vue:495` → `TriggerSettings.vue:31` → `ui/src/workflows/BindEvent.vue`) round-trips the binding filter untouched (`BindEvent.vue:221`: `filter: props.binding?.filter ?? ""`). There is no filter field and no whole-binding verdict — only per-field resolve results. Dispatch compiles the filter and records `"filtered"` on exclusion (`internal/daemon/daemon.go:644-651`); binding save refuses one that does not compile (`internal/webui/bindings.go:362`). So an operator editing from the canvas saves blind. "Shows whether the selected capture is admitted" is not UI-only: CEL evaluation exists only server-side (`internal/domain/binding/filter.go:23,51`); `ui/package.json` has no CEL library. ### Proposed solution Extend the existing preview route rather than add one. - `internal/webui/mappings.go`: `mappingPreviewRequest` (`:234`) gains `Filter string \`json:"filter"\``; `handleMappingPreview` (`:239`) runs `binding.CompileFilter(req.Filter, req.Fields)` after the existing `mapping.Resolve`. Compile error → 200 with `filter_error` (inline while typing, not 400); compiles → 200 with `admitted` from `f.Admits(values)`. Filter empty → neither key, response unchanged. Evaluation errors mean excluded, as at dispatch. - `ui/src/lib/api.ts:386`: `mappingPreview(captureId, fields, filter = "")`. - `ui/src/mappings/state.ts:62`: `Preview` gains `admitted?: boolean`, `filter_error?: string`. - `ui/src/workflows/BindEvent.vue`: `filter` ref from `binding.filter`; the watch (`:133`) becomes `[fields, captureId, filter]` (existing 250 ms debounce covers typing); the `!fields.value.length` half of the early return (`:135`) goes; staleness becomes a generation counter instead of `id === captureId.value` (`:142`); a Filter section after Inputs with the destructive `Alert` for `filter_error` and one `text-ok`/`text-warn` line for admitted/excluded; `blockers` gains a compile blocker so Save is disabled while `filter_error` is set (`save()` PATCHes the mapping before the binding, so a refused filter would leave the mapping rewritten); `save()` sends `filter.value.trim()`. - `e2e/checks/workflow-bind-filter.cjs`: new check driving new source + posted capture → `pr-review` (only shipped workflow with declared inputs) → filter `pr_number > 100` (Excluded) → `< 100` (Admitted) → typo (compile error, Save disabled) → save → assert trigger row and `GET /api/bindings` carries the filter → delete in `finally`. ### Acceptance criteria Preview accepts optional `filter` and returns `admitted` / `filter_error` / unchanged shape; semantics identical to dispatch (same function, same field list, same values); filter field shown and saved; verdict within ~250 ms, distinct admitted/excluded states, inline compile message, nothing when empty; no stale response overwrites a newer one; Save disabled while the filter does not compile; no console/page error and `task check` plus `pnpm run typecheck` pass; the Playwright check passes against `task e2e:up`. ### Non-goals No verdict in the `/bindings` dialog (`BindingEditor.vue:200-209`, separate bead); no client-side CEL, new dependency, new endpoint, or change to dispatch/`internal/domain/binding`; no fix for filter-only parameters being unreachable; no preservation of filter-only mapping fields; no header-based filters. ### Files and estimated diff `internal/webui/mappings.go` ~15, `ui/src/lib/api.ts` ~3, `ui/src/mappings/state.ts` ~4, `ui/src/workflows/BindEvent.vue` ~35, `e2e/checks/workflow-bind-filter.cjs` ~55 → ~110 lines. Right at AGENTS.md's "past about 100 lines, stop and assess" line; assessed — a new endpoint or client CEL is larger and duplicates server semantics. ### Known limitations to file as beads 1. Filter-only parameters are unreachable from this panel: `mappingFields` (`bind-event.ts:34`) rebuilds the mapping from declared inputs plus the repository path and `save()` PATCHes it, so a binding like the seeded `e2e-binding` (field `title`, workflow `feasibility` with no inputs) fails `CompileFilter` at save. The new field at least names it before Save. 2. A no-input workflow with a blank repository path cannot be bound from the canvas at all: the rebuilt field list is empty and `mapping.Mapping.Validate` refuses it. 3. Same verdict in the `/bindings` dialog. ### Risks Preview is a filter verdict, not a dispatch simulation — it does not check `m.EventTypeID == c.EventType`; accept and note in a handler comment. The e2e check cannot reuse the seeded `issue-opened` type (schema from its example lacks `issue.number`), hence a fresh source and capture. Add a `### archie-ui` line under `## [Unreleased]` in `CHANGELOG.md` (newsgen skips Unreleased, so `docs/news` stays untouched). Two commits scoped by package (`feat(webui)`, `feat(ui)`), `task check` once, then `bd close`. ### Verification Read this run: `BindEvent.vue`, `bind-event.ts`, `bindings/binding-draft.ts`, `BindingEditor.vue`, `mappings/state.ts`, `workflow-triggers.ts`, `TriggerSettings.vue`, `internal/webui/mappings.go`, `bindings.go`, `authorization_surfaces_test.go`, `internal/domain/binding/{filter,binding,inputs}.go`, `internal/domain/mapping/mapping.go`, `internal/domain/eventtype/eventtype.go`, `daemon.go:590-807`, `e2e/{README.md,seed.sh,run.cjs}`, `e2e/checks/org-schedule-trigger.cjs`, `pr-review.yaml`, `Taskfile.yml`, `Newsgen` sources, `ui/package.json`, AGENTS.md/CLAUDE.md. Not verified: exact cel-go error strings, the two limitation chains by execution, and whether Node/pnpm/Chromium exist here (preflight reported only Go 1.27.3; `e2e/node_modules` absent), so the Playwright stop-condition may not be producible in this environment. _Decide in chat or on the dashboard._
Author
Owner

Closed: goes against the product plan in epic #1977. Bindings are replaced by triggers (#1978), and the canvas becomes a place to review and inspect rather than the main authoring path.

Closed: goes against the product plan in epic #1977. Bindings are replaced by triggers (#1978), and the canvas becomes a place to review and inspect rather than the main authoring path.
sam closed this issue 2026-11-14 14:45:07 +00:00
sam added a new dependency 2026-11-14 14:45:10 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#145