Skip to content

feat(viewer)!: remove the chunk viewer and the summary tier - #691

Merged
cbcoutinho merged 3 commits into
mainfrom
feat/remove-chunk-viewer
Dec 2, 2026
Merged

cbcoutinho merged 3 commits into
mainfrom
feat/remove-chunk-viewer

Conversation

@cbcoutinho

@cbcoutinho cbcoutinho commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

What

The last step of ADR-0001 (§6 steps 2–4): Astrolabe's own chunk viewer and summary tier are removed. Search results now open in the MCP App views served by nextcloud-mcp-server:

Result Opens
file (PDF, image hit on a paged server, any text file incl. CSV) document viewer
note, Deck card, news item, mail record viewer
anything else (older or unreachable server, calendar, contacts) no Open action; the title link opens it in its own Nextcloud app. A shared link to it navigates there in the same tab.

Breaking change (minor bump on 0.x)

The commit carries a BREAKING CHANGE: footer, so the change appears in the changelog for the release it ships in.

  • Requires nextcloud-mcp-server 0.237.0 or later. It lists both views. Against an older server, every result opens in its own app. Admins should not upgrade Astrolabe before their MCP server.
  • Removed API surface:
    • GET /apps/astrolabe/api/chunk-context
    • POST /apps/astrolabe/api/v1/summary
    • the assistant.summary_modes OCS capability (openapi.json regenerated)
  • Summaries need the agent: Summarize/Ask in the viewers need a Chat with tools provider plus the admin opt-in. Summary-only and image-analysis providers are no longer used, and the admin hint now says so.

The MCP server keeps /api/v1/chunk-context for older Astrolabe installs. This app just stops calling it.

Removed

  • Frontend:
    • DocumentViewer, PDFViewer, CsvViewer and MarkdownViewer
    • chunkViewer.js and csvTable.js with their tests, and pdfRangeTransport.js
    • the pdfjs-dist and markdown-it dependencies, the vite PDF.js asset plugin, and the pdfjs/ packaging include
    • the page CSP grants that PDF.js needed (worker-src blob:, wasm)
  • Backend:
    • ApiController::chunkContext with its access helpers, and McpServerClient::getChunkContext
    • AssistantController, SummaryService, SummaryException and SummaryCleanupListener
    • getSummaryModes
  • Kept one more release: the 24 h scratch-folder sweep (SweepSummaryScratchJob), cut down to sweep(). It cleans up after summaries that were in flight at upgrade.

Tests

  • Unit:
    • viewerChoice: the model and pinned table are updated to the five rules. The "every outcome reached" check is now app/native/record, and appFocus with no usable focus opens unfocused.
    • Capabilities pin that the assistant block is only agent_available.
    • Summary and chunk-context tests are removed.
  • Contract: the consumer interaction for chunk-context is removed. The /mcp pacts (open_document, open_record) are unchanged.
  • e2e:
    • access.spec checks revocation where it is now enforced. Bob's open_document works while the file is shared and fails once the share is revoked, because the viewer reads the file as the user.
    • viewer-routing adds tests that:
      • a note on a server without the record viewer has no Open action, and its title opens Notes
      • a legacy link no viewer can open goes to Files
      • a pre-offset server opens a legacy link unfocused
      • the removed routes answer 404
    • search-options asserts that a global-search note link launches open_record with the link's offsets.
    • pdf-viewer.spec.ts and the chunk-viewer scan test are deleted.
  • Gates: PHPUnit 476, Psalm 0, cs clean, JS unit 61, lint 0 errors, build OK, contract 26 (1 env skip).

ADR-0001 §2 (the rule table) and §6 (outcome) are updated, and so are the docs page Assistant → Summarize or ask about a document.

Tracked on Deck board 12, card #1762.


This PR was generated with the help of AI, and reviewed by a Human

🤖 Generated with Claude Code

@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astrolabe-docs Canceled Canceled Dec 2, 2026 7:19pm UTC

@claude

claude Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Claude finished @cbcoutinho's task in 30s —— View job


Review of PR #691 (already merged)

What I read: the full diff of 8331048..cfa870e, covering all 69 changed files. I read these in detail: App.vue, viewerChoice.js, SearchResultItem.vue, PageController, Capabilities, AssistantCapabilities, SemanticSearchProvider, Application.php, routes.php, info.xml, and the sweep job. I skimmed the deleted files and the test changes. I did not run the test suites; the figures below are the PR's own claims. I grepped for leftovers: nothing under lib/, src/, appinfo/, the docs or openapi.json still references summaryModes, summary_modes or chunkContext. The only chunk-context reference is the e2e test that checks the route now answers 404.

Verdict: approve.

Checks against CLAUDE.md

  • Breaking change: commit 3948867 has a BREAKING CHANGE: footer naming the 0.237.0 server requirement. The PR body states the version rather than a merge order, as the repo rules require.

  • Degradation: the new native outcome in chooseViewer covers an old server, a failed listing, and calendar or contacts results. Results stay reachable through their own app instead of a broken page. This matches the "degrade, don't break" rule.

  • Test coverage: this PR removes API surface and adds none. The tests changed with the code:

    • the viewerChoice unit model and pinned table
    • the capabilities pin on the assistant block
    • the e2e 404 checks for the removed routes
    • the revocation test in access.spec.ts
    • the removed consumer interaction in the Pact tests

    The mandatory new-surface gate therefore does not apply.

  • openapi.json was regenerated, and the removed assistant.summary_modes capability is gone from it.

