Files
Marcos Paulo e8c8c06d1e
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
feat: smart folder model, media time fragments, link card URL guard (MiniMax); specs for 10 more gaps (Codex) and the registry with bloat measurements
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 14:41:26 -03:00

2.0 KiB

TASK citation-model: normalized bibliography model and CSL JSON (Citations)

Runs through OpenCode (specs/agents/opencode-runbook.md is attached automatically). Task 1 of specs/plugins-parity/citations/tasks.md (rank 39).

OWNS

  • crates/engine/src/citations/model.rs (new, FIRST; unit tests inside).
  • crates/engine/src/citations/mod.rs (new, //!, module declaration and internal exports), one mod citations; in crates/engine/src/lib.rs.
  • crates/engine/src/error.rs only a narrow bibliography variant if no fitting error exists.

FILES TO OPEN

  • specs/plugins-parity/citations/spec.md D1 and tasks.md task 1.
  • crates/engine/src/lib.rs, crates/engine/src/error.rs, crates/engine/src/activity/outbox.rs.

GOAL / API

Write crates/engine/src/citations/model.rs in SECOND tool call (compiling stub plus one failing test, then pass). Pure Entry, Creator, Library; parse_csl_json(&str) -> Result<Library> and validate_key(&str) -> Result<()>. No IO or CSL formatting. CSL JSON id becomes stable key; preserve family/given or literal authors and issued date precision. Missing optional metadata remains absent, never invented. Bounds and key subset exactly D1: 8 MiB, 20,000 entries, 256-byte keys, 64 KiB fields, 32 levels, 100 creators. Detect duplicate keys before returning any library; invalid input returns Err. No new crate or dependency.

TESTS

Equivalent entries, Unicode/literal creators, partial dates, optional fields, invalid JSON/duplicate keys, key subset and boundary cases; every D1 cap including nesting. Module declared so tests execute.

VERIFY

export PATH="$HOME/.cargo/bin:$PATH"
cargo test -p notescraft-engine citations
cargo clippy -p notescraft-engine --all-targets -- -D warnings
rustfmt --edition 2024 crates/engine/src/citations/model.rs crates/engine/src/citations/mod.rs

DO NOT

Edit Cargo files, add dependency, read/write bibliography files, register commands, implement BibTeX/CSL formatting, access Zotero/network, touch UI. Q2 parser decision belongs to later adapter scope.