Skip to content

feat(integration-jfrog): add run --dry-run preview and cursor reset - #49

Merged
KunalSin9h merged 6 commits into
mainfrom
feat/jfrog-dry-run-reset-cursor
Aug 25, 2026
Merged

feat(integration-jfrog): add run --dry-run preview and cursor reset#49
KunalSin9h merged 6 commits into
mainfrom
feat/jfrog-dry-run-reset-cursor

Conversation

@KunalSin9h

@KunalSin9h KunalSin9h commented Aug 25, 2026

Copy link
Copy Markdown
Member

Two small additions to the JFrog XRay integration, on top of the merged feed migration (#47).

run --dry-run

Preview the feed without sending to JFrog. Prints each finding as Would push:.

The JFrog client is a port (xrayClient). jfrogClient is the real adapter; printClient is the dry-run one, it reuses the shared buildEvent so the preview is the exact event a real push would build, then prints. So a dry-run tests the whole pipeline as-is and differs only in the destination.

  • No JFrog credentials needed.
  • --backfill works the same as a real run (default 0).
  • It advances the same saved cursor, so run cursor remove before the first real run.

cursor set / cursor remove

Manage the saved feed cursor for the active profile:

  • cursor set <timestamp> sets the cursor to an RFC3339 time so the next run processes reports updated after it. A precise alternative to --backfill.
  • cursor remove clears the cursor so the next run starts fresh.

A cursor noun with set / remove verbs (noun/verb, no hyphens per the cobra lints). Both verbs are already in the allow-list.

Also

Dropped SAFEDEP_INTEGRATION_JFROG_BACKFILL. Backfill is a one-time first-run window, not a secret, so the flag is enough.

Tests

printClient never sends and needs no creds; cursorStore.remove clears and is a safe no-op; resolveConfig dry-run cases; command-tree conventions. go build, go test ./..., gofmt, and convention lints are green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y

@safedep

safedep Bot commented Aug 25, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep GitHub App

@KunalSin9h
KunalSin9h force-pushed the feat/jfrog-dry-run-reset-cursor branch 2 times, most recently from bcc71f8 to faee768 Compare August 25, 2026 10:41
Add two operator-facing commands on top of the ThreatIntel Feed migration.

run --dry-run previews the feed without sending to JFrog. The JFrog client
is now a port (xrayClient): jfrogClient is the real adapter, printClient is
the dry-run adapter that reuses buildEvent to show the exact event a real
push would build, then prints instead of sending. It needs no JFrog
credentials. Everything else runs as-is, the same feed and the same
persistent per-profile cursor, so a dry-run tests the whole pipeline and
differs only in the destination.

Because a dry-run advances the same saved cursor, run cursor reset before the
first real run so it re-processes what the preview consumed. This is
documented on both commands.

cursor reset clears the saved feed cursor for the active profile so the next
run starts fresh. Shaped as a cursor noun with a reset verb to satisfy the
cobra convention lints. Adds reset to the verb allow-list: reset returns a
resource to its initial state without destroying it, distinct from delete.

Drop SAFEDEP_INTEGRATION_JFROG_BACKFILL: backfill is a one-time first-run
window, not a secret, so the flag alone is enough. --backfill resolves
identically for real and dry runs (default 0, fresh from now).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
@KunalSin9h
KunalSin9h force-pushed the feat/jfrog-dry-run-reset-cursor branch from faee768 to 42f537c Compare August 25, 2026 10:56
Comment thread internal/cmd/integration/jfrog/printclient.go Outdated
claude added 4 commits August 25, 2026 11:11
Review feedback: printClient embedded jfrogClient only to reuse buildEvent
and issueID, which promoted the whole method set and carried an unused
http.Client. Make buildEvent and issueID package functions instead, drop
issueID from the xrayClient port (the service calls the package function),
and make printClient a standalone struct with no jfrogClient dependency.

No behaviour change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
Keep the dry-run preview to the "Would push" line and the JFrog issue id.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
Review feedback: there was no way to position the cursor, only clear it, and
"reset" was really a remove. Replace the single cursor reset verb with two:

- cursor set <timestamp>: set the cursor to an RFC3339 time so the next run
  processes reports updated after it. A precise alternative to --backfill.
- cursor remove: clear the cursor so the next run starts fresh.

Drop the reset entry from the verb allow-list; set and remove are already
allowed. Rename the store method reset to remove. Docs and README updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
The xrayClient port is the parent of both adapters, so it belongs with the
real client rather than in printclient.go. Each file keeps its own
compile-time assertion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
@KunalSin9h
KunalSin9h requested a review from arunanshub August 25, 2026 11:29
Comment thread docs/cmd/integration-jfrog-cursor-remove.md Outdated
Comment thread internal/cmd/integration/jfrog/types.go Outdated
- Drop the self-explanatory dryRun field comment in cmdConfig (its second
  sentence was stale after dry-run moved to the persistent cursor).
- Replace a semicolon sentence-join in the cursor remove doc with two
  sentences per ASD-STE100.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
@KunalSin9h
KunalSin9h merged commit 1742e30 into main Aug 25, 2026
6 checks passed
@arunanshub
arunanshub deleted the feat/jfrog-dry-run-reset-cursor branch August 25, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants