Skip to content

refactor: rewrite batch processor [ANK-377]#161

Open
piazza-bot wants to merge 1 commit into
mainfrom
codex/ank-377-rewrite-batch-processor
Open

refactor: rewrite batch processor [ANK-377]#161
piazza-bot wants to merge 1 commit into
mainfrom
codex/ank-377-rewrite-batch-processor

Conversation

@piazza-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Replaced fixed-size batch chunks with a refill worker pool so free workers immediately take the next note.
  • Threaded cancellation through batch/note processing while keeping local-server generateNotes isolated from stale manual UI cancellation.
  • Made local-server generateNotes preflight note/deck mapping before worker execution and return partial results with Out of credits when the worker pool hits capacity.
  • Preserved deterministic result ordering and added worker fatal-error draining so unexpected worker-loop failures do not return while sibling workers keep running in the background.

Verification

  • source .venv/bin/activate && ./scripts/build.sh fix
    • Result: 83 files left unchanged; all checks passed.
  • source .venv/bin/activate && ./scripts/build.sh check
    • Result: formatting/static checks passed with 0 errors, 0 warnings, 0 informations.
  • source .venv/bin/activate && python -m pytest
    • Result: 142 passed.
  • Architecture-review subagent loop:
    • Initial passes found worker out-of-credits/admission/fatal-drain issues; addressed them.
    • Final pass reported no actionable architecture/design issues.
  • Anki sandbox E2E on this branch via source .venv/bin/activate && ./scripts/build.sh sandbox-local:
    • Smart Notes loaded successfully and started the local server on 127.0.0.1:8766.
    • Used AnkiConnect to verify version 6, read Basic model fields, create a temporary note, read it back, and delete it.
    • Used Smart Notes local server to verify ping, getSmartFields for Basic, and generateNotes on the temporary note.
    • Observed expected result for no Smart Fields: {"updated": [], "failed": [], "skipped": [<temp note id>]} with no error.
    • Shutdown left ports 8765 and 8766 closed.
    • Note: AnkiConnect printed its known requireReset() is obsolete; please use CollectionOp() warning during addNote; Smart Notes requests completed with HTTP 200.
  • Computer Use visual sanity check:
    • get_app_state attached to /Applications/Anki.app and showed the sandbox Anki deck list.
    • No screenshot is included because ANK-377 changes processing/local-server behavior rather than a visual UI surface.

Agent session metadata

  • Working directory: /Users/michaelpiazza/conductor/workspaces/smart_notes_all/warsaw/anki-smart-notes
  • Session ID: b77430b7-3079-4a90-b0a2-ce65f0b1115a

@linear

linear Bot commented Jun 7, 2026

Copy link
Copy Markdown

ANK-377

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.

2 participants