Skip to content

refactor: restructure settings modules, rename Intelligent tab, group panel sections#725

Merged
tangcent merged 1 commit into
masterfrom
refactor/settings-restructure
Jul 5, 2026
Merged

refactor: restructure settings modules, rename Intelligent tab, group panel sections#725
tangcent merged 1 commit into
masterfrom
refactor/settings-restructure

Conversation

@tangcent

@tangcent tangcent commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves long-standing structural smells in the settings UI and consolidates duplicated TitledBorder boilerplate. Backwards-compatible: existing users migrate from ApplicationSettingsState/ProjectSettingsState on next startup (no unified-state release has shipped yet).

1. Field moves (eliminate cross-module leaks)

Two settings were stored in a different module from the panel that edited them, requiring bespoke cross-module shims:

  • enumFieldAutoInferEnabled: GeneralSettingsParsingOutputSettings. It's enum inference, lives in the Parsing & Output panel, but was stored in GeneralSettings via resetEnumFieldFrom / applyEnumFieldTo / isEnumFieldModified shims. Folded into the standard resetFrom/applyTo/isModified flow; shims deleted.
  • globalEnvironments: IntelligentSettingsEnvironmentSettings. Edited in the Environments tab but parked in IntelligentSettings because EnvironmentSettings was PROJECT-only. EnvironmentSettings is now mixed APP+PROJ scope (modeled on RuleFileSettings). The panel's resetGlobalEnvsFrom / applyGlobalEnvsTo / isGlobalEnvsModified shims are deleted; EnvironmentService now touches only EnvironmentSettings.

2. Migration

SettingsMigrationActivity: MIGRATION_VERSION 2 → 3. Both fields are written to their new module keys. Legacy ApplicationSettingsState/ProjectSettingsState retained as the migration source. Orphaned unified-state keys are harmless (never read).

3. Class & tab rename

  • IntelligentSettingsParsingOutputSettings (file renamed via git mv, history preserved). The old name described only one of six fields.
  • Tab label "Intelligent""Parsing & Output"; "Other""Backup".
  • Module FQN is the persistence key, but no release has shipped the unified-state code yet, so every user migrates from legacy state directly to the new key — no orphans.

4. Panel layout restructuring

  • New shared helper SettingsUiKit (titledPanel / labeledRow) consolidates the TitledBorder boilerplate that was inlined 3× in GrpcSettingsPanel, 1× in EnvironmentSettingsPanel, 2× in GeneralSettingsPanel.
  • GeneralSettingsPanel: flat list of 11 controls + 2 trailing titled boxes → 6 titled groups in concept order: Framework Support, Scanning, Editor, Output, Diagnostics, Cache Management. Log Level moved out of the Output cluster into its own Diagnostics group.
  • ParsingOutputSettingsPanel: 6 interleaved toggles → two titled groups (Inference, Output Format) matching the new tab name. Path Multi stays as a labeled row outside.
  • GrpcSettingsPanel / EnvironmentSettingsPanel / createRepositoryPanel: inlined TitledBorder blocks replaced with SettingsUiKit.titledPanel.
  • Removed private createTitledPanel and AiAssistantSection.compactRow in favor of SettingsUiKit.

Test plan

  • ./gradlew compileKotlin compileTestKotlin — clean
  • ./gradlew test --tests "com.itangcent.easyapi.settings.*" — pass
  • ./gradlew test --tests "*EnvironmentService*" — pass
  • ./gradlew test --tests "*Case2_SeeWithAutoMatch*" --tests "*Case1_IntelligentMode*" --tests "*Case2_IntelligentModeAutoMatch*" --tests "*ComprehensiveEnumCasesTest*" — pass (the cases that exercise enumFieldAutoInferEnabled = true)
  • Manual spot-check in runIde: confirm General tab shows 6 titled groups, Parsing & Output shows 2, Backup renamed, enum checkbox persists, global environments editor persists across restart.

