Skip to content

feat: add retain_attestations API and CLI purge command for removing stale pending attestations#65

Merged
lightsing merged 9 commits intodev/m2from
copilot/add-method-to-purge-pending-attestation
Mar 18, 2026
Merged

feat: add retain_attestations API and CLI purge command for removing stale pending attestations#65
lightsing merged 9 commits intodev/m2from
copilot/add-method-to-purge-pending-attestation

Conversation

Copy link

Copilot AI commented Mar 18, 2026

Adds a generic retain_attestations primitive for filtering attestation leaves in timestamp trees, a purge CLI command with interactive selection, and syncs across all SDKs.

Core (crates/core)

  • Timestamp::retain_attestations<F>(&mut self, f: F) — generic filter taking FnMut(&RawAttestation) -> bool, returns true to keep. Collapses single-branch FORKs after removal.
  • Timestamp::retain_attestations_mut<F>(&mut self, f: F) — same as above but provides &mut RawAttestation access, allowing in-place modification of attestations during filtering.
  • Timestamp::purge_pending() — convenience wrapper removing all pending attestations.
// Generic: remove any attestation type
ts.retain_attestations(|att| att.tag != PendingAttestation::TAG);

// Mutable variant: modify attestations during filtering
ts.retain_attestations_mut(|att| { /* can mutate att */ true });

// Convenience
ts.purge_pending();

Rust SDK (packages/sdk-rs)

  • Sdk::list_pending(), Sdk::purge_pending(), Sdk::purge_pending_by_uris(stamp, uris) — built on retain_attestations

CLI (crates/cli)

  • uts purge <FILES> — interactive numbered selection of which pending attestations to remove
  • Accepts comma-separated indices, all, or none; -y/--yes skips prompt
  • If purging would leave zero attestations, warns and does not touch the file

TypeScript SDK

  • retainAttestations(stamp, shouldRetain) — generic
  • purgePending(stamp, urlsToPurge?) — convenience with optional selective filter

Go SDK

  • RetainAttestations(stamp, shouldRetain) — generic
  • PurgePending(stamp) / PurgePendingByURIs(stamp, uris) — convenience

Python SDK

  • retain_attestations(stamp, should_retain) — generic
  • purge_pending(stamp, uris_to_purge=None) — convenience
  • New PurgeResult dataclass

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 5 commits March 18, 2026 00:51
Co-authored-by: lightsing <15951701+lightsing@users.noreply.github.com>
Co-authored-by: lightsing <15951701+lightsing@users.noreply.github.com>
…ll SDKs

Co-authored-by: lightsing <15951701+lightsing@users.noreply.github.com>
Co-authored-by: lightsing <15951701+lightsing@users.noreply.github.com>
Co-authored-by: lightsing <15951701+lightsing@users.noreply.github.com>
Copilot AI changed the title [WIP] Add method to SDK for purging stale pending attestation Add retain_attestations API and CLI purge command for removing stale pending attestations Mar 18, 2026
Copilot AI requested a review from lightsing March 18, 2026 01:16
…tions_mut variant

Co-authored-by: lightsing <15951701+lightsing@users.noreply.github.com>
Copilot AI requested a review from lightsing March 18, 2026 02:49
@lightsing lightsing marked this pull request as ready for review March 18, 2026 04:59
@lightsing lightsing changed the title Add retain_attestations API and CLI purge command for removing stale pending attestations feat: add retain_attestations API and CLI purge command for removing stale pending attestations Mar 18, 2026
@lightsing lightsing merged commit d9b76ae into dev/m2 Mar 18, 2026
3 of 4 checks passed
@lightsing lightsing deleted the copilot/add-method-to-purge-pending-attestation branch March 18, 2026 05:14
@lightsing lightsing added this to the L1 Anchoring milestone Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants