Skip to content

feat: add attestr/trusted-list kind search aliases (phase 1) - #247

Open
dadofsambonzuki wants to merge 1 commit into
dergigi:masterfrom
dadofsambonzuki:feat/attestr-kind-search-phase1
Open

feat: add attestr/trusted-list kind search aliases (phase 1)#247
dadofsambonzuki wants to merge 1 commit into
dergigi:masterfrom
dadofsambonzuki:feat/attestr-kind-search-phase1

Conversation

@dadofsambonzuki

@dadofsambonzuki dadofsambonzuki commented Apr 6, 2026

Copy link
Copy Markdown

Adds Phase 1 support for searching attestation-related Nostr kinds by extending aliases and kind metadata.

What changed

1) Search aliases (public/replacements.txt)

Added is: aliases for attestr/trusted-list/trusted-assertion kinds:

  • is:attestation -> kind:31871
  • is:attestation-request -> kind:31872
  • is:attestor-recommendation -> kind:31873
  • is:attestor-proficiency -> kind:11871
  • is:trusted-service-providers -> kind:10040
  • is:trusted-assertion-user -> kind:30382
  • is:trusted-assertion-event -> kind:30383
  • is:trusted-assertion-address -> kind:30384
  • is:trusted-list -> kind:30392
  • is:trusted-list-topic -> kind:30393
  • is:trusted-list-dedup -> kind:30394
  • is:trusted-list-meta -> kind:30395

This enables direct search queries such as:

  • is:attestation by:alice
  • is:trusted-list
  • is:trusted-service-providers by:bob

2) Kind metadata/icons (src/lib/eventKindIcons.ts)

Added icon and display-name mappings for the same kinds so kind badges/buttons resolve correctly and consistently.

Scope

This PR intentionally focuses only on Phase 1 (search/discoverability + mappings). It does not add custom rendering cards for these kinds yet.

Validation

  • npx tsc --noEmit
  • npm test ✅ (all existing suites passing)

Summary by CodeRabbit

  • New Features
    • Added new search tokens for attestations, attestation requests, attestor recommendations, proficiency ratings, trusted lists (and variants), trusted assertions, and trusted service providers to improve discoverability.
    • Added visual icons and human-friendly display names for these new event types to make the interface clearer; existing tokens and labels remain unchanged.

@vercel

vercel Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the dergigi's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 26570a2f-e384-4d69-8ea6-b5b183e859a2

📥 Commits

Reviewing files that changed from the base of the PR and between dc96e5a and 60c7c16.

📒 Files selected for processing (2)
  • public/replacements.txt
  • src/lib/eventKindIcons.ts
✅ Files skipped from review due to trivial changes (1)
  • public/replacements.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/eventKindIcons.ts

📝 Walkthrough

Walkthrough

This PR adds new Nostr event kind mappings for attestations and trusted lists to query tokens and extends UI icon/display name mappings for those event kinds.

Changes

Cohort / File(s) Summary
Trusted Lists & Attestations Query Mappings
public/replacements.txt
Added 12 new is: query token mappings (is:attestation, is:attestation-request, is:attestor-recommendation, is:attestor-proficiency, is:trusted-list, is:trusted-list-topic, is:trusted-list-dedup, is:trusted-list-meta, is:trusted-assertion-user, is:trusted-assertion-event, is:trusted-assertion-address, is:trusted-service-providers) mapping to specific kind:<number> values.
Event Kind Icons & Display Names
src/lib/eventKindIcons.ts
Extended EVENT_KIND_ICONS with the corresponding new kinds (including 10040, 11871, 31871–31873, 30382–30395) and updated getEventKindIconName() / getEventKindDisplayName() to return icon name strings and human-readable labels for those kinds.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: adding search aliases for attestation and trusted-list related kinds in phase 1.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/lib/eventKindIcons.ts (1)

33-66: Consider consolidating the three parallel mappings.

The file maintains three separate Record<number, ...> structures (EVENT_KIND_ICONS, icon names in getEventKindIconName, and display names in getEventKindDisplayName) that must stay synchronized. This is an existing pattern, but as the number of kinds grows, a single source-of-truth object could reduce maintenance burden.

♻️ Optional: Unified mapping structure for future consideration
// Single source of truth
interface KindMeta {
  icon: IconDefinition;
  iconName: string;
  displayName: string;
}

const EVENT_KINDS: Record<number, KindMeta> = {
  // ... etc
};

export const EVENT_KIND_ICONS: Record<number, IconDefinition> = 
  Object.fromEntries(Object.entries(EVENT_KINDS).map(([k, v]) => [k, v.icon]));

export function getEventKindIconName(kind: number): string | null {
  return EVENT_KINDS[kind]?.iconName ?? null;
}

export function getEventKindDisplayName(kind: number): string {
  return EVENT_KINDS[kind]?.displayName ?? 'Note';
}

Also applies to: 82-119, 126-163

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/eventKindIcons.ts` around lines 33 - 66, The three parallel mappings
(EVENT_KIND_ICONS, getEventKindIconName, getEventKindDisplayName) drift out of
sync; replace them with a single source-of-truth mapping (e.g., EVENT_KINDS:
Record<number, KindMeta> where KindMeta has icon, iconName, displayName) and
derive the existing exports/helpers from it (keep EVENT_KIND_ICONS by building
it from EVENT_KINDS, implement getEventKindIconName and getEventKindDisplayName
to read from EVENT_KINDS with appropriate fallbacks); update usages to continue
relying on EVENT_KIND_ICONS/getEventKindIconName/getEventKindDisplayName so
behavior remains unchanged while ensuring a single authoritative mapping.
public/replacements.txt (1)

60-72: New search aliases are correctly formatted and follow existing conventions.

The is: token mappings in replacements.txt (lines 60-72) are properly structured. However, note that src/lib/spellTranslate.ts:KIND_SHORTCUTS was not updated to include these new kinds. If spell events (kind:777) should support filtering by attestation and trusted list kinds, consider adding them to the KIND_SHORTCUTS map for consistency. Currently, spell events won't recognize these shortcuts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@public/replacements.txt` around lines 60 - 72, replacements.txt added new is:
shortcuts but src/lib/spellTranslate.ts's KIND_SHORTCUTS map doesn't include
them, so spell events (kind:777) won't recognize them; update the KIND_SHORTCUTS
constant in spellTranslate.ts to add entries for each new alias (e.g.,
"is:attestation" -> 31871, "is:attestation-request" -> 31872,
"is:attestor-recommendation" -> 31873, "is:attestor-proficiency" -> 11871,
"is:trusted-list" -> 30392, "is:trusted-list-topic" -> 30393,
"is:trusted-list-dedup" -> 30394, "is:trusted-list-meta" -> 30395,
"is:trusted-assertion-user" -> 30382, "is:trusted-assertion-event" -> 30383,
"is:trusted-assertion-address" -> 30384, "is:trusted-service-providers" ->
10040) and verify that KIND_SHORTCUTS is used by the logic handling kind 777 so
these aliases are recognized by spell events.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@public/replacements.txt`:
- Around line 60-72: replacements.txt added new is: shortcuts but
src/lib/spellTranslate.ts's KIND_SHORTCUTS map doesn't include them, so spell
events (kind:777) won't recognize them; update the KIND_SHORTCUTS constant in
spellTranslate.ts to add entries for each new alias (e.g., "is:attestation" ->
31871, "is:attestation-request" -> 31872, "is:attestor-recommendation" -> 31873,
"is:attestor-proficiency" -> 11871, "is:trusted-list" -> 30392,
"is:trusted-list-topic" -> 30393, "is:trusted-list-dedup" -> 30394,
"is:trusted-list-meta" -> 30395, "is:trusted-assertion-user" -> 30382,
"is:trusted-assertion-event" -> 30383, "is:trusted-assertion-address" -> 30384,
"is:trusted-service-providers" -> 10040) and verify that KIND_SHORTCUTS is used
by the logic handling kind 777 so these aliases are recognized by spell events.

In `@src/lib/eventKindIcons.ts`:
- Around line 33-66: The three parallel mappings (EVENT_KIND_ICONS,
getEventKindIconName, getEventKindDisplayName) drift out of sync; replace them
with a single source-of-truth mapping (e.g., EVENT_KINDS: Record<number,
KindMeta> where KindMeta has icon, iconName, displayName) and derive the
existing exports/helpers from it (keep EVENT_KIND_ICONS by building it from
EVENT_KINDS, implement getEventKindIconName and getEventKindDisplayName to read
from EVENT_KINDS with appropriate fallbacks); update usages to continue relying
on EVENT_KIND_ICONS/getEventKindIconName/getEventKindDisplayName so behavior
remains unchanged while ensuring a single authoritative mapping.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 259b671e-80bc-4a3d-93fa-d5f75ae83fb2

📥 Commits

Reviewing files that changed from the base of the PR and between 27558eb and dc96e5a.

📒 Files selected for processing (2)
  • public/replacements.txt
  • src/lib/eventKindIcons.ts

@dergigi

dergigi commented Apr 17, 2026

Copy link
Copy Markdown
Owner

FYI — master was reverted to the v0.2.11 state in #248 (now released as v0.4.0 in #249). This PR only touches public/replacements.txt and src/lib/eventKindIcons.ts, both of which exist in the reverted tree, so it's likely still applicable — but you'll need to rebase onto the new master to get it mergeable. If you'd rather I close it and you open a fresh PR from v0.4.0, just say the word.

@dadofsambonzuki
dadofsambonzuki force-pushed the feat/attestr-kind-search-phase1 branch from dc96e5a to 60c7c16 Compare April 22, 2026 07:32
@dadofsambonzuki

Copy link
Copy Markdown
Author

FYI — master was reverted to the v0.2.11 state in #248 (now released as v0.4.0 in #249). This PR only touches public/replacements.txt and src/lib/eventKindIcons.ts, both of which exist in the reverted tree, so it's likely still applicable — but you'll need to rebase onto the new master to get it mergeable. If you'd rather I close it and you open a fresh PR from v0.4.0, just say the word.

OK, done. 🫡

I have ignored the CodeRabbit nitpicks as they extend to the whole codebase.

@vercel

vercel Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ants Ready Ready Preview, Comment May 6, 2026 3:09pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants