Skip to content

fix(queryexec): offer the features nearest to the missing segment, not the first three by name - #1581

Merged
HuiJun merged 2 commits into
developfrom
fix/missing-feature-nearest
Oct 28, 2026
Merged

HuiJun merged 2 commits into
developfrom
fix/missing-feature-nearest

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What and why

The missing-feature error introduced in #1577 ends, when the element has more than three features, with a "did you mean …?" suggestion. missingFeatureMessage passed the whole Candidates list — every feature of the element, sorted by name — to suggest.With, which offers the first Limit entries in the order given. The suggestion therefore named the first three features alphabetically, not the ones nearest to the missing segment, while Frontier.Nearest on the same record already held the right answer:

$ sysml nested.sysml -run-query "Nest::Deep source=Nest::root2"    # root2::y::sub::sub has count, runa, runb, runz
sysml: query Nest::Deep reads feature sub.sub.runs of Nest::root2::y, but the path stops at Nest::root2::y::sub::sub: its features are count, runa, runb, runz — did you mean count, runa or runb?

Now the message ranks the candidates with suggest.Nearest(segment, e.Candidates) first, so the same query says did you mean runa, runb or runz?. The record (Candidates, Frontier) is unchanged; only the sentence moves.

Specification basis

No specification clause: a diagnostic wording fix. docs/internals/design/query-outcomes.md describes Frontier.nearest as "the closest spelling, by edit distance"; the sentence now agrees with the record.

How it was verified

  • TestExecuteMissingFeatureSuggestsTheNearestFeatures (new, internal/doc/queryexec/missing_feature_test.go) fails on develop with the message above and passes with the fix.
  • go test -count=1 ./internal/doc/queryexec/..., go vet ./internal/doc/queryexec, gofmt -l clean.
  • Re-ran the probe above against a binary built from this branch.

Checklist

  • make test and make lint pass locally (the touched package; the full suite runs in CI)
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md) — no documented example shows the suggestion
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build) — no count moved
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/9cd1c7a9f9a94b7597fc6968dac74733
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/9cd1c7a9f9a94b7597fc6968dac74733?variant=devin
Requested by: @HuiJun

…t the first three by name

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

…e-nearest

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	internal/doc/queryexec/errors.go
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 27, 2026 23:30
@HuiJun
HuiJun merged commit af6e1a8 into develop Oct 28, 2026
53 checks passed
@HuiJun
HuiJun deleted the fix/missing-feature-nearest branch October 28, 2026 02:24
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