Skip to content

feat(615): knowledge & collaboration reads (service-bridge 1.8.0), comment resolve, native label-leak fix - #59

Merged
PMQ9 merged 1 commit into
wiki-v2from
feat/615-knowledge-collab
Sep 26, 2026
Merged

PMQ9 merged 1 commit into
wiki-v2from
feat/615-knowledge-collab

Conversation

@PMQ9

@PMQ9 PMQ9 commented Sep 26, 2026

Copy link
Copy Markdown

TL;DR

Fork side of wiki-v2 issue 615: service-bridge contract 1.8.0 adds the reads that back the new /v1 + MCP knowledge and collaboration surface. It also adds an original comment-resolve endpoint and fixes the native label-picker leak. Merge this first, then the wiki-v2 super PR bumps the gitlink.

Context

wiki-v2 issue 615 gives agents search filters, a page tree, labels, comments, activity and permission introspection. The platform keeps every authorization decision. This fork only serves data for the PDP-authorized id set it is handed (filter-then-retrieve). The full plan and tradeoffs are in the issue 615 "Implementation plan" comment.

Related issues

  • wiki-v2 issue 615 (closed by the super PR)

What changed

  • content/pages/list
    • New filters: labelName, lastUpdatedById, pages created range, topLevel, descendantOf+maxDepth, linksTo/linkedFrom. Each is pinned to the supplied ids, the workspace and live pages. descendantOf walks only through supplied live ids and is depth-bounded.
    • New position sort (collate "C", '~' NULL sentinel).
    • New wire-only creator/last-editor ids and names.
  • New content:read routes: pages/ancestors (ids only; never self or restriction facts), labels/list (with pageCount over the supplied ids), activity/list (a keyset union over pages, page_history, comments, attachments and the Docmost audit table), and spaces/comment-policy.
  • content/search
    • The new filters apply in the candidate SQL, before the PDP gate.
    • hasMore comes from a one-row peek.
    • An optional service-account leg makes OBO results and paging service ∩ user. searchPage keeps its native shape.
  • POST /api/comments/resolve (authz/comment-resolution/, app-root seam fix(authz): harden PLATFORM_AUTHZ_TIMEOUT_MS parse (empty/typo → deny-all self-DoS) #4). This is original code; upstream's is EE-only. It checks, in order: live page, validateCanComment, the comment belongs to the page, then top-level only. The write is an idempotent compare-and-set. It updates the inline mark only for inline comments, and emits the ws event, notification and audit event.
  • PdpLabelRepo (remote mode, seam feat(public): anonymous front page + discovery endpoint (wiki-v2 #26) #1, mode-selected like the two existing rebinds). Native POST /api/labels and /api/labels/pages gate through the PDP before pagination, so labels that exist only on pages the caller cannot view are no longer listed.
  • Activity source. PlatformAuditService (and a StandaloneAuditService in native mode) also persists an IP-free allowlist into Docmost's own audit table: page trashed, restored and moved to space; comment deleted, resolved and reopened. It never throws and has a retention prune. The table already existed, so there is no new schema.
  • Docs: contract docs (service-bridge 1.8.0, authorization-service 1.2.0 Subject description) and the stub README/comment.

How this was tested

  • Fork suites: AUTHZ_TEST_PG_URL=… npx jest src/authz src/service-bridge src/core/label src/core/comment src/integrations/audit. 1484/1484 tests pass, including real-Postgres specs: new knowledge pg specs, the label repo pg spec, the search pg spec, and the activity writer pg spec.
    • Anti-vacuity: removing an id/live/workspace predicate turns tests red.
    • One unchanged upstream spec, comment.service.spec.ts, can't load an ESM dependency locally and is not in the CI lane.
  • Static checks: eslint is clean on changed files, and there are no new tsc errors in changed files. scripts/check-upstream-boundary.sh passes, the platform consumer contract passes 64/64, and the import-boundary, route-inventory and scope-coverage specs are green.
  • Real stack: an isolated compose stack built from this commit ran the full scripts/smoke-v1-content.sh at 190/190. Curl checks confirmed the native /api/labels no longer lists a restricted-only label for a reader, and there were real MCP OAuth tool calls.

AWS / infra apply

N/A

Checklist

Scope

  • Complete and scoped to one logical concern — no unrelated drive-by changes (or follow-ups noted below).

Tests

  • New/changed behavior has appropriate tests — unit / integration / e2e / security / regression as applicable (or N/A, with why).
  • Existing tests pass, and any new tests pass.

Docs & contracts

  • Docs added/updated where needed (README / docs/ / an ADR), or N/A.
  • Any API/contract, config, migration, permission, or deployment impact is called out in this PR, or N/A.
  • Any AWS/infra apply is described precisely, scoped (no mass-apply), and captured in a reviewable one-time script — see "AWS / infra apply" above, or N/A.

Safety (this is a security-first, deny-by-default platform)

  • Security, authorization, data integrity, failure paths, and backward compatibility considered, or N/A.
  • Upstream boundary respected — no undocumented edits to Docmost-owned files (see UPSTREAM_MODIFICATIONS.md); proprietary/authz logic stays out-of-process.

Housekeeping

  • Related issue(s) linked above.
  • Known limitations, follow-ups, or intentionally deferred work identified below.

Known limitations / follow-ups

  • The contract becomes 1.8.0. The platform client now requires the new fields, so the fork and platform must ship together; they already share one ECS task.
  • Activity limits: lifecycle events start at deploy, and ACL changes, same-space moves and title-only renames have no engine event.
  • Resolving an inline comment rewrites its mark in the live document, which rotates the page version.

🤖 Generated with Claude Code

Service-bridge contract 1.8.0 (all CCC code; the bridge stays an
id-trusting data plane pinned to the platform's authorized set):
- content/pages/list: labelName, lastUpdatedById, created range,
  topLevel, descendantOf+maxDepth (recurses only through supplied live
  ids), linksTo/linkedFrom, position sort, creator/last-editor projection
- new: pages/ancestors, labels/list, activity/list, spaces/comment-policy
- content/search: label/parent/editor/date filters in the candidate SQL,
  one-row hasMore peek, and an optional service-account leg so OBO
  results and paging are computed over service ∩ user

Also:
- POST /api/comments/resolve: original resolve/reopen endpoint (EE-only
  upstream), app-root seam #4
- PdpLabelRepo (remote mode, seam #1): the native label picker and
  pages-by-label no longer list labels that exist only on pages the
  caller cannot view; pagination meta computed after the PDP gate
- activity: the CCC audit service also persists a small IP-free
  allowlist of lifecycle events into Docmost's own `audit` table
  (reused; no new table) for the activity feed, with retention prune

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@PMQ9
PMQ9 merged commit 8edb215 into wiki-v2 Sep 26, 2026
@PMQ9
PMQ9 deleted the feat/615-knowledge-collab branch September 26, 2026 20:25
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