Skip to content

feat(smartqa): add run comment edit and delete routes [squash] - #352

Merged
congvc-dev merged 4 commits into
mainfrom
agent/x99-claude-sonnet/che-7704-e9608b0718ce
Nov 27, 2026
Merged

congvc-dev merged 4 commits into
mainfrom
agent/x99-claude-sonnet/che-7704-e9608b0718ce

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Status

Draft. Head 6d5f7108704b2e2a2018bc8fe119def2421b1780. Do not merge. An independent cross-lab verifier must sign the verdict (RGS-1) before the PR is marked ready.

Conditions

  • Additive code only. No schema change, no new config.
  • Out of scope: comment UI (CHE-1468), edit history, soft-delete retention, a comment change event.

Change

  • annotation_repository.py: add get_comment, edit_comment and delete_comment. edit_comment uses the same body checks as add_comment and sets edited_at.
  • run_annotations.py: add PATCH and DELETE /api/runs/{session_id}/comments/{comment_id}.
  • Order on both routes: run visibility, comment lookup, then the principal lookup, author check, require_note_write, write. A signed-in caller with no subject gets 404 for a hidden run or unknown comment, not 401. A fully anonymous caller gets 401 first from the shared evidence_scope dependency, as on POST.
  • PATCH accepts only {"body": "..."} and returns 200 with the comment. Only the author can edit, admins included.
  • DELETE returns 204. The author or an admin can delete.
  • A comment id that does not exist, or that belongs to another run, returns run_not_visible 404. A non-author gets comment_not_permitted 403.
  • A refused call (403, 404) spends no write budget. Edit and delete count against the shared note write budget.
  • Both routes are classified in access_control.py and in preview_routes.py REAL.
  • docs/board-api.md documents both routes and their errors.
  • The actor_required 401 mapping in CommentRoute now covers every non-GET comment route.

Blast Radius

  • Callers: the two new routes only. Existing GET and POST comment routes and the annotation routes keep their behaviour. The 401 mapping change affects only comment routes with a method other than GET.
  • Detection: the route registry tests (test_route_tiers.py, test_preview_routes.py) fail if a route is unclassified.
  • Hosts: none. No deploy step.
  • Proof level: 2 (unit and in-process API tests on X99).

Evidence

Red first: the new repository and API tests failed before the implementation (for example test_get_comment_returns_the_comment_or_none failed with no get_comment).

uv run pytest tests/unit/admin_console -q
2288 passed, 4 skipped, 1 deselected in 675.52s
uv run ruff check apps tests/unit/admin_console   -> All checks passed!
uv run ruff format --check apps tests/unit/admin_console -> 205 files already formatted

/verify ran: lint was ENV (ruff not on the bare PATH) and tests were TOO_BROAD (380 files). The uv run commands above cover both.

NOT-RUN: a What's New entry. No QA-visible UI changes in this PR.

Refs CHE-7704, CHE-1365

@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review November 26, 2026 23:02
@congvc-dev
congvc-dev added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 8a3a001 Nov 27, 2026
8 checks passed
@congvc-dev
congvc-dev deleted the agent/x99-claude-sonnet/che-7704-e9608b0718ce branch November 27, 2026 04:56
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