Skip to content

feat: Persist HTTP send history with global/per-request sidebars, replay, and request duplication#13

Merged
markkr125 merged 7 commits into
mainfrom
request-history
Jun 2, 2026
Merged

feat: Persist HTTP send history with global/per-request sidebars, replay, and request duplication#13
markkr125 merged 7 commits into
mainfrom
request-history

Conversation

@markkr125
Copy link
Copy Markdown
Owner

@markkr125 markkr125 commented Jun 2, 2026

Summary

This branch replaces the removed bottom History panel with a full send history system modeled after Postman: every HTTP send can be recorded, browsed, reopened, and replayed from the sidebars.

Persistence and settings

  • RequestHistoryService records sends at the end of the normal send pipeline (skipped during debug replay via _suppress_history_record).
  • Metadata lives in SQLite (RequestHistoryEntryModel); response bodies and request snapshots are stored on disk under user_history_root() via body_store.py.
  • HistorySettingsManager (history/* QSettings) controls retention, body storage, and related options; Settings → History adds a dedicated configuration page.
  • Startup reconciles legacy paths; init_db migrates the schema for history entries.

UI — history panels

  • HistoryPanel (src/ui/sidebar/history/) supports two modes:
    • Global (left rail, globalHistoryPanel): all sends, search, calendar date filter, Open navigates into the correct request/draft tab via _HistoryNavigationMixin.
    • Per-request (right rail, requestHistoryPanel): sends for the active request, Replay re-runs HTTP from the stored snapshot without loading the editor first.
  • Detail flyout shows read-only Headers, Request Headers, and Request Body tabs; async text formatting via text_format_async.
  • Custom delegate with status badges and date group headers; date-filter popup shared pattern with saved responses search.

Send pipeline and replay

  • Send identity is gathered at send start; record_send runs in on_send_finished.
  • Replay rebuilds worker payload from snapshot (build_send_payload_from_entry / entry_for_replay).
  • ResponseReplayIndicator on the response viewer labels replayed sends; draft session restore can replay history into the viewer only (send_pipeline_history_replay).

Request duplication

  • CollectionService.duplicate_request clones a request with saved responses and assertions; tree context menu wired through CollectionWidget.

Sidebar and polish

  • Removed obsolete src/ui/panels/history_panel.py and its tests.
  • Right sidebar flyout: expand_flyout on _show_panel, clearer sidebarPanelArea border behavior (no double line with the icon rail), QSS updates; drag-to-collapse clears the history rail highlight (tested).
  • Left sidebar gains a third rail page for workspace history.

Tests and docs

  • Repository/service tests for body store, repository CRUD, replay payloads, snapshot headers, environment integration.
  • UI tests for global/per-request history panels, open navigation, right-sidebar wiring, replay indicator, settings history page, collection tree duplicate action.
  • API docs (request-history-service.md), sidebar reference, signal-flow / service-repository skills, and nested AGENTS.md files updated.

Scope: 4 commits, ~116 files, +8.3k / −685 lines vs main.

Test plan

  • Send requests from saved tabs and drafts; confirm entries appear in right History and left global History.
  • Use search and date filters on both panels; verify list limits and grouping headers.
  • Select an entry: detail tabs show headers/body; delete an entry and confirm files are removed.
  • Replay from per-request history; confirm response loads and replay banner appears; replay should not create a duplicate history row when suppressed.
  • Open from global history for persisted request, deleted request (deleted), and draft (draft); confirm correct tab/editor behavior and status messages on failure.
  • Settings → History: change retention/storage options; send again and verify pruning behavior.
  • Duplicate a request from the collection tree; confirm name suffixing and copied saved responses/assertions.
  • Right sidebar: drag flyout closed; history icon highlight clears.
  • Restart app with saved session including draft/history replay paths.
  • poetry run pytest, poetry run ruff check src/ tests/, poetry run ruff format --check src/ tests/, poetry run mypy src/ tests/ — all green.

markkr125 added 7 commits May 31, 2026 14:24
- Deleted the HistoryPanel class and its associated tests, as well as all references to it in the UI and documentation.
- Updated the ConsolePanel to serve as the sole bottom panel, simplifying the UI structure.
- Adjusted documentation and code comments to reflect the removal of the history functionality.
- Introduced `RequestHistoryService` for persisting HTTP send history, including methods for recording sends, retrieving entries, and managing retention settings.
- Added `RequestHistoryEntryModel` to the database schema for storing metadata related to each request, including response bodies and snapshots.
- Implemented file-backed storage for request bodies and snapshots in `body_store.py`, ensuring efficient management of historical data.
- Updated documentation to reflect new request history features and their integration into the UI, including the HistoryPanel for displaying recorded sends.
- Enhanced the database initialization process to handle legacy paths and files, ensuring a smooth transition for existing users.
- Introduced `duplicate_request` method to clone requests along with their saved responses and assertions, ensuring unique naming for duplicates.
- Updated `RequestHistoryService` to include new methods for managing request history, including enhanced metadata handling and date filtering.
- Enhanced UI components to support the new duplication feature and improved history navigation, including global and per-request history panels.
- Updated documentation to reflect changes in request management and history features, ensuring clarity on new functionalities.
- Refactored related services and models to accommodate the new request duplication logic and maintain consistency across the application.
- Enhanced the `sidebarPanelArea` documentation to clarify the layout and border behavior, specifically regarding the left and right edges.
- Modified the `_show_panel` method in `RightSidebar` to include an `expand_flyout` parameter, allowing for more control over flyout expansion.
- Adjusted the handling of flyout panel visibility during drag events to ensure consistent state management.
- Updated global QSS styles to reflect the new border handling for the sidebar panel area, ensuring proper visual alignment with the icon rail.
- Added a test to verify that collapsing the flyout via dragging clears the history rail highlight correctly.
- Updated error reporting in the `_run_restricted_subprocess` function to include detailed information from the subprocess's stderr and exit code.
- Introduced a new `_parse_ipc_line` function to handle parsing of IPC lines, specifically for identifying terminal `__done__` rows.
- Modified the `_ipc_loop` function to improve handling of subprocess output and ensure proper termination conditions.
- Added a `closeEvent` method in the `HistoryPanel` class to cancel in-flight operations during widget teardown.
- Enhanced the `FormatTextRunnable` class to check the validity of signals before emitting results, preventing potential errors.
- Replaced the `Runnable` pattern with dedicated worker classes for loading orphan history and detail entries, improving thread management and signal handling.
- Introduced shutdown methods in `OrphanHistoryOpenLoader` and `HistoryDetailLoader` to ensure proper cleanup of worker threads during widget teardown.
- Updated `HistoryPanel` and `MainWindow` to call shutdown methods, preventing potential memory leaks and ensuring smooth application closure.
- Added a new utility function for safely delivering results from worker threads to the GUI thread.
…uplication

- Updated README and documentation to reflect new features including request duplication and comprehensive HTTP send history tracking.
- Improved UI components to support the new history and duplication functionalities, ensuring better navigation and user experience.
- Added details about the left and right sidebar functionalities, including the integration of history panels for both global and per-request sends.
- Clarified settings related to history retention and response body storage in the documentation, enhancing user understanding of the new features.
@markkr125 markkr125 merged commit ba2d4e0 into main Jun 2, 2026
4 checks passed
@markkr125 markkr125 deleted the request-history branch June 2, 2026 17:45
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.

1 participant