Skip to content

A base can follow a gitlab.com project's issues and, when switched on, its merge requests (#1327) - #1508

Merged
WaylandYang merged 3 commits into
deeplethe:devfrom
QuintinBotes:issue-1327-gitlab-issues
Nov 16, 2026
Merged

WaylandYang merged 3 commits into
deeplethe:devfrom
QuintinBotes:issue-1327-gitlab-issues

Conversation

@QuintinBotes

Copy link
Copy Markdown
Contributor

Second of the two PRs agreed in #1327, on the shared ticket document from #1378 and as 0013 decision 7 describes it.

What it does

  • New source kind gitlab_issues. Each issue is one document; each merge request is one too when include_merge_requests is on (default off, as include_pull_requests is for GitHub). A merge request has !<iid> in its heading and "Merged on" beside "Closed on".
  • ## History comes from resource_state_events, resource_label_events and resource_milestone_events, never from system notes, so a change is not told twice. ## Comments holds non-system notes only.
  • Reads by update time like GitHub and Jira (0072): updated_after, order_by=updated_at, sort=asc, a run stops only at a timestamp boundary, and a second listing pass checks nothing moved. updated_after is inclusive on gitlab.com (checked 2026-11-14), so rows at or before the checkpoint are skipped.
  • Issues and merge requests are two lists under one checkpoint. The checkpoint stops where the earlier of two truncated lists stopped; tickets of the other list past that point wait for the next round. The 200-ticket round budget is split between the lists.
  • A token is required: notes and the three event endpoints answer 401 without one, even for a public project. The sync says so before sending a request, the create dialog requires it, and the hint says why.
  • Timestamps carry milliseconds; text and doc_time are cut to the second. The checkpoint keeps the milliseconds, otherwise a later ticket in the same second would be read again every round.
  • Changing project, or switching merge requests on, clears the checkpoint so the older tickets are read; unchanged ones dedupe. A sync still running under the old config is failed in the same transaction, because with a NULL checkpoint the clear alone would not stop it committing.

Not in this PR

  • GitHub has the same gap for repo and include_pull_requests: the checkpoint survives the edit. I kept the fix to gitlab_issues and can open an issue for the other two.
  • No retry on 429; a round fails and keeps its checkpoint, as gitlab_repo does today.
  • gitlab.com only. Self-managed GitLab is not verified, and the kind's hint says so.

Why it is one PR

About 1,120 lines of code and tests (1,427 with the fixture, golden file and docs). The kind, its reader, the checkpoint wiring and the dialog only work together: without the enum variant and the store's kind list the checkpoint never saves, and without the dialog the kind cannot be created. The renderer was already split out as #1378.

Fixture

Recorded with a read_api token from https://gitlab.com/QuintinBotes/utopia-gitlab-fixture and trimmed to the fields read: two issues (one closed and reopened twice with label and milestone events, one closed) and two merge requests (one merged, one closed unmerged). The merged one carries a system note, which the render test asserts is left out.

What was run

macOS (Apple silicon), on f33f9fc plus this commit, Postgres 17.12 with pgvector 0.8.7 (the compose file uses the pg16 image), UTOPIA_DATABASE_URL set and UTOPIA_TEST_REQUIRE_DB=1:

  • cargo fmt --all -- --check: clean
  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test --workspace --no-fail-fast: 1853 passed, 0 failed, 6 ignored, 47 test binaries
  • pnpm build in web: passes; pnpm test: 343 passed in 49 files

New tests: render from the recording (issue, merged and closed merge request); the shared checkpoint across both lists; a ticket that moves between the two listing passes; a database-backed sync over the recording; GitLab added to the 0072 checkpoint tests (1,001 equal-time tickets, failed listing, failed write, recovery). The race test was checked by disabling the guard: it fails without it.

ticket_render_golden.json gained the four GitLab tickets; no GitHub or Jira line changed.

🤖 Generated with Claude Code

QuintinBotes and others added 2 commits November 14, 2026 23:25
…, its merge requests, each as one document whose history comes from resource events (deeplethe#1327)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Quintin Botes <quintinbotes@outlook.com>
…that can see it does not hand it to every viewer

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

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is careful work: the shared checkpoint is handled correctly and the clear-on-edit guard closes a real gap. One thing I fixed on the branch in 0ff5e4f: with a token that can see them, GitLab also lists confidential issues (public projects included), and they would have become readable by every viewer of the base, so they are now listed (checkpoint and re-read unchanged) but not written, with a test. And yes, please open the issue for the same checkpoint gap on GitHub's repo / include_pull_requests. Merging.

@WaylandYang
WaylandYang merged commit 4ed8a59 into deeplethe:dev Nov 16, 2026
6 checks passed
WaylandYang pushed a commit to rollroyces/utopia that referenced this pull request Nov 18, 2026
Keeps dev's reads_by_timestamp for the three ticket sources (deeplethe#1508 added
gitlab_issues) and the custom checkpoint from this branch beside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants