Repository navigation
Conversation
getRankedResponses picked the top 4 scores from a guessed section (frontend/backend/general) rather than the skills that actually matched the requested `skills` filter. A user's genuinely matched skill (e.g. EnvironmentSetup) could be silently dropped from topSkills if it wasn't among their top 4 highest-scoring skills in that section, and replaced by an unrelated higher-scoring skill from the same section (e.g. MongoDB). topSkills is now built from the matched filter skills first (ranked by their own score), then filled up to 4 with the user's other highest-scoring skills. Unfiltered browsing is unchanged. Adds a regression test reproducing the bug; confirmed it fails on the old logic and passes with the fix.
AaditTrivedi
left a comment
There was a problem hiding this comment.
Reviewed by Aadit Trivedi.
Checked out the PR, installed with npm ci, and ran npx jest src/controllers/hgnFormResponseController.test.js: 9/9 passing.
Verified
- Scope matches the title:
hgnFormResponseController.jsand its test file. - The Top Skills logic now puts the skills that matched the active filter first, sorted by score, then fills the remaining slots with the user's other highest-scoring skills. Previously it took the top skills from the section of the first match only, so a user could appear in filtered results without the matching skill in their displayed Top Skills. The new behavior fixes that, and the inline comment explains the intent clearly.
- The new test covers the filtered case.
Pointer, not blocking
- This changes the result from "top skills within one section" to "matched skills first, then any section," which seems to be the intent; worth confirming the frontend in #5440 expects mixed sections.
Approving.
vidiyala99
left a comment
There was a problem hiding this comment.
Reviewed 66318a9 against the real form data on the shared dev database (read-only). Showing the matched skills in "Top Skills" is a good idea, but it also changes who passes the skills filter, because the filter is applied to topSkills right afterwards:
filteredUsers = filteredUsers.filter((user) =>
user.topSkills.some((skill) => skillList.includes(skill.toLowerCase())),
);With this PR, the matched skills always go to the front of topSkills, so anyone who has a score for the selected skill passes, however low that score is. Every form response stores a number for every skill, so the filter stops narrowing anything.
I fetched the 182 dev form responses (GET /api/hgnform) and ran both versions of the topSkills logic on them. The old logic gives exactly the same counts as the live GET /api/hgnform/ranked?skills=... on a backend without this PR, so the comparison is like for like:
skills= |
without this PR (live endpoint) | with this PR | of those, score 0 to 2 |
|---|---|---|---|
| EnvironmentSetup | 29 | 178 | 25 |
| AdvancedCoding | 31 | 178 | 25 |
| Database | 129 | 178 | 24 |
| MongoDB | 131 | 178 | 26 |
| React | 110 | 175 | 22 |
So "Find Community Members" with any skill selected would list nearly everyone who filled in the form, including people who rated themselves 0 to 2 on that skill. hgnFormResponseController.test.js passes (9/9), including the new test, because that test only checks the topSkills content for a single user.
Keeping the two concerns separate would fix it. For example, decide whether a user matches using the old rule (or a minimum score on the matched skill), and only then build the displayed topSkills with the matched skills first. A test with a user who has the selected skill at a low score (who should not appear) would cover it.
Requesting changes.
sai-velagala-swe
left a comment
There was a problem hiding this comment.
Reviewed by Sai Manojna Velagala
How I verified
Checked out Akshay_fix_skills_overview_top_skills_filter_mismatch and tested it locally with frontend PR #5440. I tested multiple active skill filters, preference filtering, returned member cards, Top Skills output, low-score matches, and dark mode. I also ran npx jest src/controllers/hgnFormResponseController.test.js.
Verified working
- Backend tests pass.
npx jest src/controllers/hgnFormResponseController.test.js passed all 9/9 tests.
-
Matched skills appear in Top Skills.
Returned member cards include filter-relevant skills inside their Top Skills list. -
Filtering UI continues to return member results.
Skill filters and preference filters continue to return member cards, and the UI remains usable. -
Dark mode works with filtered results.
Filter controls and returned member cards remain readable in dark mode.
Issues found
- Very low-score users are returned by skill filtering.
While skill filters were active, I observed returned member cards with scores as low as 1/10. This supports the concern that the new filtering logic may treat users with very low proficiency as valid matches simply because the selected skill exists in their survey response.
-
Some member cards have no displayed name.
Multiple returned cards show an avatar, score, and Top Skills, but no member name. -
The same missing-name/low-score behavior is still visible with additional filtering.
This was also observed while preference filtering was active.
- Required action
Please review the skill matching logic so that users with very low scores are not treated as meaningful skill matches, and confirm how records with missing member names should be handled.
- Decide who passes the skills filter with the original rule (a selected skill in the user's top 4 for that section). The previous commit filtered on the display list, which now always starts with the selected skills, so anyone with a 0-2/10 score passed. Top Skills still shows the selected skills first; it no longer decides who matches. - Some form responses were saved with an empty userInfo.name. Use the linked profile's first and last name so member cards are not blank. - Tests: a low-score user is excluded, the internal flag stays out of the response, and the name falls back to the profile.
|
@vidiyala99 @sai-velagala-swe @AaditTrivedi Thanks for the reviews, especially the comparison against the real form data. The latest push ( 1. Low-score users passing the skills filter
I checked this read-only against the shared dev database (184 responses today, so the counts are slightly higher than the 182 in the earlier table). For 2. Member cards with no name Tests
I also merged the latest |
|
vidiyala99
left a comment
There was a problem hiding this comment.
Re-tested the new head 3622734 on a test server against the shared dev data (read-only), with the same comparison as my last review: an in-browser copy of the development rule run over all form responses (GET /api/hgnform, 184 today), next to the live GET /api/hgnform/ranked?skills=... from this branch.
skills= |
development rule |
this branch (live) | selected skill listed first |
|---|---|---|---|
| MongoDB | 133 | 133 | 133 / 133 |
| EnvironmentSetup | 30 | 30 | 30 / 30 |
| AdvancedCoding | 31 | 31 | 31 / 31 |
| Database | 130 | 130 | 130 / 130 |
| React | 110 | 110 | 110 / 110 |
So the filter is strict again (it matches development exactly), and "Top Skills" still leads with the selected skill on every returned card, which was the goal of the PR.
- Blank names: with no filter, all 184 cards have a name (0 blank), matching your note about the 11 responses saved with an empty
userInfo.name. - Tests:
hgnFormResponseController.test.jsandcommunityController.test.jspass on the box (2 suites, 12/12).
Approving. Thanks for separating the two concerns.
Niket07pathak
left a comment
There was a problem hiding this comment.
Reviewed by Niket Pathak
How I verified
Reviewed the backend changes in hgnFormResponseController.js and hgnFormResponseController.test.js alongside the related frontend PR #5440. Both frontend and backend applications were set up and running locally. Examined the skill-filtering logic, Top Skills ordering, member eligibility conditions, name fallback, and regression test coverage.
Verified working
- The updated logic preserves the existing skill-filter eligibility criteria, requiring selected skills to qualify within the top four skills of the relevant section.
- Selected skills are prioritized by score in the Top Skills display, followed by other highest-scoring skills, with a maximum of four skills per card.
- Low-scoring users who do not meet the filtering criteria are excluded.
- The name fallback correctly uses the linked user profile when the form response name is empty.
- The internal
matchesSkillsflag is excluded from the API response. - The regression tests cover selected skill visibility, low-score exclusion, response structure, and name fallback.
- The existing unfiltered behavior is preserved by the updated logic.
Issues found
No major or blocking issues were identified during the code review.
Evidence
Required action
No changes required. Approved. The implementation addresses the reported Skills Overview mismatch while preserving the existing member-filtering criteria. The added regression tests provide coverage for the updated behavior.
RichaSapre
left a comment
There was a problem hiding this comment.
I reviewed the skills-filter logic and confirmed that selected skills now appear first in each member’s Top Skills list while low-score users remain excluded. The profile-name fallback also prevents blank member cards, and the response does not expose the internal matching flag.
I ran the targeted Jest suite: 11/11 tests passed, and the backend build compiled 773 files successfully. No blocking issues were found.



Description
Fixes a non-blocking issue flagged in review of frontend PR OneCommunityGlobal/HighestGoodNetworkApp#5440 (Skills Overview data mismatch fix). Jae has confirmed this is in scope to fix now rather than defer to a follow-up issue.
On
/hgnhelp/skills-overview, selecting skill-tag filters under "Find Community Members" sometimes returns member cards whose "Top Skills" list does not include the skills that were actually selected/matched, showing unrelated (but higher-scoring) skills instead.Root cause is in
getRankedResponsesinsrc/controllers/hgnFormResponseController.js. When askillsfilter is active, the endpoint found the first skill matching the filter, then used its section (frontend/backend/general) to pick the top 4 skills by score for that user - not the skills that actually matched the filter. So a user's genuinely matched skill (e.g.EnvironmentSetup) could be silently dropped fromtopSkillsif it wasn't among their top 4 highest-scoring skills in that section, and replaced by an unrelated higher-scoring skill from the same section (e.g.MongoDB).Related PRs (if any):
This backend PR is related to the OneCommunityGlobal/HighestGoodNetworkApp#5440 frontend PR.
.
Main changes explained:
src/controllers/hgnFormResponseController.js:development. Users who only have a low score (for example 1/10) in the selected skill are not returned.src/controllers/hgnFormResponseController.test.js: tests for the selected skill shown first, a low-score user being excluded, the internal match flag staying out of the response, and the name fallback.How to test:
Akshay_fix_skills_overview_top_skills_filter_mismatch.npm install,npm run build, thennpm start(port 4500).Akshay_fix_skills_overview_data_mismatch) against this backend./hgnhelp/skills-overview> "Find Community Members".npx jest src/controllers/hgnFormResponseController.test.js. All 11 tests should pass.Screenshots or videos of changes:
Note:
Checked read-only against the shared dev database (184 form responses). For single skills, two skills together, a preference filter and no filter, this branch returns exactly the same users as
development; only the Top Skills order changes. Blank names on member cards went from 11 to 0.