Skip to content

feat(fetcher): add gitlab_* forge family + extend github_* shape coverage - #243

Merged
unhappychoice merged 21 commits into
mainfrom
feat/gitlab-forge-family
May 17, 2026
Merged

unhappychoice merged 21 commits into
mainfrom
feat/gitlab-forge-family

Conversation

@unhappychoice

@unhappychoice unhappychoice commented May 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds the gitlab_* forge family so the per-dir killer feature works on
GitLab repos the same way it does on GitHub, and brings the existing
github_* family up to the current shape-coverage convention (8 list
shapes + count badge for list fetchers).

New fetchers (Safety::Safe)

name shapes mirror of
gitlab_my_mrs 9 github_my_prs
gitlab_review_requests 9 github_review_requests
gitlab_repo_mrs 9 github_repo_prs
gitlab_repo_issues 9 github_repo_issues
gitlab_repo_stars 6 github_repo_stars (no watchers row, GitLab has no equivalent)
gitlab_pipeline_status 3 github_action_status

Self-hosted GitLab via host option; default gitlab.com. Host is
validated (hostname-only allowlist) before any auth header leaves the
process, matching the project_trust_model rule.

Auth: GITLAB_TOKEN env var. PAT needs read_api scope for user-scope
queries (gitlab_my_mrs, gitlab_review_requests); public project
queries (gitlab_repo_*, gitlab_pipeline_status) are scope-tolerant.

ProjectPath accepts arbitrarily nested groups (group/sub/proj) and
requires at least two segments so a typo like group/ fails fast
instead of generating a 404 at the API.

Shared row model

src/fetcher/forge_items.rs carries the ForgeRow row struct and the
nine-shape dispatcher used by both forge families. Adding a new shape
variant or label convention now lights up on github and gitlab
simultaneously.

Extended github_* shape coverage

fetcher before after
github_my_prs, github_review_requests, github_assigned_issues, github_repo_prs, github_repo_issues 4 (LinkedTextBlock / TextBlock / Entries / Timeline) 9 (+ Text / MarkdownTextBlock / ImageLinkedList / Bars / Badge)
github_repo_stars 2 (Text / Entries) 6 (+ TextBlock / MarkdownTextBlock / Bars / Badge)
github_action_status 2 (Badge / Text) 3 (+ Entries)

Note: the Entries key convention for list fetchers changes from "splashboard #54" to "unhappychoice/splashboard#54" to keep the row label consistent across every shape. Repo-scope fetchers (github_repo_prs/issues) already used #54 and stay unchanged.

Test plan

  • cargo test --lib: 2707 pass / 0 fail / 17 ignored
  • cargo clippy --all-targets -- -D warnings: clean
  • cargo fmt --all -- --check: clean
  • Manual smoke test on gitlab.com against the gitlab-org/gitlab
    project: gitlab_repo_mrs (Timeline), gitlab_repo_issues (Bars),
    gitlab_repo_stars (Entries / Bars / Badge),
    gitlab_pipeline_status (Badge / Entries) all render the expected
    shapes. User-scope gitlab_my_mrs / gitlab_review_requests confirmed
    to surface 403 insufficient_granular_scope for a PAT without
    read_api, demonstrating the placeholder path.
  • GitHub extensions verified against unhappychoice/splashboard:
    Bars / Badge / ImageLinkedList / MarkdownTextBlock all paint.

Catalog ticks

Ticks the six checkboxes under gitlab_* in #63 once this lands. Also
contributes the broader shape coverage hinted at in #41's "shapes are
the only coupling" rule by making the two forge families produce
structurally identical output for every shape.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added GitLab support with new fetchers for merge requests, issues, stars, and pipeline status.
    • Expanded output shapes for GitHub fetchers, enabling additional formatting options (Entries, Bars, Timeline).
    • Added activity indicators (comment/interaction counts) to GitHub issue and pull request listings.
  • Refactor

    • Consolidated rendering pipeline for list-based outputs across GitHub and GitLab fetchers.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 17, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@unhappychoice has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 26 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: caae2614-4a45-46ca-8dba-68541f5b5ed2

📥 Commits

Reviewing files that changed from the base of the PR and between 7430edd and b0aa0ca.

📒 Files selected for processing (20)
  • src/fetcher/forge_items.rs
  • src/fetcher/github/action_status.rs
  • src/fetcher/github/assigned_issues.rs
  • src/fetcher/github/items.rs
  • src/fetcher/github/my_prs.rs
  • src/fetcher/github/repo_issues.rs
  • src/fetcher/github/repo_prs.rs
  • src/fetcher/github/repo_stars.rs
  • src/fetcher/github/review_requests.rs
  • src/fetcher/gitlab/client.rs
  • src/fetcher/gitlab/common.rs
  • src/fetcher/gitlab/items.rs
  • src/fetcher/gitlab/mod.rs
  • src/fetcher/gitlab/my_mrs.rs
  • src/fetcher/gitlab/pipeline_status.rs
  • src/fetcher/gitlab/repo_issues.rs
  • src/fetcher/gitlab/repo_mrs.rs
  • src/fetcher/gitlab/repo_stars.rs
  • src/fetcher/gitlab/review_requests.rs
  • src/fetcher/mod.rs
📝 Walkthrough

Walkthrough

This PR introduces a shared forge_items row-rendering pipeline supporting multiple output shapes, migrates five GitHub fetchers to use it, and adds complete GitLab integration with six new fetchers, HTTP client, and common helpers.

Changes

Forge-based rendering and GitHub migration

Layer / File(s) Summary
Forge row model and shape-driven rendering pipeline
src/fetcher/forge_items.rs
Introduces ForgeRow (label/title/url/avatar/updated/activity) and shape-dispatched renderers for Text, TextBlock, Markdown, LinkedText, Entries, Bars, Timeline, ImageLinkedList, and Badge. Provides async dispatch_rows_async() with thumbnail URL resolution, sync dispatch_sample() for documentation, and render_count_badge() for activity badges.
GitHub item model and ForgeRow conversion
src/fetcher/github/items.rs
Extends IssueItem with comments and optional user/avatar_url fields. Implements to_forge_row() converting items to ForgeRow with repo-prefixed labels, optional URL/avatar, unix timestamps, and activity counts; adds sample_rows() fixture helper.
GitHub assigned_issues, my_prs, repo_prs, repo_issues migration
src/fetcher/github/assigned_issues.rs, my_prs.rs, repo_prs.rs, repo_issues.rs
Each fetcher now advertises shapes via shared LIST_SHAPES, generates samples through dispatch_sample(), and renders via dispatch_rows_async() with async thumbnail resolution.
GitHub review_requests, action_status, repo_stars shape expansion
src/fetcher/github/review_requests.rs, action_status.rs, repo_stars.rs
review_requests migrates to forge_items. action_status adds Shape::Entries support. repo_stars expands to TextBlock, MarkdownTextBlock, Bars, Badge via unified render_body() for both samples and fetched data.

GitLab integration

Layer / File(s) Summary
GitLab HTTP client and shared helpers
src/fetcher/gitlab/client.rs, common.rs
Singleton reqwest::Client with GITLAB_TOKEN auth via PRIVATE-TOKEN header, resolve_authenticated_username() with per-host caching, rest_get() for JSON API requests. Common helpers: parse_options() for TOML, parse_timestamp() for RFC3339, cache_key() via SHA256, validate_host() with strict hostname rules, ProjectPath with URL encoding, resolve_project() from explicit option or git remote.
GitLab item DTOs and ForgeRow adapters
src/fetcher/gitlab/items.rs
Defines GitlabIssueLike, GitlabReferences, GitlabAuthor DTOs with serde defaults. Implements to_forge_row() with include_repo-dependent labels, conditional URL/avatar, timestamp parsing, and activity mapping; adds to_forge_rows() and sample_rows() helpers.
GitLab module and user-scoped fetchers
src/fetcher/gitlab/mod.rs, my_mrs.rs, review_requests.rs
Declares module and registers fetchers via fetchers(). GitlabMyMrs lists user's authored MRs; GitlabReviewRequests lists MRs to review. Each parses host/limit options, validates host, resolves authenticated username (cached per host), queries filtered MRs, converts to rows, and dispatches to shape.
GitLab project-scoped fetchers
src/fetcher/gitlab/repo_mrs.rs, repo_issues.rs
GitlabRepoMrs and GitlabRepoIssues parse host/project/limit with unknown-field rejection, resolve and validate project (from option or git remote), clamp limit to 1..=30, query filtered items, convert to rows, dispatch to shape, with cache keys varying by project.
GitLab repo stats and pipeline status
src/fetcher/gitlab/repo_stars.rs, pipeline_status.rs
GitlabRepoStars queries project metadata and renders star/fork/issue counts into multiple shapes via render_body(). GitlabPipelineStatus fetches latest pipeline, classifies status, renders as badge/text/entries with SHA truncation and duration formatting, emits "no runs" warning when empty.
Fetcher module exports and registry
src/fetcher/mod.rs
Declares new forge_items and gitlab public submodules and registers GitLab fetchers into runtime Registry::with_builtins().

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

  • unhappychoice/splashboard#63: This PR directly implements the VCS/Forge roadmap by introducing the shared forge_items pipeline and adding both GitHub and GitLab fetcher families with multi-shape output support.

Possibly related PRs

  • unhappychoice/splashboard#148: This PR refactors the same GitHub fetchers (assigned_issues, my_prs, repo_issues, repo_prs, review_requests, and items) to use the new forge_items rendering pipeline, which affects the shape-specific output behavior.

Poem

🐰 A forge is built of rows and shapes so grand,
GitHub and GitLab now share common land.
From merge requests to stars, the pipeline flows,
One shape renderer to rule them all—oh, how the data glows!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.83% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main changes: adding GitLab forge family and extending GitHub fetcher shape coverage, which aligns with the core objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/gitlab-forge-family

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented May 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.10729% with 235 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.17%. Comparing base (2ea314e) to head (b0aa0ca).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/fetcher/gitlab/pipeline_status.rs 79.41% 49 Missing ⚠️
src/fetcher/gitlab/repo_stars.rs 71.51% 47 Missing ⚠️
src/fetcher/gitlab/repo_issues.rs 60.24% 33 Missing ⚠️
src/fetcher/gitlab/common.rs 85.78% 29 Missing ⚠️
src/fetcher/forge_items.rs 91.08% 27 Missing ⚠️
src/fetcher/github/action_status.rs 81.03% 11 Missing ⚠️
src/fetcher/gitlab/repo_mrs.rs 90.90% 10 Missing ⚠️
src/fetcher/gitlab/review_requests.rs 89.15% 9 Missing ⚠️
src/fetcher/gitlab/client.rs 96.77% 7 Missing ⚠️
src/fetcher/gitlab/my_mrs.rs 94.40% 7 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #243      +/-   ##
==========================================
- Coverage   95.42%   95.17%   -0.26%     
==========================================
  Files         211      222      +11     
  Lines       56895    58605    +1710     
==========================================
+ Hits        54293    55777    +1484     
- Misses       2602     2828     +226     
Files with missing lines Coverage Δ
src/fetcher/github/assigned_issues.rs 95.78% <100.00%> (+0.70%) ⬆️
src/fetcher/github/my_prs.rs 95.48% <100.00%> (+0.05%) ⬆️
src/fetcher/github/repo_issues.rs 96.95% <100.00%> (+0.89%) ⬆️
src/fetcher/github/repo_prs.rs 97.61% <100.00%> (+0.82%) ⬆️
src/fetcher/github/review_requests.rs 95.70% <100.00%> (+0.54%) ⬆️
src/fetcher/gitlab/items.rs 100.00% <100.00%> (ø)
src/fetcher/gitlab/mod.rs 100.00% <100.00%> (ø)
src/fetcher/mod.rs 99.00% <100.00%> (+<0.01%) ⬆️
src/fetcher/github/items.rs 97.23% <97.67%> (-0.62%) ⬇️
src/fetcher/github/repo_stars.rs 96.80% <95.00%> (-0.98%) ⬇️
... and 10 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 11

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fetcher/forge_items.rs`:
- Around line 99-108: The render_markdown function interpolates user-controlled
ForgeRow fields (label and title) directly into a MarkdownTextBlock which can
break formatting or inject links (e.g., titles like "fix ](oops)" or markup like
"*_wip_*"); fix this by escaping markdown metacharacters before formatting:
add/implement a small helper (e.g., escape_markdown) that escapes characters
such as [, ], (, ), `, *, _, ~, and backslash, call it on r.label and r.title
inside render_markdown before building the formatted string, and continue to
return Body::MarkdownTextBlock(MarkdownTextBlockData { value }) with the escaped
values.

In `@src/fetcher/github/action_status.rs`:
- Line 16: The no-runs branch currently always returns Body::Badge despite
advertising Shape::Entries in SHAPES; update the fetch/compute logic in
action_status.rs to branch on ctx.shape (the request shape) and return
Body::Entries when ctx.shape == Shape::Entries (leave Badge/Text for their
shapes), ensuring both the early no-runs branch and the later runs-handling
branch (the other branch around lines referenced 87-107) honor ctx.shape so
shape consistency is preserved; reference SHAPES, ctx.shape, and the functions
compute/fetch (where the Body::Badge is returned) when making the change.

