diff options
Diffstat (limited to 'AGENTS.md')
| -rw-r--r-- | AGENTS.md | 40 |
1 files changed, 40 insertions, 0 deletions
| @@ -158,6 +158,46 @@ EventBuilder::new(kind, content).tags(tags) | |||
| 158 | 158 | ||
| 159 | See `docs/archive/2025-11-04-nostr-sdk-upgrade.md` for full migration. | 159 | See `docs/archive/2025-11-04-nostr-sdk-upgrade.md` for full migration. |
| 160 | 160 | ||
| 161 | ### Audit Event Tagging (grasp-audit) | ||
| 162 | |||
| 163 | **All audit events automatically include cleanup tags:** | ||
| 164 | |||
| 165 | The grasp-audit system automatically adds three tags to every event for production cleanup and test isolation. These tags are added transparently via [`AuditEventBuilder::build()`](grasp-audit/src/audit.rs:120-129) with 100% coverage through [`AuditClient::event_builder()`](grasp-audit/src/client.rs:107-138). | ||
| 166 | |||
| 167 | **Automatic Tags (no manual intervention needed):** | ||
| 168 | |||
| 169 | ```rust | ||
| 170 | // These tags are automatically added to EVERY audit event: | ||
| 171 | ["t", "grasp-audit-test-event"] // Identifies all audit test events | ||
| 172 | ["t", "audit-{run_id}"] // Unique ID for this audit run (correlates events) | ||
| 173 | ["t", "audit-cleanup-after-{unix_timestamp}"] // Unix timestamp for cleanup scheduling | ||
| 174 | ``` | ||
| 175 | |||
| 176 | **Tag Format Details:** | ||
| 177 | |||
| 178 | - Uses standard NIP-01 `"t"` (hashtag) tags for maximum compatibility | ||
| 179 | - Unix timestamps (not ISO 8601) for easier database queries | ||
| 180 | - All tags added automatically when calling `client.event_builder().build()` | ||
| 181 | - No manual tag management required | ||
| 182 | |||
| 183 | **Verifying Tags in Tests:** | ||
| 184 | |||
| 185 | ```rust | ||
| 186 | // Test that verifies automatic tag addition: | ||
| 187 | // See: grasp-audit/src/client.rs:273-302 | ||
| 188 | #[test] | ||
| 189 | fn test_audit_tags_automatically_added() { | ||
| 190 | // Creates event and verifies all three tags are present | ||
| 191 | } | ||
| 192 | ``` | ||
| 193 | |||
| 194 | **Testing Implications:** | ||
| 195 | |||
| 196 | - All audit events are tagged for easy cleanup | ||
| 197 | - Use `run_id` tag to correlate events from same audit run | ||
| 198 | - Tags enable production relay cleanup scripts | ||
| 199 | - No special handling needed in test code - tags are automatic | ||
| 200 | |||
| 161 | ## Documentation | 201 | ## Documentation |
| 162 | 202 | ||
| 163 | **Diátaxis Framework Used:** | 203 | **Diátaxis Framework Used:** |