feat: expose embed command_id in note API responses #545
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Note.save()already returns thecommand_idfrom theembed_notebackground job it submits, but the note API routes were discarding this value. This PR surfaces thecommand_idinNoteResponsefor both the create (POST /api/notes) and update (PUT /api/notes/{id}) endpoints.This enables API consumers to poll
GET /api/commands/jobs/{command_id}to know when note embedding has completed, which is useful for workflows that need to trigger downstream processing only after embeddings are ready.Related Issue
N/A — This is a small enhancement to improve API observability for async embedding operations.
Type of Change
How Has This Been Tested?
uv run pytest)Test Details:
Added 4 new unit tests in
tests/test_notes_api.py:test_create_note_returns_command_id— verifies POST returns the embed command_idtest_create_note_command_id_none_when_no_content_embedding— verifies POST returns None when no embedding is triggeredtest_update_note_returns_command_id— verifies PUT returns the embed command_idtest_update_note_command_id_none_when_no_embedding— verifies PUT returns None when no embedding is triggeredFull test suite passes (102/102 tests).
Design Alignment
Which design principles does this PR support?
Explanation:
Exposes an already-available internal value through the REST API, enabling external consumers to track async embedding status. This aligns with API-First by making the note embedding lifecycle fully observable via the existing commands API, and with Async-First by giving callers the tools to coordinate with background processing.
Checklist
Code Quality
Testing
make rufforruff check . --fixmake lintoruv run python -m mypy .Documentation
/docs(if applicable)Database Changes
/migrations)Breaking Changes
Screenshots (if applicable)
N/A — No UI changes.
Additional Context
This is a non-breaking, additive change. The new
command_idfield onNoteResponseis optional with a default ofNone, so existing clients are unaffected. Thecommand_idwill beNonewhen the note has no content (and thus no embedding is triggered).Pre-Submission Verification