In `@src/fetcher/github/items.rs`:
- Around line 57-63: The function render_items currently bypasses the forge
dispatcher by calling forge_items::render_forge_rows(&rows, shape), which causes
Shape::Badge and Shape::ImageLinkedList to fall back incorrectly; replace that
direct call with the forge dispatch helper (e.g.,
forge_items::dispatch_render_rows(&rows, shape) or the actual dispatcher
function used elsewhere) so shapes are handled by the dedicated renderer and
avatars/badges resolve correctly; alternatively, if you prefer to restrict
capability, change render_items’ signature to accept only the sync-only shape
type (e.g., SyncShape) and update callers accordingly so unsupported async
shapes cannot be passed.

In `@src/fetcher/gitlab/my_mrs.rs`:
- Around line 52-54: Change the safety classification from Safe to Network in
the safety() implementation because the outbound host is configurable via the
host option on the struct; update the fn safety(&self) -> Safety in the impl for
MyMrs (or the type that defines the host field/option) to return Safety::Network
instead of Safety::Safe so the network gating applies to this config-controlled
destination.

In `@src/fetcher/gitlab/pipeline_status.rs`:
- Around line 103-105: The branch value is interpolated into the query without
encoding (opts.branch → branch → path.push_str), which can break the URL if it
contains reserved characters; percent-encode the branch before appending it to
path (e.g., compute an encoded_branch from opts.branch using a URL
percent-encoding helper such as url::form_urlencoded or percent_encoding) and
then call path.push_str(&format!("&ref={}", encoded_branch)) instead of using
the raw branch.
- Around line 62-64: The safety classification in the pipeline_status fetcher is
wrong: update the safety() method in pipeline_status.rs to return
Safety::Network instead of Safety::Safe because the host is configurable; modify
the safety(&self) -> Safety implementation to return Safety::Network (refer to
the Safety enum and the safety() function in this module) so the fetcher is
correctly marked as network-bound.
- Around line 108-113: The early-return for the “no runs” case currently always
builds Body::Badge (the block using pipelines.into_iter().next() and returning
payload(Body::Badge(...))); change it to branch on ctx.shape and return the
corresponding shape (e.g., Body::Text or Body::Entries) when there are no
pipelines instead of always Body::Badge so consumers retain the requested shape;
update the fetch/compute branch to check ctx.shape and construct the appropriate
empty/no-runs payload for Body::Text, Body::Entries, or Body::Badge and ensure
shapes() declares the supported shapes.

In `@src/fetcher/gitlab/repo_issues.rs`:
- Around line 61-63: The safety classification in the fetcher is incorrect:
update the safety() method on the struct (the function safety) to return
Safety::Network instead of Safety::Safe because the fetcher uses a
user-configurable host; change the return value in the safety() method from
Safety::Safe to Safety::Network so the host-configurable traffic is treated as
network-trust-gated.

In `@src/fetcher/gitlab/repo_mrs.rs`:
- Around line 62-64: The safety() method currently returns Safety::Safe but this
fetcher permits host overrides so it should be classified as network-accessing;
update the safety() implementation in the repo_mrs::safety (the safety method on
this fetcher struct) to return Safety::Network instead of Safety::Safe so the
Safety enum reflects config-driven network destinations.

In `@src/fetcher/gitlab/repo_stars.rs`:
- Around line 62-64: The safety() method currently returns Safety::Safe but this
fetcher allows a configurable host, so update the safety classification to
Safety::Network: locate the safety(&self) -> Safety implementation (which
currently returns Safety::Safe) and change it to return Safety::Network to
reflect that traffic destination can be controlled via configuration; keep the
rest of the implementation unchanged.

In `@src/fetcher/gitlab/review_requests.rs`:
- Around line 54-56: The safety classification in the fetcher method safety() is
incorrect: change the returned value from Safety::Safe to Safety::Network
because the request target (host) is derived from options (see host resolution
in the same module) and is config-controlled; update the safety() implementation
in the ReviewRequests fetcher (the safety() method) to return Safety::Network
and ensure any necessary imports or enum paths remain valid.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f1725519-3fc3-43a9-b9b9-ffaffd6c2544

📥 Commits

Reviewing files that changed from the base of the PR and between 07f093b and 7430edd.

