Repository navigation
refactor(scripts): remove search from the lists that new-feature writes - #395
Conversation
A generated list now has one query path for text: QueryKit filters. A caller writes any text as a raw string with one space of padding on each side, so the search parameter, its max length, and its LikePattern code are gone from the parameters DTO, the handler, and the HTTP, MCP, and gRPC entrypoints. The MCP filters description shows how to write text with a quote. The list query test now proves through a padded raw string filter that the text is found with no regard to case, that %, _, and \ are plain text, and that a quote at the start or end of a value, or a run of three quotes, is part of the value. The gRPC test lists by an id filter. The generated proto has no field 5. A generated proto is a new contract, and the script never rewrites a feature that exists, so no reserved number is needed.
Independent verification of 3ecca3e: PASS+NOTESThe goal is that a developer who runs Generated code
Live stack (ZeroFactor,
|
| filters | HTTP GET /api/v1/carriers (BFF) |
MCP list_carriers |
gRPC ListCarriers |
|---|---|---|---|
name @=* """ "Acme" """ |
"Acme" |
"Acme" |
"Acme" |
name == """ "Acme" """ |
"Acme" |
not run | not run |
name == "Acme" |
Acme |
Acme |
Acme |
name @=* "acme" |
"Acme", Acme, ACME corp |
not run | "Acme", Acme, ACME corp |
name @=* "50% off" |
50% off (not 50x off) |
50% off |
50% off |
name @=* "a_b" |
a_b (not axb) |
a_b |
a_b |
name @=* "c\d" |
c\d (not cxd) |
c\d |
c\d |
name @=* """ c\d """ |
c\d |
not run | not run |
name @=* """" q"""q """" |
q"""q |
q"""q |
q"""q |
- OpenAPI. The live
GET {server}/openapi/v1.jsonand the committed doc give the parameters['filters', 'sortOrder', 'pageNumber', 'pageSize']for/api/v1/carriers. - MCP. I registered
clinic-assistantas a delegated agent throughPOST /api/v1/agentswith the BFF session, which returned 201. Then I got a password-grant token from ZeroFactor and sentinitialize,tools/list, andtools/callto{server}/mcp. Thelist_carriersinput schema haspageNumber, pageSize, filters, sortOrder. Thefiltersdescription is the new text:... Put text with a " in a raw string with one space on each side, for example: name @=* """ say "hi" """. Its delimiter is one quote more than the longest run of quotes in the text, and at least three quotes. - gRPC. I used grpcurl 1.9.3 with
-plaintext -proto carriers.protoagainst the h2cgrpcendpoint, with the same agent token. A request with{"search":"Acme"}fails on the client:ListCarriersRequest has no known field named search.
Tests I ran myself
The build has 0 warnings. These test runs passed: the Carrier tests in UnitTests (15/15), the Carrier tests in IntegrationTests (10/10, CarrierListQueryTests included), the Carrier tests in FunctionalTests (11/11, HTTP, MCP, and gRPC), and NewFeatureTextTests (12/12). I did not run the full solution or the examples-removed matrix leg.
Notes (not blockers for this PR)
- HTTP ignores an old
searchquery param without an error:?search=Acmereturns 200 with all 10 rows. MCP does the same with asearchargument. That is normal for ASP.NET binding and the MCP SDK, but a caller that still sendssearchsilently gets an unfiltered list. It may deserve a line in the migration notes of the later PR. - I ran only the four-field Carrier above, not the eight-field Carrier and the Shipment from the CI job.
buf lintwas not run. buf is not installed on this machine.
Why
A list in the template has two ways to query by text: a
searchparam and QueryKitfilters. QueryKit 1.17.1 (#394) lets a filter hold any text, so one path is enough. This PR removessearchfrom each list thatscripts/new-feature.cswrites. Lists then use onlyfilterson HTTP, MCP, and gRPC. A later PR removessearchfrom the workshop and venue examples, the SPA, and their docs.What changed
The generator no longer writes these items:
SearchMaxLength,Search, and thesearchargument ofFromon the parameters DTO.ILikesearch block in the list handler.searchparam on HTTP and MCP, andoptional string search = 5on gRPC. Field 5 is dropped, not reserved, because the generator writes only new protos and never edits one that exists.The MCP
filtersdescription now tells a caller how to write text with a": a raw string with one space on each side,status @=* """ say "hi" """.The help text and the
backend-featureskill now say that the list sorts by the first field, and no longer that it searches by it.Tests
filters. It proves that@=*ignores case, reads%,_, and\as plain text, and keeps a quote at the start or the end of the text. It also covers text with"""in it, which needs a four-quote delimiter.QueryKitText.QuoteinSharedTestHelpers/Utilitiesbuilds the literal. It uses the same rule as the frontendquoteText.searchis gone.QueryKitInputExtensionsTestsandQueryInputErrorTestsalready cover thefilterslimit.NewFeatureTextTestsexpects the new MCP description.Local runs
new-featureCI job locally with the examples kept: 0 warnings, 2208 of 2208 tests passed.