Code observations (no blockers)

  • viewerChoice.js and App.vue:
    • The five rules are clear.
    • The id guard now sends bad ids to native rather than the removed chunk viewer.
    • appFocus always returns an object, so focusFor can no longer be null. I found no caller that still checks for null.
  • Shared links:
    • The native branch calls history.replaceState before location.assign, so Back doesn't loop.
    • It navigates in the same tab to avoid a blocked popup, which is the right call.
    • documentUrl falls back to the app root when ids are missing, so a malformed link still lands somewhere sensible.
  • Link title default: it is now title ?? '', which fixes the earlier misapplied edit. Line 1 of App.vue is <template> again.
  • CSP: removing worker-src blob: and allowEvalWasm() narrows the page policy, which is the safer direction. Nothing else in the page uses those grants now.
  • Leftover job: SweepSummaryScratchJob and ScratchImageStore are kept for one release and tracked on card #1762. This is acceptable. Dropping TaskSuccessfulEvent/TaskFailedEvent cleanup is safe because the sweep job still clears in-flight leftovers within 24 h.

Nits (optional)

  • In AssistantCapabilities, summaryNeedsToolCallingProvider() and the TextToTextSummary import remain, and they now only drive the admin hint. That is fine, but the method name is a little misleading now that summary providers are never used. A rename could go in the follow-up that deletes the sweep job.
  • The /api/chunk-context 404 assertion in viewer-routing.spec.ts is intentional, as noted in the author's reply.

View job run

claude-review: verdict=approve head=cfa870ed8da6676cf3e7500e36fdcad07bdb02e8

@cbcoutinho

Copy link
Copy Markdown
Owner Author

Review findings addressed in d941371:

  • App.vue line 1: a misapplied edit had put the link-title default in front of <template> instead of on the link result (line 684). Line 1 is <template> again, and the shared-link title now defaults to '' as intended.
  • Stale SummaryCleanupListener references: the SweepSummaryScratchJob docblock and the info.xml comment now say the job only clears pages left from before the summary tier was removed, and goes in a later release.
  • tests/README.md: dropped ScratchImageStore::assertToken from the list of extracted pure functions, and rewrote the near-miss generator example in the past tense, since that code is gone.
    Left as-is: the /api/chunk-context call in viewer-routing.spec.ts, which asserts the removed route answers 404 (as the review notes).

npm run build, npm run lint (0 errors), npm run test:unit (61 pass) and composer run cs:check are green.

@cbcoutinho

Copy link
Copy Markdown
Owner Author

Approve-round nits, in a2bf9ea:

  • Orphaned docblock in SemanticSearchProvider: moved the "Build the URL that opens the result…" docblock down onto buildResourceUrl.
  • Removal follow-up: added a note on Deck card #1762 to remove SweepSummaryScratchJob and ScratchImageStore in a later release.
    Left as-is: the revocation poll in access.spec.ts is strict on purpose. A revoked share reaches McpAppController::callTool as a 200 whose result has isError: true. A 4xx or 5xx there would mean the viewer isn't listed or the MCP server is unreachable. Counting either as "denied" would let the test pass without checking revocation, so the test times out instead.

php -l and composer run cs:check are green.

@cbcoutinho
cbcoutinho force-pushed the feat/remove-chunk-viewer branch from a2bf9ea to 85a4913 Compare December 2, 2026 19:19
Base automatically changed from feat/record-viewer-routing to main December 2, 2026 19:19
cbcoutinho and others added 3 commits December 2, 2026 20:19
Search results now open in the MCP App views only: the document viewer for
files and the record viewer for notes, Deck cards, news and mail (ADR-0001
§6). A result no view opens (an older or unreachable server, calendar,
contacts) has no Open action, and its title opens it in its own Nextcloud app;
a shared link to one navigates there. CSV opens in the document viewer's text
mode.

Removed: DocumentViewer, PDFViewer, CsvViewer and MarkdownViewer with their
utilities, the PDF.js and markdown-it dependencies with the page CSP and
packaged assets PDF.js needed, the chunk-context proxy and its local access
re-check, and the summary tier (AssistantController, SummaryService, the
cleanup listener). The scratch-folder sweep stays one release to clean up
after summaries in flight at upgrade.

access.spec now checks revocation where it is enforced: open_document reads
the file as the user, so a revoked share fails there.

BREAKING CHANGE: requires nextcloud-mcp-server 0.237.0 or later, which lists
the document and record viewers; against an older server every result opens
in its own Nextcloud app, so do not upgrade Astrolabe before the MCP server.
Removed API surface: GET /apps/astrolabe/api/chunk-context,
POST /apps/astrolabe/api/v1/summary, and the assistant.summary_modes OCS
capability. Summaries need the agent (a Chat with tools provider plus the
admin opt-in); summary-only and image-analysis providers are no longer used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y comments

A misapplied edit put the shared-link title default on line 1, in front of
<template>, instead of on the link result. The link title now defaults to
the empty string as intended.

The sweep job, its info.xml comment and tests/README.md still cited the
removed SummaryCleanupListener and ScratchImageStore token check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cbcoutinho
cbcoutinho force-pushed the feat/remove-chunk-viewer branch from 85a4913 to cfa870e Compare December 2, 2026 19:19
@cbcoutinho
cbcoutinho merged commit 706ea60 into main Dec 2, 2026
4 checks passed
@cbcoutinho
cbcoutinho deleted the feat/remove-chunk-viewer branch December 2, 2026 19:19
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

This branch was successfully deployed

1 active deployment
Preview — cfa870ed Deployed Dec 2, 2026 by vercel[bot]
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