88b4c00ea11c8653cada22e11edf20ab1594de43
58
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3a7d0314a9 |
usage: a window's Pace as a number on its card, and in the menu bar when asked (fflake33)
fflake33 on Discord asked for the pace as a figure, "+12%" or "−8%"
against an even pace through the window, on the Usage cards and in the
menu bar.
- provider: QuotaWindow.Pace(readAt, now) is the share used (0-100) less
the share of the window gone by, from Bounds (reset less span; a
month's window a calendar month); none for an unlimited window, one
whose span or reset isn't known, or outside it. WithWindowStarts sets
startsAt on copies of the cards for the GUI (the caches' cards are
left alone); /api/usage/quotas and its refresh send it.
- Usage page: "Pace +20%" on the reset line after the wait (quotaPace,
paceLine), its sign turned with the meter in Left mode, amber while
more is used than an even pace would have, what it means in its
tooltip. Past cycles and windows with no known start show none.
- Menu bar: Settings > Menu bar pace (settings.TrayPace, off by default;
hidden on Windows, whose tray shows no text) puts " +12%" beside each
figure ("42% −14%", at most 10 runes, trayRowMax) and "pace −14%" in
the tooltip. KeepOwn keeps it device-local like the other tray
settings; the Settings save keeps it (prefsKeep).
- Strings in en, zh, zh-TW, ja, de. gui-shell.md says it.
Run:
- go test -tags nogui ./internal/provider ./internal/gui ./internal/settings
./internal/usage: ok; ./internal/davsync: ok (now covers TrayPace;
red with TrayPace taken out of KeepOwn). go test ./internal/gui -run
Tray (darwin, with the tray image tests): ok.
- New TestWindowPace, TestWithWindowStarts (input not mutated),
TestTrayUsagePace (off unchanged, used and left, rows, tooltip).
- quota-pace.test.cjs, chromium and webkit: 4 pass; cards in en, zh,
zh-TW, ja, de at 1100 and 420px, used and left, amber, tooltips, no
sideways scroll, a click moves nothing; the Settings row in all five
at both widths, On posts trayPace, a currency save keeps it, no
scroll; hidden with no card and on Windows, shown on Linux. Red with
paceLine not called, with trayPace out of prefsKeep, and with the
Left-mode sign not turned.
- gui-de, gui-ja, gui-zh-tw, i18n-keys: 12 pass; tray-bird 6, quota-holds
2, quota-read-at 4 pass.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean.
Not tried: the real menu bar on a Mac or Linux tray.
|
||
|
|
eb22f6355a |
davsync: a computer joining a sync folder keeps the gateway keys the folder's store has never seen (#1737, #1714, ggbdpq)
The gateway-key store rides the settings part, and a first sync brings a part changed only on the server in whole. So a computer with its own gateway keys that joined a folder another computer had set up first had every key replaced by the folder's store (8ugMak1r on #1714 got them back only from the -this-computer copy in the sync folder). On the first sync, before the settings are brought in, the keys this computer holds that the store has neither by id nor by value are added to the store brought in; that merged store is restored here and pushed for the others. A key the folder holds wins; the LAN default key follows the folder's settings as before. After the join a key missing from a store this computer has seen is a removal, as before. ggbdpq's patch (a9605c8a), cherry-picked unchanged. Run (reviewer): TestGatewayKeysJoinKeepsUnseenKeys fails on the old davsync.go (the joining computer's keys are gone, the pushed store holds only the folder's default key, computer B never gets A's key) and passes with it, -race -count=3; TestGatewayKeysJoinWithoutStoreKeepsKeys passes on both. go test ./internal/davsync/... ok. Not tried against a real WebDAV server. |
||
|
|
b8e23db45a |
backup, davsync: an import or a sync installs the plugins and names the subscriptions to sign in to (yapechan)
yapechan on Discord (Windows, Synology WebDAV): after an import or a WebDAV
sync no providers showed on the other computer; adding the same provider by
hand made the synced settings and usage apply. No error, a restart didn't
help.
Cause. A backup and a sync carry providers.json as stored. For a
subscription that is its model picks and settings alone (no endpoint, no
key), and sign-ins are never carried by design; allProviders lists such an
entry only once an account is signed in here. plugins.json was not carried
at all, so a provider served by a plugin (every moved subscription, any
plugin provider) had nothing to come from on the other side. The import
said "N added" and "Needs a key: , " (the picks entries have no name and no
key), and the sync said nothing. API-key providers do come over: tried with
a nogui build in two sandbox HOMEs (DeepSeek, a custom relay, Kimi Code all
listed after `magpie restore`). No Windows-only path issue found.
What changed:
- provider.Carried(keys): the plugins added from npm or git, on/off and
their options (without keys, options whose names look like a key are left
out, as secret headers are). Folder plugins and plugin-auth.json stay.
- backup.Bundle.Plugins (nil from an older magpie). Restore installs the
ones not here through provider.AddPlugins (plugin.Add, then Off and
Options, then HandOver once); it never removes or changes one already
here. A failed install is reported, not a failed restore.
- Result.SignIn / provider.NotSignedIn: the subscriptions brought with no
account here. NeedKey no longer lists picks-only entries (provider.OnlyPicks).
- davsync: the providers part's hash covers the plugins (unchanged for a
setup without any), take/bring carry them, bring installs (logged on
failure), and Status().SignIn names what to sign in to.
- CLI restore and `magpie webdav`/`s3` status print both; the GUI's import
result and the sync row show them (en, zh, zh-TW, ja, de).
- docs/reference.md says what a backup carries now.
Run:
- go test -tags nogui ./internal/provider ./internal/backup ./internal/davsync
./internal/cli ./internal/gui in a sandbox HOME.
- New tests fail with the change broken by hand: TestPluginsCarried
(installed-skip and the HandOver guard), TestNotSignedIn,
TestRestorePluginsAndSignIn ("Needs a key: [ Acme]" without OnlyPicks),
TestSyncPluginsAndSignIn (bring not installing, Status not naming),
sync-sign-in.test.cjs (the lines removed).
- sync-sign-in.test.cjs: Chromium and WebKit, en/zh/ja/de, 900 and 440px,
16/16; it also caught subNames throwing while providers was still null.
sync-*.test.cjs, s3-sync, i18n-keys, gui-ja, gui-de pass.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
Not tried: a real plugin install from a real sync (the installs are stubbed
in tests); a real Synology server.
|
||
|
|
f82aba090b |
davsync, gui, cli: GitHub sync refuses a repository that isn't private (#1130)
The sealed setup is committed on every sync, so a public repository would hand anyone every version of it, the whole history, to try passphrases on offline. prepare now reads the repository's "private" field and refuses before writing when it is false or missing, naming the repository and what to do. The form's hint, the CLI usage and docs/reference.md say the repository must be private; sync-backup.md lists the rule and its verification command now points at ./internal/cli. Run: go test -tags nogui ./internal/davsync/ and the cli tests (TestGitHubCmd|TestWebdavCmd|TestS3Cmd|Help) green; TestGitHubPublicRepositoryRefused goes red with the check removed. GUI: github-sync, s3-sync, webdav-settings-refresh, sync-other-kind, sync-not-backup, i18n-keys, gui-zh-tw, gui-ja, gui-de in Chromium and WebKit, 72/72. Not tried against the real GitHub API. |
||
|
|
cdfe7629a5 |
davsync: GitHub sync's "not a magpie backup" advice names the file where it is, not under magpie/magpie/ (#1130)
fileWhere passed folder+"/"+file to g.at, which already puts the file under the configured folder and magpie/, so the recovery advice told the user to look at <folder>/magpie/magpie/sync.json, a file that isn't there. It now passes the file alone. Run: go test -tags nogui ./internal/davsync/ (green). TestGitHubNotBackup's new assertion goes red with the old path put back. |
||
|
|
1af326806f |
sync: magpie's setup syncs to an encrypted file in a GitHub repository, beside WebDAV and S3 (#1130)
A third sync kind: github://owner/repo[/folder] keeps the same sealed backup WebDAV and S3 keep, as <folder>/magpie/magpie.magpie-backup in a repository the user already has, written through GitHub's Contents API with a fine-grained token of its own (Contents read and write), kept in sync.json apart from the library's GitHub token. The token goes only to api.github.com: a redirect anywhere else is refused, and the passphrase may not equal it. Each update is a commit; an empty repository is initialised by the first backup. Settings › Sync gets a GitHub kind with Repository, Branch, Folder and token; magpie github mirrors magpie s3. Inactive servers of every kind are kept in Config.Servers (Other stays for older clients). Squashed from yetone/magpie#1130 at 6b5b1c693e1a3a23e177b4d376f3f7f70f3bc23d onto main. Merge resolutions: the CLI moved to internal/cli since the PR was cut, so github_cli_test.go moved there (package cli) and the github command, its help line and `magpie help github` were wired in internal/cli/main.go and help_cli.go; README's Sync row kept main's links and took the PR's wording; i18n.js zh-TW kept both sides. |
||
|
|
8792ee063d |
provider: a Volcengine or Tencent access key is kept through sync, restore, a stale editor and a copy, and a plan card without one says what to give (#1821, Edward4226)
The reporter's Volcengine Agent Plan card vanished: providers.json had
lost accessKeyID/secretAccessKey, and volcPlanQuotas skipped a provider
without them before building any card, so nothing said why.
Writers that dropped the access key, fixed at the cause:
- Sync and restore (Mirror, Restore, davsync take) kept this machine's
access key and balance token only when the incoming provider had no
key at all. A magpie before v0.1.1142 (
|
||
|
|
0d58ec8dcb |
davsync: a write a server without conditional PUTs let another go over is merged again at the next sync (#1776)
On an S3 server that refuses If-Match (Aliyun OSS answers 400 NotImplemented), put falls back to HEAD then an unconditional PUT. Two computers writing in the moment between both pass the HEAD, both are told they wrote, and the later file is kept. Worse, the loser's next sync then took the winner's file as having seen its own: its st.Remote was the file it wrote, so its changed parts looked unchanged here and changed there, and the old parts were brought in over its own changes. The edit was lost on the server and on the computer that made it. - version.Blind marks a write the server didn't check (s3.go's fallback). - state.Blind keeps, for such a write, the file's sum and the remote and local part hashes from before it. The next sync that reads another file than that one merges from before the write. What this computer changed counts as changed again and goes back up beside the other's. A 304 or the same file clears it. Restore and Upload clear it. - docs/reference.md says what happens on such a server. No compare-and-swap exists on OSS, so the race itself isn't closed: the other computer's file is kept for up to one sync interval (3 minutes) before this computer's change is merged back. The reporter's AppendObject journal would close it but needs every computer upgraded and OSS-only signing. If the other computer saw this one's write and then changed the same part again, the next sync can't tell that from a write that went over it. It counts the part as changed on both sides: the newer stays, the other is saved, and a notice says so. Nothing is lost. Run: - TestS3BlindWriteGoneOverIsMergedAgain (fake S3 with no conditional writes, two computers): A renames a provider and B sets the theme, B's PUT goes over A's, then A's next sync puts both on the server with no conflict notice, B brings in the rename, and nothing more is written. With the reset taken out (broken by hand), it fails: "A's rename here after its next sync: \"DeepSeek\"". - go test ./internal/davsync whole. Not tried against real Aliyun OSS: the fake answers conditional PUTs the way the reporter quotes OSS (NotImplemented). |
||
|
|
206dc085be |
provider: a magpie run from a terminal that only lists accounts no longer writes logins.json, and every change to it is made under a lock the gateway holds too, so a token the gateway just refreshed is never written back over (#1674, FaintGhost)
Every CLI command that reached Logins() (magpie ls, providers, sessions,
usage) ran rememberLogins, whose 30-second throttle (loginsSeenAt) lives
in the process, so in a new process it never held: each run moved Seen on
for the signed-in Codex and Claude accounts and wrote logins.json back.
loginsMu was an in-process mutex, so that read-modify-write could
interleave with the gateway's renewSavedLogin: the CLI reads, the gateway
writes a refreshed sign-in, the CLI writes what it read. Codex/OpenAI
refresh tokens are single use, so the account would be signed out.
- rememberLogins writes nothing when the only change is Seen and the saved
Seen is less than seenEvery (10 minutes) old (onlySeenMoved, comparing
with what was read, IDs and order normalised as writeLogins writes them;
sortLogins is split out of writeLogins for that).
- internal/filelock (new): davsync's TryLock/Unlock (flock; LockFileEx on
Windows) moved here and davsync uses it; Lock(path, wait) and
filelock.Mutex, a sync.Mutex that also holds the OS lock on a lock file.
A lock another magpie holds is waited for up to filelock.Wait (10s),
then gone on without, as before, so a stuck magpie never hangs others.
- loginsMu is a filelock.Mutex on logins.json.lock, so all 107 existing
Lock sites (every writeLogins is under one) are cross-process with no
change at the call sites. Taking it calls filememo.Look (new), so the
read under it isn't a parse filememo.Hold kept from before another
magpie's write. savedTokenMu holds logins.json.renew.lock the same way:
two magpies never refresh one saved account at once.
- Siblings: caller-keys.json (access.mu: magpie keys from the CLI vs the
window; a lost revoke would bring a key back) and mcp-signins.json
(mcpauth.fileMu, plus mcp-signins.json.renew.lock around renew, since
library's MCP check renews from the CLI too) get the same lock.
plugin-auth.json already has one (plugin-auth.json.lock, shared with
host.js). Not covered: providers.json (33 store sites with no
in-process lock either; user-entered keys, nothing refreshed there),
migrations.json/settings.json (no credentials), and the agents' own
files (~/.codex/auth.json etc.: the agent itself writes them without
any lock of ours, so a magpie-only lock can't make them safe).
Tests:
- TestReadOnlyRunLeavesLogins: Codex and Claude signed in, Seen a minute
old, file time set back; three "new processes" of Logins("")/codex/
claude/All() leave logins.json's bytes and mtime as they were. Seen an
hour old is written; Codex's own refresh is written at once.
- TestLoginsKeepAnotherMagpiesWrite: between this process's read and write
(beforeLoginsWrite hook) a second test process (TestLoginsOtherMagpie,
os.Args[0] -test.run) renews the saved work@ account's refresh token;
both the renewed token and this process's change are in the file.
- TestLoginsReadAfreshUnderLock: with filememo.Hold held, a write
filememo never heard of is seen by a read under loginsMu.
- TestLockAcrossProcesses (filelock): a holder subprocess makes Lock wait
and give up after its wait; killed, the lock is free; a Mutex holds it.
Broken by hand: onlySeenMoved bypassed -> TestReadOnlyRunLeavesLogins
FAIL "a run that only listed the accounts wrote logins.json"; the file
lock taken out of filelock.Mutex.Lock -> TestLoginsKeepAnotherMagpiesWrite
FAIL "the other magpie's renewed sign-in was written over"; Locked hook
emptied -> TestLoginsReadAfreshUnderLock FAIL. Each restored, green.
Ran: gofmt -l (nothing); go vet ./..., GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./...; go build, GOOS=linux go build -tags
nogui, GOOS=windows go build; go test -tags nogui -count=1 ./... under a
temp HOME with pinned caches: all ok but internal/provider, whose
TestReadOnlyRunLeavesLogins failed at that point from its own fixture
(two rewrites of one size given the same mtime read as unchanged by
filememo); fixed in the test, then internal/provider, access, mcpauth,
filememo, filelock and davsync -count=1 all ok, and the three new provider
tests -race -count=10 ok.
Not tried: the reporter's Linux arm64 box with a real systemd gateway and
real Codex accounts; Windows (LockFileEx path) only vetted and built, not
run on the Windows box.
|
||
|
|
aa82288fb6 |
usage: Volcengine Ark's Coding Plan and Agent Plan windows, read with the account's access key (#1427, yayoinoyume)
Ark tells a Coding Plan's or Agent Plan's 5-hour, weekly and monthly
windows only to the account's control plane (GetCodingPlanUsage,
GetAFPUsage on open.volcengineapi.com), signed with the account's
AccessKey ID and Secret, never to the plan's inference key. An Ark
provider's editor now takes that access key, and the Usage page shows the
plan's windows as a card.
From yayoinoyume's feat/volcengine-usage, reviewed and reworked:
- Signing is volc-sdk-golang's (base/sign.go GetSignRequest, 06f9ef66):
signed headers sorted (content-type;host;x-content-sha256;x-date), only
Action and Version in the query. The branch signed them unsorted and put
Region in the query. TestVolcSignMatchesSDK pins two signatures the SDK
made.
- The card is in PlanQuotas beside the Step Plan's (its cache, last
reading, refresh and `magpie quota wait`), not in the subscription
cards. One per access key and plan.
- The plan is the endpoint's: /api/coding asks GetCodingPlanUsage,
/api/plan GetAFPUsage, pay-as-you-go none, in the host's region. The
branch asked both and showed whichever answered.
- Dropped guessed reply fields; the Coding Plan reply is the one
pi-ark-usage, dsh-ark-quota and ArkCodingPlanUsage read. AFP buckets are
read in the forms dsh-ark-quota and arkcli read (Used of Quota or Total,
or Percent), plus Tier; none was seen from a real account.
- An Ark provider is known by its host, not the preset id, so a copy or a
custom provider takes the key too.
- The Secret is never sent to the page (accessKey {id, secretSet}); a
blank Secret keeps it, a save without the ID keeps both, Remove
(clearAccessKey) drops both, an ID with no Secret is refused.
- The pair goes where keys go: AddCopy, Restore, Mirror, backups and
davsync carry it only with keys (withoutKeys), and a keyless restore or
sync keeps this machine's. CLI: access.key, access.secret.
- A changed access key drops the cached cards (ForgetPlanQuotas).
- UI strings in zh, zh-TW, ja and de.
Nothing was tried against the real Volcengine API: there was no access
key. A local fake checked the real request PlanQuotas makes against
volc-sdk-golang's own GetSignRequest (both actions, two regions); it
lives outside the repo, so go.mod is unchanged.
Run: gofmt -l; go vet (darwin), GOOS=linux and GOOS=windows go vet
-tags nogui on provider, gui, backup, davsync and the root; go test
-tags nogui ./internal/provider ./internal/gui ./internal/backup
./internal/davsync . under a temp HOME; node --test
volc-access-key, zhipu-team, gui-ja, gui-de, i18n-keys in Chromium and
WebKit. Fail without the change: TestVolcSignMatchesSDK (unsorted
headers), TestAddCopy, TestBackupBalanceToken, TestNoKeys,
TestTakeBalanceToken, TestSyncBalanceToken (pair not carried),
TestProviderSaveKeepsVolcengineSecret (blank Secret dropped),
volc-access-key (Remove not posted).
Co-authored-by: YAYOI27 <111715843+yayoinoyume@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
be2037285a |
davsync, gui: a server file that isn't a backup is said as what it is, and can be replaced by this computer's setup (JasonLeeForOnly on Discord)
JasonLeeForOnly's WebDAV sync failed with only "not a magpie backup" for
several versions, and nothing on the page got past it. A WebDAV GET of the
backup can come back as a body that isn't the file in several ways; each is
now reproduced with an httptest server that answers the way the real one
does:
Unpacked (WebDAV and S3): gzip with or without Content-Encoding (a proxy
that drops the header), x-gzip, zstd with or without the header, deflate
(zlib or raw), and a header that says gzip over a plain body. Bodies are
told by magic number; a backup is JSON, so either magic is never the file.
Brotli (br) can't be unpacked and is said as itself, with what to turn off.
Said, with no upload offered: an HTML page answered with 200 (Nextcloud
login after a redirect, Cloudflare Access, an AList/OpenList web app, an
rclone directory listing, a captive portal), with its <title> and the
host/path a redirect ended at (query, fragment and user dropped), and
where the WebDAV address is for 坚果云 and Nextcloud; an XML answer, by its
root element.
Said, with Upload as the way out: an empty (0-byte) file, a backup cut
short or damaged (the automatic rebuild is unchanged and still goes first
when its rules allow), another app's file ("format": "…"), other JSON,
and any other file by its content type. Messages carry the size, kind and a
page title only, never the file's contents.
backup.Open now tells ErrNotBackup (doesn't begin like a backup) from
ErrCorrupt (begins like one, cut short). The status carries the kind as
serverFile; Settings › Sync and backup says it in the reader's language,
wraps it whole, and shows "Upload this computer's setup" only when the file
may be replaced. davsync.Upload (POST /api/davsync/upload, `magpie webdav
upload`, `magpie s3 upload`) asks first in the GUI, re-reads the file,
refuses a backup this computer opens, one sealed with another passphrase,
a newer magpie's, a page and an XML answer, keeps the server's copy in the
sync folder (0600, newest 5) and writes nothing if that fails, then writes
with If-Match on the version read. New strings in en, zh, zh-TW, ja, de.
Verified: internal/davsync/not_backup_test.go (TestReadCompressedBackup,
TestReadBrotliSaid, TestServerAnswerSaid, TestCutBackupSaidAndUploaded,
TestS3ReadCompressedObject; Upload-only parts stripped to compile) fails
on
|
||
|
|
b37a082c48 |
davsync: WebDAV sync reads the backup uncompressed, so its ETag matches the write after it (#1362, laiquziru: TeraCloud synced once, then every sync said "the file on the server changed meanwhile")
What: dav.get sends Accept-Encoding: identity, and unpacks a body a server gzips anyway (Go only unpacks what it asked gzip for itself). Why: Go's client asks for gzip on every GET. InfiniCLOUD's (TeraCloud's) WebDAV is Apache mod_dav_fs, whose PUT answers with no ETag (mod_dav.c's dav_created: "### insert an ETag header?"), so the sync after the first reads the file in full and pushes over the ETag that read gave. Apache's mod_deflate (DeflateAlterETag AddSuffix, the default) gives the gzip copy "<etag>-gzip", which no If-Match on the file matches: every write after the first was 412, the retry read the same -gzip tag, and the state left the local change pending, so every sync after failed. A read asked for as it is gets the file's own ETag. nginx-style proxies that weaken the ETag (W/"...") on gzip are covered by the same change. TeraCloud behaviour assumed: seen without an account on 2026-10-09 against https://domi.teracloud.jp: OPTIONS /dav/ says Server: Apache and DAV: <http://apache.org/dav/propset/fs/1>; GET / with Accept-Encoding: gzip gives ETag "fb-5d88268abcf08-gzip" + Content-Encoding: gzip, without it "fb-5d88268abcf08"; GET with If-Match the -gzip tag is 412, with the plain tag 200. Not seen: that mod_deflate compresses files under /dav/ (needs an account). The fake (apacheDAV in teracloud_test.go) does: no ETag on PUT, gzip + "-gzip" ETag on a GET that accepts gzip, If-Match strong against the file's own ETag. Real conflict detection is unchanged: If-Match is still sent with the version read; TestSyncTeraCloudStillSeesOtherWrites lands another computer's write between a's read and write on the same fake and checks the 412, the merge over it, and b's file kept aside. Run: - new tests fail on the old code: without identity, TestSyncTeraCloudGzipETag "sync 2 after the first: the file on the server changed meanwhile (2 writes refused, 2 reads sent gzip)"; with If-Match dropped, TestSyncTeraCloudStillSeesOtherWrites "write over a replaced version: <nil>, want errChanged"; without the unpack, TestDAVGetGzipAnyway reads gzip bytes. All pass restored. - sandbox HOME, pinned caches: go test -race -tags nogui ./internal/davsync/ ./internal/gui/ . ok; -race -count=5 on the davsync sync/conditional/ short-write/Nutstore tests ok - gofmt -l clean; go vet (darwin, darwin nogui, linux nogui, windows) of internal/davsync; go build darwin, linux nogui, windows Not run: a real TeraCloud account. |
||
|
|
10f7b4aa3f |
davsync, gui: a WebDAV server whose HEAD says Content-Length: 0 no longer fails every shared usage day as "kept 0 of 6869 bytes", and a usage share that failed is its own red line under the sync status (#1259, mzcinf on 坚果云)
After each PUT, check read the file's size from a HEAD and called anything
shorter a cut write. On 坚果云 every usage write failed that way with 0
bytes kept, three tries each; the 0 can only have come from the HEAD's
Content-Length, since a 6869-byte body that the PUT sends with its
Content-Length (not chunked) isn't cut by a dropping network three times
running. A HEAD that says short is now asked again of PROPFIND (Depth 0)
getcontentlength, the size WebDAV clients of 坚果云 read. The write counts
as kept when that size is whole. When PROPFIND gives no size, the HEAD's
stands. A real cut write is still told as cut, with the bytes PROPFIND
says were kept. The extra request is made only after a short HEAD, so
坚果云's request limit isn't spent on servers whose HEAD is right. The
backup's own PUT goes through the same check, so a 坚果云 user whose
setup changes would have hit the same error on the main sync.
Settings > Sync put "Couldn't share usage: …" in the same grey line as
"Synced · host", so it read as part of a sync that went fine. It is now a
line of its own under the status, in red, wrapped whole at 440px. The CLI
already printed it on its own line.
Verified: TestNutstoreHeadSaysNoLength and TestNutstoreBackupWrite use a
fake 坚果云: HEAD Content-Length: 0, real getcontentlength on PROPFIND,
409 for a read in a missing folder, a chunked PUT refused. Whole writes
sync with no usage error, and each write goes once with one HEAD and one
PROPFIND. A tunnel that keeps half is still told as cut, with the half it kept.
On the old dav.go all three fail ("the WebDAV server kept 0 of 536 bytes
of magpie.magpie-backup", "kept 0 of 6869"). TestDAVShortWrite and
TestUsageSharedShortWrite/TestUsageSyncShortWrite pass unchanged.
sync-usage-error.test.cjs runs in Chromium and WebKit, en/zh/ja/de, at
900 and 440px, and fails on the old app.js ("the status line carries no
usage error: 14:46 已同步 · dav.jianguoyun.com · 用量未能共享:…"). The
sync-*, s3-sync, usage-computers, gui-ja, gui-de, gui-zh-tw, i18n-keys
and click-scroll tests pass, 78/78. go test -tags nogui -count=1
./internal/davsync ./internal/gui pass under a temp HOME. go vet passes
on darwin, GOOS=linux and GOOS=windows. Not tried against a real 坚果云
account: that its HEAD answers 0 is inferred from the error, and that its
PROPFIND gives the real size is how its other WebDAV clients read sizes,
neither seen here.
|
||
|
|
be1ce5d4d2 |
davsync: incomplete S3 listings keep cached usage days (#1243)
Reject truncated listings with missing or repeated tokens and listings that exceed the page limit. On the old code the regression reports successful partial listings and shareWith removes a cached day. Focused tests pass in a temporary HOME. |
||
|
|
30a8ce2915 |
davsync tests: TestSlowTransferIsNotCutShort's watchdog is a second, not 300 ms, over ~24 MB each way
A line that never stops is all this test sends, so a 300 ms watchdog only
catches the runner itself pausing: red on macOS in run 37693090857 at
7.99s, near the end of the GET, where a full run takes 7.23s and 8 runs
under 3x CPU oversubscription here all passed. The server's 40 ms gap is
still 25x inside the watchdog, the PUT's tail is still twice it, and with
allSent's extension taken out the test still fails ("took nothing for 1s
(PUT)").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
e22d5eef81 |
davsync tests: the slow transfer's line is narrow both ways, so a download on macOS doesn't burst through the tuned-up buffers past the 300ms watchdog (TestSlowTransferIsNotCutShort red on macos-latest in main's run 37693090857: "took nothing for 300ms (GET)"; b1cba654 narrowed only the upload's way)
|
||
|
|
e961836fb0 |
usage, gateway, gui, provider, cli: the tests pass when a run crosses midnight, and a usage answer reads the clock once (#1046)
* usage: the usage tests pass at any time of day, midnight included The usage tests stamped their calls with the machine's time and then asked for today, 7 or 30 days, or a cached answer, which the code worked out from its own time.Now a moment later. A minute after midnight a call made "a minute ago" was yesterday's, and when midnight fell between the test's read and the code's, the call and the period were of two days. magpie usage, the TUI's Usage page, the two Codex cache-write tests and the computers' shared days failed in the first minutes after midnight (the TUI's after midnight UTC, the zone its package's tests run in since |
||
|
|
b1cba65477 |
davsync tests: the slow transfer runs on a line with small buffers, and the PUT's tail is the server's to hold (TestSlowTransferIsNotCutShort red on ubuntu in PR #1030's run 37466034290: "the server sent and took nothing for 300ms (PUT)")
The test scales the watchdog from 60 s down to 300 ms and sends 20 MB at 6.4 MB/s, taking each of magpie's reads of the body as the line moving. On Linux the line's buffers aren't scaled with it: the kernel hands a writer room in bursts, waking it once a third of its send buffer has drained, and it tunes that buffer up to 4 MB (the receiver's window opens in steps the same way). A probe on magpie's body reads in a golang:1.26.3 container showed gaps of 130–290 ms between two of them while the line never stopped, every run; one over 300 ms failed the test. That is the test's ratio, not the watchdog's: at the real 60 s, a burst that long needs a line under ~25 KB/s. Not a race (the same in -race and without).
narrowLine serves the fake WebDAV server and gives the client with both ends' buffers held to 128 KB (SetWriteBuffer on the client's connection, SetReadBuffer on the server's), so a burst is a chunk or two. The MBs that used to sit in the buffers after magpie had handed the body over, which is what allSent's longer wait is for, are now the server's own tail: it answers the PUT twice the watchdog after the body is in. The server also grows its buffer to the body's length up front.
On Linux (golang:1.26.3, 14 CPUs): before, 5 of 30 runs failed (-race -count=10 -cpu 1,2,4); after, 30 of 30 pass, and -race -count=20 -cpu 1,2,8 of TestSlowTransferIsNotCutShort, TestStalledTransferFailsPromptly and TestMetadataRequestHasALimit with four busy loops beside them pass. With allSent changed to put the watchdog back by stallAfter alone, the test fails 3 of 3 ("took nothing for 300ms (PUT)"), so the tail is still tested. go test -race ./internal/davsync (darwin), go vet and gofmt -l pass. No change outside the test.
|
||
|
|
58ecd4454c |
davsync, agent: sync turned off and on again to the same server keeps what changed here, and an agent shown only routing groups connects on the first (#939, aiirobyte)
Off deleted sync-state.json, so turning sync on again made this computer a new one: the first sync brought the server's whole setup in over it, and every agent changed while sync was off went back to the server's older fields. Off now keeps what this computer last synced (dropping only the error, notice, undo and usage state), so it resumes: changes here go up. TestOffAndOnAgainKeepsChangesHere fails without it (Codex's model went back to "gpt-old"). The Agents switch said "magpie has no models Codex can use" when the only models shown to the agent were routing groups (its own ChatGPT account's are left out of Codex's list), while `magpie codex group/folia-1` worked. Connect now falls back to the first routing group. TestConnectOnARoutingGroupAlone fails without it. |
||
|
|
76f3b97c09 | sync: it can sync by itself less often or only when asked, and the server's setup can be restored over this computer's, undoably (Sun1090, #847: 同步太快了,需要设置个开关控制自动同步,还有恢复按钮) — the gateway's magpie synced every 3 minutes with no way to change it, and a free 坚果云 account is allowed only so many WebDAV requests (600 per 30 minutes, 1 GB up and 3 GB down a month); and there was no way to take the server's setup back over a computer's own, which the next sync would otherwise push up. Settings › Sync now has Sync by itself, the app's segmented control (no <select>): Off, 3 min (the default, as before), 15 min, 30 min, 1 hour; Off syncs only on Sync now, and the sync row says only when asked. The loop reads the setting each minute (no request), so a change takes effect without a restart, and a server limiting requests is still waited for as backoff says. Restore from the server asks first in the app's own dialog, naming the parts replaced; it reads the server's file as it is now, seals this computer's setup (keys and all) into the sync folder as <time>-before-restore (newest 5 kept), brings in each part that differs as a sync brings one changed only there, and leaves the state as such a sync would, so the next sync pushes nothing back. Its notice says what was restored, with Undo, which brings the kept setup back (the next sync then takes it to the others); OK, or a later sync's own notice, drops the undo. The form's Save keeps the setting (SetAuto alone sets it). CLI: magpie webdav|s3 auto off|3|15|30|60, restore, undo; the status says how often it syncs by itself. zh, ja, de strings. TestAutoSync (off: no request by itself; back to 15 min: one sync, then none; Save keeps it; 7 refused) and TestRestore (b's own changes replaced by the server's with no push, the kept copy holds b's provider and key, Undo puts it back and a gets it, nothing differing restores nothing) pass -race; sync-auto-restore.test.cjs (WebKit, en and zh: Off posts -1 and the rows say so, Cancel posts nothing, Restore and Undo post, no click moves the page) fails on the old code. sync-other-kind, sync-spin, s3-sync, webdav-settings-refresh, usage-computers, click-scroll, gui-ja, gui-de and settings-sections pass on WebKit. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
3ec6b4da27 | gateway, gui: a provider's keys can be routed by weight, a key weighing 3 taking three requests for every one a key weighing 1 takes (dengtongcai, #841) — Routing already spread requests over a provider's keys in order, in turn, least used first or by pace, but never in a set proportion: two team keys meant to split 75/25 could only go evenly or one after the other. Routing now has By weight (routing "weight") for a provider with keys: each key that's on shows its weight and its share beside it in the editor (Weight 3 · 75%), a click edits it in place and posts keys/weight (provider.SetKeyWeight, 1 to 1000; none or 0 counts as 1, kept out of the file), and providers.json takes it as "weight" on each of keys (keyWeight for the first). The gateway picks as NGINX's smooth weighted round robin does (weighted.go): 3, 1 and 4 go round in every 8 requests in that ratio, never bunched; the others follow in their order for failover. A key resting after a failure is left out of the round while it rests, the others taking its share by their weights, and goes last. A conversation still stays with its key as Stays says (cache-warm across turns by default, within a turn always), and a request kept so is counted against the key that took it, not the one the round picked, so new conversations make up the share; Stays Off gives the ratio request by request. The weight goes with its key through Make first, the editor's Save, backups and WebDAV sync. The Routing page offers By weight for key pools and explains a pick by it; sink (Goes to the back) is off for it as for In turn. zh, ja, de strings. TestWeightedKeys (3:1:4 exact in each of 50 rounds of 8 through perKey and route; with one resting the other two 75/25 and the resting one last; a kept request made up by the next picks) and TestSetKeyWeight fail on the old code (no Weighted); key-weight.test.cjs (WebKit, en and zh: By weight shows the weights and shares, a click sets one and the shares redraw, Smart hides them, no scroll) fails on the old code (no By weight). key-import, panel-routing, routing-save, rate-limited-sink, routing-reset-deadline, account-arrange, gui-ja, gui-de and click-scroll pass on WebKit. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
05596ef4e2 |
davsync: scope provider and library credentials during partial sync (#744)
* davsync: scope provider and library credentials during partial sync * davsync: a sync writes which part carries its credentials, and no blank clears one yetone's review of the first cut found two losses the per-part markers caused, and both are fixed by making the markers say exactly which part they belong to: 1. A keyed computer's library-only upload cleared a keyless computer's private MCP token. The blanks in the uploader's library are redactions it downloaded and never held a value for, not clears it made; take now keeps the server's value for an empty secret whatever the policy is, so only a server taken out here is gone. The test that had the loss as its expected now expects the token kept. 2. Mixed versions dropped the remote's provider keys. A keyed upload didn't write the whole-bundle Keys bit, and an older keyless magpie, which reads no per-part marker, uploaded its own providers over the server's with nothing to keep. take sets Keys for the providers' again. The per-part markers are three-state now: a whole collect and a magpie before them write none, and the whole-bundle bit says it then; a sync writes one for every part it merges — true when the upload carried that part's credentials, false when it didn't — and that bit, not Keys, is what a reader goes by. That is what keeps 1 and 2 apart: the providers' whole-bundle bit is set for older readers, while the settings' and the library's own false is what tells a new reader they came without keys and their local values stay. take marks its merged bundle as a sync one (BundleVersion), so a sync's readers never fall back to Keys for a part it wrote. The two regression tests of the first cut that encoded the losses as expected are updated: library/clear keeps the server's secret, and the keyed providers upload writes the whole-bundle bit while leaving the other parts' contents alone. A remote that main already flipped to Keys=true over redacted settings or library isn't repaired by this: the fix keeps new syncs from flipping it, and a keyed computer syncing those parts repairs them by writing them whole. Validation on Windows: go test ./internal/... under a temp HOME passes whole; the davsync, backup, access and settings packages pass with -race; stashing the change fails TestTakeScopedPartCredentials (8 cases), the scoped-sync tests that cover both losses, and the balance-token and restore-scope tests that read the markers. go vet ./internal/... and the darwin, GOOS=linux and GOOS=windows builds pass. * davsync: preserve local secrets when applying partial uploads |
||
|
|
21702d01ff |
Add German translation; harden paths against unset env vars (#770)
* Add German translation and harden paths against unset env vars Add a German locale to the GUI, tray menu, usage alerts and website home page, and refuse to start when the home folder is unset or relative so nothing is written under the working folder; the pi plugin no longer adopts the user's PI_CODING_AGENT_DIR, and an inherited APPIMAGE no longer selects portable mode. Scripts refuse to run from the wrong folder or empty a shared out folder, and a new internal/testenv sandboxes every test package from the user's real files, which also fixes the Claude picker and Termux installer tests on Windows. * Makefile: know magpie's folder by its go.mod, so paths with spaces work The check compared $(CURDIR) with $(dir $(abspath …)), which make splits on spaces, so a checkout under 'My Projects' or 'John Doe' refused every target. It now reads go.mod relative to the working folder and wants magpie's module there: make -C and a symlinked Makefile work, make -f from another folder still stops before any recipe runs. * i18n: German for the strings main added since, with a parity test 75 strings main added (group order, patterns, slow-start wait, usage caps, RTK savings …) get their German, and two that main dropped go. gui-de.test.cjs checks, as gui-ja does, that de has every zh string with its placeholders and tags, and that the window reads in German when picked or on a German system. * appdir: ignore relative folder variables when reading, keep them for children CheckEnv no longer unsets anything. magpie reads the XDG folders, APPDATA/LOCALAPPDATA and every agent's folder variable through appdir.Getenv/LookupEnv, which pass over a relative value; the environment stays as it is, so the agents magpie starts get the variable as the user set it. That covers what proc.UserPath lends from the login shell too, which is set after main's check and reached the desktop app unchecked. On Windows a path rooted on the current drive (\Users\x, Git Bash's /c/x) counts as usable, and magpie version and help answer without a home, before run makes any folder. * Sandbox the tests main added since internal/wslrun gets testenv's TestMain, and four tests main added that set HOME alone set their home with testenv.SetHome, so on Windows they don't read the runner's profile through USERPROFILE. * agentenv: PI_CONFIG_DIR and OPENCODE_DB take relative names on purpose omp puts $PI_CONFIG_DIR under the home and OpenCode a relative $OPENCODE_DB in its data folder, so neither depends on the working folder: appdir no longer passes them over. * i18n: German for the Library's multi-select and System One's decision API The 19 strings main added since (#791's skill multi-select, the decision API snippets) get their German; the one main replaced (four APIs → five APIs) goes. * appdir: tidy the import into magpie's group; say what Go makes of /c/x The appdir import joins the group of magpie's own imports where a file has one. rooted's comment now says that Go takes a Git Bash path like /c/x as \c\x on the current drive, not C:\x. |
||
|
|
9aa7a3dca6 | tray: the Mac menu bar can show the allowances without magpie's icon (KevinXC on Discord: 能否支持隐藏状态栏里的图标,只显示各个供应商的剩余额度?) — Settings → Usage has a Menu bar magpie icon row (On by default) under Menu bar logos, on a Mac with a card in the menu bar. Off (settings.TrayNoBird) draws the cards alone: the image starts at the first card, with no room left for the bird; a click on a card still opens the panel at it, a modified click opens it as before, and the flap leaves the image alone. With no cards up the bird is shown as before, so the item never goes blank. It is the computer's own, like the other menu-bar settings (KeepOwn), and a change redraws at once. Menu bar logos is 菜单栏订阅图标 in Chinese now, so the two rows read apart. TestTrayImageNoBird (the image 48 px narrower at 2x, the rest the same cells, ink at its left edge, logos and plain, light and dark) fails on the old code; tray-bird.test.cjs (WebKit, en and zh) and tray-logos pass; the birdless image was looked at in light and dark. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass (TestClientGoneRecordedAsCanceled failed once under the full run's load and passes alone, five times, and in the gateway package's own run). Not tried in the real menu bar. | ||
|
|
855e7985f2 |
routing: the groups are put in an order of the user's, as the Agents page's rows are, and /v1/models lists them so (#779)
The Routing page's group list followed the order the groups were made in, found ones after, so a group used every day couldn't be put first, though /v1/models lists the groups in that order and agents' pickers (Claude Desktop's 3P list among them) show it and some clients probe its first model. A group row's logos are now its handle, as an agent row's logo is (#57): dragged (dragRows, the Agents page's sorter) it moves the row, clicked, or the row right-clicked, it opens Move up and Move down (openRowMenu, with the Agents menu's arrows, now MOVE_UP/MOVE_DOWN), and Alt+↑/↓ moves it from the keyboard, which stays on it. The grip in the row's margin is drawn only while the row is under the pointer, dragged, or its handle is focused or its menu open, as on the Agents page. The list is drawn in its new order at once and put back if the save fails; a later move wins over an earlier one still saving. The order is kept in providers.json as groupOrder (provider.SetGroupOrder, POST /api/groups/arrange), beside the providers' own order (#499), and applied in groupsIn, which every list of the groups is made from: the Routing page, Catalog and so /v1/models, magpie group ls and the TUI's routing page. A found group, which isn't stored until changed, can be put among the user's this way, which reordering the groups array couldn't do. A group not named (one made or found after) goes last; a renamed one keeps its place. Backup and sync carry the order as they do the providers' (MirrorGroupOrder). TestGroupOrder (Groups and the catalog follow SetGroupOrder, providers.json has it, a new group last, a rename in place, bad orders refused, a synced order first) fails on the old code. group-arrange.test.cjs (WebKit, en and zh): the grip hidden with the pointer away and shown on the hovered row only, in its margin; right-click Move down with Move up off on the first; Alt+↓ and Alt+↑ with focus kept; the handle's click opens the menu, not the editor; a drag by the grip to the top; each posting every group's id with the removed one last; no click moving the page. It fails on the old code. agent-grip, click-scroll, account-arrange, usage-arrange, provider-order and the group-*/routing-* GUI tests pass in WebKit, but for group-from-model-add's 600x420 cases, which fail on main as well. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. |
||
|
|
07644556a7 | fix(davsync): scope settings credentials during partial sync (#673) | ||
|
|
f1224a055e | sync: a backup on a slow line is no longer cut off at 2 minutes; a server that stops moving is (#657, irx999: a 43 MB backup with many skills to a WebDAV server on a 2.4 Mbps VPS, 305 KB/s, needs 2.4 minutes and every sync failed) — a sync had a fixed deadline in all (2 minutes from the gateway's loop and magpie webdav/s3 sync, 90 s from Settings › Sync now), so a large backup on a slow line never got through, however steadily it moved. WebDAV and S3 requests now go through a watchdog instead (stall.go): the backup's GET and PUT fail once nothing has moved either way for 60 s, each byte of the body sent or read putting it back, and after a PUT's body is all handed over the answer gets 60 s on top of as long as the write took (at least 4 minutes), for what still sits in the system's buffers to leave; the other requests (PROPFIND, MKCOL, HEAD, MOVE, DELETE) have 30 s in all. A stall says so ("the server sent and took nothing for 1m0s (PUT)"). Sync now and the CLI have no deadline; the gateway's loop keeps an hour as a backstop; a wait for another magpie's sync stays 30 s. TestSlowTransferIsNotCutShort (20 MB up and down at a steady trickle, over 5 times the watchdog each way), TestStalledTransferFailsPromptly (a server stopping mid-PUT and mid-GET fails within a second) and TestMetadataRequestHasALimit fail on the old code (no watchdog: the stalled ones hang) and pass. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried against a real slow WebDAV server. | ||
|
|
9ccabdfbd8 |
usage: quota cards draw what was left over time, against an even burn, and the tray card its cycle's line (#651, songlairui) — each reading magpie makes anyway of a subscription's windows (and of a plan bought with a key) is kept as a point in quota-history.json beside the config: provider, account, window, when read, percent left, the window's start and reset — no token, no prompt. A failed reading, one kept from before (As of), an unlimited window and a model family's aren't kept; Antigravity's pools are kept by pool. Within a cycle points are 5 minutes apart at least and a run of one figure is its two ends; a cycle ends where the window starts again (its reset passed, or moved further than the time between two readings, so a rolling window's isn't one). 45 days and 6000 points a window are kept. The Usage page's card has, under its meters, a line a window (several tiers of one account on one chart), broken at each reset, a dashed even burn from each window's start to its reset and an upright now line, with 2 days / Cycle (the account's longest current window, start to reset) in the app's segmented control, remembered, turning every card without moving the page. The tray's card has a thin line of its first window's current cycle. GET /v1/magpie/quotas/history (?days=, ?provider=, ?user=; local or LAN with the key, as /v1/magpie/quotas) and /api/usage/quotas/history serve it; /v1/magpie/quotas and magpie quota stay snapshots. Computers sharing usage (WebDAV/S3, Settings › Sync › usage) put their history beside their days, sealed, as <id>.magpie-quotas, and merge the others': the union by account, window and time, two points within 30 s the newer, nothing twice however often they sync; an older magpie never reads the file. TestQuotaHistoryRecords, TestQuotaHistoryCycles, TestMergeQuotaHistory, TestQuotasHistory and TestQuotaHistorySharedBetweenComputers cover recording, cycles, pruning, merge, the API and two computers on one WebDAV folder; quota-curve.test.cjs (WebKit, en/zh, light and dark) the curves, the toggle, no curve without readings, and the tray's line (Chromium doesn't start in this sandbox). go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried with real accounts; pay-as-you-go balances aren't drawn.
|
||
|
|
960e611a79 | fix(davsync): sync independent gateway key changes (#643) | ||
|
|
c221b9e2a9 |
davsync: a damaged file on the server is rebuilt, not failed on forever (#607)
* davsync: a damaged file on the server is rebuilt, not failed on forever When the server's backup can't be read as a backup at all — a write a relay or tunnel cut short, or one damaged since — syncOnce returned the error and stopped. This computer's own setup is fine, so it could never be pushed over the unreadable file to fix it, and every sync after failed the same way: the only way out was deleting the file by hand. (#531 detects a short write as it happens, but a file already damaged — by an older magpie without that check, or by anything since — stayed stuck on "not a magpie backup".) The rebuild merges; it never pushes this computer's bundle as it is. A sync that finds the file unreadable falls back to the last good copy of the server's file it read whole — its cache, when that copy is trustworthy — and runs the normal three-way merge over it, so another computer's newer setup the damaged write swallowed survives. Three guards say when a computer may do that, and any one missing leaves the error standing: it has synced before (a fresh computer has no last-good copy and no right to rebuild what it never saw); the cached copy is the version the damage replaced (the damaged body is a prefix of it, which is what a cut-short write leaves — and what an out-of-date computer's older copy is not); and the body really begins like a magpie backup, so a server answering with a page (a captive portal) is reported, never rebuilt over. backup.ErrCorrupt — the message those two damaged checks already gave — marks that case, told from a wrong passphrase and from a newer magpie's file, both still refused. The push carries the damaged file's ETag, so it stays checked against the server, and it happens even when the merge matches the cached copy: the server's file is the damaged one and must be replaced. The unreadable body is kept aside under the sync folder, the newest few, so a server that always answers the same unreadable way doesn't pile one up per tick. Tests: TestSyncRebuildsFromCachedCopy pins the self-heal (the server ends whole, the damaged body kept aside); TestSyncFreshComputerDoesNot Rebuild and TestSyncOutOfDateComputerDoesNotRebuild pin the two data-loss cases — the out-of-date one fails without the prefix guard (verified by mutation); TestSyncPageIsNotDamage pins that a 200 HTML page is reported, not pushed over; the newer-magpie refusal is guarded against regression. go vet, and go test -tags nogui ./internal/davsync ./internal/backup under a temp HOME pass, as do the linux and windows builds. * davsync: a body cut inside the sealed file's constant head rebuilds nothing (yetone on #607) The prefix check alone let an out-of-date computer rebuild: Seal writes the envelope with MarshalIndent, so every version begins with the same constant head up to the salt, and a body cut inside it (40 or 90 bytes) is a prefix of every version — including an older cached copy — so that copy's computer passed the guard and pushed its merge over a newer one's data. The guard now also requires the damaged body to reach past the random fields, to the "data" key that follows the salt and nonce, which ties it to the one version it was cut from. A body cut before them is attributable to no version, so it stays an error for every computer, even the one that saw the good version — fail loud rather than rebuild blind; a relay cutting a real write cuts deep into the data, so legit rebuilds still go. TestSyncOutOfDateComputerDoesNotRebuild now cuts at half, 90 and 40 bytes; the two short cuts fail against the old guard (the out-of-date computer rebuilds and kimi is lost). Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Co-authored-by: Claude Code <noreply@anthropic.com> |
||
|
|
bb42b47663 | fix(davsync): retry short shared usage uploads (#574) | ||
|
|
da834411b5 |
usage: with WebDAV or S3 sync, each computer shares its usage and sees the others', the total and each computer's part (#542) — sync carried keys, agents and the library, and each computer's Usage page counted only the calls made on it. Sync now has a Usage tick (off unless picked, usage=yes in magpie webdav/magpie s3): a computer with it on puts its own calls up as one file a day, magpie/usage/<id>-<day>.magpie-usage beside the bundle (under the prefix's usage/ on S3), each a gzipped list of times, agents, providers, models, tokens, costs and statuses, sealed with the sync passphrase (backup.SealData, the key cached per passphrase so a sync derives it once); no request body, session, archive name or key goes, a call another computer passed on over the LAN (Via) isn't put up again, and an error is cut to 300 characters. The id is a random one kept in usage-computer.json, which no backup carries, with the host name beside it. A computer only ever writes and deletes its own names, so none overwrites another's; the files are not in the bundle and its hash, so sharing usage never makes a sync or a conflict of the bundle; the first sync puts up the last 90 days, after that only yesterday and today, at most every 15 minutes (a Save or Sync now at once), and a day past 90 is deleted by the computer it is of. The others' files, listed (PROPFIND Depth 1; ListObjectsV2) and fetched only when changed, are kept in usage-others and read with the ledger, as Record.Computer; a failure is said in the sync row ("Couldn't share usage") and never fails the sync. The Requests page and the panel's Usage tab get a Computer pick (this computer, other computers when more than one, each by name) sending computer=this|others|<id>; a row from another computer says "· on <name>" beside its agent, and its details name the computer and say what was said stays there, nothing asked of this computer's session files for it. With no other computer's usage there is no pick and nothing new on either page, and an older magpie never lists or reads usage/. TestUsageSharedBetweenComputers (computers a and b over a fake WebDAV under httptest: each sees 4 calls, the totals and its own and the other's part, nothing counted twice over repeated syncs, the bundle not put again for usage, a new call reaching the other, a day past the window deleted), TestUsageSharedThroughS3 (the same through a fake S3, signed list and delete, a prefix with a space and a plus) and TestUsageOffAsksNothing are new and don't build without the change; usage-computers.test.cjs (WebKit, en and zh: no pick without other computers, the pick and computer=this, another computer's row and details with no /content asked, the panel's pick, the sync form's tick posting usage: true, no click moving the page) fails without it on all but the no-other-computers case. s3-sync, sync-other-kind, panel-usage, request-archive-usage, click-scroll and usage-ledger-chart pass in WebKit. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass (TestFXInState failed once on its TempDir cleanup, passes alone). Turning the Usage tick off, or sync off, lets the other computers' usage kept here go (DropAllShared), so the Usage page counts this computer's alone again: TestUsageSharedBetweenComputers checks both, and fails without it.
|
||
|
|
d8ebf2b893 | test: one list of the agent folders a sandbox clears, so no sandbox misses an agent (yetone, on #522: A shared list of env vars for the other sandboxes would be a welcome follow-up) — every sandbox kept its own list of the variables that point at an agent's folder, and each had drifted: the gateway's cleared 5 of the 32 magpie reads, the provider package's 2, the tui's 10, the library's 20. A sandbox clearing 2 meets whatever Grok, Kimi, Hermes, MiniMax, Qoder or ZCode the developer has installed, which is how #522 came about — Qoder's two were in the library's list and in none of the four that failed. internal/agentenv is now the one list, and the 21 sandboxes that fake an environment with no agent in it clear it, each keeping beside it the variables that are not an agent's: APPDATA and LOCALAPPDATA, which a sandbox sets to a folder of its own rather than clearing, VISUAL and EDITOR. A name in the list is one magpie reads, and TestVarsAreRead walks the sources to say so, which is how two names a sandbox had been clearing turned out to be read by nothing at all — GEMINI_CLI_HOME and OPENCODE_CONFIG in internal/backup's, while OPENCODE_CONFIG_DIR, the one internal/agent reads (agents.go:545), was not in it. Where a sandbox set an agent's folder to a fixture of its own, the clearing now comes first, since a list of 32 wipes what a list of 5 left standing. Not converted: the omp tests' four variables, which are the ones omp's own lookup consults (a Pi fork) rather than every agent's, and the warm-up's Claude Code traffic flags, which are not folders — CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC stays out of the list for that reason too, its one test setting it on purpose. On Windows 11 the whole suite answers as it did before the change: 31 packages pass, and the same 15 tests in internal/library, internal/gateway and internal/agent fail for what they failed for before (symlinks this machine has no privilege for, and TestSuffixModesReachAgentFiles). go vet ./..., go build -tags nogui (windows, GOOS=linux, GOOS=darwin), and go vet -tags nogui for linux and darwin over every package touched pass. (#543) | ||
|
|
93a1e3e7fc |
fix(davsync): detect a WebDAV write the server kept short (#531)
Relays and tunnels cut long uploads short. Over a Cloudflare Tunnel with a 3MB write this came up 2 of 3 times, and each time the client saw it happen: the relay answered 502 or 423, which the sync reports as itself. The quiet shape is a server that answers 2xx with half the file on disk: every later sync then reads the half and fails as "not a magpie backup", with no way to tell what actually went wrong. A write is now looked at after it lands: a HEAD read of the backup is compared with the size sent, a short write is retried over the version the short one made (its ETag, from the PUT's answer or the HEAD's), and after three tries reported as itself. A HEAD that can't be done — an error, a 429 or 503, a non-200 — leaves the write unchecked: it landed either way. Servers without HEAD check as before. Co-authored-by: Claude Code <noreply@anthropic.com> |
||
|
|
7b4065b12a | sync: the order the providers were put in on the Providers tab goes with them, so a computer that syncs lists and tries them as the other does (ARNO on Discord: 发现webdav同步的时候没有同步provider的顺序) — since #499 the order is kept apart from the providers, as providers.json's "order" (ids, the built-in signed-in accounts among them), and the list is sorted by it when read; the providers themselves stay in the file in the order they were added. The sync's bundle (backup.Bundle) carried the providers, icons, groups and search APIs but not that order, and the providers part was hashed without it, so arranging the list was not even a change to sync, and a computer bringing the providers in (provider.Mirror) kept its own order, or none. The bundle now has Order (omitempty, from provider.StoredOrder), hashed with the providers part only when there is one, so the hashes of a setup never arranged are as before and an older magpie's file still compares the same; take carries it with the providers, and bring applies it after Mirror with the new provider.MirrorOrder: the other computer's ids first as it has them, then the ones named here alone (an account only this computer has) in the order they have here; none, from a magpie before this or a setup never arranged, leaves the order here as it is. This goes for WebDAV and S3 alike (one path). A backup restored by hand still merges providers without changing the order. TestSyncProviderOrder (a arranges three providers, b joins and lists them in a's order and pushes nothing back, b arranging only is pushed and a follows; against an httptest WebDAV server) fails without the change ("b after joining: [one two three]"); TestMirrorOrder covers the merge. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... (temp HOME) pass. | ||
|
|
7ab91961d2 | davsync: an unchanged file on the server costs a request, not a download (Crispin on Discord: 是不是Magpie后台一直在自动同步,导致被坚果云给限制了) — every 3 minutes sync read the whole sealed file even when nothing had changed, and 坚果云's free plan caps monthly downloads and requests per 30 minutes. The sync state now keeps the server's version beside its hash (its ETag, or a Last-Modified at least a second older than the server's Date, so a write in that same second can't go unseen), from the read or from the ETag a write answers with (none said: the next sync reads in full, as before); the next read sends If-None-Match (or If-Modified-Since) and a 304 with nothing changed here ends the sync, while a change here merges with a copy of the server's file kept beside sync-state.json (sync-server.magpie-backup, 0600, checked against the hash; gone or different, the file is read again), so it isn't read twice. A server that ignores the condition sends the file and syncs exactly as today. S3 does the same with If-None-Match on GetObject, signed with the rest (the fake S3 checks every signature). A 429 or 503 (S3's SlowDown) now says the server is limiting how often magpie may reach it, and Run waits as long as Retry-After says (up to 6 h) or else doubles from 6 up to 30 minutes, back to 3 after a sync that goes through; log de-dup is kept, as the message doesn't carry the wait. The 403 paths (there, forbidden) only run when the server answers 403, so a working setup costs one conditional GET per cycle. TestSyncUnchangedIsNotRead (ETag, ETag not on PUT, Last-Modified: three unchanged cycles read 0 bytes, a server change is read once and merged, a change here is pushed without a read, a missing copy is read again), TestSyncRateLimited and TestS3Unchanged fail without the change (with the conditions dropped: 3 full reads of 1932 bytes, 'HTTP 429' with no backoff, unconditional S3 GETs); TestSyncIgnoringConditions guards servers without conditional reads. go vet ./internal/..., go build -tags nogui ./... (darwin, GOOS=linux), GOOS=windows go build ./..., go test -tags nogui ./internal/davsync/ ./internal/gui/ pass. | ||
|
|
da1ee0f81a | sync: the menu bar's usage is each computer's own, not synced (yoooo on Discord: usage in the menu bar turned off on a Mac came back on from a Windows box that shows it, over WebDAV) — a sync and a restored backup kept only the window's size, the proxy and the Dock from this computer, so which subscriptions show beside the icon, how often they refresh and their logos came from whichever computer synced last. They are now kept like the others (Settings.KeepOwn, used by both), and left out of what tells a change. TestSync fails without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. | ||
|
|
3c04877cfc | archive: a request the archive kept is opened and downloaded from the Usage page, with its bodies whole (jorben, #447: 请求存档 reachable from usage history, full bodies, download) — the archive's name was only on the Gateway page's recent calls, gone once a call left the list or the gateway restarted, and the archive kept the first 256 KB of each body, the recent list's cut. The usage ledger's row now names the call's archive (archive in usage.jsonl, kept through the Requests page's packed rows), and its details on Usage → Requests show the Request archive panel, Fetch from archive and Download; with the archive on, a request it has no copy of says "Not archived". The bodies are kept whole up to requestArchiveMaxMB in settings.json (32 MB unless set, at most 1024): the response is teed to a temp file as it is sent, the request body written to one when the call ends, so the upload queue holds file handles, not bodies, and one upload at a time reads them; a body past the limit is kept to it and marked cut, with its whole size. What goes upstream is unchanged, the archive stays off unless turned on, headers and bodies are scrubbed as before, and the temp files are removed after the upload or when the queue is full. The page is sent a body to show only when it is 256 KB or less (a longer one is said by its size), an archive over 80 MB is only said to be; Download streams the object whole, to Downloads in the app (archive/export, -2, -3… for a name taken) and as the browser's download in magpie web (archive/file). TestArchiveWholeBodies, TestArchiveLimit, TestRowKeepsArchive and TestArchivePreviewAndDownload fail without the change; TestArchiveOffUsage, TestArchiveTooLargeToPreview, TestArchiveOldPreview keep the rest. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; request-archive-usage (new), request-archive, click-scroll, old-webkit, usage-ledger, usage-ledger-detail, usage-ledger-content, web-page, sse-body pass. | ||
|
|
0361189f9e | test: every package's tests pass on Windows, and none writes outside its sandbox (the user: 把 Windows 上那几个失败的测试修掉) — on a Windows box the suite failed in most packages, and the root package hung for 25 minutes. Tests set HOME, which os.UserHomeDir ignores on Windows (it reads USERPROFILE), so they read and wrote the runner's own home; each now sets USERPROFILE beside HOME, and Devin's, Goose's, Crush's and Claude Desktop's tests set APPDATA/LOCALAPPDATA, where those keep their files there. said() read the command's output only once it returned, and a pipe holds a few KB on Windows, so magpie model --help blocked forever; it reads while the command writes. Unix permission bits (the gateway key store's 0600 too), exec bits and symlinks Windows lacks are checked only off Windows; TOML strings hold Windows paths as literal strings, JSON as marshalled ones; a URL's path is compared as one. The provider and usage packages run in a home of their own (TestMain, as the gateway's already does), since a CLI's identity kept by a refresh still going when its test ended landed in the runner's ~/.config/magpie — and on a Mac in the user's own. Two product fixes came out of it: imagemcp took a file:///C:/… root or image for the path /C:/…, which doesn't exist on Windows, and now makes a Windows path of it (a host for a UNC share); and session discovery could keep a new Cowork session hidden on Linux, where a folder's mtime is a kernel tick and its size doesn't change, so an entry added within the tick of the last listing left both as they were — a listing made within 2s of its folder's last change is read again, as git does for racy files. TestFilePath and TestRacyDirectoryListedAgain fail without the change. On Windows 11 every package passes (32 of 32) and a run of each package in a fresh home leaves nothing in home, APPDATA or LOCALAPPDATA; on Linux (WSL) and macOS go test -tags nogui ./... passes. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build pass. | ||
|
|
9c54a560cc | provider: a providers.json that can't be read is said where the providers are listed, never backed up or synced as none, and is replaced through a rename (PR #415's review) — #415 made edits refuse a file they couldn't read or decode, but every read for the user still took it as empty: magpie providers said "no providers yet", magpie models "no models yet", the Providers page opened the Add sheet as for a first use, and backup.Collect, so an export and a WebDAV/S3 sync, carried it as no providers, which another computer's Mirror would then take as every provider removed. magpie providers and magpie models now list what is left (the signed-in accounts) and end in the error, the TUI says it over its list, and the Providers page shows a "Your providers file can't be read" box (无法读取供应商配置文件) over the list with magpie's reason and no Add sheet; start-up, the gateway and the catalog still go on with it as empty. Stored and StoredGroups return the read error, so a backup and a sync stop on it with nothing pushed. The error, for reads and refused writes alike, names the file, says magpie left it unchanged and to fix it or move it aside (errors.Is ErrUnreadable). store writes through writePrivate, a 0600 temp file renamed over it (steady.Rename waits out a Windows reader holding it, a symlink keeps its target), instead of os.WriteFile's truncate-then-write, and the read goes through steady.ReadFile. TestFileErrorSaysUnreadable, TestWriteErrorsSayLeftUnchanged, TestStoredRefusesUnreadable, TestStoreReplacesAtomically, TestSyncStopsOnUnreadableProviders, TestProvidersCmdSaysUnreadable and provider-file-error.test.cjs fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; provider-file-error, click-scroll, old-webkit, providers-off-fold, add-sheet pass. | ||
|
|
f654bec468 | gateway: a model's web search goes to a search API of the user's own when no provider can search (#419 by HwFee: let me set up Tavily, Brave or SearXNG with my key rather than lose the search tool) — with no provider that searches by itself and no provider magpie could search with, the gateway took the client's web search tool away. Tavily, Brave Search, Exa, Firecrawl and SearXNG (an address of one's own, a key only if it asks for one) can now be set up, in an order: the injected web_search tool is then offered, and a search goes to the searcher's model as before, or, with none or when it fails, to each search API in turn, called directly with no model, its results handed back as the same hits and text the searcher path gives, so clients see the same web_search_tool_result blocks. The order is provider searches itself, searcher provider, search APIs, strip. They are kept in providers.json (0600) like provider keys; a backup carries them, their keys only when it carries keys, and one restored without keys keeps the key here; sync does the same, and a backup or sync from a magpie before them leaves the ones here alone. magpie search lists them, magpie search add <api> [key] [url=…] adds or updates one, magpie search rm <api> removes one; Settings has a Web search section (联网搜索) to add and remove them. Prompts, identity lines and headers to model providers are unchanged. TestWebSearchBySearchAPI, TestNoSearchAPINoTool, TestBackupSearchAPIs, TestSyncSearchAPIs and search-api.test.cjs fail without the change; TestSearchAPIsEachAsked checks each vendor against a fake, TestSearchCLI the command. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; search-api, provider-search, click-scroll, old-webkit pass. | ||
|
|
2e94643c7b | sync: moving between WebDAV and S3 keeps the other's server, and moving back finds it (ARNO on Discord: 我体验了一下s3同步,结果它把我之前配置好的webdav同步设置给删了) — sync.json held one setup, and saving S3 in Settings › Sync and backup (or magpie s3 on) wrote the bucket over it, so the WebDAV address, user and password were gone. sync.json now keeps the other kind's server beside the one synced to (other: its address, user, password or secret, and S3's endpoint, region and path-style), in the same file, readable by the user alone, and never in a backup, as before. Only one is synced to. Moving back with the password left empty uses the one kept, for the same server and user alone; magpie webdav on / magpie s3 on with nothing else given moves back to the kept one, and magpie webdav / s3 say which is kept. In Settings the row says "WebDAV settings kept" (or S3's), the form marks the kind synced to "· on", says whether saving keeps it or moves sync, its button reads "Move sync to WebDAV" when it does, and the other kind's fields show the kept server. A sync.json from before reads as it did; turning sync off still removes it all. TestConfigureKeepsTheOtherKind, TestS3Cmd and sync-other-kind.test.cjs fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; sync-other-kind, s3-sync, webdav-settings-refresh, click-scroll, old-webkit pass. | ||
|
|
a32186a6ba | fix(profile): preserve default values in snapshots (#421) | ||
|
|
e4bf875b85 | fix(backup): exclude balance tokens from keyless exports (#418) | ||
|
|
258d04f569 | gateway: a request archive, off unless turned on, keeps each call's headers and bodies in the user's own S3 bucket and a recent call reads its own back (Jorben on Discord: 请求存档) — the Gateway page's recent calls only ever held the last bodies in memory, the first 256 KB of each, with no headers, gone at a restart. A switch over Recent calls ("Request archive", POST /api/settings/archive, settings' requestArchive) turns it on, refused with a reason while sync isn't set up with an s3:// bucket; with it on, each call the gateway serves gets an id (UTC HHMMSS-<16 hex>, said back in X-Magpie-Archive-Id) and, once it is recorded, its method, path and query, request headers and body and response status, headers and body go as one JSON file to <prefix>/magpie/archive/<YYYY-MM-DD>/<id>.json in the bucket sync keeps its backup in, signed with the same client (davsync.Bucket, no new SDK). Before anything leaves, Authorization, x-api-key, Cookie, Set-Cookie, any header or JSON field or query parameter named for a key, token, secret or password, and anything that looks like a key or token anywhere in the text (the redaction rules' patterns, in a stream's data lines too) become [REDACTED] — gone, no placeholder kept; the archive is plain JSON, readable in the bucket, not sealed with the passphrase. Uploads go one at a time on their own goroutine from a queue of 16 calls, each body capped at the 256 KB the call already keeps and marked truncated; a full queue drops the call with a log line, a failed upload is logged and shown under the switch until the next one goes, and no request waits on any of it. A recent call the archive kept shows its date and id under its bodies, and "Fetch from archive" (GET /api/archive?date=&id=, only a date and an id of that shape) shows the request's and response's headers and bodies as the bucket has them, or says it isn't there yet. The hook is in record() and the Call literal, so PR #239's request log lines are not touched; the archived call carries its usage, and with #239 its vendor request id. Only calls through serve() are archived, not Codex's backend, image or video calls. TestArchiveOn, TestArchiveOff, TestArchiveName, TestRequestArchiveToS3 (a real gateway request through the signature-checking fake S3), TestScrub and request-archive.test.cjs fail without the change; TestSettingsSaveKeepsWhatItDoesNotSend now sets requestArchive. A sandbox magpie web with a fake vendor and a fake S3 server uploaded nothing while off; on, it uploaded a signed archive with none of eight planted secrets in it, read it back through /api/archive and in the page, and with the S3 server down served the call in 0.1 s and said why the upload failed. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (Claude account tests and TestClaudeRunEndsWhenTheClientLeaves pass alone); request-archive, click-scroll, old-webkit, sse-body, gateway-fold pass. | ||
|
|
8931a4b3ac |
davsync: sync can keep its file in an S3-compatible bucket as well as a WebDAV folder (#296) — AWS S3, Cloudflare R2, Backblaze B2, MinIO, Garage or a NAS. Settings › Sync and backup picks WebDAV or S3: endpoint (empty is AWS), bucket, prefix, region (empty is us-east-1, auto for R2), access key ID and secret, path-style; CLI magpie s3 on s3://bucket/prefix access-key-id=… endpoint=… region=… path-style. The bucket holds the same passphrase-sealed file at <prefix>/magpie/magpie.magpie-backup, signed with SigV4 (no SDK). It is read with its ETag and written with If-Match (If-None-Match: * for the first), so two computers syncing at once don't overwrite each other; a server that refuses conditional writes (501, or 400 naming the header) is remembered and gets a HEAD-then-PUT instead. An IP, localhost or a dotted bucket on https goes path-style on its own. Errors say what to do: wrong key/secret, clock skew, bucket in another region (names it), no such bucket, 403 on the first read on AWS without s3:ListBucket. The secret is kept as the WebDAV password is, sent only to the endpoint and key it was typed for, and may not be the passphrase. sigv4_test (AWS's published vectors), s3_test (fake server: conditions, conflict, fallback, regions, errors), s3_cli_test and s3-sync.test.cjs (Chromium, WebKit, en/zh) fail without the change; tested against MinIO. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestGroupAddSetRemove, a TempDir-cleanup flake under load, passes alone); click-scroll, old-webkit pass.
|
||
|
|
04f374fa8c |
agent: OmO (oh-my-openagent, omo-ai), a fork of Pi that keeps its own ~/.omo/agent, gets its own row: a magpie model sets settings.json's defaultProvider/defaultModel and magpie's provider in models.json there as Pi's does, $OMO_CODING_AGENT_DIR / $SENPI_CODING_AGENT_DIR are honoured, the Library writes its AGENTS.md, mcp.json and skills, and omo update updates it (#264 rhyme227). Pi's own ~/.pi is left alone. piIn becomes piLike(at, id, name, dir) so both share one wiring. Tested with omo_test.go in agent and library (fail without the change); go vet, go build -tags nogui (darwin, GOOS=linux, GOOS=windows), go test -tags nogui ./... pass.
|
||
|
|
7931723d79 |
cli: 新增 magpie webdav,在终端里开启、修改和触发 WebDAV 同步 / add magpie webdav to turn on, change and run WebDAV sync from the terminal (#127)
* cli: magpie webdav — WebDAV sync from the terminal, what Settings › WebDAV sync does, for a machine with no window (WSL, a server over SSH) magpie webdav shows it; on <address> [user=…] [password=…] [keys=no] [agents=no] [library=no] turns it on and syncs at once, asking for the passphrase (and the password, when a user has none); set k=v… changes what is given and keeps the rest; now, dismiss and off are the page's Sync now, OK and Turn off. Through the same davsync.Configure, Now, Dismiss and Off. A sync, Off and Dismiss hold a lock the system keeps on sync.lock (flock; LockFileEx on Windows): the gateway's sync every 3 minutes and one from a terminal — or from the app's window while magpie serve has the gateway — would each save sync-state.json over the other's. The system lets it go when the magpie holding it ends, however it ends. Configure keeps the saved password only for the same server (scheme and host) and user: an address moved to another server, or another user, no longer takes it there — in the app too, where a new address with the password left empty was sent the old one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * davsync, cli: from the review of #127 — the setup read again under the lock, Configure locked too, the password never an argument, one left behind asked for, a wait that runs out said in the status Now reads the setup again once it has the lock: one that waited while another magpie turned sync off went on with the setup it had read, and saved sync-state.json back after the Off. Configure takes mu and the lock too, after a sync in progress. magpie webdav takes neither the password nor the passphrase as an argument: password= asks for it, as passphrase= does. Configure with the saved password left behind — another server or user, the password empty — says to type it and saves nothing, where the Settings page dropped it and the sync failed with 401 under a field that still said saved. A wait for the lock that runs out is davsync.ErrBusy. Dismiss returns it, and the davsync routes put ErrBusy from a sync in the status they answer with, where the page shows a sync's failures; Save's own errors stay in its form, what was typed in it kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * davsync, cli: the lock before mu, a wait bounded under the page's, one called off not called busy, the password rule in one place, a bare address with = in it The lock comes before mu everywhere, so a wait for another magpie never holds mu, and Configure, Off and Dismiss wait for it 30 seconds at most, less than the Settings page gives a request: before, a request could hang on mu and then on the lock for minutes. A wait for the lock called off, as when the page is closed or the gateway stops, is its context's error, not ErrBusy: nothing said another magpie was syncing. What becomes of the saved password is decided in one place, davsync.SavedPassword, which Configure and magpie webdav both go by, where the two had rules of their own that had come apart: an account with a password and no user name, moved to another server, had its password dropped with nothing asked, and the sync failed with 401. It is asked for now, as for an account with a user. magpie webdav takes a bare argument with :// in it as the address, = in it or not: https://host/dav?token=… was read as a field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2b2a7bf83f | sync: a WebDAV server that answers 403 for what isn't there (a Synology, PROPFIND too) no longer fails the first sync as if the account couldn't write in the folder — magpie's own folder in it is looked for, and when it isn't there a 403 to reading the backup is no backup yet and one to writing it is made as a 404 is | ||
|
|
c6dc08e105 | sync: an address at OpenList's or Alist's /dav/ says to go into one of its storages, naming them — the list of storages there takes no folder (MKCOL 405, as if it were there) and no file (PUT 404), so a first sync failed with a bare HTTP 404; a folder in the address that isn't there says so. Tried on OpenList 4.2.6 |