Skip to content

feat: POST /doc/update endpoint — partial document update with chunk rebuild - #583

Merged
ajianaz merged 3 commits into
developfrom
feat/doc-update-endpoint
Jul 6, 2026
Merged

ajianaz merged 3 commits into
developfrom
feat/doc-update-endpoint

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add POST /doc/update endpoint to uteke-serve — partial document update with automatic chunk rebuild on content changes.

Follow-up to Corin #139. Enables the DocumentsView.svelte Save button for editing existing documents.

API

POST /doc/update
{
  "id": "uuid" | "slug": "slug-name",
  "title": "New Title",
  "content": "# Updated markdown",
  "tags": ["tag1", "tag2"],
  "metadata": { ... },
  "namespace": "default"
}
-> Full Document (version incremented)
-> 404 if not found

Behavior

Field Changed What Happens
title only Title updated, no chunk rebuild
content Content updated, old chunks deleted, new chunks embedded and indexed
tags Tags updated, no chunk rebuild
metadata Metadata updated, no chunk rebuild
Multiple fields All updated atomically in single transaction
version Always incremented (implicit)
updated_at Always set to now (implicit)

Changes

File What LOC
documents.rs update_document() - dynamic SET clause, only provided fields +91
lib.rs doc_update() - resolve doc, partial update, chunk rebuild if content changed +95
types.rs DocUpdateRequest struct + resolve_doc_id_update helper +24
handlers.rs POST /doc/update route with 404 handling +33

Verification

  • cargo fmt --all -- --check pass
  • cargo clippy -p uteke-core -p uteke-server zero errors zero warnings
  • cargo check zero compiler errors from our crates
  • Full build verified by CI

Cross-repo Dependency

Corin needs this merged first, then wire doc_update in uteke_client.rs + commands.rs + ipc.ts + DocumentsView.svelte (Corin #139)

…rebuild (#579)

Add partial document update endpoint to uteke-serve HTTP API.

Changes:
- documents.rs: update_document() — dynamic SET clause, only updates provided
  fields, always increments version, returns updated doc
- lib.rs: doc_update() — resolves doc by id/slug, partial update, rebuilds
  chunks + re-embeds if content changed
- types.rs: DocUpdateRequest struct + resolve_doc_id_update helper
- handlers.rs: POST /doc/update route with 404 for missing docs

API:
  POST /doc/update { id | slug, title?, content?, tags?, metadata? }
  → Full document (version incremented)
  → 404 if not found

Partial update semantics: only fields present in request are modified.
Content changes trigger chunk rebuild (old chunks deleted, new ones
embedded and indexed). Non-content updates (title, tags) skip re-chunking.

Follow-up to Corin #139 — Corin DocumentsView will use this for Save.
@ajianaz ajianaz added the scope:core Core engine work label Jul 6, 2026
Comment thread crates/uteke-core/src/lib.rs Fixed
Comment thread crates/uteke-core/src/lib.rs Fixed
@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-cli · BYOK · MIT

// If content was changed, rebuild chunks.
if let Some(content_text) = content {
let old_chunk_ids = self
.store
content: chunk.content.clone(),
char_start: chunk.char_start as i64,
char_end: chunk.char_end as i64,
tags: updated.tags.clone(),
@ajianaz
ajianaz merged commit 4f1a9be into develop Jul 6, 2026
8 checks passed
@ajianaz
ajianaz deleted the feat/doc-update-endpoint branch July 9, 2026 14:27
ajianaz added a commit that referenced this pull request Aug 13, 2026
feat: POST /doc/update endpoint — partial document update with chunk rebuild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:core Core engine work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants