feat: auto-assign issue to current user during lifecycle start#1167
Merged
feat: auto-assign issue to current user during lifecycle start#1167
Conversation
When `start` is called on an issue-lifecycle model, the method now reads the authenticated username from local auth (~/.config/swamp/auth.json), resolves it to a userId via the swamp-club eligible-assignees endpoint, and PATCHes the issue's assignees additively. All assignment failures are best-effort warnings — the triage flow never breaks. Changes: - Export `loadAuthFile` from swamp_club.ts, now returns optional `username` - Add `fetchEligibleAssignees`, `resolveUserId`, `updateAssignees` to SwampClubClient - Extend `FetchedIssue` with `assignees` field - Wire assignment into `start()` after context/state writes - Bump model version to 2026.04.12.1 - 6 new unit tests covering happy path, additive merge, idempotent, missing username, 403 on lookup, PATCH failure Closes swamp-club#86 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stack72
added a commit
to systeminit/swamp-extensions
that referenced
this pull request
Apr 12, 2026
Sync from systeminit/swamp#1167. When `start` is called, the method reads the authenticated username from local auth, resolves it to a userId via the eligible-assignees endpoint, and PATCHes the issue's assignees additively. All assignment failures are best-effort warnings. Bumps model version to 2026.04.12.1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
Blocking Issues
None.
Suggestions
- Double
loadAuthFile()call (issue_lifecycle.ts:493): Duringstart(),loadAuthFile()is called twice — once internally bycreateSwampClubClient()(for apiKey/serverUrl) and once directly bystart()(for username). A future cleanup could havecreateSwampClubClientreturn the username alongside the client, or have the client store it. Not blocking since it's a minor I/O redundancy on a local file.
Notes
- DDD:
SwampClubClientis the right home forfetchEligibleAssignees/resolveUserId/updateAssignees— it stays within its infrastructure service responsibility.EligibleAssigneeis a clean value object. The orchestration instart()keeps assignment as a best-effort side effect after the core lifecycle transition, which is the correct application-layer pattern. - CLAUDE.md compliance: No
anytypes, all promises awaited,AbortSignal.timeouton every outbound call, license headers present, named exports used. No libswamp import boundary violations (extensions don't import fromsrc/libswamp). - Test coverage: 6 new tests cover the key paths well — happy path, additive merge, idempotency, missing username, 403 on lookup, and PATCH failure. The fetch stub infrastructure is clean and reusable.
- Security: API key stays in the private
#apiKeyfield, auth file is read from the well-known XDG/HOME config path, no user input is interpolated into sensitive contexts.
stack72
added a commit
to systeminit/swamp-extensions
that referenced
this pull request
Apr 12, 2026
…#65) Sync from systeminit/swamp#1167. When `start` is called, the method reads the authenticated username from local auth, resolves it to a userId via the eligible-assignees endpoint, and PATCHes the issue's assignees additively. All assignment failures are best-effort warnings. Bumps model version to 2026.04.12.1. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
start()method of the@swamp/issue-lifecycleextension model~/.config/swamp/auth.json), resolves it to a userId via the eligible-assignees endpoint, and PATCHes the issue's assignees additively2026.04.12.1Changes
extensions/models/_lib/swamp_club.ts: ExportloadAuthFile(now returns optionalusername); addfetchEligibleAssignees(),resolveUserId(),updateAssignees()toSwampClubClient; extendFetchedIssuewithassigneesfieldextensions/models/issue_lifecycle.ts: Wire assignment block intostart()after context/state writes; add version upgrade entryextensions/models/issue_lifecycle_test.ts: 6 new unit tests with fetch stub infrastructure covering happy path, additive merge, idempotent, missing username, 403 on lookup, PATCH failureextensions/models/README.md: Updatestartdescription in methods table.claude/skills/issue-lifecycle/references/triage.md: Add auto-assignment documentation sectionTest Plan
deno check— cleandeno lint— cleandeno fmt— cleandeno run compile— binary builtsysteminit/swamp-extensionsandsysteminit/swamp-clubCloses swamp-club#86
🤖 Generated with Claude Code