Created NOSTR_GIT_DEBUGGING.md to help diagnose patch discovery issues. Key insights: - Relay synchronization is the core problem - Events must be on the same relay for discovery - NostrHub and Shakespeare may use different relays - Repository announcement must exist on relay before patches The guide covers: - How Nostr git discovery works (announcement → patches) - Why relay differences cause issues (no auto-sync) - Step-by-step debugging workflow - Console log interpretation - Multiple solutions (same relay, multi-relay, NIP-65) - Verification steps for both Shakespeare and NostrHub - Common issues and fixes - Event format reference - Testing tools (nostr.band explorer) - Recommended workflow for success This should help users understand why patches aren't visible and how to fix it.
6.7 KiB
Nostr Git Debugging Guide
Understanding the Problem
Patches are being published successfully but not showing up in NostrHub or other Nostr git clients. This is likely a relay synchronization issue.
How Nostr Git Discovery Works
-
Repository Announcement (Kind 30617)
- Published once per repository
- Contains metadata: name, description, clone URLs, relays
- Includes
rtag with earliest unique commit (euc) - Has
dtag with repository identifier - Coordinate:
30617:<pubkey>:<repo-id>
-
Patches (Kind 1617)
- Reference repository via
atag:30617:<pubkey>:<repo-id> - Include
rtag with euc for repository-specific filtering - Published to relays specified in repository announcement
- Reference repository via
-
Discovery Flow
- Client queries for repositories (kind 30617)
- User selects a repository
- Client queries for patches using
#afilter:#a: ["30617:<pubkey>:<repo-id>"]
The Relay Problem
Key Issue: Events must be on the same relay for discovery to work.
Scenario:
- You're connected to
wss://relay.primal.netin Shakespeare - You announce repository → published to
wss://relay.primal.net - You create patch → published to
wss://relay.primal.net - NostrHub is connected to
wss://relay.nostr.band - NostrHub queries
wss://relay.nostr.band→ finds nothing
Why This Happens:
- Nostr relays don't automatically sync with each other
- Each relay is independent
- Events are only on relays they were explicitly published to
- Relay hints in events are suggestions, not guarantees
Debugging Steps
Step 1: Check Which Relay You're On
In Shakespeare, check the current relay:
- Look at bottom of the page or settings
- Default is
wss://relay.primal.net
Step 2: Verify Repository Announcement
After clicking "Announce Repository", check console logs:
=== ANNOUNCING REPOSITORY ===
Repository ID: git.shakespeare.diy/portfoliux
Owner pubkey: 932614571afcbad4d17a191ee281e39eebbb41b93fac8fd87829622aeb112f4d
Event coordinate: 30617:932614571afcbad4d17a191ee281e39eebbb41b93fac8fd87829622aeb112f4d:git.shakespeare.diy/portfoliux
Published repository announcement to Nostr relays
To verify: Query for kind 30617 with authors=[...] and #d=[...]
Step 3: Verify Patch Can Find Repository
When creating a patch, check console logs:
Querying for repository announcement with filter: {...}
Repository announcement query returned 1 events ✅ GOOD
Found repository announcement event: {...}
Or:
Repository announcement query returned 0 events ❌ BAD
Repository announcement not found - patch may not be discoverable
Step 4: Check NostrHub's Relay
- Open NostrHub (nostrhub.io)
- Check which relay it's using
- Compare with Shakespeare's relay
Solutions
Solution 1: Use Same Relay as NostrHub
- In Shakespeare settings, change relay to match NostrHub
- Common NostrHub relays:
wss://relay.nostr.bandwss://relay.damus.io
- Re-announce repository on this relay
- Create new patch
Solution 2: Publish to Multiple Relays
When announcing repository, add multiple relays:
wss://relay.primal.netwss://relay.nostr.bandwss://relay.damus.io
The announcement event will be published to all of these, and patches will follow.
Solution 3: Use NIP-65 Relay Lists (Future Enhancement)
Proper solution would be to:
- Query user's NIP-65 relay list
- Publish repository announcements to all user's read/write relays
- Patches automatically go to same relays
Verifying Success
Check Repository is Discoverable:
- Open NostrHub
- Go to Repositories page
- Look for your repository
- If found → announcement is on correct relay ✅
Check Patches are Discoverable:
- Find your repository on NostrHub
- Click into repository
- Check Patches tab
- Your patches should appear ✅
Common Issues
Issue: "Repository announcement not found"
Cause: Announcement not on current relay
Fix: Re-announce on current relay
Issue: Patches published but not visible
Cause: Patches on different relay than announcement
Fix: Ensure both announcement and patches on same relay
Issue: Works in Shakespeare but not NostrHub
Cause: Different relays
Fix: Use same relay in both clients
Issue: Relay hints not working
Explanation: Relay hints are suggestions only - clients may ignore them
Fix: Ensure announcement is on relay the client uses
Event Format Reference
Repository Announcement (Kind 30617)
{
"kind": 30617,
"content": "",
"tags": [
["d", "git.shakespeare.diy/portfoliux"],
["name", "Portfoliux"],
["description", "Portfolio website"],
["clone", "nostr://npub.../git.shakespeare.diy/portfoliux"],
["relays", "wss://relay.nostr.band"],
["r", "abc123...", "euc"]
]
}
Patch Event (Kind 1617)
{
"kind": 1617,
"content": "From abc... Mon Sep 17...\n<git format-patch content>",
"tags": [
["a", "30617:932614571afcbad4d17a191ee281e39eebbb41b93fac8fd87829622aeb112f4d:git.shakespeare.diy/portfoliux"],
["p", "932614571afcbad4d17a191ee281e39eebbb41b93fac8fd87829622aeb112f4d"],
["t", "root"],
["t", "root-revision"],
["subject", "Fix bug in component"],
["r", "abc123..."],
["commit", "def456..."],
["parent-commit", "ghi789..."]
]
}
Testing Relay Synchronization
To test if events are on a relay:
-
Using nostr.band explorer:
- Go to https://nostr.band
- Search for your event ID or repository coordinate
- Check which relays have the event
-
Using console in Shakespeare:
// Check repository announcement await nostr.query([{ kinds: [30617], authors: ["your-pubkey"], "#d": ["your-repo-id"], limit: 1 }]); // Check patches await nostr.query([{ kinds: [1617], "#a": ["30617:your-pubkey:your-repo-id"], limit: 10 }]);
Recommended Workflow
-
First time setup:
- Switch to
wss://relay.nostr.band(widely used) - Announce repository
- Verify announcement succeeded
- Switch to
-
Creating patches:
- Ensure same relay as announcement
- Create patch
- Check console for successful repository lookup
- Verify patch appears in "Your Patches" section
-
Checking in NostrHub:
- Ensure NostrHub on same relay
- Browse to Repositories
- Find your repository
- View patches
Future Improvements Needed
- Multi-relay publishing: Publish to multiple relays automatically
- NIP-65 integration: Use user's relay list
- Relay fallback: Try multiple relays when querying
- Relay selection UI: Easy relay switching before operations
- Event verification: Confirm events were published successfully
- Cross-relay search: Query multiple relays for better discovery