Skip to content

fix(entries): preserve merged timeline pagination#62

Closed
arapov wants to merge 1 commit into
masterfrom
codex/review-v166-minor-fixes
Closed

fix(entries): preserve merged timeline pagination#62
arapov wants to merge 1 commit into
masterfrom
codex/review-v166-minor-fixes

Conversation

@arapov
Copy link
Copy Markdown
Collaborator

@arapov arapov commented May 29, 2026

Summary

  • preserve upstream Link rel=next when list_party_entries includeLinkedPersons returns an exactly-full merged page
  • fetch enough entries per party to cover the requested merged window, up to Capsule's per-party 100 cap
  • align the new timeline probe/docs with the v1.7.0 minor-release line and refresh the test count

Review notes

  • No security blockers found in the changed HTTP landing page, explicit MCP annotations, or linked-person timeline path.
  • npm outdated reports only @biomejs/biome 2.4.15 -> 2.4.16; left out of this scoped fix as a non-blocking dev-tool patch.
  • package.json/serverInfo still report 1.6.5; bump to 1.7.0 during the release cut.

Verification

  • npm test -- tests/entries.test.ts tests/tool-annotations.test.ts tests/http-app.test.ts tests/mcp-integration.test.ts
  • npm test
  • npm run typecheck
  • npm run lint
  • npm run format:check
  • npm run build
  • npm audit --audit-level=low
  • npm outdated --json
  • npm install --package-lock-only --ignore-scripts
  • npm view capsulemcp dist-tags version versions --json --cache /private/tmp/capsulemcp-npm-cache
  • npm pack --dry-run --json --cache /private/tmp/capsulemcp-npm-cache
  • npm publish --dry-run --tag latest --cache /private/tmp/capsulemcp-npm-cache
  • git diff --check HEAD

@arapov
Copy link
Copy Markdown
Collaborator Author

arapov commented May 29, 2026

Cherry-picked the substantive pagination fix (entries.ts + tests) into #64, which targets current master. Dropped this PR's v1.6.6→v1.7.0 doc rewrites and the wire-trace-v166.ts→v170.ts rename: the probe scripts are iteration markers (v163–v167), not release versions, and renaming only v166 would break the sequence + the NOTES §32 references. Your semver point (next release is a minor bump for the new tools) is correct and noted for the release cut. Thanks for catching the page>1 under-fetch + the exactly-full-page-1 nextPage bug — both were real. Closing in favour of #64.

@arapov arapov closed this May 29, 2026
@arapov arapov deleted the codex/review-v166-minor-fixes branch May 29, 2026 08:18
arapov added a commit that referenced this pull request May 29, 2026
…ons (#64)

Two off-by-one-class bugs in the v1.6.6 fan-out merge path:

  1. Under-fetch for page > 1 — only `perPage` candidates were pulled
     per linked party, so page 2 sliced from too small a pool and
     could come back short/empty.
  2. False end-of-feed on an exactly-full page 1 — nextPage was
     `merged.length > start + perPage`, which reported undefined when
     the page filled exactly perPage even though linked parties still
     had older entries upstream (the per-party Link rel=next was
     discarded).

Fix: fetch min(page × perPage, 100) candidates per party
(mergedTimelineCandidatePerParty), and preserve each party's upstream
next-page signal when the requested window fits within the per-party
fetch cap (mergedTimelineNextPage). fanOutPartyEntries now returns
{entries, nextPage} per party so the signal is available. Very deep
pagination on a large multi-person org can still be approximate
(documented). Default single-GET path unchanged.

Cherry-picked from the substantive part of codex PR #62, dropping
that PR's v1.6.6→v1.7.0 doc rewrites and the wire-trace-v166→v170
rename — the probe scripts are iteration markers (v163–v167), not
release versions, and renaming only v166 would break the sequence
and the NOTES §32 references. The release-version bump is a
release-cut decision, deferred.

537 tests (+1). Bundle 168.08 KB stdio / 195.95 KB http.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
arapov added a commit that referenced this pull request May 29, 2026
#67)

Cherry-picked the genuine bits from codex PR #66, dropping that PR's
v1.6.6→v1.7.0 doc rewrites and the wire-trace-v166/v167→v170-* probe
renames (iteration markers, not release versions — rejected the same
way as #62/#64).

Real fixes the audit's docs lane missed:
  - README.md tool table: Tags row now lists delete_tag_definition
    (was added to the catalog but not the README table).
  - src/capsule/cache.ts: header + invalidateByPrefix doc comments now
    name delete_tag_definition as a third tag-mutating tool that drops
    the list_tags cache (accurate — the handler does call
    invalidateByPrefix), and generalize "/tags" → "/<entity>/tags".

Test coverage:
  - tests/cache.test.ts: delete_tag_definition invalidates the cached
    list_tags response.
  - tests/entries.test.ts: a merged-timeline window that CROSSES the
    100-entry ceiling returns the in-ceiling tail and ends the feed
    (complements the #65 boundary test with the partial-window case).

Plus a sharper PAGINATION CAVEAT wording (distinguishes crossing-window
truncation from beyond-ceiling empty) — kept the v1.6.6 provenance.

Closes #66 (cherry-picked clean). 538 → 540 tests.

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

Development

Successfully merging this pull request may close these issues.

1 participant