📒 Files selected for processing (20)
  • src/fetcher/forge_items.rs
  • src/fetcher/github/action_status.rs
  • src/fetcher/github/assigned_issues.rs
  • src/fetcher/github/items.rs
  • src/fetcher/github/my_prs.rs
  • src/fetcher/github/repo_issues.rs
  • src/fetcher/github/repo_prs.rs
  • src/fetcher/github/repo_stars.rs
  • src/fetcher/github/review_requests.rs
  • src/fetcher/gitlab/client.rs
  • src/fetcher/gitlab/common.rs
  • src/fetcher/gitlab/items.rs
  • src/fetcher/gitlab/mod.rs
  • src/fetcher/gitlab/my_mrs.rs
  • src/fetcher/gitlab/pipeline_status.rs
  • src/fetcher/gitlab/repo_issues.rs
  • src/fetcher/gitlab/repo_mrs.rs
  • src/fetcher/gitlab/repo_stars.rs
  • src/fetcher/gitlab/review_requests.rs
  • src/fetcher/mod.rs

Comment thread src/fetcher/forge_items.rs Resolved
Comment thread src/fetcher/github/action_status.rs Resolved
Comment thread src/fetcher/github/items.rs Resolved
Comment on lines +52 to +54
fn safety(&self) -> Safety {
Safety::Safe
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use Safety::Network for a config-controlled host.

host is option-driven (Line 92), so outbound traffic destination is user-configurable and should be network-gated.

Suggested fix
     fn safety(&self) -> Safety {
-        Safety::Safe
+        Safety::Network
     }

As per coding guidelines "Safety classification (Safe vs. Network): Safe if URL/query is hardcoded in struct; Network if config can control where traffic goes".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn safety(&self) -> Safety {
Safety::Safe
}
fn safety(&self) -> Safety {
Safety::Network
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fetcher/gitlab/my_mrs.rs` around lines 52 - 54, Change the safety
classification from Safe to Network in the safety() implementation because the
outbound host is configurable via the host option on the struct; update the fn
safety(&self) -> Safety in the impl for MyMrs (or the type that defines the host
field/option) to return Safety::Network instead of Safety::Safe so the network
gating applies to this config-controlled destination.

Comment on lines +62 to +64
fn safety(&self) -> Safety {
Safety::Safe
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

This fetcher should be classified as Safety::Network.

Line 63 sets Safety::Safe, but host is configurable, so destination control is external.

Suggested fix
     fn safety(&self) -> Safety {
-        Safety::Safe
+        Safety::Network
     }

As per coding guidelines, "Safety classification (Safe vs. Network): Safe if URL/query is hardcoded in struct; Network if config can control where traffic goes".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn safety(&self) -> Safety {
Safety::Safe
}
fn safety(&self) -> Safety {
Safety::Network
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fetcher/gitlab/pipeline_status.rs` around lines 62 - 64, The safety
classification in the pipeline_status fetcher is wrong: update the safety()
method in pipeline_status.rs to return Safety::Network instead of Safety::Safe
because the host is configurable; modify the safety(&self) -> Safety
implementation to return Safety::Network (refer to the Safety enum and the
safety() function in this module) so the fetcher is correctly marked as
network-bound.

Comment thread src/fetcher/gitlab/pipeline_status.rs Resolved
Comment on lines +61 to +63
fn safety(&self) -> Safety {
Safety::Safe
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use Safety::Network for a host-configurable fetcher.

Line 62 marks this as Safety::Safe, but host is user-configurable, so traffic destination is externally controlled and should be trust-gated as network.

Suggested fix
     fn safety(&self) -> Safety {
-        Safety::Safe
+        Safety::Network
     }

As per coding guidelines, "Safety classification (Safe vs. Network): Safe if URL/query is hardcoded in struct; Network if config can control where traffic goes".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn safety(&self) -> Safety {
Safety::Safe
}
fn safety(&self) -> Safety {
Safety::Network
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fetcher/gitlab/repo_issues.rs` around lines 61 - 63, The safety
classification in the fetcher is incorrect: update the safety() method on the
struct (the function safety) to return Safety::Network instead of Safety::Safe
because the fetcher uses a user-configurable host; change the return value in
the safety() method from Safety::Safe to Safety::Network so the
host-configurable traffic is treated as network-trust-gated.

Comment on lines +62 to +64
fn safety(&self) -> Safety {
Safety::Safe
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

safety() should be Network, not Safe.

Line 63 currently returns Safety::Safe, but this fetcher allows host override, so network destination is config-driven.

Suggested fix
     fn safety(&self) -> Safety {
-        Safety::Safe
+        Safety::Network
     }

As per coding guidelines, "Safety classification (Safe vs. Network): Safe if URL/query is hardcoded in struct; Network if config can control where traffic goes".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn safety(&self) -> Safety {
Safety::Safe
}
fn safety(&self) -> Safety {
Safety::Network
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fetcher/gitlab/repo_mrs.rs` around lines 62 - 64, The safety() method
currently returns Safety::Safe but this fetcher permits host overrides so it
should be classified as network-accessing; update the safety() implementation in
the repo_mrs::safety (the safety method on this fetcher struct) to return
Safety::Network instead of Safety::Safe so the Safety enum reflects
config-driven network destinations.

Comment on lines +62 to +64
fn safety(&self) -> Safety {
Safety::Safe
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reclassify this fetcher as Safety::Network.

Line 63 returns Safety::Safe, but host can be configured, so the target endpoint is not fixed.

Suggested fix
     fn safety(&self) -> Safety {
-        Safety::Safe
+        Safety::Network
     }

As per coding guidelines, "Safety classification (Safe vs. Network): Safe if URL/query is hardcoded in struct; Network if config can control where traffic goes".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn safety(&self) -> Safety {
Safety::Safe
}
fn safety(&self) -> Safety {
Safety::Network
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fetcher/gitlab/repo_stars.rs` around lines 62 - 64, The safety() method
currently returns Safety::Safe but this fetcher allows a configurable host, so
update the safety classification to Safety::Network: locate the safety(&self) ->
Safety implementation (which currently returns Safety::Safe) and change it to
return Safety::Network to reflect that traffic destination can be controlled via
configuration; keep the rest of the implementation unchanged.

Comment on lines +54 to +56
fn safety(&self) -> Safety {
Safety::Safe
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Classify this fetcher as Safety::Network.

host is resolved from options (Line 93), so the traffic target is config-controlled and should not be marked Safe.

Suggested fix
     fn safety(&self) -> Safety {
-        Safety::Safe
+        Safety::Network
     }

As per coding guidelines "Safety classification (Safe vs. Network): Safe if URL/query is hardcoded in struct; Network if config can control where traffic goes".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fetcher/gitlab/review_requests.rs` around lines 54 - 56, The safety
classification in the fetcher method safety() is incorrect: change the returned
value from Safety::Safe to Safety::Network because the request target (host) is
derived from options (see host resolution in the same module) and is
config-controlled; update the safety() implementation in the ReviewRequests
fetcher (the safety() method) to return Safety::Network and ensure any necessary
imports or enum paths remain valid.

@unhappychoice

Copy link
Copy Markdown
Owner Author

Re: Safety classification on the six gitlab_* fetchers

Intentional: Safety::Safe matches splashboard's existing forge-family rule (catalog #63) and ships consistently with github_* siblings that also accept config knobs (repo = "owner/name").

Reasoning for keeping host on a Safe fetcher:

  • Trust binds (path, sha256) of the config file, not the live config state. Editing .splashboard/dashboard.toml to swap host automatically revokes trust (trust.rs::load_config_and_hash reads bytes once, TOCTOU-safe). So a malicious or accidental host swap cannot silently retarget an already-trusted token.
  • host is validated against a hostname-only allowlist (common::validate_host) before reaching the network layer, so it cannot smuggle a scheme, path, or port that would change where the token goes within https://{host}/api/v4.
  • Token leaves only to the host pinned at trust time, just like github_* fetchers leave only to api.github.com.

The project_trust_model rule splashboard follows is "token never reaches an attacker-controlled origin," not "destination is hardcoded at compile time." A host-fixed-at-trust-time fetcher satisfies the former.

Will reply on the individual nits / bug findings (markdown escape, no-runs shape, branch URL-encoding, render_items API tightening) by pushing fix commits to this branch.

unhappychoice and others added 21 commits May 17, 2026 19:32
Shared `ForgeRow` row struct and shape-driven dispatcher used by the
github and gitlab forge families. Renders any of the eight list-shaped
variants (Text / TextBlock / MarkdownTextBlock / LinkedTextBlock /
ImageLinkedList / Entries / Bars / Timeline) plus a `render_count_badge`
count-pill helper.

Async `dispatch_rows_async` resolves `ImageLinkedList` thumbnails through
the shared thumbnails cache; sync `dispatch_sample` skips that step for
docs / catalog previews.

No consumer in this commit; the github / gitlab families wire into it in
follow-up commits.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sets up the shared substrate the six gitlab_* fetchers will plug into:

- `client.rs`: singleton `reqwest::Client`, `GITLAB_TOKEN` via `PRIVATE-TOKEN`
  header, per-host cached `resolve_authenticated_username`, `rest_get` against
  `https://{host}/api/v4{path}`. Mirrors `github/client.rs` shape; the GitLab
  differences (PAT header, per-host username cache) are documented inline.
- `common.rs`: option parsing, RFC3339 timestamp, sha256 cache key, hostname
  allowlist `validate_host`, `ProjectPath` with subgroup support
  (`group/sub/proj`, requires >=2 segments), `resolve_project` from option or
  git remote, `project_from_url` for the four common remote URL shapes.
- `items.rs`: GitLab MR / Issue DTOs (`GitlabIssueLike`, `GitlabReferences`,
  `GitlabAuthor`) and `to_forge_row` / `sample_rows` adapters into the shared
  forge_items pipeline.
- `mod.rs`: empty `fetchers()` vec; populated by per-fetcher follow-up
  commits.

Registered in `fetcher::Registry::with_builtins` so the `for f in
gitlab::fetchers()` loop is in place before the first fetcher lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Open merge requests authored by the authenticated GitLab user across every
project. Uses `/api/v4/merge_requests?scope=created_by_me&state=opened`.

9 shapes via the shared forge_items dispatcher: LinkedTextBlock (default) /
TextBlock / MarkdownTextBlock / ImageLinkedList / Entries / Text / Bars /
Badge ("N open MRs") / Timeline. `host` option (default `gitlab.com`)
covers self-hosted instances; `limit` clamps 1..=30 (default 10).

Mirrors `github_my_prs`; differences are GitLab-specific (`reviewer_username`
filter, `references.full` slug, MR `!42` instead of PR `#42`).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Open MRs where the authenticated GitLab user is a reviewer. GitLab's MR
search has no `@me` shortcut for the reviewer field, so the fetcher resolves
the username via `/api/v4/user` (cached per host through
`resolve_authenticated_username`) and then queries
`/api/v4/merge_requests?reviewer_username=<me>&state=opened`.

Same 9-shape coverage and `host` / `limit` option pair as `gitlab_my_mrs`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Open MRs against one specific GitLab project. Project resolves from the
`project` option or (fallback) the git remote of cwd, gated on the
configured `host` so a polyrepo cwd's GitHub remote doesn't get misrouted.

Same 9-shape coverage as the user-scope siblings. Cache key mixes host +
project path so two projects don't collide.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Open issues against one specific GitLab project. Same option set as
`gitlab_repo_mrs` (host / project / limit), same 9-shape coverage.
References use `#75` rather than `!42` so the row labels match GitLab's
own UI convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Stargazer / fork / open-issue counts for one GitLab project. 6 shapes
(Text headline, TextBlock, MarkdownTextBlock, Entries, Bars, Badge) — one
fewer than the GitHub sibling because GitLab has no separate `watchers`
concept, so that row is dropped rather than shipped as a zero.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Latest CI pipeline state for a GitLab project as a pass/fail Badge, short
Text line, or status / branch / sha / duration Entries rollup. Pulls from
`/api/v4/projects/{id}/pipelines?per_page=1[&ref=<branch>]`.

`classify(status)` maps GitLab's pipeline states (success / failed /
canceled / skipped / manual / running family / unknown) onto the Status
traffic-light tri-state used across the splashboard.

Two known limitations addressed in follow-up commits on this branch:
- `no runs` always returns Badge regardless of ctx.shape (fixed later).
- `branch` is interpolated raw into the query string (fixed later).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`IssueItem` gains two fields the wider shape coverage needs:
- `comments: u64` → drives the `Bars` per-row activity weight.
- `user: Option<GithubUserRef>` → carries `avatar_url` for `ImageLinkedList`.

`render_items` now converts items into `forge_items::ForgeRow` via the new
`to_forge_row` and delegates rendering to
`forge_items::render_forge_rows`. The function signature stays unchanged
so the existing per-fetcher call sites keep compiling; the per-fetcher
files migrate to the richer `dispatch_rows_async` API in follow-up commits.

`sample_rows` is a small fixture helper mirroring the gitlab/items.rs
counterpart so docs / catalog samples format consistently across both
forges.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Replaces the local 4-element SHAPES const with the shared `LIST_SHAPES`
(LinkedTextBlock / TextBlock / MarkdownTextBlock / ImageLinkedList /
Entries / Text / Bars / Badge / Timeline). `fetch` routes through
`forge_items::dispatch_rows_async` so `ImageLinkedList` resolves author
avatars through the thumbnails cache and `Badge` produces the
`"N open PRs"` count-pill.

Entries key convention changes from "splashboard #54" to
"#54" so the row label stays consistent across
every shape variant. Repo-scope fetchers (which already used `#54`)
are unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…dispatch

Same migration as `github_my_prs`: SHAPES becomes `LIST_SHAPES`, fetch
goes through `dispatch_rows_async`, Badge noun pair is ("to review", "to
review") (verb-form, no plural drift).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…dispatch

Same migration as the sibling user-scope fetchers. Badge noun pair is
("open issue", "open issues").

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Same migration as the user-scope fetchers, but with `include_repo = false`
so the row label stays the bare `#54` rather than the full
`#54`. Badge noun pair is ("open PR", "open PRs").

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…atch

Same migration as `github_repo_prs`. Pull-request filtering in the fetch
path is unchanged; the conversion happens after the filter, so the rows
the renderer sees are still pure issues.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds `TextBlock`, `MarkdownTextBlock`, `Bars`, and `Badge` on top of the
existing `Text` and `Entries`. `Bars` ranks stars / forks / watchers /
open_issues so the same fetched payload can fill a chart slot without a
sibling fetcher. `Badge` is a calm "★ N" Info-tone pill suitable for a
narrow status row.

Renderer dispatch goes through a single `render_body(info, shape)` helper
shared between `sample_body` and `fetch` so the two paths can't drift on
new shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds `Shape::Entries` to the SHAPES catalog with a status / branch /
conclusion rollup. Pairs nicely with `grid_table` for an at-a-glance
"why is CI flaky" view that the Badge / Text variants can't carry.

Known limitation: the `no runs` branch always returns Badge regardless
of `ctx.shape`. Follow-up commit on this branch reconciles that.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`render_items` is a public sync helper still called by `good_first_issues`,
whose `shapes()` set is bounded to the four sync-renderable variants. Routing
`Badge` or `ImageLinkedList` through it would silently degrade `Badge` to the
`TextBlock` fallback (no count, no noun) and emit `ImageLinkedList` with every
thumbnail column blank.

Document the contract and `debug_assert` on both shapes so accidental misuse
crashes loudly in tests instead of shipping broken bodies. Fetchers that
accept those shapes already route through `forge_items::dispatch_rows_async`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…s path

`github_action_status` advertises Badge / Text / Entries, but when the
`workflow_runs` list came back empty the fetcher always returned a `Body::Badge`
with `"no runs"`, regardless of `ctx.shape`. Consumers asking for Text or
Entries got a shape mismatch and the runtime fell through to the placeholder.

Extract a `no_runs_body(shape)` helper that mirrors the populated `render_body`
shape selection so each advertised shape stays consistent across the "have
runs" and "no runs" branches. Adds a unit test covering all three shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…uns path

Same shape-consistency fix as the github_action_status sibling: when the
`pipelines` list comes back empty the fetcher used to always emit a
`Body::Badge`, dropping the shape advertised in `ctx.shape`. Extract a
`no_runs_body(shape)` helper so Text and Entries consumers keep the right
variant.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Naive interpolation of `branch` into the `&ref=<branch>` query parameter
broke the request semantics for any branch name carrying `&`, `=`, `#`, `+`,
`?`, or a slash. The fetcher silently returned the wrong pipeline (or a
parse error from GitLab) instead of failing fast.

Route the value through `url::form_urlencoded::byte_serialize` so the
encoded payload stays inside a single query pair. Adds a unit test pinning
the encoding for the canonical reserved-character set so a future url-crate
loosening surfaces here.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…arkdown

`forge_items::render_markdown` interpolated user-controlled `label`, `title`,
and `url` directly into Markdown source. A PR title like `fix ](oops)` would
truncate the link target and trail the rest as plain text; `*_wip_*` would
render as bold-italic instead of literal punctuation; and a URL carrying `)`
would break the link target the same way.

Add small `escape_markdown_inline` / `escape_markdown_url` helpers covering
the documented set of CommonMark-significant inline glyphs and the two URL
characters that can terminate a `(...)` link target. Adds unit coverage for
both helpers and a regression test on the combined rendering path.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@unhappychoice
unhappychoice force-pushed the feat/gitlab-forge-family branch from 37c595d to b0aa0ca Compare May 17, 2026 10:39
@unhappychoice
unhappychoice merged commit 0925002 into main May 17, 2026
7 checks passed
@unhappychoice
unhappychoice deleted the feat/gitlab-forge-family branch May 17, 2026 10:45
@unhappychoice unhappychoice mentioned this pull request May 17, 2026
30 of 62 tasks
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