Skip to content

feat(frontend): Refine Gap Analysis link strength categorization (Weak threshold 20 -> 7)#717

Merged
northdpole merged 4 commits intoOWASP:mainfrom
PRAteek-singHWY:optimize-gap-analysis-pruning
Feb 14, 2026
Merged

feat(frontend): Refine Gap Analysis link strength categorization (Weak threshold 20 -> 7)#717
northdpole merged 4 commits intoOWASP:mainfrom
PRAteek-singHWY:optimize-gap-analysis-pruning

Conversation

@PRAteek-singHWY
Copy link
Contributor

@PRAteek-singHWY PRAteek-singHWY commented Jan 15, 2026

Note

Stacked PR: This PR is built on top of PR #716 (Backend Optimization). Please merge #716 first.

Summary

This PR adjusts the categorization logic for Gap Analysis links in the frontend. It lowers the score threshold for "Weak" links from 20 to 7 to better reflect the true quality of connections, as requested by the maintainers.

Motivation

The maintainer noted:

"By the way, I notice we don't seem to have weak links anymore: should we change our categorization and make 3-6 average and 7+ weak?"

Previously, a "Weak" link was defined as having a penalty score of 20 or higher. This score is practically unreachable in normal operation (requires ~10 hops of "related" links), causing truly weak connections to be mislabeled as "Average" or "Strong". This change aligns the UI with the maintainer's request and the user's intuitive understanding of link strength.

Changes

  • application/frontend/src/pages/GapAnalysis/GapAnalysis.tsx:
    • Updated GetStrength function: Changed condition for 'Weak' from >= 20 to >= 7.
    • Updated GetStrengthColor function: Changed condition for Red color from >= 20 to >= 7.
    • Updated the UI Popup Legend to explicitly state that "Weak" links start at score 7.

Related Issue

Verification

  1. Navigate to the map analysis page.
  2. Hover over the strength indicator (Popup).
  3. Verify the legend states: "Weakly connected likely to have small or no overlap" corresponds to score 7.
  4. Verify that paths with a score of 7+ appear as Red/Weak.

Checklist

@PRAteek-singHWY
Copy link
Contributor Author

Hi @northdpole

Verification Report
I have verified the frontend logic changes in GapAnalysis.tsx.

  • Logic Check: Confirmed that GetStrength and colors now treat scores 7+ as Weak (Red), previously 20.
  • Requirement Met: This matches the maintainer's request to make "3-6 average and 7+ weak".
  • UI Update: The Legend has been updated to reflect the new threshold.

Always open to iterating further based on your guidance. I'm really learning a lot from this process—thanks for the review and the honest responses!

@northdpole
Copy link
Collaborator

please resolve the conflicts and lets merge this

@PRAteek-singHWY PRAteek-singHWY force-pushed the optimize-gap-analysis-pruning branch from fc5bc3d to 3728d35 Compare January 25, 2026 01:15
@northdpole northdpole merged commit ba4b27d into OWASP:main Feb 14, 2026
2 checks passed
PRAteek-singHWY added a commit to PRAteek-singHWY/OpenCRE that referenced this pull request Feb 19, 2026
The toggle added in PR OWASP#717 was being overridden by a duplicate
gap_analysis method left over from PR OWASP#716. Removed the duplicate
so the feature toggle actually works as intended.

Also adds scripts/benchmark_gap.py which proved the optimized mode
is 99.5% faster and uses 99.6% less memory than the original.

Closes OWASP#587
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.

Prune map analysis search to save time and memory

2 participants

Comments