Skip to content

function that augments search results - #3472

Open
yonadavGit wants to merge 14 commits into
masterfrom
chore/sc-44769/create-function-that-augments-search-results
Open

function that augments search results#3472
yonadavGit wants to merge 14 commits into
masterfrom
chore/sc-44769/create-function-that-augments-search-results

Conversation

@yonadavGit

Copy link
Copy Markdown
Contributor

Description

A brief description of the PR

Code Changes

The following changes were made to the files below

Notes

Any additional notes go here

@yonadavGit
yonadavGit requested a review from nsantacruz June 30, 2026 15:25
@gitvelocity-reviewer

Copy link
Copy Markdown

📊 Code Quality Score: 31/100

51 × 0.6 = 30.6 ≈ 31

Category Score Factors
🔭 Scope 9/20 New endpoint + new module + URL routing; single subsystem (semantic search); no external service changes; additive only
🏗️ Architecture 10/20 Protocol-based LinkSource abstraction for DI; clean module separation; new public API endpoint; follows existing patterns
⚙️ Implementation 12/20 Statistical thresholding (mean+std); graph traversal with configurable depth; Protocol-based DI; careful edge case handling; parameter validation helpers
⚠️ Risk 8/20 New authenticated endpoint with token auth; potential N+1 MongoDB queries at scale; no feature flag; additive change with no migrations or schema changes
✅ Quality 10/15 Comprehensive tests for linked_refs.py (8 test cases covering edge cases, depth traversal, statistical thresholding); missing view-level tests for auth/validation/error paths; no API documentation
🔒 Perf / Security 2/5 Token-based auth implemented; input validation present; N+1 query risk unaddressed; no rate limiting; no benchmarks

Was this score accurate? 👍 Yes · 👎 No

Scored by GitVelocity · How are scores calculated?

@yonadavGit
yonadavGit force-pushed the chore/sc-44769/create-function-that-augments-search-results branch from 2ecdbad to 513a939 Compare June 30, 2026 16:57
Comment thread api/views.py Outdated

# Public response controls. Clients may request fewer or more items, but values
# are clamped by the max constants to keep response size and query cost bounded.
_DEFAULT_RESULT_LIMIT = 10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can all of these constants be class variables of the KnnSearch class? I realize _SEARCH_RESULT_FIELDS should also probably be moved there.

Comment thread api/views.py Outdated
return serialized

@staticmethod
def _linked_ref_text(ref):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is just _ref_text. technically this function doesn't care about links

Comment thread semantic_search/linked_refs.py Outdated

class LinkSource(Protocol):
def linked_refs_for(self, ref: str) -> list[str]:
...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is this??

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

actually, what are all these classes? maybe they're related to tests? can't we just have one normalize_ref function outside a class?

if type(index_node).__name__ in {"DictionaryNode", "DictionaryEntryNode"}:
return True

index = getattr(oref, "index", None)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this whole second half of the function is nonsense. the categories it's checking don't even exist.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the first part of the function is enough

Comment thread api/views.py Outdated
response.update({
"linked_refs": [
self._serialize_linked_ref(ref, include_text)
for ref in enhancement.appended_refs[:linked_ref_limit]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this arbitrarily cuts off linked ref enahncements. we should be retaining the ones with the highest link counts.

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