Out of scope (deferred Tier 3)

  • Tooltip wording cleanup (several tooltips restate the label).
  • Moving outputDemo out of GeneralSettings into a Markdown-exporter module.
  • Dropping dead TAB_RULES / TAB_POSTMAN constants.
  • Grouping Feign/JAX-RS/Actuator under a "Frameworks" header (they're already in a titled group).
  • Note: EnumValueResolver's unrelated INTELLIGENT mode concept (Source.INTELLIGENT_SINGLE, etc.) intentionally not renamed — that's enum-resolution domain vocabulary from issue #1383, unrelated to the settings class.

@github-actions github-actions Bot added the type: enhancement New feature or request label Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

📦 Plugin has been packaged for this PR. You can download easy-api-3.1.5.252.0.zip from the GitHub Actions workflow run by clicking on the "Artifacts" dropdown.

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.85612% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.961%. Comparing base (58758ce) to head (77b5580).

Files with missing lines Patch % Lines
...om/itangcent/easyapi/settings/ui/SettingsPanels.kt 68.657% 20 Missing and 1 partial ⚠️
...ent/easyapi/settings/module/EnvironmentSettings.kt 25.000% 2 Missing and 1 partial ⚠️
...nt/easyapi/settings/ui/EnvironmentSettingsPanel.kt 70.000% 3 Missing ⚠️
...com/itangcent/easyapi/settings/ui/SettingsUiKit.kt 95.833% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##            master      #725       +/-   ##
=============================================
+ Coverage   63.937%   63.961%   +0.024%     
=============================================
  Files          362       363        +1     
  Lines        20750     20750               
  Branches      5108      5110        +2     
=============================================
+ Hits         13267     13272        +5     
- Misses        5609      5610        +1     
+ Partials      1874      1868        -6     
Flag Coverage Δ
unittests 63.961% <79.856%> (+0.024%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../com/itangcent/easyapi/exporter/EndpointBuilder.kt 82.692% <100.000%> (+2.885%) ⬆️
...syapi/exporter/springmvc/SpringMvcClassExporter.kt 81.092% <100.000%> (ø)
...lin/com/itangcent/easyapi/psi/EnumValueResolver.kt 62.632% <100.000%> (ø)
...tangcent/easyapi/psi/helper/DocMetadataResolver.kt 73.469% <100.000%> (ø)
...itangcent/easyapi/script/env/EnvironmentService.kt 82.759% <100.000%> (-0.758%) ⬇️
...pi/settings/migration/SettingsMigrationActivity.kt 88.889% <100.000%> (+0.139%) ⬆️
...angcent/easyapi/settings/module/GeneralSettings.kt 100.000% <ø> (ø)
...t/easyapi/settings/module/ParsingOutputSettings.kt 100.000% <100.000%> (ø)
...itangcent/easyapi/settings/ui/GrpcSettingsPanel.kt 36.864% <100.000%> (-2.812%) ⬇️
...com/itangcent/easyapi/settings/ui/SettingsUiKit.kt 95.833% <95.833%> (ø)
... and 3 more

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58758ce...77b5580. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… panel sections

Resolve long-standing structural smells in the settings UI and consolidate
duplicated TitledBorder boilerplate. Backwards-compatible: existing users
migrate from ApplicationSettingsState/ProjectSettingsState on next startup
(no unified-state release has shipped yet).

## Field moves (eliminate cross-module leaks)

* `enumFieldAutoInferEnabled`: GeneralSettings -> ParsingOutputSettings.
  It is enum inference, lived in the Intelligent panel, but was stored in
  GeneralSettings via bespoke resetEnumFieldFrom/applyEnumFieldTo/
  isEnumFieldModified shims. Folded into the standard
  resetFrom/applyTo/isModified flow; shims deleted.
* `globalEnvironments`: IntelligentSettings -> EnvironmentSettings.
  It is edited in the Environments tab but was parked in IntelligentSettings
  because EnvironmentSettings was PROJECT-only. EnvironmentSettings is now
  mixed APP+PROJ scope (modeled on RuleFileSettings).
  EnvironmentSettingsPanel's resetGlobalEnvsFrom/applyGlobalEnvsTo/
  isGlobalEnvsModified shims deleted; EnvironmentService.load/persist now
  touch only EnvironmentSettings.

## Migration

SettingsMigrationActivity: MIGRATION_VERSION 2 -> 3. Both fields are written
to their new module keys. Legacy ApplicationSettingsState/ProjectSettingsState
retained as the migration source. Orphaned unified-state keys are harmless
(never read).

## Class & tab rename

IntelligentSettings -> ParsingOutputSettings (file renamed via `git mv`,
history preserved). The old name described only one of six fields. Tab label
"Intelligent" -> "Parsing & Output"; "Other" -> "Backup". Module FQN is the
persistence key, but no release has shipped the unified-state code yet, so
every user migrates from legacy state directly to the new key.

## Panel layout restructuring

* New shared helper SettingsUiKit.titledPanel / labeledRow consolidates the
  TitledBorder boilerplate that was inlined 3x in GrpcSettingsPanel, 1x in
  EnvironmentSettingsPanel, 2x in GeneralSettingsPanel.
* GeneralSettingsPanel: flat list of 11 controls + 2 trailing titled boxes
  -> 6 titled groups in concept order: Framework Support, Scanning, Editor,
  Output, Diagnostics, Cache Management. Log Level moved out of the Output
  cluster into its own Diagnostics group.
* ParsingOutputSettingsPanel: 6 interleaved toggles -> two titled groups
  (Inference, Output Format) matching the new tab name. Path Multi stays
  as a labeled row outside.
* GrpcSettingsPanel / EnvironmentSettingsPanel / createRepositoryPanel:
  inlined TitledBorder blocks replaced with SettingsUiKit.titledPanel.
* Removed private createTitledPanel and AiAssistantSection.compactRow in
  favor of SettingsUiKit.

## Tests

Updated: EasyApiSettingsConfigurableTest (constants), SettingsDefaultsTest
(parity assertions moved + new EnvironmentSettings.globalEnvironments
parity), SettingsPanelsParityTest, SettingsPanelsCoverageTest,
EnvironmentSettingsPanelPlatformTest (rewired to single EnvironmentSettings),
EnhancedSettingsPanelsLogicTest, and the two PSI enum tests that flip
enumFieldAutoInferEnabled via settingBinder.update. Layout tests check
resetFrom/applyTo/isModified semantics, not component structure, so the
restructuring is transparent to them.

Verification: ./gradlew compileKotlin compileTestKotlin clean; all settings,
EnvironmentService, and enum-resolution tests pass.
@tangcent tangcent force-pushed the refactor/settings-restructure branch from 88d3ec3 to 77b5580 Compare July 4, 2026 23:25
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

📦 Plugin has been packaged for this PR. You can download easy-api-3.1.5.252.0.zip from the GitHub Actions workflow run by clicking on the "Artifacts" dropdown.

@tangcent tangcent merged commit 861af64 into master Jul 5, 2026
12 checks passed
@tangcent tangcent deleted the refactor/settings-restructure branch July 5, 2026 01:38
@github-actions github-actions Bot mentioned this pull request Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant