fix(web): unify operation history tracking for monorepo plugin operations (#240)

The operation history UI was reading from the wrong data source
(operation_queue instead of operation_history), install/update records
lacked version details, toggle operations used a type name that didn't
match UI filters, and the Clear History button was non-functional.

- Switch GET /plugins/operation/history to read from OperationHistory
  audit log with return type hint and targeted exception handling
- Add DELETE /plugins/operation/history endpoint; wire up Clear button
- Add _get_plugin_version helper with specific exception handling
  (FileNotFoundError, PermissionError, json.JSONDecodeError) and
  structured logging with plugin_id/path context
- Record plugin version, branch, and commit details on install/update
- Record install failures in the direct (non-queue) code path
- Replace "toggle" operation type with "enable"/"disable"
- Add normalizeStatus() in JS to map completed→success, error→failed
  so status filter works regardless of server-side convention
- Truncate commit SHAs to 7 chars in details display
- Fix HTML filter options, operation type colors, duplicate JS init

Co-authored-by: Chuck <chuck@example.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-02-12 12:11:12 -05:00
committed by GitHub
parent 9d3bc55c18
commit 9a72adbde1
3 changed files with 156 additions and 69 deletions

View File

@@ -167,6 +167,13 @@ class OperationHistory:
return history[:limit]
def clear_history(self) -> None:
"""Clear all operation history records."""
with self._lock:
self._history.clear()
self._save_history()
self.logger.info("Operation history cleared")
def _save_history(self) -> None:
"""Save history to file."""
if not self.history_file: