Skip to content

fix(vscode): sort the diagram panel's relationship kinds with an explicit code-unit comparator - #1335

Merged
HuiJun merged 1 commit into
developfrom
fix/sonar-webview-sort
Oct 21, 2026
Merged

HuiJun merged 1 commit into
developfrom
fix/sonar-webview-sort

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What and why

develop's SonarCloud quality gate fails new_reliability_rating = 4 (threshold 1) on one new-code bug: typescript:S2871 at editors/vscode/src/webview/diagram.ts:511 — the diagram panel's relationship-kind list was built with a bare [...kinds.keys()].sort(). Verified unauthenticated: api/issues/search?componentKeys=Open-MBEE_OpenSysML&branch=develop&resolved=false&sinceLeakPeriod=true&impactSoftwareQualities=RELIABILITY (and &types=BUG) returns exactly this one issue, so with it and the three security issues of #1329 fixed, no new-code condition is left red on develop.

Which order. The kinds are the renderer's ASCII identifiers shown as checkbox labels; what the list needs is a stable order that does not depend on the webview's locale, which is what the bare sort gave (code-unit order, every locale) and what layout.ts already names byCodeUnit for its own sort. The fix exports that comparator and passes it, rather than switching the list to localeCompare (locale-dependent, and not what the code relied on). The order of the list is unchanged for today's kinds.

In-flight overlap

#1330 (f26e19977) edits the same file at lines 98, 314 and 846; this branch touches lines 35 and 512. git merge --no-commit --no-ff refs/remotes/pr/1330 on this head: auto-merge clean, no conflicting files. No other open PR or PR-less branch touches layout.ts's byCodeUnit.

How SonarCloud will see this

The scan runs only on main/develop (CircleCI scan, filters: *integration-branches), so there is no Sonar analysis on this PR; develop's first branch-mode run after this and #1329 land is the proof that both new_reliability_rating and new_security_rating return to A.

How it was verified

  • byCodeUnit orders strings by code unit, unlike a locale-aware comparison added to src/webview/layout.test.ts: pins the code-unit order (Transition before binding) and that it differs from localeCompare.
  • editors/vscode: npm run typecheck (three tsconfigs) ok; npm test 373 pass / 0 fail; npm run build ok.
  • python3 scripts/changelog.py check ok.

Checklist

  • make test and make lint pass locally — the extension's own lint/typecheck/test/build; no Go change
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md) — no documented surface changes
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build) — none moved
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/2ce4197c3a6c4c13982380aaf8d6f857
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/2ce4197c3a6c4c13982380aaf8d6f857?variant=devin
Requested by: @HuiJun

…icit code-unit comparator

Sonar typescript:S2871 flags the bare Array.prototype.sort at
showRelations. The kinds are the renderer's ASCII identifiers and the
list's order should not depend on the webview's locale, so it uses the
byCodeUnit comparator layout.ts already keeps for the same reason.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 21, 2026 03:06
@HuiJun
HuiJun merged commit f53120a into develop Oct 21, 2026
42 checks passed
@HuiJun
HuiJun deleted the fix/sonar-webview-sort branch October 21, 2026 06:30
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