High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
docs: document the button field's accepted names and 400 contract in endpoints.md (PIN-257)
Luigi Agostiacc571bffd16
diff --git a/cmd/pinchtab/cmd_cli_button_test.go b/cmd/pinchtab/cmd_cli_button_test.goindex 636d4264..fd2eb63a 100644--- a/cmd/pinchtab/cmd_cli_button_test.go+++ b/cmd/pinchtab/cmd_cli_button_test.go@@ -1,6 +1,8 @@package mainimport (+ "os"+ "path/filepath""strings""testing"@@ -67,6 +69,47 @@ func TestEveryButtonFlagRefusesAnUnknownNameLocally(t *testing.T) {}}+func buttonContractBlock(text string) (string, bool) {+ for _, block := range strings.Split(text, "\n\n") {+ if strings.Contains(block, "`button`") && strings.Contains(block, "400") {+ return block, true+ }+ }+ return "", false+}++func TestButtonContractIsDocumentedWhereAnAPICallerReads(t *testing.T) {+ want := bridgecdpops.MouseButtons()+ if len(want) < 3 {+ t.Fatalf("MouseButtons() returned %v, so this guard would pass vacuously", want)+ }++ for _, rel := range []string{+ filepath.Join("..", "..", "docs", "endpoints.md"),+ filepath.Join("..", "..", "docs", "reference", "mouse.md"),+ } {+ raw, err := os.ReadFile(rel)+ if err != nil {+ t.Fatalf("cannot read %s, so a renamed doc would be a silent skip: %v", rel, err)+ }++ block, ok := buttonContractBlock(string(raw))+ if !ok {+ t.Errorf("%s no longer documents the button field's 400 contract, so drift there is now unguarded", rel)+ continue+ }++ for _, name := range want {+ if !strings.Contains(block, name) {+ t.Errorf("%s button paragraph omits %q, so an accepted button is missing from the reference", rel, name)+ }+ }+ if !strings.Contains(strings.ToLower(block), "omit") {+ t.Errorf("%s button paragraph does not state what omitting the field means, so left-as-default reads as forgiveness for an unknown name", rel)+ }+ }+}+// The help text and the default both come from the vocabulary owner, so the next button is// not documented in one place and refused in another.func TestEveryButtonFlagDerivesItsHelpFromTheVocabulary(t *testing.T) {diff --git a/docs/endpoints.md b/docs/endpoints.mdindex 78481a65..b8b291e4 100644--- a/docs/endpoints.md+++ b/docs/endpoints.md@@ -214,6 +214,13 @@ dropdown, and a `select` carrying neither key is rejected. Every surface express`POST /action` with `"value": ""`, `pinchtab select <ref> ""`, and the `pinchtab_select` MCPtool with `value: ""`.+`button` accepts `left`, `right`, and `middle` — the same vocabulary the CLI's `--button`+help lists, tolerating case and surrounding whitespace, so `RIGHT` and ` middle ` are the+buttons they name. Any other value is refused with `400` `invalid_mouse_button` naming the+three, on any action body carrying the field: `primary`, `secondary` and `0` used to be+reinterpreted as `left` and reported as success. Omitting `button` means `left`, which is a+default rather than forgiveness for a name the server does not know.+`humanize` is a per-action override for input style. When omitted, actions use `instanceDefaults.humanize`, which defaults to `false`. Use `kind:"click"` or `kind:"type"` with `humanize:true` when a page needs the slower human-like pointer or typing path.Pointer fallback behavior: