Add session export/import to jfr-shell - #40
Conversation
Combined JUnit Test Report
HTML Test ReportsRun artifacts: https://github.com/btraceio/jafar/actions/runs/33555098506
|
The first pass keyed recognition off the review-requested list, which meant it only worked for somebody else's PR. Verified against btraceio/jafar#40 -- your own PR, no reviewers requested -- and the row read "pr-40": no number, no branch, nothing to say what it merges into. gh pr list already returns every open PR, so carry number and head with the base (OpenPullRequest) instead of just the base, and resolve a pr-<n> worktree against that. The same call, one richer value. REQUESTED still means "somebody asked you for a review", so a PR of your own groups where any branch of yours groups; it just carries its real name now. Verified in the running app against jafar#40: "PR #40 jb/sessions · jafar · vs main", 12 files, 12 intents -- against gh's own changedFiles of 12. It read "pr-40 [base=main]" before this commit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Implements complete session state export/import functionality allowing users to save and share analysis sessions including variables, queries, and settings. - Add SessionSnapshot data model for serializable state - Add SessionExporter service with JSON export support - Add SessionImporter service with path remapping - Add export/import commands to CommandDispatcher - Add comprehensive help documentation - Add tab completion for new commands - Add integration tests for roundtrip export/import - Update all documentation (README, tutorial, usage guide) Export options: --include-results, --max-rows, --format json Import options: --alias, --remap-path Use cases: save progress, share with team, create templates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1db2e94 to
e167634
Compare
|
Rebased this PR onto current Rebase:
JDK 21 failure diagnosis: the CI matrix only runs Verification: Generated by Claude Code |
The shell-core module split (after this branch's base) made SessionManager and Session generic to support pprof/hprof backends and moved LazyQueryValue out of VariableStore. Update SessionExporter, CommandDispatcher, and the export/import test to compile against the current API, and apply spotless formatting that was missing from the original commit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWghAjvEb1zR5BLkxz3LWm
Summary
Implements complete session state export/import functionality for jfr-shell, enabling users to:
Changes
New Features
Session Export: Save complete session state to JSON file
--include-results)--max-rows)Session Import: Restore previously exported sessions
--remap-path)--alias)Implementation
SessionSnapshot.java- Immutable data model for session state (~200 lines)SessionExporter.java- Export service with JSON serialization (~400 lines)SessionImporter.java- Import service with JSON parsing (~500 lines)SessionExportImportTest.java- Integration tests (2 tests, all passing)Commands
Integration
help export,help import)Documentation
Test plan
Testing checklist
Tested scenarios:
--include-resultsoption--aliasoption--remap-pathfor different file locationExample usage
Future enhancements (Phase 2)
Notes
🤖 Generated with Claude Code