ui/phase-14: rename planet end-to-end + order read-back
Wires the first end-to-end command through the full pipeline:
inspector rename action → local order draft → user.games.order
submit → optimistic overlay on map / inspector → server hydration
on cache miss via the new user.games.order.get message type.
Backend: GET /api/v1/user/games/{id}/orders forwards to engine
GET /api/v1/order. Gateway parses the engine PUT response into the
extended UserGamesOrderResponse FBS envelope and adds
executeUserGamesOrderGet for the read-back path. Frontend ports
ValidateTypeName to TS, lands the inline rename editor + Submit
button, and exposes a renderedReport context so consumers see the
overlay-applied snapshot.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,14 @@ var pathParamStubs = map[string]string{
|
||||
"turn": "42",
|
||||
}
|
||||
|
||||
// queryParamStubs lists the deterministic substitutions used to fill
|
||||
// query-string parameters declared in `openapi.yaml`. Every required
|
||||
// query parameter must have an entry here; optional ones can stay
|
||||
// blank (the contract test omits them when no stub is registered).
|
||||
var queryParamStubs = map[string]string{
|
||||
"turn": "42",
|
||||
}
|
||||
|
||||
// requestBodyStubs lists the JSON request bodies the contract test sends for
|
||||
// each operationId. Operations missing from the map default to an empty
|
||||
// object `{}`, which is a valid placeholder thanks to `additionalProperties:
|
||||
@@ -323,6 +331,9 @@ func buildRequest(t *testing.T, c contractOperation) *http.Request {
|
||||
t.Helper()
|
||||
|
||||
target := substitutePathParams(t, c.path)
|
||||
if query := buildQuery(t, c); query != "" {
|
||||
target += "?" + query
|
||||
}
|
||||
url := "http://backend.internal" + target
|
||||
|
||||
body := bodyFor(t, c)
|
||||
@@ -376,6 +387,31 @@ func bodyFor(t *testing.T, c contractOperation) requestBody {
|
||||
}
|
||||
}
|
||||
|
||||
func buildQuery(t *testing.T, c contractOperation) string {
|
||||
t.Helper()
|
||||
if c.op == nil {
|
||||
return ""
|
||||
}
|
||||
values := make([]string, 0, len(c.op.Parameters))
|
||||
for _, p := range c.op.Parameters {
|
||||
if p == nil || p.Value == nil {
|
||||
continue
|
||||
}
|
||||
if p.Value.In != "query" {
|
||||
continue
|
||||
}
|
||||
stub, ok := queryParamStubs[p.Value.Name]
|
||||
if !ok {
|
||||
if p.Value.Required {
|
||||
t.Fatalf("operation %q requires query parameter %q with no stub registered", c.operationID, p.Value.Name)
|
||||
}
|
||||
continue
|
||||
}
|
||||
values = append(values, p.Value.Name+"="+stub)
|
||||
}
|
||||
return strings.Join(values, "&")
|
||||
}
|
||||
|
||||
func substitutePathParams(t *testing.T, templated string) string {
|
||||
t.Helper()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user