High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: a configured-but-keyless solver is rejected as unknown, and key-gated membership is spelled three times (PIN-082)
Luigi Agostid9d4936a2aa2
diff --git a/internal/autosolver/catalog/catalog.go b/internal/autosolver/catalog/catalog.goindex b12a1413..01dbdf8f 100644--- a/internal/autosolver/catalog/catalog.go+++ b/internal/autosolver/catalog/catalog.go@@ -17,14 +17,64 @@ import (// too: their name is always valid, and whether they register is a separate// question answered by the API key.func registrable() []autosolver.Solver {+ return buildAll(autosolver.Config{})+}++// buildAll constructs every solver type, handing each key-gated one the key cfg+// carries for its own name. This is the only place a solver type is constructed with+// its key, so the handler that used to do it per solver no longer knows any of them.+func buildAll(cfg autosolver.Config) []autosolver.Solver {return []autosolver.Solver{&solvers.Cloudflare{},&solvers.JSChallenge{},- external.NewCapsolver(external.CapsolverConfig{}),- external.NewTwoCaptcha(external.TwoCaptchaConfig{}),+ external.NewCapsolver(external.CapsolverConfig{APIKey: cfg.APIKey(autosolver.CapsolverSolverName)}),+ external.NewTwoCaptcha(external.TwoCaptchaConfig{APIKey: cfg.APIKey(autosolver.TwoCaptchaSolverName)}),}}+// Registrable is every solver that may enter the registry for this config: the+// unconditional ones, plus each key-gated one whose key is set. Registering a gated+// solver without its key is what this drops — the registry would accept it and every+// request to it would fail at the provider.+func Registrable(cfg autosolver.Config) []autosolver.Solver {+ out := make([]autosolver.Solver, 0, len(registrable()))+ for _, solver := range buildAll(cfg) {+ if _, gated := autosolver.KeyGatedSolverNamed(solver.Name()); gated && cfg.APIKey(solver.Name()) == "" {+ continue+ }+ out = append(out, solver)+ }+ return out+}++// Available answers the question the API asks: which solver names can actually run+// under this config. It is the single owner of that rule — the unconditional set plus+// every key-gated name whose key is set — so a caller never re-derives it from the+// key fields, which is how the same rule came to be spelled three times.+//+// Derived from KeyGatedSolvers rather than from the constructed solvers, so a gated+// solver added to that set is answered here without a registry instance existing yet.+func Available(cfg autosolver.Config) []string {+ names := AlwaysRegistered()+ for _, gated := range autosolver.KeyGatedSolvers() {+ if cfg.APIKey(gated.Name) != "" {+ names = append(names, gated.Name)+ }+ }+ sort.Strings(names)+ return names+}++// IsAvailable reports whether one name can run under this config.+func IsAvailable(name string, cfg autosolver.Config) bool {+ for _, available := range Available(cfg) {+ if available == name {+ return true+ }+ }+ return false+}+// KeyGated reports the solvers that only register when their API key is set.// Naming one without its key is a missing-key mistake, not an unknown solver.// The set itself is owned by autosolver.KeyGatedSolvers, which also carries the@@ -76,10 +126,3 @@ func IsKnown(name string) bool {}return false}--// KeyGatedNamed reports the key-gated solver answering to this name together with-// the config key that enables it. A caller that has already found the name-// unavailable uses this to tell a missing key from an unknown name.-func KeyGatedNamed(name string) (autosolver.KeyGatedSolver, bool) {- return autosolver.KeyGatedSolverNamed(name)-}diff --git a/internal/autosolver/catalog/catalog_test.go b/internal/autosolver/catalog/catalog_test.goindex 9c47b3f5..a5afd46b 100644--- a/internal/autosolver/catalog/catalog_test.go+++ b/internal/autosolver/catalog/catalog_test.go@@ -2,6 +2,7 @@ package catalogimport ("reflect"+ "slices""sort""testing"@@ -57,3 +58,88 @@ func TestRegistrableSolversAreAllKnownNames(t *testing.T) {}}}++// The rule this package now owns: availability follows the key-gated SET, so adding a+// gated solver is answered here with nobody editing an availability check. Proven by+// adding one to the real set the real callers read — a fixture could not make that+// claim, since the point is that production reads this exact list.+func TestAddingAKeyGatedSolverChangesAvailabilityWithNoOtherEdit(t *testing.T) {+ const fake = "fakesolver"++ restore := autosolver.SetKeyGatedSolversForTest(append(autosolver.KeyGatedSolvers(),+ autosolver.KeyGatedSolver{Name: fake, ConfigKey: "autoSolver.external.fakeKey"}))+ defer restore()++ keyless := autosolver.Config{}+ if IsAvailable(fake, keyless) {+ t.Errorf("%q is available with no key set; a key-gated solver without its key cannot run", fake)+ }+ if slices.Contains(Available(keyless), fake) {+ t.Errorf("Available(%v) lists %q with no key set", keyless.APIKeys, fake)+ }++ keyed := autosolver.Config{APIKeys: map[string]string{fake: "k"}}+ if !IsAvailable(fake, keyed) {+ t.Errorf("%q is unavailable with its key set", fake)+ }+ if !slices.Contains(Available(keyed), fake) {+ t.Errorf("Available with a key set = %v, want it to list %q", Available(keyed), fake)+ }++ // A blank-but-present key is the same as absent, or "configured it to empty" would+ // register a solver whose every request fails at the provider.+ blank := autosolver.Config{APIKeys: map[string]string{fake: " "}}+ if IsAvailable(fake, blank) {+ t.Errorf("%q is available with a blank key", fake)+ }+}++// The unconditional solvers are unaffected by any of this: they answer available with+// no config at all, which is what stops a keyless config from disabling the whole set.+func TestUnconditionalSolversAreAvailableWithNoConfig(t *testing.T) {+ available := Available(autosolver.Config{})+ for _, name := range AlwaysRegistered() {+ if !slices.Contains(available, name) {+ t.Errorf("%q is always registered but Available(empty config) = %v", name, available)+ }+ }+ for _, gated := range autosolver.KeyGatedSolvers() {+ if slices.Contains(available, gated.Name) {+ t.Errorf("key-gated %q is available with no key configured", gated.Name)+ }+ }+}++// Registration follows the same rule as availability, from the same config: a gated+// solver enters the registry exactly when its key is set. These were two separate+// re-implementations of one rule before, in a package that could not see this one.+func TestRegistrableFollowsTheSameKeyRuleAsAvailable(t *testing.T) {+ for _, tc := range []struct {+ name string+ cfg autosolver.Config+ }{+ {"no keys", autosolver.Config{}},+ {"one key", autosolver.Config{APIKeys: map[string]string{autosolver.CapsolverSolverName: "k"}}},+ {"blank key", autosolver.Config{APIKeys: map[string]string{autosolver.CapsolverSolverName: " "}}},+ {"both keys", autosolver.Config{APIKeys: map[string]string{+ autosolver.CapsolverSolverName: "k",+ autosolver.TwoCaptchaSolverName: "k2",+ }}},+ } {+ t.Run(tc.name, func(t *testing.T) {+ registered := []string{}+ for _, solver := range Registrable(tc.cfg) {+ registered = append(registered, solver.Name())+ }+ for _, gated := range autosolver.KeyGatedSolvers() {+ wantRegistered := tc.cfg.APIKey(gated.Name) != ""+ if got := slices.Contains(registered, gated.Name); got != wantRegistered {+ t.Errorf("%q registered = %v, want %v (available = %v)", gated.Name, got, wantRegistered, IsAvailable(gated.Name, tc.cfg))+ }+ if slices.Contains(registered, gated.Name) != IsAvailable(gated.Name, tc.cfg) {+ t.Errorf("%q: registration and availability disagree under %v", gated.Name, tc.cfg.APIKeys)+ }+ }+ })+ }+}diff --git a/internal/autosolver/keygated.go b/internal/autosolver/keygated.goindex c0301bcb..c954ce4e 100644--- a/internal/autosolver/keygated.go+++ b/internal/autosolver/keygated.go@@ -15,11 +15,26 @@ type KeyGatedSolver struct {ConfigKey string}+var keyGatedSolvers = []KeyGatedSolver{+ {Name: CapsolverSolverName, ConfigKey: "autoSolver.external.capsolverKey"},+ {Name: TwoCaptchaSolverName, ConfigKey: "autoSolver.external.twoCaptchaKey"},+}++// KeyGatedSolvers returns a copy, so a caller iterating it cannot edit the set.func KeyGatedSolvers() []KeyGatedSolver {- return []KeyGatedSolver{- {Name: CapsolverSolverName, ConfigKey: "autoSolver.external.capsolverKey"},- {Name: TwoCaptchaSolverName, ConfigKey: "autoSolver.external.twoCaptchaKey"},- }+ return append([]KeyGatedSolver(nil), keyGatedSolvers...)+}++// SetKeyGatedSolversForTest replaces the set and returns a restore function. It is+// exported production code on purpose: the rule under test is "adding a gated solver+// changes availability without anyone editing the availability code", and that claim+// cannot be made from a fixture — only by adding one to the real set the real callers+// read. Every caller reads it through KeyGatedSolvers, so the substitution reaches all+// of them.+func SetKeyGatedSolversForTest(gated []KeyGatedSolver) (restore func()) {+ previous := keyGatedSolvers+ keyGatedSolvers = append([]KeyGatedSolver(nil), gated...)+ return func() { keyGatedSolvers = previous }}// KeyGatedSolverNamed reports the key-gated solver answering to this name, so adiff --git a/internal/autosolver/types.go b/internal/autosolver/types.goindex 81eb57b0..d4c70c24 100644--- a/internal/autosolver/types.go+++ b/internal/autosolver/types.go@@ -1,6 +1,9 @@package autosolver-import "time"+import (+ "strings"+ "time"+)// SemanticSolverName is what the built-in semantic stage answers to. It is a// stage rather than a registry solver, so it has no Name() method to own its@@ -165,6 +168,19 @@ type Config struct {RetryBaseDelay time.Duration `json:"retryBaseDelay"` // Base delay for exponential backoffRetryMaxDelay time.Duration `json:"retryMaxDelay"` // Cap for exponential backoffCredentials Credentials `json:"-"` // Never serialised: redacted secrets++ // APIKeys carries the key for each key-gated solver, keyed by SOLVER NAME. A map+ // rather than a field per solver: KeyGatedSolvers owns that set, so a third gated+ // solver must not need a new field here, in the catalog, or in the handler that+ // fills this. Never serialised — these are secrets.+ APIKeys map[string]string `json:"-"`+}++// APIKey returns the configured key for a solver name, blank when unset. Trimming+// here is what makes "configured but blank" mean the same as absent everywhere that+// asks, instead of each caller remembering to trim.+func (c Config) APIKey(name string) string {+ return strings.TrimSpace(c.APIKeys[name])}// DefaultConfig returns a Config with sensible defaults. Enabled is false to matchdiff --git a/internal/config/editor_sections_test.go b/internal/config/editor_sections_test.goindex 642af664..da90255a 100644--- a/internal/config/editor_sections_test.go+++ b/internal/config/editor_sections_test.go@@ -5,6 +5,7 @@ import ("strings""testing"+ "github.com/pinchtab/pinchtab/internal/autosolver""github.com/pinchtab/pinchtab/internal/autosolver/catalog")@@ -118,9 +119,9 @@ func TestEveryKeyGatedSolverConfigKeyResolves(t *testing.T) {var fc FileConfigfor _, name := range names {- gated, ok := catalog.KeyGatedNamed(name)+ gated, ok := autosolver.KeyGatedSolverNamed(name)if !ok {- t.Errorf("catalog.KeyGated lists %q but KeyGatedNamed does not know it", name)+ t.Errorf("catalog.KeyGated lists %q but autosolver.KeyGatedSolverNamed does not know it", name)continue}if gated.ConfigKey == "" {diff --git a/internal/handlers/autosolver.go b/internal/handlers/autosolver.goindex 7b37af49..38059546 100644--- a/internal/handlers/autosolver.go+++ b/internal/handlers/autosolver.go@@ -10,10 +10,8 @@ import (coreautosolver "github.com/pinchtab/pinchtab/internal/autosolver""github.com/pinchtab/pinchtab/internal/autosolver/adapters""github.com/pinchtab/pinchtab/internal/autosolver/catalog"- "github.com/pinchtab/pinchtab/internal/autosolver/external"autosolverllm "github.com/pinchtab/pinchtab/internal/autosolver/llm"autosolversemantic "github.com/pinchtab/pinchtab/internal/autosolver/semantic"- autosolvers "github.com/pinchtab/pinchtab/internal/autosolver/solvers")const (@@ -209,9 +207,26 @@ func (h *Handlers) normalizedAutoSolverConfig() coreautosolver.Config {},}+ cfg.APIKeys = h.autoSolverAPIKeys()+return cfg}+// autoSolverAPIKeys pairs each key-gated solver's name with the runtime field that+// carries its key. It is DATA, not the availability rule: which names are gated, and+// what a blank key means, are answered by internal/autosolver and the catalog. The+// pairing has to live here because internal/config cannot be imported from either —+// config imports the catalog, so the arrow only runs this way.+func (h *Handlers) autoSolverAPIKeys() map[string]string {+ if h == nil || h.Config == nil {+ return nil+ }+ return map[string]string{+ coreautosolver.CapsolverSolverName: h.Config.AutoSolver.CapsolverKey,+ coreautosolver.TwoCaptchaSolverName: h.Config.AutoSolver.TwoCaptchaKey,+ }+}+// llmProviderForAutoSolver returns the configured LLM provider, or nil when no// provider is configured. The provider is a skeleton today (returns// "not yet implemented"); wiring it gated on LLMProvider makes the llmFallback@@ -234,16 +249,8 @@ func (h *Handlers) buildAutoSolver(cfg coreautosolver.Config, includeSemantic bo}as := coreautosolver.New(cfg, semanticEngine, h.llmProviderForAutoSolver())- as.Registry().MustRegister(&autosolvers.Cloudflare{})- as.Registry().MustRegister(&autosolvers.JSChallenge{})-- if h != nil && h.Config != nil {- if key := strings.TrimSpace(h.Config.AutoSolver.CapsolverKey); key != "" {- as.Registry().MustRegister(external.NewCapsolver(external.CapsolverConfig{APIKey: key}))- }- if key := strings.TrimSpace(h.Config.AutoSolver.TwoCaptchaKey); key != "" {- as.Registry().MustRegister(external.NewTwoCaptcha(external.TwoCaptchaConfig{APIKey: key}))- }+ for _, solver := range catalog.Registrable(cfg) {+ as.Registry().MustRegister(solver)}return as@@ -251,18 +258,11 @@ func (h *Handlers) buildAutoSolver(cfg coreautosolver.Config, includeSemantic bofunc (h *Handlers) availableAutoSolverNames() []string {cfg := h.normalizedAutoSolverConfig()- available := map[string]bool{}- for _, name := range catalog.AlwaysRegistered() {+ runnable := catalog.Available(cfg)+ available := make(map[string]bool, len(runnable))+ for _, name := range runnable {available[name] = true}- if h != nil && h.Config != nil {- if strings.TrimSpace(h.Config.AutoSolver.CapsolverKey) != "" {- available[coreautosolver.CapsolverSolverName] = true- }- if strings.TrimSpace(h.Config.AutoSolver.TwoCaptchaKey) != "" {- available[coreautosolver.TwoCaptchaSolverName] = true- }- }names := make([]string, 0, len(available))seen := make(map[string]struct{}, len(available))@@ -277,7 +277,7 @@ func (h *Handlers) availableAutoSolverNames() []string {seen[configured] = struct{}{}}- for _, fallback := range catalog.AlwaysRegistered() {+ for _, fallback := range runnable {if !available[fallback] {continue}diff --git a/internal/handlers/autosolver_test.go b/internal/handlers/autosolver_test.goindex a72d3cf7..21263d7a 100644--- a/internal/handlers/autosolver_test.go+++ b/internal/handlers/autosolver_test.go@@ -7,7 +7,7 @@ import ("testing""time"- coreautosolver "github.com/pinchtab/pinchtab/internal/autosolver"+ "github.com/pinchtab/pinchtab/internal/autosolver""github.com/pinchtab/pinchtab/internal/autosolver/catalog""github.com/pinchtab/pinchtab/internal/config")@@ -164,7 +164,10 @@ func TestRegisteredSolversAreAllKnownToTheCatalog(t *testing.T) {TwoCaptchaKey: "test-twocaptcha-key",}}}- as := h.buildAutoSolver(coreautosolver.DefaultConfig(), true)+ // The normalised config, exactly as both production call sites build it: the keys+ // travel to the registry through cfg.APIKeys now, so handing buildAutoSolver a bare+ // DefaultConfig would register nothing gated and assert against a config nobody uses.+ as := h.buildAutoSolver(h.normalizedAutoSolverConfig(), true)registered := as.Registry().Names()if len(registered) == 0 {t.Fatal("no solvers registered — this guard is checking nothing")@@ -184,3 +187,61 @@ func TestRegisteredSolversAreAllKnownToTheCatalog(t *testing.T) {}}}++// The handler's only remaining per-solver knowledge is DATA: which runtime field holds+// each gated solver's key. The rule that consumes it lives in the catalog, so this pins+// the seam between them — every gated solver's key must actually arrive, or availability+// silently answers "keyless" for a solver the operator configured.+func TestEveryGatedSolverKeyReachesTheNormalisedConfig(t *testing.T) {+ h := &Handlers{Config: &config.RuntimeConfig{AutoSolver: config.AutoSolverConfig{+ CapsolverKey: "cap-key",+ TwoCaptchaKey: "two-key",+ }}}++ cfg := h.normalizedAutoSolverConfig()+ gated := autosolver.KeyGatedSolvers()+ if len(gated) == 0 {+ t.Fatal("no key-gated solvers; this seam test would check nothing")+ }+ for _, solver := range gated {+ if cfg.APIKey(solver.Name) == "" {+ t.Errorf("%s is key-gated but its key never reaches the config the catalog reads; add it to autoSolverAPIKeys beside %s", solver.Name, solver.ConfigKey)+ }+ if !catalog.IsAvailable(solver.Name, cfg) {+ t.Errorf("%s has its key configured but the catalog reports it unavailable", solver.Name)+ }+ }++ keyless := (&Handlers{Config: &config.RuntimeConfig{}}).normalizedAutoSolverConfig()+ for _, solver := range gated {+ if catalog.IsAvailable(solver.Name, keyless) {+ t.Errorf("%s is available with no key configured", solver.Name)+ }+ }+}++// availableAutoSolverNames is the list the API prints and guards on, and it must follow+// the catalog rather than re-deriving availability. Both directions, because the defect+// this card fixes was a configured solver reported as unknown.+func TestAvailableNamesFollowTheConfiguredKeys(t *testing.T) {+ for _, solver := range autosolver.KeyGatedSolvers() {+ t.Run(solver.Name, func(t *testing.T) {+ keyless := &Handlers{Config: &config.RuntimeConfig{}}+ if slices.Contains(keyless.availableAutoSolverNames(), solver.Name) {+ t.Errorf("%s is listed available with no key set", solver.Name)+ }+ if keyless.isAvailableAutoSolver(solver.Name) {+ t.Errorf("isAvailableAutoSolver(%s) with no key set", solver.Name)+ }++ keyed := &Handlers{Config: &config.RuntimeConfig{AutoSolver: config.AutoSolverConfig{+ CapsolverKey: "k",+ TwoCaptchaKey: "k",+ Solvers: []string{solver.Name},+ }}}+ if !slices.Contains(keyed.availableAutoSolverNames(), solver.Name) {+ t.Errorf("%s is not listed available with its key set (list %v)", solver.Name, keyed.availableAutoSolverNames())+ }+ })+ }+}diff --git a/internal/handlers/solver.go b/internal/handlers/solver.goindex 806aacde..b5ffab33 100644--- a/internal/handlers/solver.go+++ b/internal/handlers/solver.go@@ -12,7 +12,6 @@ import ("github.com/pinchtab/pinchtab/internal/activity"coreautosolver "github.com/pinchtab/pinchtab/internal/autosolver""github.com/pinchtab/pinchtab/internal/autosolver/adapters"- "github.com/pinchtab/pinchtab/internal/autosolver/catalog""github.com/pinchtab/pinchtab/internal/httpx")@@ -235,7 +234,7 @@ func (h *Handlers) HandleAutoSolverConfig(w http.ResponseWriter, r *http.Request// rather than being reported as a typo. Config validation deliberately accepts// the same name without its key; see docs/endpoints.md.func (h *Handlers) rejectUnavailableSolver(w http.ResponseWriter, name string) {- if gated, ok := catalog.KeyGatedNamed(name); ok {+ if gated, ok := coreautosolver.KeyGatedSolverNamed(name); ok {httpx.ErrorCode(w, 400, "solver_key_missing",fmt.Sprintf("solver %q is configured but its API key is not set; set %s to use it", gated.Name, gated.ConfigKey),false, nil)diff --git a/internal/handlers/solver_test.go b/internal/handlers/solver_test.goindex 6cc49fbc..fd9fea6f 100644--- a/internal/handlers/solver_test.go+++ b/internal/handlers/solver_test.go@@ -10,6 +10,7 @@ import ("testing"coreautosolver "github.com/pinchtab/pinchtab/internal/autosolver"+ "github.com/pinchtab/pinchtab/internal/autosolver/catalog""github.com/pinchtab/pinchtab/internal/config")@@ -246,25 +247,68 @@ func TestDeriveChallengeType_NilPage(t *testing.T) {}}-// autosolver.SemanticSolverName is the single owner of the semantic stage's name.-// A bare literal here compiles and passes every behavioural test, so the guard is-// structural: it fails if the literal comes back.-func TestSolverHandlerSpellsSemanticThroughItsOwner(t *testing.T) {- raw, err := os.ReadFile("solver.go")+// Every solver name has an owner — a solver type's Name(), or the exported constant+// for the semantic stage — and this package must spell all of them through it. The+// banned set is DERIVED from catalog.Names(), so a solver added later is covered here+// without anyone remembering to extend a list, and the scan covers every non-test file+// in the package rather than the one file that happened to be dirty: a guard reading a+// single file reports the rule as enforced while its siblings go unchecked.+func TestNoHandlerSpellsASolverNameAsALiteral(t *testing.T) {+ entries, err := os.ReadDir(".")if err != nil {t.Fatal(err)}- if len(raw) == 0 {- t.Fatal("solver.go read empty — this guard is checking nothing")++ names := catalog.Names()+ if len(names) < 2 {+ t.Fatalf("catalog.Names() returned %v; the banned set is derived from it, so this guard would check almost nothing", names)+ }++ scanned, referencing := 0, 0+ for _, entry := range entries {+ name := entry.Name()+ if entry.IsDir() || !strings.HasSuffix(name, ".go") || strings.HasSuffix(name, "_test.go") {+ continue+ }+ body, err := os.ReadFile(name) // #nosec G304 -- files listed from this package's own directory.+ if err != nil {+ t.Fatal(err)+ }+ scanned+++ src := codeWithoutCommentLines(string(body))+ if strings.Contains(src, "coreautosolver.SemanticSolverName") ||+ strings.Contains(src, "coreautosolver.CapsolverSolverName") ||+ strings.Contains(src, "coreautosolver.TwoCaptchaSolverName") {+ referencing+++ }+ for _, solver := range names {+ if strings.Contains(src, `"`+solver+`"`) {+ t.Errorf("%s spells the solver name %q as a literal; use the constant that owns it (internal/autosolver) so the two cannot drift", name, solver)+ }+ }}- literal := `"` + coreautosolver.SemanticSolverName + `"`- if strings.Contains(string(raw), literal) {- t.Errorf("solver.go spells %s as a literal; use coreautosolver.SemanticSolverName", literal)+ if scanned < 2 {+ t.Fatalf("scanned %d non-test files in this package; the census read nothing", scanned)+ }+ if referencing == 0 {+ t.Error("no file in this package references a solver-name constant; the ban above would pass vacuously on a package that stopped naming solvers at all")}- if !strings.Contains(string(raw), "coreautosolver.SemanticSolverName") {- t.Errorf("solver.go no longer references coreautosolver.SemanticSolverName; the guard above would pass vacuously")+}++// codeWithoutCommentLines drops whole-line comments so a doc example or a curl snippet+// naming a solver is not read as code. A trailing comment is NOT stripped: cutting at+// the first "//" would also cut inside a string holding a URL, and a solver name spelled+// after one is still a spelling worth catching.+func codeWithoutCommentLines(src string) string {+ var kept []string+ for _, line := range strings.Split(src, "\n") {+ if strings.HasPrefix(strings.TrimSpace(line), "//") {+ continue+ }+ kept = append(kept, line)}+ return strings.Join(kept, "\n")}func solveErrorPayload(t *testing.T, w *httptest.ResponseRecorder) (code, message string) {