feat: harden loose-offline sync for user JWT, schema, and console ops

Enable Binding-scoped agent push/pull, empty-table schema ensure, SyncPage inspect/drop-table, default module import, and agent-bound publish docs from the 宇恒联调意见.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-08-05 09:47:35 +08:00
parent 76cdcd760e
commit b04b180d30
59 changed files with 4762 additions and 308 deletions

View File

@@ -0,0 +1,31 @@
package dbsync
import "testing"
func TestNormalizeSQLiteDSN(t *testing.T) {
got := normalizeSQLiteDSN(`file:E:\data\remote.db`)
if got != "file:E:/data/remote.db?_pragma=busy_timeout(5000)" {
t.Fatalf("got %q", got)
}
got = normalizeSQLiteDSN(`E:\data\remote.db`)
if got != "file:E:/data/remote.db?_pragma=busy_timeout(5000)" {
t.Fatalf("bare path got %q", got)
}
got = normalizeSQLiteDSN(`file:E:/data/remote.db?_pragma=foreign_keys(1)`)
if got != "file:E:/data/remote.db?_pragma=foreign_keys(1)&_pragma=busy_timeout(5000)" {
t.Fatalf("keep query got %q", got)
}
}
func TestIsRetryable(t *testing.T) {
if !IsRetryable(Retryable("x")) {
t.Fatal("expected retryable")
}
if IsRetryable(fmtError("plain")) {
t.Fatal("plain should not")
}
}
type fmtError string
func (e fmtError) Error() string { return string(e) }