Repository navigation
gitlab: an issues path for reconcilePr's "issue" mode (#2292) - #2296
Merged
Merged
Conversation
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
11 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2292. Part of #2289.
reconcilePr'sissuemode shelled unconditionally togh issue create, whichcannot 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
commentmode with amerge-request note.
gitlabProjectContextFromreads any GitLab CI job's ownCI_PROJECT_ID, whichneeds no merge request, unlike
commentmode'smergeRequestContextFrom. Thatmatters because this mode exists for a cron trigger, which has none.
postOrUpdateIssueopens or edits one issue on that project by the samemarker-and-edit-in-place recipe #2268 gave the note:
findOwnedIssuenarrows theissues 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 mirrorsnoGitlabNoteTokenMessage's shape, naming the project instead of a merge-request iid.When no
CI_PROJECT_IDis present, the originalgh issue createpath runs unchanged.Proof
Every new assertion shown red by a deliberate tamper on the real source, then green
after
git checkout --:issueMarkercolliding withcommentMarker:expected '<!-- chant-reconcile:app -->' to be '<!-- chant-reconcile-issue:app -->'gitlabProjectContextFromaccepting a run with noCI_PROJECT_ID:expected { "api": "https://gitlab.com/api/v4", "project": "1" } to be undefinedfindOwnedIssuediscarding a found match:expected 'POST' to be 'PUT'expected [Function] to throw error matching /mode "issue".*project 42.*GITLAB_TOKEN.*CI_JOB_TOKEN/ssearch=/in=descriptionnarrowing:expected 'https://gitlab.com/api/v4/projects/42/issues?per_page=100&page=1' to contain 'search=%3C!--%20chant-reconcile-issue...'Verdicts
tsc --noEmitexit 0eslint packages/2 pre-existing warnings in an unrelated file, none herecheck-lexicons: gitlab 23/23 tier-1, no untracked tier-1 failuresConsumer
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
discoverFindingModeso gitlab getsissueregenerates cleanly with no build-time refusal, changing only thegenerator'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
issuepath has no sticky behaviour: every run opens a new issue. Thenew 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