Skip to content

gitlab: an issues path for reconcilePr's "issue" mode (#2292) - #2296

Merged
lex00 merged 1 commit into
mainfrom
feat/2292-gitlab-issue-mode
Sep 9, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/2292-gitlab-issue-mode

Conversation

@lex00

@lex00 lex00 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Closes #2292. Part of #2289.

reconcilePr's issue mode shelled unconditionally to gh issue create, which
cannot reach a GitLab instance, so a cron Op's finding on GitLab had nowhere to go
but the run log. That is the same gap #2268 closed for comment mode with a
merge-request note.

gitlabProjectContextFrom reads any GitLab CI job's own CI_PROJECT_ID, which
needs no merge request, unlike comment mode's mergeRequestContextFrom. That
matters because this mode exists for a cron trigger, which has none.
postOrUpdateIssue opens or edits one issue on that project by the same
marker-and-edit-in-place recipe #2268 gave the note: findOwnedIssue narrows the
issues search server-side by the hidden marker and pages GitLab's own way, POSTing
when there is no owned issue yet and PUTting when there is. Token resolution reuses
gitlabNoteTokenFrom, and the no-credential message mirrors
noGitlabNoteTokenMessage's shape, naming the project instead of a merge-request iid.

When no CI_PROJECT_ID is present, the original gh issue create path runs unchanged.

Proof

Every new assertion shown red by a deliberate tamper on the real source, then green
after git checkout --:

  • issueMarker colliding with commentMarker: expected '<!-- chant-reconcile:app -->' to be '<!-- chant-reconcile-issue:app -->'
  • gitlabProjectContextFrom accepting a run with no CI_PROJECT_ID: expected { "api": "https://gitlab.com/api/v4", "project": "1" } to be undefined
  • findOwnedIssue discarding a found match: expected 'POST' to be 'PUT'
  • the project name missing from the no-token message: expected [Function] to throw error matching /mode "issue".*project 42.*GITLAB_TOKEN.*CI_JOB_TOKEN/s
  • the issues search dropping its search= / in=description narrowing: expected 'https://gitlab.com/api/v4/projects/42/issues?per_page=100&page=1' to contain 'search=%3C!--%20chant-reconcile-issue...'

Verdicts

  • tsc --noEmit exit 0
  • eslint packages/ 2 pre-existing warnings in an unrelated file, none here
  • repo-wide typecheck: 31 known failures, no regressions
  • check-lexicons: gitlab 23/23 tier-1, no untracked tier-1 failures
  • full suite: Test Files 1206 passed, 5 skipped; Tests 16946 passed, 39 skipped

Consumer

Verified against INTENTIUS/choudoufu's examples/ci-pipelines in a scratch copy with
these packages linked in. The baseline regenerates byte-identical to what is
committed there. Flipping that project's discoverFindingMode so gitlab gets
issue regenerates cleanly with no build-time refusal, changing only the
generator's own header comment line, since the finding mode is baked into the Op's
args rather than the emitted YAML.

One thing found on the way

GitHub's own issue path has no sticky behaviour: every run opens a new issue. The
new GitLab path is therefore stickier than GitHub's. Left alone here as out of
scope, noted in the new JSDoc, and worth its own issue.

Not observed

No live GitLab instance was exercised. The issues-API shape is pinned by mocked
fetch and never observed against a real GitLab, the same caveat #2268 carried.
INTENTIUS/choudoufu#1026 is standing up GitLab CE 17.11 and may settle it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KCvXZWJq4nrMCBRe98TX1v

reconcilePr's "issue" mode shelled unconditionally to `gh issue create`,
which cannot reach a GitLab instance, so a cron Op's finding on GitLab
had nowhere to go but the run log. gitlabProjectContextFrom reads any
GitLab CI job's own CI_PROJECT_ID (no merge request needed, unlike the
comment mode's mergeRequestContextFrom), and postOrUpdateIssue opens or
edits one issue by the same marker/edit-in-place recipe #2256 gave the
merge-request note: findOwnedIssue narrows the search server-side by
the hidden marker and pages GitLab's own way, POST when there is no
owned issue yet and PUT when there is. Token resolution and its
no-credential message reuse gitlabNoteTokenFrom and mirror
noGitlabNoteTokenMessage's shape.

Part of #2289.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KCvXZWJq4nrMCBRe98TX1v
@lex00
lex00 merged commit 428f141 into main Sep 9, 2026
5 checks passed
@lex00
lex00 deleted the feat/2292-gitlab-issue-mode branch September 9, 2026 05:16
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.

gitlab: issue finding mode has no GitLab path, so a cron Op's finding reaches only the run log

1 participant