Commit graph

19 commits

Author SHA1 Message Date
Virgil
2e188e346a feat(agentci): add context-aware ssh command helper
Some checks failed
Security Scan / security (push) Failing after 11s
Test / test (push) Successful in 2m15s
Thread dispatch SSH subprocesses through the caller context so cancellation applies to ticket transfer, remote cleanup, and existence checks.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 06:53:33 +00:00
Virgil
976d20c02f feat(jobrunner): resolve dispatch target branch
Some checks failed
Security Scan / security (push) Failing after 10s
Test / test (push) Successful in 2m12s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 04:45:40 +00:00
Virgil
a0fac1341b chore(ax): add usage docs to exported APIs
Some checks failed
Security Scan / security (push) Failing after 10s
Test / test (push) Successful in 2m11s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-30 14:11:15 +00:00
Virgil
dd59b177c6 chore(ax): normalise test naming and usage annotations
Some checks failed
Security Scan / security (push) Failing after 10s
Test / test (push) Successful in 2m2s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-30 06:37:20 +00:00
Virgil
c42cc4a6ce chore(ax): gofmt exported declaration comments
Some checks failed
Security Scan / security (push) Failing after 10s
Test / test (push) Successful in 2m4s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-30 05:44:09 +00:00
Virgil
305aa0da6f chore(ax): normalize SPDX header identifier
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Successful in 4m12s
2026-03-30 00:54:20 +00:00
Virgil
5f73d41184 chore(ax): add SPDX headers to remaining Go files
Some checks failed
Security Scan / security (push) Failing after 15s
Test / test (push) Failing after 29s
2026-03-30 00:19:43 +00:00
Virgil
d5f98c1341 refactor(ax): align code with AX principles
Some checks failed
Security Scan / security (push) Failing after 10s
Test / test (push) Failing after 25s
2026-03-29 23:59:48 +00:00
Claude
2dcb86738a
chore: migrate to dappco.re vanity import path
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Failing after 22s
Change module path from forge.lthn.ai/core/go-scm to dappco.re/go/core/scm.
Update all Go source imports for migrated packages:
- go-log  -> dappco.re/go/core/log
- go-io   -> dappco.re/go/core/io
- go-i18n -> dappco.re/go/core/i18n
- go-ws   -> dappco.re/go/core/ws
- api     -> dappco.re/go/core/api

Non-migrated packages (cli, config) left on forge.lthn.ai paths.
Replace directives use local paths (../go, ../go-io, etc.) until the
dappco.re vanity URL server resolves these modules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 23:54:23 +00:00
Snider
e9fc6902b1 refactor: replace fmt.Errorf/errors.New with coreerr.E()
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Successful in 1m57s
Replace all remaining fmt.Errorf and errors.New calls in production
code with coreerr.E("caller.Method", "message", err) from go-log.
This standardises error handling across 23 files using the structured
error convention already established in the plugin package.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 20:37:25 +00:00
Snider
89cedeac62 refactor: swap pkg/{io,log,i18n} imports to go-io/go-log/go-i18n
Some checks failed
Security Scan / security (push) Failing after 6s
Test / test (push) Successful in 2m4s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 12:35:42 +00:00
Snider
5bfafcd6fc feat: restore agentci, git, and jobrunner packages
These packages are still imported by the CLI. Reverting the premature
extraction so forge consumers can resolve them.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 19:27:35 +00:00
Snider
c95aefed94 refactor: extract agentci + jobrunner to core/go-agent
Both packages now live in forge.lthn.ai/core/go-agent as a unified
agent orchestration repo. go-scm retains collect/, forge/, git/, gitea/.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 17:13:26 +00:00
Claude
148003e005
fix(dispatch): resolve target branch from repo default
Replace hardcoded "new" target branch with a lookup against the
Forgejo API for the repository's default branch, falling back to
"main" if the API call fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:58:35 +00:00
Snider
0fe2978b9d test: Phase 3 — Forgejo signal source, journal replay, handler integration
Forgejo signal source tests:
- Signal parsing for empty body, mixed content, large issue numbers
- findLinkedPR edge cases (multiple refs, empty body, first match wins)
- Poll with combined status failure/error fallback to PENDING
- Poll with unassigned child (no signal), child fetch failure (skipped)
- Poll with multiple epics, mixed labels (only epics generate signals)
- Report format verification (success/failure, error in code block)

