Skip to content

docs: backfill docstrings on 55 public functions#5

Merged
silversurfer562 merged 1 commit into
mainfrom
docs/backfill-docstrings
May 4, 2026
Merged

docs: backfill docstrings on 55 public functions#5
silversurfer562 merged 1 commit into
mainfrom
docs/backfill-docstrings

Conversation

@silversurfer562
Copy link
Copy Markdown
Member

Summary

Public-API docstring coverage was 29% (22/77) per the deep-review pass. Now 100% (77/77).

Backfilled across 12 files:

  • `jobs.py` (7): registry + JobContext API
  • `living_docs_store.py` (11): scan, queue, quality, get_store
  • `routes/living_docs.py` (11): all REST endpoints
  • `routes/cowork_pages.py` (9): every Cowork dashboard page handler
  • `routes/cowork_files.py` (4): read / render / write / pin
  • `routes/jobs.py` (5): commands, list / start / get / cancel jobs
  • `commands.py` (2): `get_command`, `list_commands`
  • `routes/profile.py` (2): get / set profile
  • `app.py` (1): `create_app`
  • `main.py` (1): `main` CLI entry
  • `routes/system.py` (1): `health`
  • `routes/cowork_templates.py` (1): `list_templates`

One-liners where the function name + signature carry the meaning; multi-line for endpoints with non-obvious error semantics.

Test plan

  • All 77 public functions have docstrings (verified by AST)
  • `uv run pytest sidecar/tests/` — 124 passing
  • `uv run ruff check sidecar/attune_gui/` — clean

🤖 Generated with Claude Code

Public-API docstring coverage was 29% (22/77). Now 100% (77/77).

Backfilled across 12 files:
  - jobs.py (7): registry + JobContext API
  - living_docs_store.py (11): scan, queue, quality, get_store
  - routes/living_docs.py (11): all REST endpoints
  - routes/cowork_pages.py (9): every Cowork dashboard page handler
  - routes/cowork_files.py (4): read/render/write/pin
  - routes/jobs.py (5): commands, list/start/get/cancel jobs
  - commands.py (2): get_command, list_commands
  - routes/profile.py (2): get/set profile
  - app.py (1): create_app
  - main.py (1): main CLI entry
  - routes/system.py (1): health
  - routes/cowork_templates.py (1): list_templates

One-liners where the function name + signature carry the meaning;
multi-line for endpoints with non-obvious error semantics.

124 tests pass, ruff clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@silversurfer562 silversurfer562 merged commit 1cd160d into main May 4, 2026
@silversurfer562 silversurfer562 deleted the docs/backfill-docstrings branch May 4, 2026 13:15
silversurfer562 added a commit that referenced this pull request May 8, 2026
…27)

Phase D4 of the architecture-realignment spec — final phase. Closes
findings #5 (private cross-route _get_pipeline import) and #7
(inconsistent error envelopes).

#5 — RagPipeline cache moved to attune_gui.services.rag_pipeline
with public ``pipeline_for(workspace)`` / ``invalidate(workspace)``.
routes.rag, routes.search, routes.living_docs, and the
_author_proxy invalidate path all import from the canonical owner.
routes.rag keeps backwards-compat aliases (_get_pipeline,
_PIPELINES, etc.) so existing in-tree code that referenced the old
private surface keeps working.

#7 — attune_gui.errors registers three handlers at app
construction: HTTPException (normalizes string + dict detail to
the envelope shape), RequestValidationError (renders 422s with a
``validation_error`` code and the original error list as a sibling
key), and bare Exception (catches anything else, logs the
traceback, returns the canonical 500 envelope without leaking the
exception message). Every ``/api/*`` response now renders through
one shape:

  4xx → {"detail": {"message": str, "code": str | null}}
  5xx → {"detail": {"message": "internal error",
                    "code": "internal_error"}}
  422 → {"detail": {"message": "Request validation failed.",
                    "code": "validation_error",
                    "errors": [...]}}

Routes raising HTTPException(detail="some string") get normalized
into the dict shape automatically — no per-route migration needed.
Routes already using detail={"code": ..., "message": ...} flow
through unchanged.

17 new tests (9 services + 8 envelope). Existing tests updated to
assert against detail["message"] instead of bare detail string.

Bumps to 0.7.0. Stop saying "internal_error" leaks an exception
detail to clients is a behavior change worth a minor bump even if
the shape itself is mostly compatible.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant