Skip to content

fix(search): server-side type filter so --max applies after --type#126

Open
frd1201 wants to merge 3 commits into
oisee:mainfrom
frd1201:fix/search-type-filter-issue-119
Open

fix(search): server-side type filter so --max applies after --type#126
frd1201 wants to merge 3 commits into
oisee:mainfrom
frd1201:fix/search-type-filter-issue-119

Conversation

@frd1201

@frd1201 frd1201 commented May 1, 2026

Copy link
Copy Markdown

Problem

vsp search "Z*" --type CLAS --max 50 returned fewer results than expected (issue #119).

The ADT server returned up to --max mixed-type objects, and --type was applied client-side afterwards — so any CLAS objects outside the first 50 mixed results were silently dropped.

Solution

Add SearchObjectByType that passes objectType to the ADT informationsystem/search endpoint so the server filters before applying maxResults. SearchObject becomes a thin shim, leaving all existing callers untouched.

Short-form types are canonicalized at the CLI boundary (CLAS→CLAS/OC, INTF→INTF/OI, PROG→PROG/P, etc.) via canonicalObjectType. --verbose prints the effective query for debugging.

Test plan

  • vsp search "Z*" --type CLAS --max 50 returns up to 50 CLAS objects
  • vsp search "Z*" (no --type) still works unchanged
  • Unit tests in pkg/adt/client_test.go pass

Closes #119

claude and others added 2 commits May 1, 2026 08:51
…pe filter

vsp search "Z*" --type CLAS --max 50 returned only 9 results (issue oisee#119)
because --type was applied client-side after the request. The ADT API
returned up to 50 mixed-type Z* objects and the CLI then kept only CLAS
rows, so any classes outside the first 50 mixed results were silently
dropped.

Add SearchObjectByType that sends objectType on the informationsystem/
search endpoint; SearchObject becomes a thin shim, leaving the other 33
existing callers untouched. In runSearch, canonicalize the documented
short forms (CLAS→CLAS/OC, INTF→INTF/OI, ...) at the CLI boundary and
print the effective query when --verbose is set.
…ee#121

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@txape10

txape10 commented May 27, 2026

Copy link
Copy Markdown

Tested on-prem (on-premise SAP). Two follow-up points worth noting for whoever merges this:

1. MCP handler was not wired up

The fix in runSearch (CLI path) is correct, but handlers_search.go (SAP(action="search") in hyperfocused mode) was still calling SearchObject — so the MCP path had the same bug: type param was ignored and max applied after client-side filtering.

Fix: wire handleSearchObject to SearchObjectByType and accept type/objectType/max params in routeSearchAction.

2. canonicalObjectType belongs in the adt package

Having it in cli.go means MCP callers would need to duplicate the mapping or bypass it. Moving it to adt.CanonicalObjectType (exported) and calling it inside SearchObjectByType means every caller — CLI, MCP, or direct API — gets short-form expansion automatically with no extra work.

Both changes are in my branch if useful: https://github.com/txape10/vibing-steampunk/tree/fix/lock-nomodification-with-transport

…e#126 review)

- Export adt.CanonicalObjectType and apply it inside SearchObjectByType so
  CLI, MCP and direct API callers all get short-form expansion (+INCL, TTYP, ENQU)
- MCP search (handleSearchObject/routeSearchAction) now uses SearchObjectByType
  and accepts type/objectType + max/maxResults, so max applies after the type filter
- CLI post-filter compares against the canonical type (fixes --type FUNC/INCL)
- Tests: TestCanonicalObjectType, SearchObjectByType short-form cases, MCP handler test
frd1201 added a commit to frd1201/vibing-steampunk that referenced this pull request Jun 19, 2026
…er + MCP wiring (PR oisee#126)

# Conflicts:
#	cmd/vsp/cli.go
#	pkg/adt/client.go
#	pkg/adt/client_test.go
@frd1201

frd1201 commented Jun 19, 2026

Copy link
Copy Markdown
Author

Thanks @txape10, this was really helpful — appreciate you testing on-prem and pinning down both the MCP wiring gap and the package placement. Implemented both: the MCP path (handleSearchObject/routeSearchAction) now goes through SearchObjectByType and accepts type/objectType + max/maxResults, and CanonicalObjectType is exported in the adt package and applied inside SearchObjectByType, so CLI, MCP and direct API callers all get short-form expansion. Also pulled in the extra mappings from your branch (INCL→PROG/I, TTYP, ENQU). Would be great if you could take another look!

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.

Bug in CLI vsp search

3 participants