fix(Descriptions): keep Available exhaustive, let the hint carry its list (#557) - #558
Merged
Merged
Conversation
…s list Follow-up to #553. Its fix routed the similarity-filtered matches into `candidates`, which `Exceptions/display.jl:158` labels `Available` -- so the two message fields effectively swapped content: a 12-entry catalog was reported as holding 5 descriptions, with nothing saying the list had been filtered, while `Hint Try one of the closest matches:` still ended on a colon with nothing after it. Two lines put each field back on its own job: - `candidates` is always the catalog again -- every entry, or the first `max_show` followed by the `… and N more` marker; - the closest matches are joined into `suggestion`, which the renderer already splits on newlines (`_print_pipe_field`), so `display.jl` needs no change. This also makes #553's marker reachable. It is built from `all_candidates`, which was discarded whenever `similar_descs` was non-empty, and `_find_similar_descriptions` returns empty only when the request shares no symbol with any description (Jaccard, filtered on > 0). The marker could therefore only ever render for a catalog above `max_show` *and* a wholly unknown request -- never in the case #553 was filed about. Tests: new non-regression testset for #557 covering the branch #553 could not reach (catalog > max_show *with* similar matches), the exhaustive small-catalog path, a self-contained hint, and an end-to-end check that the rendered message shows the matches after the `Hint` label. The #553 testset asserted the behaviour this commit fixes (`candidates` equal to the closest matches) and was corrected. Verified failing without the source change. Also refreshed the `complete` docstring, whose example still showed a message format several releases old. Closes #557. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #557, a follow-up to #553 (fixed by #556, released in v0.30.3-beta).
The problem
#556 routed the similarity-filtered matches into
candidates.Exceptions/display.jl:157-159labels that fieldAvailable, so the two message fields effectively swapped content:A reader asking "what can I call?" is given a filtered subset under a label that claims completeness, and the hint announces a list it never prints — the matches are on screen, under the wrong heading.
And #553's own truncation marker turned out to be unreachable. It is built from
all_candidates, which was discarded wheneversimilar_descswas non-empty;_find_similar_descriptionsreturns empty only when the request shares no symbol with any description (_compute_similarityis a Jaccard index, filtered on> 0.0). So the marker could only render for a catalog abovemax_showand a wholly unknown request — never in the scenario #553 was filed about.The fix — two lines,
complete.jlonly_print_pipe_fieldalready splits aStringvalue on newlines and keeps the│prefix and indentation (display.jl:283-291), so a multi-line hint renders correctly with no display change:Each field goes back to its own job:
candidatesdescribes the catalog (exhaustive, ormax_showplus the marker) on every path, and the hint carries its own list.Tests
A new
issue 557testset, five parts:max_showwith similar matches:candidatesmust still be the catalog and still end on… and N more. This is the assertion that pins the second-order bug.candidatesexhaustive (12 of 12), including the entries that do not resemble the request — that is whatAvailablemeans.sprint(showerror, e)shows the matches after theHintlabel, not only in the struct.The #553 testset asserted the behaviour this PR fixes —
— so it is corrected here, with the closest-matches assertion moved to
suggestionwhere it belongs. One nearby test ("description not found with similar suggestions") was checking the closest matches throughcandidatesfor the same reason; it now checkssuggestionand asserts the catalog stays whole.Verified the new tests bite: with the source change stashed,
suite/descriptions/test_complete.jlfails at lines 212, 213 and 265; with it applied,suite/descriptionsis 284/284 and the full suite is 121095/121095.Verified downstream
Pkg.develop-ed this branch into OptimalControl.jl's documentation environment and re-ran the case that produced the report —solve(ocp, :adnlp, :gpu)on the 12-method registry — confirming both fields now read correctly on the page that publishes this message (solve/gpu.md, control-toolbox/OptimalControl.jl#941).Also in this PR
0.30.3-beta→0.30.4-beta, CHANGELOG entry, and two BREAKING notes: the 0.30.4-beta one, plus the 0.30.3-beta one that was missing.completedocstring example showed a message format several releases old (Valid candidates:,Suggestion: Available descriptions: …). Since this PR changes that very message, it is replaced with the real current output. Drop this hunk if you would rather keep the diff to the fix.No breaking change: error-message content only. Resolution behaviour, signatures, return values and the
AmbiguousDescriptionfield names are unchanged.candidatesis the catalog again — what it was before 0.30.3-beta — andsuggestionis multi-line on the closest-matches path.🤖 Generated with Claude Code