Skip to content

Editable profile drives matching (BM25 + kNN + RRF) - #32

Merged
riponcm merged 4 commits into
mainfrom
feat/profile
Nov 9, 2026
Merged

riponcm merged 4 commits into
mainfrom
feat/profile

Conversation

@riponcm

@riponcm riponcm commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

The core of Confox: the user's profile drives what Elasticsearch ranks.

  • Edit profile (avatar, Edit profile, Edit interests): basics, interests and keywords (chips with suggestions from aggregations), schools, past companies, communities, tracks, looking for, links, visibility. Saving re-embeds only when the profile text changes and writes with refresh; Profile saved · matches updated; People, Schedule, Now, Dashboard and My brief refetch.
  • Ranking: a BM25 list (shared school, company, community, city, country, topics) and a kNN list on the profile vector, fused with Elasticsearch's native rrf retriever (client-side fallback on a basic licence); shared-value boosts and explainable why reasons on top. One pipeline for People and My brief; Schedule For you also uses keywords, projects and tracks.

Verified (on a scratch copy of the people index, Emma's shared document untouched): adding eBPF and BUET → 6 BUET alumni in her top 30, For you 15 → 17 of 76 with eBPF talks, My brief suggests BUET alumni; removing them restores everything exactly.

Built by a Claude Code agent from a written brief; reviewed before this pull request.


Summary by Gitar

  • Access control:
    • Profile saves are limited to the signed-in user, other users get a 403
  • Privacy:
    • Private profiles are excluded from other people's matches and kNN results
  • Ranking:
    • Country adds a shared-location boost, shown as "Also from" when cities differ

This will update automatically on new commits.

- GET/PUT /api/profile/{id}: validated editable fields; saving rebuilds
  interests_text, re-embeds when the profile text changes, writes with
  refresh; span profile.save and counter confox.profile.updates
- GET /api/profile/options: suggestions from aggregations
- People and My brief rank with one pipeline: a BM25 list (shared school,
  company, community, city, country, topics) and a kNN list on the profile
  vector, fused by the native rrf retriever (client-side fallback), with
  shared-value boosts and explainable reasons on top
- Schedule For you also uses keywords, projects and chosen tracks
- Profile editor in the drawer (chip inputs with suggestions, sections,
  dirty state, errors, toast); pages refetch after a save
- Sample data: some attendees also list BUET; tests updated, new tests
@riponcm
riponcm enabled auto-merge November 9, 2026 22:58
Comment thread backend/app/routers/profile.py Resolved
# Conflicts:
#	frontend/src/components/Shell.tsx
#	frontend/src/components/dashboard/HeroRow.tsx
#	frontend/src/pages/Brief.tsx
#	frontend/src/pages/Now.tsx
#	frontend/src/pages/People.tsx
#	frontend/src/pages/Schedule.tsx
Comment thread backend/app/routers/schedule.py Resolved
@gitar-bot

gitar-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 closed / 2 findings

🔴 High risk · Profile write restrictions and private-profile filtering alter access controls; mistakes could expose users’ profile data or block legitimate edits.

Editable profile now drives BM25 and kNN matching fused with RRF, with shared-value boosts and explainable match reasons across People, Schedule and My brief. Profile writes are restricted to the signed-in user, addressing the finding that any caller could overwrite another user's profile, and the day view no longer returns a 500 when the search fails. No open issues found.

✅ 2 closed
✅ Security: PUT /api/profile/{user_id} lets any caller overwrite anyone's profile

📄 backend/app/routers/profile.py:234-248
save_profile accepts any user_id in the path and overwrites that document in the people index, sending refresh with the write. Nothing checks who is calling. Any client can rewrite another attendee or a public speaker profile: name, bio, links, visibility. Setting visibility: private also removes that person from everyone else's matches. The app only has one signed-in demo user, so settings.demo_user is the only profile the editor should be able to save. Reject any other id with 403 or 404 until real auth exists.

✅ Bug: _top_matches misses SearchFailed, so the day view 500s

📄 backend/app/routers/schedule.py:358-364 📄 backend/app/routers/people.py:358-364 📄 backend/app/routers/people.py:407-409
rank_people runs its last BM25 search through _msearch. When Elasticsearch returns an error inside the msearch response (for example the people index is mid-rebuild or a query is rejected), _msearch raises SearchFailed, which is a plain Exception and not an ApiError. In _top_matches the handler only catches ApiError, so that exception goes up through day() and /api/schedule/day returns a 500. The new docstring promises an empty list when ranking fails ('Empty if ranking fails'), and the old code did return one. Fix: import SearchFailed and catch (ApiError, SearchFailed).

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@riponcm
riponcm merged commit f048ea9 into main Nov 9, 2026
3 checks passed
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