Skip to content

Migrate AI service to API, add scan persistence, improve Settings UI - #139

Merged
spoofzu merged 2 commits into
masterfrom
feature/api-migration-ui-improvements
Mar 14, 2026
Merged

spoofzu merged 2 commits into
masterfrom
feature/api-migration-ui-improvements

Conversation

@spoofzu

@spoofzu spoofzu commented Mar 14, 2026

Copy link
Copy Markdown
Owner

Summary

Migrate AI and crypto code to the DeepViolet API module, integrate API-level scan persistence with multi-mode encryption, and improve Settings dialog layout consistency across all tabs.

Improvements

AI Service Migration

  • AiAnalysisService gutted to thin wrapper — retains only parseAiResponse() (depends on DVT-specific ScanNode)
  • All HTTP client code, Provider enum, ChatMessage, AiAnalysisException, default constants moved to com.mps.deepviolet.api.ai
  • UIBackgroundScanTask rewritten to use AiConfig builder and IAiAnalysisService
  • FontPreferences crypto methods now delegate to API CryptoUtils
  • FontChooserDialog AI test button and model fetching use API types (AiProvider, AiConfig, IAiAnalysisService)
  • MainFrm chat feature uses AiChatMessage and AiConfig.builder()

Scan Persistence Integration

  • ScanResult.toSnapshot()/fromSnapshot() bridge DVT model to API ScanSnapshot/HostSnapshot
  • Save dialog — three-mode radio panel: Unencrypted JSON, Host locked (default), Password locked with password field
  • Load dialog — PasswordCallback lambda shows Swing password dialog for cross-machine files
  • ReportExporter delegates save/load to ScanFileIO
  • CLI — new --password-env and --password-file options for .dvscan transfer passwords

Save Warning Dialog

  • Saving as "Unencrypted JSON" shows warning: "Unencrypted scan data is provided for research purposes but may contain sensitive information" with OK/Cancel
  • New General group on Settings | Application tab with "Suppress Save Scan Warning" checkbox
  • general.suppressSaveWarning property persisted to deepviolet.properties

Settings UI Left-Justification

Spacer panels added to 13 sections across all tabs — controls stay at natural width, left-aligned:

  • Host Detail: Colors, Risk Graph, Risk Priority, Output
  • Cards: Colors
  • Engine: Report Sections, Cipher Suite Naming (combo cut to fixed width), Protocol Versions, Scanning Priority
  • AI: Provider/API Key (fixed-width combos and text fields), Terminal Colors
  • Application: General, Font (combo cut to fixed width), Colors

Removals

  • ScanResult.SourceProvenance inner class removed — replaced with simple String scanId (SHA-256 hex digest)
  • ReportExporter inner classes (LoadedRiskScore, LoadedCategoryScore, LoadedDeduction, LoadedCipherSuite) removed — logic moved to API persist layer
  • ReportExporter JSON parsing utilities (parseScanJsonMap, parseCategoryScores, parseDeductions) replaced by ScanFileIO
  • 10 AiAnalysisService tests moved to DV API test suite
  • DeltaScanResult, DeltaScanner, StartCMD, MainFrm updated for scanId replacing SourceProvenance

Build

  • pom.xml — DeepViolet API version changed to 5.1.18-SNAPSHOT (update to JitPack commit hash before release)

Test Plan

  • Run mvn compile — clean build
  • Run mvn test — all tests pass
  • Verify Settings | Application tab shows General group with suppress checkbox
  • Verify save dialog shows "Unencrypted JSON" label and warning on save
  • Verify all Settings panels are left-justified across Host Detail, Cards, Engine, AI, Application tabs
  • Verify AI chat and report configuration dialogs work with API types
  • Verify .dvscan save/load in all three modes (plain, host locked, password locked)

🤖 Generated with Claude Code

Milton Smith and others added 2 commits March 14, 2026 16:32
Migrate AI and crypto code to the DeepViolet API module, integrate
API-level scan persistence, and improve Settings dialog layout
consistency across all tabs.

AI Service Migration:
- AiAnalysisService gutted to thin wrapper retaining only parseAiResponse
- All HTTP client code, Provider enum, ChatMessage, AiAnalysisException,
  default constants moved to com.mps.deepviolet.api.ai
- UIBackgroundScanTask, ScanTask, FontPreferences, FontChooserDialog,
  MainFrm updated to use API types (AiConfig builder, IAiAnalysisService,
  AiProvider, AiChatMessage)
- FontPreferences crypto methods now delegate to API CryptoUtils

Scan Persistence Integration:
- ScanResult.toSnapshot()/fromSnapshot() bridge DVT model to API model
- MainFrm save dialog: three-mode radio panel (Unencrypted JSON, Host
  locked, Password locked) with password field
- MainFrm load: PasswordCallback lambda shows Swing password dialog
- ReportExporter delegates save/load to ScanFileIO
- CLI: new --password-env and --password-file options for .dvscan files

SourceProvenance Removal:
- ScanResult.SourceProvenance inner class removed entirely
- Replaced with simple String scanId (SHA-256 hex digest)
- DeltaScanResult, DeltaScanner, StartCMD, MainFrm updated accordingly

Save Warning Dialog:
- Unencrypted JSON save shows warning with OK/Cancel
- New "General" group on Settings | Application tab with
  "Suppress Save Scan Warning" checkbox
- general.suppressSaveWarning property persisted to preferences

Settings UI Left-Justification:
- Spacer panels added to 13 sections across all tabs to prevent controls
  from stretching full-width
- Host Detail: Colors, Risk Graph, Risk Priority, Output
- Cards: Colors
- Engine: Report Sections, Cipher Suite Naming (combo cut to fixed
  width), Protocol Versions, Scanning Priority
- AI: Provider/API Key fields (fixed-width), Terminal Colors
- Application: General, Font (combo cut to fixed width), Colors

Removals:
- ReportExporter inner classes (LoadedRiskScore, LoadedCategoryScore,
  LoadedDeduction, LoadedCipherSuite) moved to API persist layer
- ReportExporter JSON parsing utilities replaced by ScanFileIO
- 10 AiAnalysisService tests moved to API test suite

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update deepviolet.version from local SNAPSHOT to the JitPack commit
hash from the feature/ai-analysis-scan-persistence branch so CI can
resolve the dependency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@spoofzu
spoofzu merged commit 40d9555 into master Mar 14, 2026
4 checks passed
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