Skip to content

feat(examples/gitlab): add fail-open category/severity publication controls - #685

Open
SeonggwanAhn wants to merge 2 commits into
alibaba:mainfrom
SeonggwanAhn:feat/gitlab-ci-category-severity-publication-controls
Open

feat(examples/gitlab): add fail-open category/severity publication controls#685
SeonggwanAhn wants to merge 2 commits into
alibaba:mainfrom
SeonggwanAhn:feat/gitlab-ci-category-severity-publication-controls

Conversation

@SeonggwanAhn

@SeonggwanAhn SeonggwanAhn commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Test plan

  • python3 examples/gitlab_ci/post_review_test.py (78 tests)
  • Smoke on a GitLab MR with OCR_ROUTE_SEVERITY_BELOW=medium and OCR_ROUTE_CATEGORIES=style,documentation,test
  • Confirm security/high findings still land as inline discussions with suggestion:-0+0
  • Confirm routed findings appear in a summary note with Routed to summary… reason and Before/After details

Made with Cursor

@CLAassistant

CLAassistant commented Aug 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s).

…ntrols

Port the GitHub Action publication policy (alibaba#478/alibaba#529) to the GitLab CI
example so MRs can badge findings and optionally route low-signal
categories/severities to summary notes without dropping them.

Co-authored-by: Cursor <cursoragent@cursor.com>
@SeonggwanAhn
SeonggwanAhn force-pushed the feat/gitlab-ci-category-severity-publication-controls branch from b920e00 to a75b737 Compare August 3, 2026 07:26

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review

Nice port — the fail-open design is solid and tests are thorough (78 cases covers the surface well).

A few things I noticed:

sanitize_metadata gap in route_comment

build_badge runs values through sanitize_metadata (strips control chars), but route_comment just does .strip().lower() on the raw value. So if an LLM spits out "bu\ng" as a category, the badge renders [bug · high] but routing won't match it against CATEGORIES — it stays inline silently.

Fail-open means nothing gets dropped, so it's safe, but it's confusing: the badge says "bug" while routing doesn't recognize it as one. Probably worth running sanitize_metadata in route_comment too:

cat_raw = sanitize_metadata(comment.get("category") if comment else None).strip().lower()
sev_raw = sanitize_metadata(comment.get("severity") if comment else None).strip().lower()

Multiple notes per MR could get noisy

When a review has all three flavors (no-line, routed, failed), you'll post 4 separate notes plus inline comments. On a busy MR that's a lot of bot noise. Might be worth collapsing no-line + routed + failed into one note with section headers. Not a blocker, just something to think about for UX.

Minor

  • Removing the unused start_line assignment from the loop — good cleanup, confirmed it was never passed to the discussion payload.
  • Two test_badge_prefix methods exist across different test classes. Not a conflict in Python but easy to confuse when grepping test names.

Overall LGTM with the sanitize fix as the one actionable item.

Align routing with build_badge so control characters in LLM
category/severity values do not desync badge labels from policy matching.

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@SeonggwanAhn

Copy link
Copy Markdown
Author

Addressed the sanitize_metadata feedback in route_comment (87f1727) — PTAL.

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.

3 participants