Journal replay tests:
- Write + read-back round-trip with full field preservation
- Filter by action (tick_parent from mixed actions)
- Filter by repo (date-partitioned files in owner/repo directories)
- Filter by time range (entries across multiple days)
- Combined filter (action + repo + time)
- Concurrent write safety (20 goroutines, valid JSONL output)
- Empty journal returns no entries

Handler integration tests:
- TickParent full flow: signal -> execute -> verify epic body updated,
  child closed, progress tracked (checked/unchecked counts)
- EnableAutoMerge: verify squash merge method via mock
- PublishDraft: verify draft=false PATCH sent
- SendFixCommand: conflict vs review message paths
- Completion: success flow (label swap, comment) and failure flow
- Full pipeline: signal -> handler -> journal write -> read-back
- Handler priority: verify correct handler matches each signal state
  (merged, draft, conflicting, open+passing)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 05:51:48 +00:00
Snider
3ba8fbb8fb fix: Phase 2 — error wrapping, context audit, rate limiting review
- Standardise all fmt.Errorf calls to "package.Func: context" pattern
  across jobrunner/journal.go, agentci/config.go, agentci/security.go,
  handlers/dispatch.go, and forge/labels.go (15 bare errors fixed)
- Add SecureSSHCommandContext with context propagation for cancellable
  SSH operations; update dispatch handler to use it
- Add CheckGitHubRateLimitCtx for context-aware rate limit checking
- Document Forgejo/Gitea SDK v2 context limitation in FINDINGS.md
  (SDKs do not accept context.Context — adding ctx to 66 wrappers
  would be ceremony without real propagation)
- Review and document rate limiter: handles all edge cases, adaptive
  throttling at 75% GitHub usage, SDK header parsing not feasible

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 05:42:02 +00:00
Claude
8d1d7fce01
test: push coverage across collect/jobrunner/gitea
collect: 83.0% -> 90.0% via error medium injection (write/list/read/ensureDir
failures), rate limiter blocking tests, HTTP mock servers for papers/market/
bitcointalk write errors, processor context cancellation, state round-trip,
and GitHub collector gh-auth-failure paths.

gitea: 89.2% -> 94.0% via paginated org/user repo servers, PR meta with
comment counting and nil dates, GetCommentBodies with nil poster, ListPullRequests
state mapping, and NewFromConfig flag override tests.

jobrunner: 86.4% -> 94.4% via journal error paths (empty baseDir, readonly dir,
path sanitisation), poller with error-returning source/handler/report, journal
integration (JSONL file verification), multiple sources, immediate cancellation,
and cycle counter tests.

handlers: 83.8% -> 89.2% via dispatch mock servers (invalid repo, EnsureLabel
failure, GetIssue not found, AssignIssue failure, AddIssueLabels error, issue
with no special labels), completion label errors, EnableAutoMerge pending checks,
PublishDraft merged state, SendFixCommand merge conflict, DismissReviews stale
review, TickParent checkbox ticking, and dual-run mode. Remaining 10.8% is in
SSH-dependent dispatch code (secureTransfer/runRemote/ticketExists) that cannot
be tested without modifying production code.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 03:06:43 +00:00
Claude
2505aff461
test(handlers): push coverage from 61.6% to 83.8%
Add full test suite for CompletionHandler (success, failure, no-message,
ensure-label-fails). Add Name() tests for all six handlers. Add Match
edge cases (closed PR, conflicting, no threads). Add Execute error paths
for PublishDraft (server error), SendFixCommand (code reviews message,
comment fails), TickParent (already ticked, fetch fails, edit fails,
close child fails), DismissReviews (list fails, nothing to dismiss,
dismiss fails). Add Dispatch dedup tests (already in-progress, already
completed, invalid repo owner).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 01:58:07 +00:00
Claude
3e883f6976
feat: extract SCM/forge integration packages from core/go
Forgejo and Gitea SDK wrappers, multi-repo git utilities, AgentCI
dispatch, distributed job orchestrator, and data collection pipelines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:25:58 +00:00