feat(tags): Add support to bulk unassign tags - #75
Merged
Conversation
Rutvik G (rutvik-gs)
marked this pull request as ready for review
July 30, 2026 12:24
Rutvik G (rutvik-gs)
changed the base branch from
feat/tags-11-bulk-assign
to
feat/tags
July 30, 2026 12:28
Rutvik G (rutvik-gs)
force-pushed
the
feat/tags-12-bulk-unassign
branch
from
July 30, 2026 12:34
511a854 to
ed7a081
Compare
Ben Schwartz (btschwartz12)
approved these changes
Jul 30, 2026
Ben Schwartz (btschwartz12)
left a comment
Contributor
There was a problem hiding this comment.
LGTM!
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.
Problem
tags assign --querygave us bulk tagging, but there was no way to bulk untag. So this PR adds that. Similarly, there was also no way to stop a bulk job once submitted. A mistyped CenQL query on a broad corpus had to run to completion, and operations could only watch it happen. Hence cancel operation support was also added.Technical Changes
tags unassigngains a bulk mode —--allremoves every assignment,--created-before/--created-afterremove a window. Either submits abulk_deletejob and reports the tracking operation, with--wait/--timeoutreusing the shared poll loop. Bulk is entered only by those flags, never inferred from missing asset arguments, and cannot be combined with explicit assets or--input-file.--allcan't be narrowed by a time filter — that combination contradicts itself and is rejected.tags operations cancel <tag> <op-id>— new subcommand, confirms unless--yes. Deliberately does not treat a cancelled status as a failure the way--waitdoes: a successful cancel exits 0. Cancelling is not a rollback, and the prompt says so.internal/pkg/clients/censys/tags.go—BulkDeleteTagAssignments(absent timestamps send an empty body, which is the API's "delete ALL") andCancelTagOperation.followSubmittedOperationused by both bulkassignand bulkunassign, so the interrupt-vs-track-hint branch can't drift.ValidateTimeWindowis exported so unassign rejects an inverted window in PreRun and the service keeps its guard — the same double-validation assign uses for a blank--query, which is what lets it fail before credentials are needed.How to Test
Fast path:
Live walkthrough — self-cleaning, one uniquely named tag: