mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
refactor: rename project uatu -> sanderling (#24)
* refactor: rename Go module path uatu -> sanderling
Module path github.com/priyanshujain/uatu -> github.com/priyanshujain/sanderling,
including all imports and the proto go_package option. Generated .pb.go files
rewritten in-place; safe to regenerate with protoc later.
* chore(proto): regenerate driverpb after module path rename
The previous sed-based module rename corrupted the embedded descriptor
byte lengths. buf generate rewrites them cleanly.
* refactor: rename CLI binary uatu -> sanderling
Updates Makefile target + UATU_BIN var, .goreleaser project/build IDs,
.gitignore comment, and all user-facing strings in the CLI help text,
error messages, and tests. Binary is now bin/sanderling.
* refactor(sdk): rename Kotlin package dev.uatu.sdk -> dev.sanderling.sdk
Moves sdk/android/src/{main,test}/kotlin/dev/uatu -> dev/sanderling and
rewrites package declarations, imports, and the Gradle namespace. Class
names (Uatu, UatuRuntime) are renamed in a follow-up commit.
* refactor(sidecar): rename Kotlin package dev.uatu.sidecar -> dev.sanderling.sidecar
Moves sidecar/src/{main,test}/kotlin/dev/uatu -> dev/sanderling and
rewrites package declarations, imports, and the application mainClass.
* refactor: rename Uatu API surface -> Sanderling
- Kotlin: Uatu -> Sanderling, UatuRuntime -> SanderlingRuntime (+ files).
- JS host binding: globalThis.__uatu__ -> __sanderling__ (Go verifier,
spec-api, tests).
- TS interface: UatuRuntime -> SanderlingRuntime; internal tags
__uatuFormula / __uatuActionGenerator -> __sanderling* variants.
- Go trace: UatuVersion field + uatu_version JSON tag renamed.
- Socket naming: uatu-agent / uatu-agent-reader -> sanderling-agent*.
- Sample app, docs, inline-JS test strings updated to match.
* refactor(examples): rename examples/folio/uatu -> examples/folio/sanderling
Renames the example spec directory; updates justfile paths + gitignore
entries accordingly. Package.json name/description and @uatu/spec
dependency are renamed in the npm + docs commits.
* chore(build): rename gradle property + rootProject.name uatu -> sanderling
- Renames the uatu.version gradle property and all its -P references in
Makefile, build.gradle.kts files, and .github/workflows/release.yml.
- settings.gradle.kts rootProject.name = "sanderling".
- Renames .env.local.example header + release-cli workflow job name.
* refactor(proto): rename proto package uatu.driver.v1 -> sanderling.driver.v1
Updates the proto package and java_package, regenerates driver.pb.go +
driver_grpc.pb.go, rewrites Kotlin imports and the gRPC ServiceName
assertion in driver_test.go.
* refactor: rename npm package @uatu/spec -> @sanderling/spec
Renames package name in pkg/spec-api/package.json + lockfile, all
consumer imports (examples/folio spec, testdata, verifier tests), the
esbuild alias in cmd/sanderling/test_run.go, and related doc references.
* docs: rename uatu -> sanderling in README, docs, and URLs
- README + docs/{manual,development}/*: narrative + GitHub + Pages URLs.
- POM + npm package.json repo/homepage/bugs URLs.
- .gitignore + embed_stub + Makefile-comment references updated to
'make sanderling'.
- Minor narrative comments in cmd/sanderling/test_run.go and
internal/inspect/server.go.
* refactor: rename remaining internal uatu strings -> sanderling
- SANDERLING_TEST_PHONE/OTP env vars (cmd + bundler tests).
- sanderling-sidecar runtime tmp dir + extracted JAR filename.
- Inspect web UI: @sanderling/inspect-web package, title, theme
localStorage key, RunList empty-state copy, uatu_version TS field.
- Sample app storage key sanderling.ledger.v1.
- Test data: sanderling_test AVD name + com.example.sanderling_test.
- Release docs tarball name template.
This commit is contained in:
111 files changed
+514
-514
No files matched your search
@@ -47,15 +47,15 @@ func TestBundle_ProducesIIFE(t *testing.T) {
|
||||
|
||||
func TestBundle_InlinesDefines(t *testing.T) {
|
||||
entry := writeFixture(t, "spec.ts", `
|
||||
const phone = process.env.UATU_TEST_PHONE;
|
||||
const otp = process.env.UATU_TEST_OTP;
|
||||
const phone = process.env.SANDERLING_TEST_PHONE;
|
||||
const otp = process.env.SANDERLING_TEST_OTP;
|
||||
export const credentials = { phone, otp };
|
||||
`)
|
||||
result, err := Bundle(Options{
|
||||
EntryFile: entry,
|
||||
Defines: map[string]string{
|
||||
"UATU_TEST_PHONE": "+919876543210",
|
||||
"UATU_TEST_OTP": "123456",
|
||||
"SANDERLING_TEST_PHONE": "+919876543210",
|
||||
"SANDERLING_TEST_OTP": "123456",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -87,13 +87,13 @@ func TestBundle_DeterministicHash(t *testing.T) {
|
||||
|
||||
func TestBundle_HashChangesWithDefines(t *testing.T) {
|
||||
entry := writeFixture(t, "spec.ts", `
|
||||
export const phone = process.env.UATU_TEST_PHONE;
|
||||
export const phone = process.env.SANDERLING_TEST_PHONE;
|
||||
`)
|
||||
first, err := Bundle(Options{EntryFile: entry, Defines: map[string]string{"UATU_TEST_PHONE": "1111"}})
|
||||
first, err := Bundle(Options{EntryFile: entry, Defines: map[string]string{"SANDERLING_TEST_PHONE": "1111"}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
second, err := Bundle(Options{EntryFile: entry, Defines: map[string]string{"UATU_TEST_PHONE": "2222"}})
|
||||
second, err := Bundle(Options{EntryFile: entry, Defines: map[string]string{"SANDERLING_TEST_PHONE": "2222"}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/driver"
|
||||
driverpb "github.com/priyanshujain/uatu/proto/driverpb"
|
||||
"github.com/priyanshujain/sanderling/internal/driver"
|
||||
driverpb "github.com/priyanshujain/sanderling/proto/driverpb"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
driverpb "github.com/priyanshujain/uatu/proto/driverpb"
|
||||
driverpb "github.com/priyanshujain/sanderling/proto/driverpb"
|
||||
)
|
||||
|
||||
type fakeServer struct {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/driver"
|
||||
"github.com/priyanshujain/sanderling/internal/driver"
|
||||
)
|
||||
|
||||
type ActionKind string
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/driver"
|
||||
"github.com/priyanshujain/sanderling/internal/driver"
|
||||
)
|
||||
|
||||
func TestNew_Defaults(t *testing.T) {
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>uatu inspect</title>
|
||||
<title>sanderling inspect</title>
|
||||
<script type="module" crossorigin src="/assets/index-DFpYQDqN.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BSJUf7yI.css">
|
||||
</head>
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/trace"
|
||||
"github.com/priyanshujain/sanderling/internal/trace"
|
||||
)
|
||||
|
||||
// Maximum size of a single trace.jsonl line. Hierarchies and snapshots
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/trace"
|
||||
"github.com/priyanshujain/sanderling/internal/trace"
|
||||
)
|
||||
|
||||
func TestScan_OrdersByStartedAtDescendingAndCountsViolations(t *testing.T) {
|
||||
|
||||
@@ -20,7 +20,7 @@ type ServerOptions struct {
|
||||
DevTarget string
|
||||
}
|
||||
|
||||
// Server holds the HTTP handlers for `uatu inspect`.
|
||||
// Server holds the HTTP handlers for `sanderling inspect`.
|
||||
type Server struct {
|
||||
options ServerOptions
|
||||
cache *Cache
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/trace"
|
||||
"github.com/priyanshujain/sanderling/internal/trace"
|
||||
)
|
||||
|
||||
func newFixtureServer(t *testing.T) (*Server, string) {
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/agent"
|
||||
"github.com/priyanshujain/uatu/internal/driver"
|
||||
"github.com/priyanshujain/uatu/internal/hierarchy"
|
||||
"github.com/priyanshujain/uatu/internal/ltl"
|
||||
"github.com/priyanshujain/uatu/internal/trace"
|
||||
"github.com/priyanshujain/uatu/internal/verifier"
|
||||
"github.com/priyanshujain/sanderling/internal/agent"
|
||||
"github.com/priyanshujain/sanderling/internal/driver"
|
||||
"github.com/priyanshujain/sanderling/internal/hierarchy"
|
||||
"github.com/priyanshujain/sanderling/internal/ltl"
|
||||
"github.com/priyanshujain/sanderling/internal/trace"
|
||||
"github.com/priyanshujain/sanderling/internal/verifier"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
|
||||
@@ -15,19 +15,19 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/agent"
|
||||
mockdriver "github.com/priyanshujain/uatu/internal/driver/mock"
|
||||
"github.com/priyanshujain/uatu/internal/trace"
|
||||
"github.com/priyanshujain/uatu/internal/verifier"
|
||||
"github.com/priyanshujain/sanderling/internal/agent"
|
||||
mockdriver "github.com/priyanshujain/sanderling/internal/driver/mock"
|
||||
"github.com/priyanshujain/sanderling/internal/trace"
|
||||
"github.com/priyanshujain/sanderling/internal/verifier"
|
||||
)
|
||||
|
||||
const fixtureSpec = `
|
||||
const screen = __uatu__.extract(state => state.snapshots.screen ?? "");
|
||||
const balance = __uatu__.extract(state => state.snapshots.balance ?? 0);
|
||||
const screen = __sanderling__.extract(state => state.snapshots.screen ?? "");
|
||||
const balance = __sanderling__.extract(state => state.snapshots.balance ?? 0);
|
||||
globalThis.properties = {
|
||||
balanceNonNegative: __uatu__.always(() => balance.current >= 0),
|
||||
balanceNonNegative: __sanderling__.always(() => balance.current >= 0),
|
||||
};
|
||||
globalThis.actions = __uatu__.actions(() => [__uatu__.tap({ on: "id:next" })]);
|
||||
globalThis.actions = __sanderling__.actions(() => [__sanderling__.tap({ on: "id:next" })]);
|
||||
`
|
||||
|
||||
type harness struct {
|
||||
@@ -195,9 +195,9 @@ func TestRunner_ViolationSurfacesInSummary(t *testing.T) {
|
||||
func TestRunner_ThrowingPredicateIsLoggedNotPanic(t *testing.T) {
|
||||
const throwingSpec = `
|
||||
globalThis.properties = {
|
||||
broken: __uatu__.always(() => { throw new Error("bad predicate"); }),
|
||||
broken: __sanderling__.always(() => { throw new Error("bad predicate"); }),
|
||||
};
|
||||
globalThis.actions = __uatu__.actions(() => [__uatu__.tap({ on: "id:next" })]);
|
||||
globalThis.actions = __sanderling__.actions(() => [__sanderling__.tap({ on: "id:next" })]);
|
||||
`
|
||||
state := newHarnessWithSpec(t, []map[string]json.RawMessage{{}, {}}, throwingSpec)
|
||||
state.startSDK(t)
|
||||
|
||||
@@ -23,12 +23,12 @@ func EmbeddedSHA256() string {
|
||||
// matching checksum, no rewrite happens. Returns the JAR path.
|
||||
func Extract(dir string) (string, error) {
|
||||
if len(embeddedJAR) == 0 {
|
||||
return "", errors.New("sidecar: binary built without -tags withsidecar; rebuild with `make uatu`")
|
||||
return "", errors.New("sidecar: binary built without -tags withsidecar; rebuild with `make sanderling`")
|
||||
}
|
||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||
return "", fmt.Errorf("mkdir %s: %w", dir, err)
|
||||
}
|
||||
jarPath := filepath.Join(dir, "uatu-sidecar.jar")
|
||||
jarPath := filepath.Join(dir, "sanderling-sidecar.jar")
|
||||
checksumPath := jarPath + ".sha256"
|
||||
checksum := EmbeddedSHA256()
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@ package sidecar
|
||||
var embeddedJAR []byte
|
||||
|
||||
// IsPlaceholder reports whether the binary was built without the real
|
||||
// sidecar JAR embedded. Build with `make uatu` (which passes
|
||||
// sidecar JAR embedded. Build with `make sanderling` (which passes
|
||||
// -tags withsidecar) to embed the real fat JAR.
|
||||
func IsPlaceholder() bool { return true }
|
||||
@@ -25,7 +25,7 @@ func TestExtract_WritesJARAndChecksum(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if path != filepath.Join(directory, "uatu-sidecar.jar") {
|
||||
if path != filepath.Join(directory, "sanderling-sidecar.jar") {
|
||||
t.Errorf("unexpected path: %s", path)
|
||||
}
|
||||
body, err := os.ReadFile(path)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/hierarchy"
|
||||
"github.com/priyanshujain/sanderling/internal/hierarchy"
|
||||
)
|
||||
|
||||
type Step struct {
|
||||
@@ -74,7 +74,7 @@ type Meta struct {
|
||||
BundleID string `json:"bundle_id"`
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
EndedAt *time.Time `json:"ended_at,omitempty"`
|
||||
UatuVersion string `json:"uatu_version"`
|
||||
SanderlingVersion string `json:"sanderling_version"`
|
||||
}
|
||||
|
||||
type Writer struct {
|
||||
|
||||
@@ -25,7 +25,7 @@ func TestWriteMeta_RoundTrip(t *testing.T) {
|
||||
Platform: "android",
|
||||
BundleID: "in.okcredit.merchant",
|
||||
StartedAt: time.Date(2026, 4, 17, 22, 30, 0, 0, time.UTC),
|
||||
UatuVersion: "0.0.1",
|
||||
SanderlingVersion: "0.0.1",
|
||||
}
|
||||
if err := writer.WriteMeta(meta); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -60,7 +60,7 @@ func TestWriteMeta_EndedAtRoundTrip(t *testing.T) {
|
||||
BundleID: "in.test",
|
||||
StartedAt: time.Date(2026, 4, 17, 22, 30, 0, 0, time.UTC),
|
||||
EndedAt: &endedAt,
|
||||
UatuVersion: "0.0.1",
|
||||
SanderlingVersion: "0.0.1",
|
||||
}
|
||||
if err := writer.WriteMeta(meta); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/hierarchy"
|
||||
"github.com/priyanshujain/sanderling/internal/hierarchy"
|
||||
)
|
||||
|
||||
// TestStateAxFindWorks verifies that a Parse+PushSnapshot+extract round trip
|
||||
@@ -24,11 +24,11 @@ func TestStateAxFindWorks(t *testing.T) {
|
||||
|
||||
verifier := newVerifier(t)
|
||||
mustLoad(t, verifier, `
|
||||
globalThis.probe = __uatu__.extract(state => {
|
||||
globalThis.probe = __sanderling__.extract(state => {
|
||||
const element = state.ax.find("id:select_language");
|
||||
return element ? "matched:" + element.text : "miss";
|
||||
});
|
||||
globalThis.count = __uatu__.extract(state => state.ax.findAll("id:select_language").length);
|
||||
globalThis.count = __sanderling__.extract(state => state.ax.findAll("id:select_language").length);
|
||||
`)
|
||||
|
||||
if err := verifier.PushSnapshot(SnapshotInput{Snapshots: Snapshots{}, Tree: tree}); err != nil {
|
||||
|
||||
@@ -80,11 +80,11 @@ type formulaSpec struct {
|
||||
}
|
||||
|
||||
const (
|
||||
tagFormula = "__uatuFormula"
|
||||
tagFormulaSpecIndex = "__uatuFormulaSpec"
|
||||
tagActionGenerator = "__uatuActionGenerator"
|
||||
tagInternalKind = "__uatuKind"
|
||||
tagSelector = "__uatuSelector"
|
||||
tagFormula = "__sanderlingFormula"
|
||||
tagFormulaSpecIndex = "__sanderlingFormulaSpec"
|
||||
tagActionGenerator = "__sanderlingActionGenerator"
|
||||
tagInternalKind = "__sanderlingKind"
|
||||
tagSelector = "__sanderlingSelector"
|
||||
|
||||
internalKindActions = "actions"
|
||||
internalKindWeighted = "weighted"
|
||||
@@ -94,63 +94,63 @@ const (
|
||||
internalKindBuiltinPressKey = "pressKey"
|
||||
)
|
||||
|
||||
// installRuntimeBindings exposes globalThis.__uatu__ to the loaded spec.
|
||||
// installRuntimeBindings exposes globalThis.__sanderling__ to the loaded spec.
|
||||
func (v *Verifier) installRuntimeBindings() error {
|
||||
uatu := v.runtime.NewObject()
|
||||
sanderling := v.runtime.NewObject()
|
||||
|
||||
if err := uatu.Set("extract", v.bindExtract); err != nil {
|
||||
if err := sanderling.Set("extract", v.bindExtract); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("always", v.bindAlways); err != nil {
|
||||
if err := sanderling.Set("always", v.bindAlways); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("now", v.bindNow); err != nil {
|
||||
if err := sanderling.Set("now", v.bindNow); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("next", v.bindNext); err != nil {
|
||||
if err := sanderling.Set("next", v.bindNext); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("eventually", v.bindEventually); err != nil {
|
||||
if err := sanderling.Set("eventually", v.bindEventually); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("actions", v.bindActions); err != nil {
|
||||
if err := sanderling.Set("actions", v.bindActions); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("weighted", v.bindWeighted); err != nil {
|
||||
if err := sanderling.Set("weighted", v.bindWeighted); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("from", v.bindFrom); err != nil {
|
||||
if err := sanderling.Set("from", v.bindFrom); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("tap", v.bindTap); err != nil {
|
||||
if err := sanderling.Set("tap", v.bindTap); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("inputText", v.bindInputText); err != nil {
|
||||
if err := sanderling.Set("inputText", v.bindInputText); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("swipe", v.bindSwipe); err != nil {
|
||||
if err := sanderling.Set("swipe", v.bindSwipe); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("pressKey", v.bindPressKey); err != nil {
|
||||
if err := sanderling.Set("pressKey", v.bindPressKey); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("wait", v.bindWait); err != nil {
|
||||
if err := sanderling.Set("wait", v.bindWait); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("taps", v.builtinGenerator(internalKindBuiltinTaps)); err != nil {
|
||||
if err := sanderling.Set("taps", v.builtinGenerator(internalKindBuiltinTaps)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("swipes", v.builtinGenerator(internalKindBuiltinSwipes)); err != nil {
|
||||
if err := sanderling.Set("swipes", v.builtinGenerator(internalKindBuiltinSwipes)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("waitOnce", v.builtinGenerator(internalKindBuiltinWaitOnce)); err != nil {
|
||||
if err := sanderling.Set("waitOnce", v.builtinGenerator(internalKindBuiltinWaitOnce)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uatu.Set("pressKeys", v.builtinGenerator(internalKindBuiltinPressKey)); err != nil {
|
||||
if err := sanderling.Set("pressKeys", v.builtinGenerator(internalKindBuiltinPressKey)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return v.runtime.GlobalObject().Set("__uatu__", uatu)
|
||||
return v.runtime.GlobalObject().Set("__sanderling__", sanderling)
|
||||
}
|
||||
|
||||
func (v *Verifier) bindExtract(call goja.FunctionCall) goja.Value {
|
||||
@@ -172,7 +172,7 @@ func (v *Verifier) bindExtract(call goja.FunctionCall) goja.Value {
|
||||
|
||||
// bindAlways accepts either a predicate function (legacy shape) or a formula
|
||||
// handle (new shape). Both produce a formula handle tagged with
|
||||
// __uatuFormulaSpec.
|
||||
// __sanderlingFormulaSpec.
|
||||
func (v *Verifier) bindAlways(call goja.FunctionCall) goja.Value {
|
||||
if len(call.Arguments) != 1 {
|
||||
panic(v.runtime.NewTypeError("always requires exactly one argument"))
|
||||
@@ -258,9 +258,9 @@ func (v *Verifier) formulaHandle(kind specKind, index int) *goja.Object {
|
||||
handle := v.runtime.NewObject()
|
||||
_ = handle.Set(tagFormula, true)
|
||||
_ = handle.Set(tagFormulaSpecIndex, index)
|
||||
// Keep __uatuIndex as an alias so older property shapes that read it keep
|
||||
// Keep __sanderlingIndex as an alias so older property shapes that read it keep
|
||||
// working during backward-compat transitions.
|
||||
_ = handle.Set("__uatuIndex", index)
|
||||
_ = handle.Set("__sanderlingIndex", index)
|
||||
|
||||
_ = handle.Set("implies", v.binaryChain(index, specKindImplies))
|
||||
_ = handle.Set("or", v.binaryChain(index, specKindOr))
|
||||
@@ -326,7 +326,7 @@ func (v *Verifier) eventuallyWithin(selfIndex int) func(call goja.FunctionCall)
|
||||
}
|
||||
}
|
||||
|
||||
// extractSpecIndex reads __uatuFormulaSpec from a JS formula handle.
|
||||
// extractSpecIndex reads __sanderlingFormulaSpec from a JS formula handle.
|
||||
func (v *Verifier) extractSpecIndex(value goja.Value) (int, bool) {
|
||||
if value == nil || goja.IsNull(value) || goja.IsUndefined(value) {
|
||||
return 0, false
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/dop251/goja"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/hierarchy"
|
||||
"github.com/priyanshujain/sanderling/internal/hierarchy"
|
||||
)
|
||||
|
||||
// Snapshots is the per-step extractor output forwarded by the SDK.
|
||||
|
||||
@@ -5,13 +5,13 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/bundler"
|
||||
"github.com/priyanshujain/uatu/internal/hierarchy"
|
||||
"github.com/priyanshujain/uatu/internal/ltl"
|
||||
"github.com/priyanshujain/sanderling/internal/bundler"
|
||||
"github.com/priyanshujain/sanderling/internal/hierarchy"
|
||||
"github.com/priyanshujain/sanderling/internal/ltl"
|
||||
)
|
||||
|
||||
// bundleIntegrationSpec bundles testdata/integration_spec.ts via the real
|
||||
// @uatu/spec API so the integration test exercises the same path the CLI
|
||||
// @sanderling/spec API so the integration test exercises the same path the CLI
|
||||
// uses, with no reference to any specific example app.
|
||||
func bundleIntegrationSpec(t *testing.T) string {
|
||||
t.Helper()
|
||||
@@ -30,8 +30,8 @@ func bundleIntegrationSpec(t *testing.T) string {
|
||||
bundle, err := bundler.Bundle(bundler.Options{
|
||||
EntryFile: specPath,
|
||||
Aliases: map[string]string{
|
||||
"@uatu/spec": apiPath,
|
||||
"@uatu/spec/defaults/properties": defaultsPath,
|
||||
"@sanderling/spec": apiPath,
|
||||
"@sanderling/spec/defaults/properties": defaultsPath,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import {
|
||||
eventually,
|
||||
extract,
|
||||
weighted,
|
||||
} from "@uatu/spec";
|
||||
import { noUncaughtExceptions } from "@uatu/spec/defaults/properties";
|
||||
} from "@sanderling/spec";
|
||||
import { noUncaughtExceptions } from "@sanderling/spec/defaults/properties";
|
||||
|
||||
const route = extract<string>(
|
||||
(state) => (state.snapshots.route as string) ?? "",
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/ltl"
|
||||
"github.com/priyanshujain/sanderling/internal/ltl"
|
||||
)
|
||||
|
||||
func newVerifier(t *testing.T, options ...Option) *Verifier {
|
||||
@@ -27,18 +27,18 @@ func mustLoad(t *testing.T, verifier *Verifier, source string) {
|
||||
}
|
||||
|
||||
const helloSpec = `
|
||||
const screen = __uatu__.extract(state => state.snapshots.screen ?? "");
|
||||
const balance = __uatu__.extract(state => state.snapshots["ledger.balance"] ?? 0);
|
||||
const screen = __sanderling__.extract(state => state.snapshots.screen ?? "");
|
||||
const balance = __sanderling__.extract(state => state.snapshots["ledger.balance"] ?? 0);
|
||||
|
||||
globalThis.screen = screen;
|
||||
globalThis.balance = balance;
|
||||
|
||||
globalThis.properties = {
|
||||
balanceNonNegative: __uatu__.always(() => balance.current >= 0),
|
||||
balanceNonNegative: __sanderling__.always(() => balance.current >= 0),
|
||||
};
|
||||
|
||||
globalThis.actions = __uatu__.actions(() => [
|
||||
__uatu__.tap({ on: "id:home_button" }),
|
||||
globalThis.actions = __sanderling__.actions(() => [
|
||||
__sanderling__.tap({ on: "id:home_button" }),
|
||||
]);
|
||||
`
|
||||
|
||||
@@ -135,9 +135,9 @@ func TestNextAction_FromActionsGenerator(t *testing.T) {
|
||||
func TestNextAction_WeightedSelectsByWeight(t *testing.T) {
|
||||
verifier := newVerifier(t, WithRand(rand.New(rand.NewPCG(42, 0))))
|
||||
mustLoad(t, verifier, `
|
||||
const tapHome = __uatu__.actions(() => [__uatu__.tap({ on: "id:home" })]);
|
||||
const tapAway = __uatu__.actions(() => [__uatu__.tap({ on: "id:away" })]);
|
||||
globalThis.actions = __uatu__.weighted(
|
||||
const tapHome = __sanderling__.actions(() => [__sanderling__.tap({ on: "id:home" })]);
|
||||
const tapAway = __sanderling__.actions(() => [__sanderling__.tap({ on: "id:away" })]);
|
||||
globalThis.actions = __sanderling__.weighted(
|
||||
[1, tapHome],
|
||||
[99, tapAway],
|
||||
);
|
||||
@@ -166,7 +166,7 @@ func TestNextAction_WeightedSelectsByWeight(t *testing.T) {
|
||||
func TestNextAction_EmptyGeneratorReturnsErrNoAction(t *testing.T) {
|
||||
verifier := newVerifier(t)
|
||||
mustLoad(t, verifier, `
|
||||
globalThis.actions = __uatu__.actions(() => []);
|
||||
globalThis.actions = __sanderling__.actions(() => []);
|
||||
`)
|
||||
_ = verifier.PushSnapshot(SnapshotInput{Snapshots: Snapshots{}})
|
||||
|
||||
@@ -179,8 +179,8 @@ func TestNextAction_EmptyGeneratorReturnsErrNoAction(t *testing.T) {
|
||||
func TestInputText_RoundTrip(t *testing.T) {
|
||||
verifier := newVerifier(t)
|
||||
mustLoad(t, verifier, `
|
||||
globalThis.actions = __uatu__.actions(() => [
|
||||
__uatu__.inputText({ into: "id:phone", text: "+919876543210" }),
|
||||
globalThis.actions = __sanderling__.actions(() => [
|
||||
__sanderling__.inputText({ into: "id:phone", text: "+919876543210" }),
|
||||
]);
|
||||
`)
|
||||
_ = verifier.PushSnapshot(SnapshotInput{Snapshots: Snapshots{}})
|
||||
@@ -200,7 +200,7 @@ func TestInputText_RoundTrip(t *testing.T) {
|
||||
func TestPushSnapshot_FeedsSnapshotsToExtractorState(t *testing.T) {
|
||||
verifier := newVerifier(t)
|
||||
mustLoad(t, verifier, `
|
||||
globalThis.captured = __uatu__.extract(state => state.snapshots["k"]);
|
||||
globalThis.captured = __sanderling__.extract(state => state.snapshots["k"]);
|
||||
`)
|
||||
if err := verifier.PushSnapshot(SnapshotInput{Snapshots: Snapshots{"k": json.RawMessage(`"hello"`)}}); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -222,7 +222,7 @@ func TestLoad_PropagatesSyntaxError(t *testing.T) {
|
||||
func TestEvaluateProperties_ThrowingPredicateDoesNotPanic(t *testing.T) {
|
||||
const spec = `
|
||||
globalThis.properties = {
|
||||
broken: __uatu__.always(() => { throw new Error("bad predicate"); }),
|
||||
broken: __sanderling__.always(() => { throw new Error("bad predicate"); }),
|
||||
};
|
||||
`
|
||||
verifier := newVerifier(t)
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
"github.com/dop251/goja"
|
||||
|
||||
"github.com/priyanshujain/uatu/internal/hierarchy"
|
||||
"github.com/priyanshujain/uatu/internal/ltl"
|
||||
"github.com/priyanshujain/sanderling/internal/hierarchy"
|
||||
"github.com/priyanshujain/sanderling/internal/ltl"
|
||||
)
|
||||
|
||||
type Verifier struct {
|
||||
|
||||
Reference in new issue
Block a user