Skip to content

PROJ-238, 237, 374, 234: wiki folders, delete semantics, attachments MCP parity, comments authz fix#127

Merged
TAJD merged 5 commits into
mainfrom
proj-238-237-374-234-batch
Jul 19, 2026
Merged

PROJ-238, 237, 374, 234: wiki folders, delete semantics, attachments MCP parity, comments authz fix#127
TAJD merged 5 commits into
mainfrom
proj-238-237-374-234-batch

Conversation

@TAJD

@TAJD TAJD commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • PROJ-374: adds a regression test for the viewer 403 guard on POST /api/issues/:id/comments (fix already shipped in a prior commit; this closes the coverage gap that kept the ticket open).
  • PROJ-234: extracts routes/files.ts's business logic into services/files.ts; adds PayloadTooLargeError/UnsupportedMediaTypeError typed errors (413/415); gives attachments MCP parity (list_attachments, get_attachment, create_link_attachment, delete_attachment) with R2 cleanup on delete.
  • PROJ-237: adds a Move (re-parent) UI to the wiki page island — a Move button opens a parent-page picker and PUTs the new parentId. Tree nav, create-under, and breadcrumbs were already implemented in prior work.
  • PROJ-238: fixes a dangling-parent_id bug on wiki page delete (no FK constraint exists). Default now promotes children to the deleted page's parent; cascade=true (REST query param / MCP arg) deletes the whole subtree, chunked to respect D1's bound-parameter limit.

An Opus-model review pass was run over the full batched diff before merge — no blocking issues found. Two non-blocking findings were filed as follow-up tickets: PROJ-425 (attachments have no viewer/write authz gate, now reachable via the new MCP tools) and PROJ-426 (wiki page delete orphans R2 blobs for file attachments).

Test plan

  • pnpm --filter @projektor/api test — 824/824 passed (5 pre-existing todo)
  • pnpm --filter @projektor/web test — 379/379 passed
  • pnpm turbo type-check — clean across all packages
  • pnpm --filter @projektor/web build — succeeds
  • rtk proxy pnpm lint (biome) — clean
  • Opus-model review of the full batched diff — no blocking issues

🤖 Generated with Claude Code

TAJD added 5 commits July 19, 2026 12:48
The ForbiddenError guard already shipped in 5f95e62 but had no test
covering it and the ticket was never closed.
- Move all attachments business logic + raw SQL out of routes/files.ts
  into services/files.ts + schemas/files.ts, per the service-layer
  contract. R2 object I/O (streaming put/get/delete) stays in the route.
- Add two typed errors (PayloadTooLargeError, UnsupportedMediaTypeError)
  so the 413/415 REST responses still come from the service layer via
  the standard error-adapter pattern.
- Add mcp/files.ts: list_attachments, get_attachment, create_link_attachment,
  delete_attachment. Binary upload/download remain REST-only (documented
  as a deliberate parity exception in AGENTS.md); delete_attachment also
  cleans up the R2 object so the MCP path doesn't orphan storage.
- Wire into routes/mcp.ts + mcp/catalog.ts, regenerate the tool catalog.
- Add MCP round-trip tests and extend files.test.ts; all existing REST
  behavior/status codes preserved (30/30 files.test.ts, 820/825 full
  API suite).
Adds a Move button to the page header that opens a parent-page picker
and PUTs the new parentId. Backend already enforces cycle/scope
validation on PUT /api/wiki/:slug.
wiki_pages.parent_id has no FK constraint, so deleting a page left
children pointing at a row that no longer existed. Default behavior
now promotes children to the deleted page's parent; an explicit
cascade=true (REST query param, MCP tool arg) deletes the whole
subtree instead, using inChunks to stay under D1's bound-parameter
limit. Regenerated the MCP tool catalog for the schema change.
Fixes an Opus-review finding: opening Move then clicking Edit (or
Create) left both forms mounted since only navigateTo reset move
state.
@TAJD
TAJD merged commit b90ad2c into main Jul 19, 2026
1 check passed
@TAJD
TAJD deleted the proj-238-237-374-234-batch branch July 19, 2026 12:49
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