Skip to content

test(schedules): pin the paused-source branch of copy (#1319) - #1343

Merged
Birfy merged 1 commit into
mainfrom
dev3/1319-paused-copy-test
Oct 27, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev3/1319-paused-copy-test

Conversation

@Birfy

@Birfy Birfy commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev3
Owner: Dev3
Reviewer: Reviewer2
Tip SHA: 4ba2e53

Fixes #1319

Reproduce

copySchedule splits at core/src/host/schedules.js:341: a paused source goes through service.create (as Resume does), an active one through the row write copyRow. The three #1287 cases copy an active source only, so nothing in the suite executes :341 — the reviewer that PASSed #1307 named this path as untested, and #1319 tracks exactly that gap. Evidence the branch is real and not the happy path: replace :341 with copyRow and every existing case still passes.

What changed

  • core/test/schedules.test.js: one case that pauses a task, copies it to another Bot, and asserts a fresh schedule-* id (never the paused source's), service.create called once for the copy on the target's current part with the source's request ({title, prompt, every_seconds}), and the copy's next run anchored to now + interval the way Resume re-anchors one — then asserts the paused source is still paused. It also covers the refusals this branch shares with the active one (same chat) and that a refused copy creates nothing.
  • The fake service gains a created log so a case can say which creates happened, not only how many rows exist.
  • patches/ds-bot/0001-core-fixes.patch regenerated with node scripts/ds-bot-patches.mjs generate; no product code changed — the case exposed no defect, as #1319 predicted.

What I ran

  • node --test test/schedules.test.js in core/ → # tests 28 / # pass 28 / # fail 0
  • node scripts/ds-bot-patches.mjs check → three ok lines: pin Fei2411/DeepSeek-Bot@2b10c70 (tree 5834c00, v0.1.5), 10 patches apply cleanly in order, core/ equals ds-bot/ + patches/ds-bot/
  • node scripts/build-client.mjs --check → exit 0
  • npm run lint → 70 warnings, 0 errors (same as base)

Red without the source change

This issue is a test-gap issue: no source code changes here — the knife is a temporary source edit, measured and then reverted.

On exactly this tip's core/test/schedules.test.js (git hash-object = bbc61301dbc8c916a49f582aeee68e212fd13e2f, the blob in this PR): temporarily replace the paused branch's await service.create(toSession, request) with await copyRow(sourceSession, sourceId, toSession) and run the file:

not ok 12 - \#1319: a copy of a paused task goes through create and re-anchors its next run
    {"ok":false,"error":{"code":"bot/invalid","message":"No such task"}}
# tests 28
# pass 27
# fail 1

One failure, and it is the new case. Restored (cmp against the saved copy: identical) the file is back to # tests 28 / # pass 28 / # fail 0.

Not run

  • The whole core/ suite locally: CI tests-ok runs it at this tip, and one test file is the whole diff.
  • The smoke test: no index.js or src/host/ change.

Risk

Test-only change plus the generated mirror; no runtime behaviour moves. The new case pins a current contract (a paused copy re-anchors, as Resume does) — if copy semantics for paused sources ever change deliberately, this case must change with them, which is the point of pinning it.

Checkpoint

{
"pr": 1343, "claim": "Dev3", "issue": 1319,
"summary": "Pins the paused-source branch of copySchedule, the one path that calls service.create instead of the row write. The new case pauses a task, copies it, and asserts a fresh id, create called with the source's request on the target's current part, and a next run re-anchored to now + interval. It also checks the refusals this branch shares and that a refused copy creates nothing. No product code changed; the case exposed no defect.",
"files": ["core/test/schedules.test.js", "patches/ds-bot/0001-core-fixes.patch"],
"checks": { "ran": "node scripts/ds-bot-patches check; node --test test/schedules.test.js", "result": "green", "at": "4ba2e53cfd0c5527f48e57e038282f2260f1ff19" },
"next": "none — ready for review"
}

The paused branch of copySchedule is the only path that calls service.create
instead of the row write, and nothing exercised it. Pause a task, copy it, and
assert a fresh id, create called with the source's request, and a next run
anchored to now + interval as Resume anchors one. Replacing that create with
copyRow fails the new case with "No such task".

Fixes #1319
@Birfy Birfy added the agent-pr Pull request opened by an agent label Oct 27, 2026
@Birfy Birfy self-assigned this Oct 27, 2026
@Birfy
Birfy added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 41decf0 Oct 27, 2026
13 of 15 checks passed
@Birfy
Birfy deleted the dev3/1319-paused-copy-test branch October 27, 2026 05:21
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(schedules): nothing pins the paused-source branch of copy, the one path that calls create

1 participant