feat(cua): release 0.38.0+artemis.1 with verified shell observation

Upgrade the pinned driver, validate menu and taskbar focus ownership, patch untitled Shell resolution, and remove duplicate scroll scaling. Publish package provenance, verification boundaries and matching marketplace checksum. Go tests, vet, build and byte-level package verification passed.
This commit is contained in:
chenmingxuan committed 2026-10-27 01:13:43 +08:00
1 parent dccddaa7e8
commit b780a60e8d
20 files changed
+759 -149

No files matched your search

+27 -63
View File
@@ -1,7 +1,6 @@
package main
import (
"errors"
"math"
"testing"
)
@@ -10,50 +9,30 @@ func fixtureFrame(w, h int) pointerFrame {
return pointerFrame{"current", w, h, obj{"left": -2560, "top": 120, "width": 2560, "height": 1540}}
}
func TestScrollMapsActualNativeCaptureWithoutDPIOrWindowOffset(t *testing.T) {
// Reproduce the task's 2558x1538 -> 1280x770 image transition. Window
// position and OS logical-screen dimensions must never affect this ratio.
f := fixtureFrame(1280, 770)
args := obj{"pid": 1, "window_id": 2, "capture_id": "current", "x": 900, "y": 600, "direction": "down"}
got, err := nativeScrollArgs(f, args, func() (pointerFrame, error) { return fixtureFrame(2558, 1538), nil })
if err != nil {
t.Fatal(err)
}
if math.Abs(got["x"].(float64)-1798.59375) > 0.0001 || math.Abs(got["y"].(float64)-1198.441558) > 0.0001 {
t.Fatalf("incorrect mapping: %v", got)
}
if _, ok := got["capture_id"]; ok {
t.Fatal("upstream scroll does not support capture_id")
}
if args["x"] != 900 || args["capture_id"] != "current" {
t.Fatal("input evidence mutated")
}
if got["pid"] != 1 || got["window_id"] != 2 || got["direction"] != "down" {
t.Fatal("target changed")
}
}
func TestNativeScrollAndNonCroppedCapture(t *testing.T) {
for _, size := range [][2]int{{2558, 1538}, {2560, 1540}, {1280, 770}} {
f := fixtureFrame(size[0], size[1])
args := obj{"capture_id": "current", "x": 200.5, "y": 300.25}
got, err := nativeScrollArgs(f, args, func() (pointerFrame, error) { return f, nil })
if err != nil || got["x"] != 200.5 || got["y"] != 300.25 {
t.Fatalf("native coordinates changed: %v %v", got, err)
func TestScrollPixelsReachUpstreamWithoutDoubleScaling(t *testing.T) {
for _, size := range [][2]int{{1280, 770}, {2558, 1538}, {2560, 1540}} {
frame := fixtureFrame(size[0], size[1])
args := obj{"pid": 1, "window_id": 2, "capture_id": "current", "x": 900.5, "y": 600.25, "direction": "down"}
if err := frame.validate("scroll", args); err != nil {
t.Fatal(err)
}
got := withoutCaptureBinding(args)
if got["x"] != 900.5 || got["y"] != 600.25 || got["pid"] != 1 || got["window_id"] != 2 {
t.Fatal(got)
}
if _, ok := got["capture_id"]; ok {
t.Fatal("upstream scroll rejects capture_id")
}
if args["capture_id"] != "current" {
t.Fatal("input evidence mutated")
}
}
// WGC can have a different native extent than a one-pixel DWM crop.
f := fixtureFrame(1280, 770)
got, err := nativeScrollArgs(f, obj{"capture_id": "current", "x": 640, "y": 385}, func() (pointerFrame, error) { return fixtureFrame(2560, 1540), nil })
if err != nil || got["x"] != float64(1280) || got["y"] != float64(770) {
t.Fatalf("assumed DWM crop: %v %v", got, err)
}
}
func TestInvalidCoordinatesNeverReachNativeProbe(t *testing.T) {
f := fixtureFrame(1280, 770)
func TestInvalidScrollCoordinatesAreRejectedBeforeDispatch(t *testing.T) {
frame := fixtureFrame(1280, 770)
for _, bad := range []obj{
{"capture_id": "current", "x": 1700, "y": 1000}, // Actual failing task.
{"capture_id": "current", "x": 1700, "y": 1000},
{"capture_id": "old", "x": 900, "y": 600},
{"x": 900, "y": 600},
{"capture_id": "current", "x": -1, "y": 0},
@@ -63,35 +42,20 @@ func TestInvalidCoordinatesNeverReachNativeProbe(t *testing.T) {
{"capture_id": "current", "x": math.NaN(), "y": 600},
{"capture_id": "current", "x": 900, "y": math.Inf(1)},
} {
_, err := nativeScrollArgs(f, bad, func() (pointerFrame, error) { t.Fatal("invalid coordinates reached probe"); return f, nil })
if err == nil {
if frame.validate("scroll", bad) == nil {
t.Fatalf("accepted %v", bad)
}
}
}
func TestScrollRejectsMovedResizedOrDifferentCrop(t *testing.T) {
f := fixtureFrame(1280, 770)
for _, kind := range []string{"moved", "resized", "crop", "missing"} {
native := fixtureFrame(2558, 1538)
switch kind {
case "moved":
native.window["left"] = 0
case "resized":
native.window["width"] = 1920
case "crop":
native.height = 1000
case "missing":
native.width = 0
func TestMovedOrResizedWindowInvalidatesFrame(t *testing.T) {
frame := fixtureFrame(1280, 770)
for _, key := range []string{"left", "top", "width", "height"} {
changed := copyArgs(frame.window)
changed[key] = num(changed[key]) + 1
if sameWindow(frame.window, changed) {
t.Fatal("accepted changed " + key)
}
_, err := nativeScrollArgs(f, obj{"capture_id": "current", "x": 900, "y": 600}, func() (pointerFrame, error) { return native, nil })
if err == nil {
t.Fatal(kind)
}
}
_, err := nativeScrollArgs(f, obj{"capture_id": "current", "x": 900, "y": 600}, func() (pointerFrame, error) { return pointerFrame{}, errors.New("capture disconnected") })
if err == nil {
t.Fatal("missing capture was accepted")
}
}