Automations and webhooks for the AT Protocol airglow.run

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

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

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.

Found by the loop while working on #18, rkey 3my32g5z76722.

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

loop:queued cid=bafyreidvwjnjpnpzujy4o3fydnkazmv2gfq54klitl5tt5hs4lj7luyg54

Working on this, attempt 1.

loop:claim run=contribute-20261026-161055-3mys2aitavd2d branch=loop/3mys2aitavd2d attempt=1 issue=58

fix(form): derive the remaining input examples from the trigger lexicon

The patch-record, notification, Semble and Margin action editors and the search step's "Value" input no longer show {{event.commit.record.subject...}} examples written for a like. Their examples now come from the trigger lexicon. The form passes an optional examples prop (TriggerExamples: atUri, url) to every action editor, and a field the record lacks means no example, or a generic one.

What each input shows now:

  • Patch record → Base Record URI: e.g. <first at-uri field>, or no placeholder when the record has none (as the fetch step's URI does after #18).
  • Notification → Body: e.g. From {{didToHandle(event.did)}}: <first at-uri field>, or just e.g. From {{didToHandle(event.did)}}.
  • Semble / Margin → Page URL: e.g. https://example.com or <first uri-format field>, or just e.g. https://example.com. These actions need an http(s) URL (renderHttpUrl), so they now use the record's uri-format field. An AT URI would fail at run time, which is why the old example was wrong for these two.
  • Search step → Value: the record's first at-uri or did field. When it has neither, it falls back to {{event.did}}, which every event has.

Verification #

  • pnpm run check: passes.
  • pnpm run test: 170 files, 2645 tests pass.
  • New unit tests in field-examples.test.ts cover triggerUrlExample, searchValueExample and triggerExamples. New editor tests in patch-record.test.tsx and notification.test.tsx check the placeholder with and without a lexicon example.
  • grep -rn "record.subject" app/islands (non-test files) now only matches follow.tsx and an explanatory hint in AutomationForm.tsx. Neither was in the issue's list, and both are about the follow action's own subject.

Acceptance criteria #

Decisions you can reverse #

  • examples is optional on EditorBlockProps, so existing editor tests and the other editors need no change.
  • Semble/Margin use the uri format (web URL) rather than at-uri, because those actions reject non-http URLs.
  • The search Value falls back to {{event.did}} instead of showing nothing.
  • The notification title placeholder (New like from {{didToHandle(event.did)}}) is left as it was. It was not in the issue's list, and its placeholder is valid for every lexicon; only the word "like" is specific.

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

loop:pushed run=contribute-20261026-161055-3mys2aitavd2d sha=fb23b7a3b9f41904145e4666cd0a8695815e2dd2

Merge. The branch replaces all five hard-coded like/strongRef examples the issue lists (patch-record Base Record URI, notification body, Semble and Margin URL, search step Value) with examples taken from the trigger lexicon. Action editors now get a typed examples?: TriggerExamples prop on EditorBlockProps, which is one of the two options the issue offers. pnpm run check and pnpm run test (170 files, 2645 tests) both pass on fb23b7a.

What I checked and how:

  • Each item in the issue against the code. Patch-record shows the first at-uri field, or no placeholder when there is none, the same as the fetch step after #18. The notification body shows From {{didToHandle(event.did)}}, plus the AT URI when the record has one. Semble and Margin show https://example.com, plus the record's first uri-format field. That is right, because renderHttpUrl rejects non-http values, so an AT URI example was wrong there. The search Value shows the first at-uri or did field, falling back to {{event.did}}, the same fallback conditionFieldExample already uses.
  • I read every changed line. recordFormatPaths generalises the old recordAtUriPaths walk without changing what it does. recordAtUriPaths and triggerAtUriExample keep their signatures. The new helpers and the two editor placeholders have unit tests, with and without an example.
  • grep -rn "record.subject" app/islands (non-test files) now finds only the follow action's own subject default and hint, a self-pattern comment, and a general explanatory hint under the lexicon input. None of these is in the issue's list, and each is correct where it stands.
  • No migrations and no changes outside the issue's scope.

loop:verdict run=review-20261026-161846-3mys2aitavd2d sha=fb23b7a3b9f41904145e4666cd0a8695815e2dd2 verdict=merge

Merged main into the branch: 0a7ef1a2c47acd926c217e898a70ae47ea04b32a.

loop:carry from=fb23b7a3b9f41904145e4666cd0a8695815e2dd2 sha=0a7ef1a2c47acd926c217e898a70ae47ea04b32a

Merged onto main as 841cfb797eaf2d609bca47619f9fe044f2ad36df.

loop:merged sha=841cfb797eaf2d609bca47619f9fe044f2ad36df head=0a7ef1a2c47acd926c217e898a70ae47ea04b32a

Sign up or Sign in to add to the discussion.