Automations and webhooks for the AT Protocol airglow.run

Hard-coded field examples don't fit the selected lexicon #18

Closed tyb.there-hugo.dev
Closed opened by tyb.there-hugo.dev

Problem #

  • The condition field always says "e.g. event.commit.record.subject.uri" (AutomationForm.tsx:1520).
  • Every at-uri field gets "e.g. {{event.commit.record.subject}}", including listitem's list (RecordFormBuilder.tsx:629).
  • The raw template example is strongRef-shaped (record.tsx:89-91).

Seen in the session #

In https://www.youtube.com/watch?v=5MnT-ZgbBIc:

  • 0:39: "that's not an example, I don't..."

Fix direction #

Derive examples from the selected lexicon's actual fields, or drop them where no sensible example exists.

Details: docs/brainstorms/2026-10-17-graze-conference-automation-feedback.md (U2).

Queued: the loop will work on this version of the issue.

loop:queued cid=bafyreig66m3lnsq3gndyjfu52lzjc3chz3lbpw3siudqwu2akwz2g4w334

Working on this, attempt 1.

loop:claim run=contribute-20261026-151559-3my32g5z76722 branch=loop/3my32g5z76722 attempt=1 issue=18

fix(form): derive field examples from the selected lexicon

The automation form's examples no longer assume a like's strongRef shape. The condition field's example now names the trigger lexicon's first real field, or event.did when that lexicon's fields are unknown. Examples that no lexicon field could fill sensibly are gone.

What changed #

  • Condition field (AutomationForm.tsx): the placeholder is e.g. event.commit.record.<first field of the trigger record>, for example event.commit.record.text for app.bsky.feed.post. It falls back to e.g. event.did, which every event has.
  • at-uri fields in the record builder (RecordFormBuilder.tsx): the hint is now just "AT URI". It matches the other format hints ("URI", "DID identifier"). The target lexicon has no example to give, and a trigger field would not fit fields like listitem's list.
  • Raw record template (action-editors/record.tsx): this editor only shows when the target schema can't be resolved, so nothing is known about the record's shape. The strongRef JSON example is replaced with a plain instruction: "The record as JSON, with {{placeholders}} for values from the event or earlier steps".
  • Fetch step's AT URI (AutomationForm.tsx): this input had the same hard-coded {{event.commit.record.subject}}, which is not even a URI for a like. It now shows the trigger record's first at-uri field (e.g. {{event.commit.record.subject.uri}} for a like) and shows no example when the trigger record has none.
  • New pure helpers in app/islands/step-drafts/field-examples.ts, with unit tests: conditionFieldExample, recordAtUriPaths and triggerAtUriExample.

Verified #

  • pnpm run check: passes (format, lint, types).
  • pnpm run test: 167 files and 2599 tests pass, including the new field-examples.test.ts. It covers like (nested subject.uri), listitem (top-level list), follow (no AT URI) and the unknown-schema fallbacks.
  • I did not open the form in a browser.

Acceptance criteria (issue's fix direction) #

Decisions the owner can reverse #

  • I picked the trigger record's first field for the condition example, in lexicon order. A smarter pick (e.g. preferring fields with knownValues) is possible.
  • For record-builder at-uri fields I dropped the example rather than suggesting a trigger at-uri field. A trigger URI would be valid but semantically unrelated to most targets (e.g. listitem's list).
  • I also fixed the fetch step's AT URI placeholder, which the issue does not list but which had the same hard-coded example.

Follow-up, filed as a new issue on merge if the review agrees:

fix(form): derive the remaining hard-coded examples from the selected lexicon

Several inputs still carry examples written for a like's strongRef, whatever the trigger lexicon is. Issue #18 fixed the condition field, the record builder's at-uri hint, the raw record template and the fetch step's AT URI. These are left:

  • app/islands/action-editors/patch-record.tsx:76: e.g. {{event.commit.record.subject.uri}}
  • app/islands/action-editors/notification.tsx:119: e.g. {{event.commit.record.subject.uri}} was liked
  • app/islands/action-editors/semble-save.tsx:35 and margin-bookmark.tsx:41: ... or {{event.commit.record.subject.uri}}
  • app/islands/AutomationForm.tsx, the search step's "Value" input: e.g. {{event.commit.record.subject}}

Found with grep -rn "record.subject" app/islands. With a trigger such as app.bsky.feed.post, those placeholders name a field the record doesn't have. Start from app/islands/step-drafts/field-examples.ts (triggerAtUriExample). Action editors only get a flat placeholders: string[] (EditorBlockProps), so they need a typed example passed in, or the example dropped.

Review: https://tangled.org/exosphere.site/airglow/compare/main...loop/3my32g5z76722

loop:pushed run=contribute-20261026-151559-3my32g5z76722 sha=6924890af8ad2b89b670c02cfacb216881d73b86

Verdict: merge. The branch fixes all three examples the issue names. The condition field's example now comes from the trigger lexicon's fields, and the at-uri hint and the raw-template example no longer use a strongRef shape (both are dropped, since nothing fits there). pnpm run check and pnpm run test both pass.

What I checked:

  • Read every changed line against the issue. conditionFieldExample(fields) uses the trigger's fields, which lib/lexicons/resolver.ts extractFields fills with primitive leaves only. So a like gives event.commit.record.subject.uri, a post gives event.commit.record.text, and an unknown or unresolved lexicon gives event.did. recordAtUriPaths walks the resolved RecordSchema (refs already resolved into ObjectNodes). It finds subject.uri for a like and list for a listitem, and nothing for a follow.
  • Extra change: the fetch step's AT URI placeholder had the same hard-coded example. It now uses the trigger's first at-uri field, or no placeholder when there is none. It is small and fits the issue's fix direction.
  • The new unit tests (field-examples.test.ts) cover like, listitem, follow and unknown schemas.
  • pnpm run check: format, lint and types pass. pnpm run test: 167 files and 2599 tests pass.
  • No migrations.

Followup: file. I confirmed the claim with grep -rn "record.subject" app/islands. Strongref-shaped placeholders remain in patch-record.tsx:76, notification.tsx:119, semble-save.tsx:35, margin-bookmark.tsx:41 and the search step's Value input (AutomationForm.tsx:2106). The issue does not list them and this branch does not touch them. It is the same user-facing problem, so it is worth tracking.

loop:verdict run=review-20261026-152832-3my32g5z76722 sha=6924890af8ad2b89b670c02cfacb216881d73b86 verdict=merge followup=1

Merged main into the branch: 3f076c2cfe783a5f5f3f415e99366bef3c0a54b1.

loop:carry from=6924890af8ad2b89b670c02cfacb216881d73b86 sha=3f076c2cfe783a5f5f3f415e99366bef3c0a54b1

Merged onto main as 68784c1c4b7459e4faaab22c6767da9df692407d.

loop:merged sha=68784c1c4b7459e4faaab22c6767da9df692407d head=3f076c2cfe783a5f5f3f415e99366bef3c0a54b1

Filed the follow-up as a new issue, not marked ready: fix(form): derive the remaining hard-coded examples from the selected lexicon

loop:filed issue=3mys2aitavd2d

Sign up or Sign in to add to the discussion.