Skip to content

Fix/wrong target type after renaming in csolution yaml file#49

Open
arneschmid wants to merge 10 commits intomainfrom
fix/wrong-target-type-after-renaming-in-csolution-yaml-file
Open

Fix/wrong target type after renaming in csolution yaml file#49
arneschmid wants to merge 10 commits intomainfrom
fix/wrong-target-type-after-renaming-in-csolution-yaml-file

Conversation

@arneschmid
Copy link
Collaborator

@arneschmid arneschmid commented Mar 12, 2026

Fixes stale Target Types remaining in UI after renamed in csolution.yml
This forces a reload of the yml file in the UI if a change on the file was detected, loosing local edits. Parallel editing of file and UI is currently not suppoerted.

Fixes

Changes

  • Fixes Manage Solution state consistency after external file changes and target renames.
  • Adds external change detection for csolution/cmsis files
  • Reloads solution data when on-disk updates are detected, and ensures the active target type always maps to a valid target before sending UI context.
  • Updates load-state handling for activation transitions and adds focused unit tests and factory updates to cover the new behavior.

Screenshots

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

@github-actions
Copy link

github-actions bot commented Mar 12, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@qltysh
Copy link

qltysh bot commented Mar 12, 2026

Qlty

Coverage Impact

⬆️ Merging this pull request will increase total coverage on main by 0.07%.

Modified Files with Diff Coverage (4)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
src/generic/text-file.ts100.0%
Coverage rating: A Coverage rating: A
src/generic/text-file.factory.ts100.0%
Coverage rating: B Coverage rating: B
src/views/manage-solution/manage-solution-controller.ts92.9%199, 547
Coverage rating: C Coverage rating: C
src/views/manage-solution/manage-solution-webview-main.ts85.0%106, 116-117
Total92.8%
🤖 Increase coverage with AI coding...

In the `fix/wrong-target-type-after-renaming-in-csolution-yaml-file` branch, add test coverage for this new code:

- `src/views/manage-solution/manage-solution-controller.ts` -- Lines 199 and 547
- `src/views/manage-solution/manage-solution-webview-main.ts` -- Lines 106 and 116-117

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Manage Solution UI state becoming stale after external edits (e.g., renamed target-types in *.csolution.yml) by detecting on-disk changes, reloading solution state, and validating/correcting the active target type before publishing context to the webview.

Changes:

  • Detect external modifications of csolution/cmsis.json via file stamps and reload solution data when needed.
  • Ensure the active target type always resolves to a valid target after reloads/renames.
  • Update load-state handling and add/adjust unit tests and factories.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/views/manage-solution/manage-solution-webview-main.ts Reload/validate flow on solution load-state transitions; adds external-change-triggered reloads.
src/views/manage-solution/manage-solution-webview-main.test.ts Adds coverage for external-change reload ordering; adjusts async timing in existing load-state tests.
src/views/manage-solution/manage-solution-controller.ts Adds external-change detection and active target type correction logic; improves selection fallback.
src/solutions/solution-manager.factories.ts Updates factories for the new activated load-state field.
src/generic/text-file.ts Adds reusable external on-disk change detection to TextFile/ITextFile via mtime/size stamps.
src/generic/text-file.test.ts Adds tests for external change detection behavior.
src/generic/text-file.factory.ts Extends ITextFile test factory with new external-change methods.

You can also share your feedback on Copilot code review. Take the survey.

@arneschmid arneschmid marked this pull request as ready for review March 12, 2026 10:43
@arneschmid arneschmid marked this pull request as draft March 12, 2026 10:43
@arneschmid arneschmid marked this pull request as ready for review March 16, 2026 08:21
@arneschmid arneschmid requested a review from edriouk March 16, 2026 08:25
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.

2 participants