2 Commits
Author SHA1 Message Date
amitwh bd620284ab test: fix Windows-only test failures so CI matrix runs clean
Two pre-existing Windows-specific failures blocked the CI release
matrix from publishing the Windows build:

  - tests/main/DailyNotes.test.js: 'joins dir + YYYY-MM-DD.md' used
    a hard-coded '/tmp/notes/2026-09-13.md' expected value. On
    POSIX path.join returns '/' and the test passes; on Windows
    path.join returns '\' and the test fails. Fix: build the
    expected value via path.join so it matches the platform.

  - tests/main/PDFBatchOperations.test.js: 'watermarks every PDF
    including subfolders' used the default 5s Jest timeout. Windows
    CI runners are slower at pdf-lib / pdfjs-dist cold-start and the
    test regularly exceeded 5s. Fix: jest.setTimeout(30000) at the
    start of the watermark describe block.

Neither is a regression — both predate this session. The fix gets
the Windows job green so the release matrix completes 3/3.

Amit Haridas
2026-09-30 23:12:59 +05:30
amitwh 3f856bc857 feat(pkm): daily notes + workspace search + doc-aware Q&A
Three more features from the brainstorm menu, built on a shared search
algorithm so the codebase stays small.

- src/main/DailyNotes.js — Zettelkasten-style helper. One YYYY-MM-DD.md
  per local date under <userData>/notes/daily/; loads skeleton from
  <userData>/notes/templates/daily.md when present (built-in default
  otherwise). openOrCreate never clobbers existing content.
- src/main/WorkspaceSearch.js — tag/wikilink-aware content search.
  Pure module, injectable-IO tested. Query grammar: bare words,
  #tag, @wikilink, "quoted phrases". Facets weight +3 each; prose
  terms +1/occurrence capped at 5; edits within 7 days get a recency
  nudge. Returns ranked results with snippets.
- src/main/DocQA.js — chunk-level Q&A wrapper over WorkspaceSearch.
  cleanQuestion strips question words (what/how/why/...) and verb
  noise (write/read/show/tell/...) so they don't drown the ranking.
  Returns top-K passages instead of whole-file hits — multiple chunks
  from the same file can appear in the answer.
- src/main.js — IPC: daily-notes:open-today, daily-notes:list,
  workspace-search:query, doc-qa:ask. Path validation through the
  existing validatePath gate; a global Ctrl+Alt+D shortcut creates
  today's daily note from anywhere.
- src/preload.js — all four channels added to ALLOWED_SEND_CHANNELS.

Tests (56 new across the three modules):
- tests/main/DailyNotes.test.js (15): dateKey formatting, pathFor,
  template load + {date}/{weekday} substitution, openOrCreate +
  no-clobber, nested-dir creation, listExisting filtering,
  isValidDir rejects NUL/non-string.
- tests/main/WorkspaceSearch.test.js (25): parseQuery grammar,
  hasTag/hasWikilink word boundaries, scoreDocument scoring,
  per-term spam cap, recency nudge, search ranking + limit +
  empty-query short-circuit, bad-input safety.
- tests/main/DocQA.test.js (16): cleanQuestion stripping + facet
  preservation, chunkDocument paragraph + hard-split, ask()
  top-K, recency tiebreaker, missing-files fallback.

Full suite: 748 tests pass, 66 suites, lint+format clean.

Amit Haridas
2026-09-14 00:02:58 +05:30