feat: publish and stream principal invalidations from the client - #14
Draft
pyropy wants to merge 1 commit into
Draft
feat: publish and stream principal invalidations from the client#14pyropy wants to merge 1 commit into
pyropy wants to merge 1 commit into
Conversation
Client.Invalidate self-signs a /principal/invalidate invocation the way Publish signs a revocation, so a Hilt deployment on Swarf's publisher list can record that a principal's cached proofs are void. Client.StreamEvents carries both event kinds; Stream stays as a deprecated filter that yields only revocations, and an event name the client does not know is skipped rather than treated as corrupt. The CLI prints the event kind before each record. Streaming also resumes correctly after a late record. A record committed inside the service's ten second settle window arrives behind newer ones, and the resume timestamp moved back to it, so the next connection re-delivered every record already sent from the newer timestamp. The resume timestamp now only moves forward and the delivered causes stay in the dedup set for as long as a reconnect could repeat them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
pyropy
added this pull request to stack #12
September 10, 2026 21:22
pyropy
force-pushed
the
srdjan/feat/iam-client-invalidate
branch
from
September 11, 2026 12:40
ebb92dc to
7dbede3
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Incremental pruning is needed to avoid quadratic work in pkg/client/client.go.
Pull request overview
Adds principal invalidation publishing and unified event streaming, with reconnect handling, CLI support, documentation, and tests.
Changes:
- Adds
Client.InvalidateandClient.StreamEvents. - Supports principal and delegation events with reconnect deduplication.
- Updates CLI output, documentation, and integration coverage.
File summaries
| File | Summary |
|---|---|
README.md |
Documents principal invalidations and event streaming. |
pkg/fx/app_test.go |
Tests invalidation authorization and uniqueness. |
pkg/client/client.go |
Implements publishing and unified streaming; pruning currently performs potentially quadratic work. |
pkg/client/client_test.go |
Tests invalidation, event handling, and reconnect behavior. |
itest/happy_path_test.go |
Adds end-to-end authorization and streaming coverage. |
cmd/swarf/stream.go |
Prints both firehose event kinds. |
cmd/swarf/stream_test.go |
Tests mixed event output. |
Review details
Suppressed comments (1)
pkg/client/client.go:266
- This scans every entry in
seenwhenever a newer timestamp arrives. With a busy firehose, the map contains roughly one settle window of events, so a burst of n records performs O(n²) pruning work and can make the client fall behind. Keep the timestamps in an ordered queue/min-heap (retaining the map for CID lookup), or otherwise prune incrementally.
horizon := resume.Add(-streamSettleWindow)
for link, at := range seen {
if at.Before(horizon) {
delete(seen, link)
}
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The client publishes and streams principal revocations.
Invalidatesubmits a self-signed/principal/invalidatethe wayPublishsubmits a revocation;StreamEventsyields both firehose kinds andStreamstays as a deprecated filter. The reconnect logic no longer moves its resume point backwards, and asks from one settle window back so late records are not lost. Part of the Forge S3 tenant IAM work (RFC).Change log
Client.Invalidate,Client.StreamEvents;StreamdeprecatedstreamConnhandlesprincipaland skips unknown event namesswarf streamprints<kind> <json>; README updated🤖 Generated with Claude Code