Skip to content

Fix stale didYouMean props#81

Open
Eric Hibbs (flowstate) wants to merge 5 commits into
mainfrom
erichibbs/cus2-5-fix-stale-didyoumean-props
Open

Fix stale didYouMean props#81
Eric Hibbs (flowstate) wants to merge 5 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

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.
@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.dev1

@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
…stale-didyoumean-props

# Conflicts:
#	socketdev/version.py
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.
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