Add project field to list_notes API response #117

Closed
opened 2026-03-08 16:13:31 +00:00 by forgejo_admin · 0 comments

Lineage

plan-2026-02-26-tf-modularize-postgres → Phase 7f → Phase 7f-4 (attribute augmentation) → Deliverable #6

Repo

forgejo_admin/pal-e-docs

User Story

As a platform operator using the MCP tools
I want list_notes to include the project field in each note summary
So that I can see which project each note belongs to without calling get_note for every single note

Context

The list_notes endpoint returns note summaries (no html_content) to save tokens. But it omits the project field, which means there's no way to see project distribution without fetching every note individually. This blocks deliverable #6 of 7f-4 (project + parent assignment) — Betty Sue can't audit which notes lack project assignments without calling get_note 262 times.

The get_note endpoint already includes the full project object. The list_notes endpoint should include at minimum the project slug and name.

File Targets

Files to modify:

  • src/pal_e_docs/routes/notes.py — update the list_notes query to join/load the project relationship
  • src/pal_e_docs/schemas.py — update the NoteSummary schema to include a project field (either full ProjectOut or a lightweight ProjectRef with just slug + name)

Files NOT to touch:

  • src/pal_e_docs/models.py — the relationship already exists on the Note model
  • Migration files — no schema change needed, this is a query/serialization change

Acceptance Criteria

  • GET /notes/ response includes project info for each note (at minimum: project slug and name, or null if unassigned)
  • Existing list_notes filters (tags, note_type, status, parent_slug, project) still work
  • Response token size increase is minimal (project slug + name, not full project object with repo_url etc.)
  • get_note response is unchanged

Test Expectations

  • Unit test: list_notes returns project field for notes with projects
  • Unit test: list_notes returns null project for notes without projects
  • Unit test: existing tag/type/status filters still work with project field present
  • Run: pytest tests/ -k test_list_notes

Constraints

  • Keep the summary lightweight — prefer {"slug": "...", "name": "..."} over the full ProjectOut schema
  • Do not change the get_note response format
  • Match existing code patterns in routes/notes.py

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • phase-postgres-7f-4-attribute-augmentation — parent phase
  • pal-e-platform — project
### Lineage `plan-2026-02-26-tf-modularize-postgres` → Phase 7f → Phase 7f-4 (attribute augmentation) → Deliverable #6 ### Repo `forgejo_admin/pal-e-docs` ### User Story As a platform operator using the MCP tools I want `list_notes` to include the project field in each note summary So that I can see which project each note belongs to without calling `get_note` for every single note ### Context The `list_notes` endpoint returns note summaries (no html_content) to save tokens. But it omits the `project` field, which means there's no way to see project distribution without fetching every note individually. This blocks deliverable #6 of 7f-4 (project + parent assignment) — Betty Sue can't audit which notes lack project assignments without calling `get_note` 262 times. The `get_note` endpoint already includes the full project object. The `list_notes` endpoint should include at minimum the project slug and name. ### File Targets Files to modify: - `src/pal_e_docs/routes/notes.py` — update the list_notes query to join/load the project relationship - `src/pal_e_docs/schemas.py` — update the `NoteSummary` schema to include a project field (either full `ProjectOut` or a lightweight `ProjectRef` with just slug + name) Files NOT to touch: - `src/pal_e_docs/models.py` — the relationship already exists on the Note model - Migration files — no schema change needed, this is a query/serialization change ### Acceptance Criteria - [ ] `GET /notes/` response includes project info for each note (at minimum: project slug and name, or null if unassigned) - [ ] Existing list_notes filters (tags, note_type, status, parent_slug, project) still work - [ ] Response token size increase is minimal (project slug + name, not full project object with repo_url etc.) - [ ] `get_note` response is unchanged ### Test Expectations - [ ] Unit test: list_notes returns project field for notes with projects - [ ] Unit test: list_notes returns null project for notes without projects - [ ] Unit test: existing tag/type/status filters still work with project field present - Run: `pytest tests/ -k test_list_notes` ### Constraints - Keep the summary lightweight — prefer `{"slug": "...", "name": "..."}` over the full ProjectOut schema - Do not change the get_note response format - Match existing code patterns in routes/notes.py ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `phase-postgres-7f-4-attribute-augmentation` — parent phase - `pal-e-platform` — project
forgejo_admin 2026-03-08 16:19:51 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/pal-e-api#117
No description provided.