Skip to content

Fix stale didYouMean props#81

Merged
lelia merged 4 commits into
mainfrom
erichibbs/cus2-5-fix-stale-didyoumean-props
May 22, 2026
Merged

Fix stale didYouMean props#81
lelia merged 4 commits into
mainfrom
erichibbs/cus2-5-fix-stale-didyoumean-props

Conversation

@flowstate
Copy link
Copy Markdown
Contributor

The didYouMean alert class in socketdev/core/issues.py declared four props keys but the Socket API only emits two of them. Three keys (downloads, downloadsRatio, editDistance)
were dead at runtime — consumers rendering prop labels (PR comments, security comments, dependency overview tables) showed column headers for fields that never populated.
Meanwhile detectedAt, which the API does emit, had no human-readable label.

Root Cause

The didYouMean props dict drifted from the schema — openapi.json around line 9298 declares props: { alternatePackage, detectedAt }, and the python class never caught up.

Fix

Replaced the stale four-key dict with { alternatePackage, detectedAt } to match the OpenAPI schema. Added tests/unit/test_issues_did_you_mean_props.py with two contract tests — one pins the key set against the schema, one guards that every key has a non-empty label — so future drift is caught locally.

Purely a contract correction; no behavioral change beyond the keys exposed by AllIssues().didYouMean.props.

Sibling work in CUS2-4 added a gptDidYouMean class with the same correct shape; this PR brings the existing didYouMean into alignment.

Public Changelog

@flowstate Eric Hibbs (flowstate) requested a review from a team as a code owner May 21, 2026 09:27
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

🚀 Preview package published!

Install with:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketdev==3.1.1.dev2

@lelia lelia self-assigned this May 21, 2026
@lelia lelia changed the title [cus2-5] fix stale didyoumean props Fix stale didYouMean props May 21, 2026
Copy link
Copy Markdown
Contributor

@lelia lelia left a comment

Choose a reason for hiding this comment

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

Eric Hibbs (@flowstate) can you update uv.lock to sync with new version?

Resolves CUS2-5. The didYouMean class declared four props
(alternatePackage, downloads, downloadsRatio, editDistance) but the
current OpenAPI schema (socket-sdk-js/openapi.json:9298) only emits
{ alternatePackage, detectedAt }. The three stale keys were dead at
runtime and detectedAt was missing a human-readable label entirely.
Updated to match the schema.
Run via .hooks/sync_version.py after merging origin/main (now at 3.1.0
from lelia's purl PR). Keeps pyproject.toml and socketdev/version.py
in lockstep, as flagged in code review.
@flowstate Eric Hibbs (flowstate) force-pushed the erichibbs/cus2-5-fix-stale-didyoumean-props branch from deb2476 to 5e9d425 Compare May 22, 2026 21:48
@lelia lelia merged commit be87c34 into main May 22, 2026
7 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.

2 participants