Commit graph

20 commits

Author SHA1 Message Date
Snider
175701fc93 fix(security): lock refreshMarketplace to canonical index path, isolate HOME in iter test
- pkg/api/provider.go: remove refreshRequest struct and filepath-based
  sanitisation; always load marketplace/index.json via a package-level
  const so callers cannot influence which file is read (path traversal fix)
- forge/orgs_test.go: add t.Setenv("HOME", t.TempDir()) to
  TestClient_ListMyOrgsIter_Bad_ServerError to prevent config bleed
  between test runs

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-07 11:30:04 +01:00
Snider
913b8fc960 fix(review): address CodeRabbit PR #2 round-2 findings
- manifest/compile.go: apply opts.Version override before empty-version check
  so version can be supplied via CompileOptions even when manifest has none
- manifest/compile.go: fix import grouping (stdlib before internal)
- pkg/api/provider.go: propagate c.Request.Context() into Install/Update calls
  so client disconnects cancel long-running operations
- pkg/api/provider.go: guard refreshMarketplace against path traversal; suppress
  raw filesystem errors from HTTP response
- pkg/api/provider.go: normalise typed-nil installer in NewProvider to prevent
  nil-pointer panics from non-nil interface holding nil pointer
- jobrunner/journal.go: upgrade sync.Mutex to sync.RWMutex; Query uses RLock
  for concurrent read throughput
- jobrunner/journal.go: use bytes.NewReader(data) instead of
  strings.NewReader(string(data)) to avoid double allocation
- jobrunner/journal.go: fix import grouping (stdlib before internal)
- internal/ax/stringsx/stringsx.go: fix Builder alias to strings.Builder
  (was bytes.Buffer — different copy-after-write semantics)
- internal/ax/stringsx/stringsx.go: fix NewReader to return *strings.Reader
- internal/ax/stringsx/stringsx.go: make SplitSeq lazy (no upfront []string)
- internal/ax/stringsx/stringsx.go: remove bytes import; use stdlib strings
  for ContainsAny, EqualFold, LastIndex
- gitea/client.go: fix import grouping (internal before third-party)
- gitea/prs.go: fix import grouping (internal before third-party)
- forge/labels.go: fix import grouping (internal before third-party)
- cmd/gitea/cmd_sync.go: move exec (golang.org/x/sys/execabs) to third-party
  import group
- forge/orgs_test.go: add t.Setenv("HOME", t.TempDir()) for config isolation
- forge/orgs_test.go: rename *_Bad_ServerError_Good → *_Bad_ServerError
- gitea/repos_test.go: add HOME isolation to CreateMirrorFromService test

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-07 10:29:22 +01:00
Snider
f3dd8ca0f0 fix(review): address CodeRabbit PR #2 findings
Critical/Major:
- Remove dead functions syncRepoNameFromArg and repoNameFromArg (used url pkg without import, would cause compile error)
- Migrate forge.lthn.ai/core/config → dappco.re/go/core/config in forge/config.go and gitea/config.go
- Propagate ListIssueCommentsIter errors in forge/meta.go and gitea/meta.go (was silently returning truncated count)
- Add RedactedToken() to gitea/client.go to avoid exposing raw API tokens
- Add 30s timeout to http.DefaultClient usage in gitea/prs.go via package-level httpClient
- Fix stringsx.Fields (bufio 64KiB limit), Repeat (wrong for negative/zero), Replace (ignored n param) to match stdlib
- Fix fmtx.Println to use fmt.Sprintln so spaces appear between operands
- Fix filepathx.Abs to use path/filepath for OS-aware path handling; wrap Getwd error
- Fix stdio.Write to return io.ErrShortWrite on partial writes
- Add mutex lock to jobrunner.Journal.Query to prevent data race with Append
- Add sync.RWMutex to ScmProvider; protect p.index reads/writes in pkg/api/provider.go
- Fix cmd/scm/cmd_index.go: append dir to repoPaths only after ReadDir confirms existence
- Fix manifest/compile.go: copy manifest before applying version override to avoid mutating caller
- Fix forge/labels.go: use ListOrgLabelsIter/ListRepoLabelsIter names in iterator error logs
- Wrap single-segment validation error in syncutil.ParseRepoName with function context

Minor:
- Fix import ordering (stdlib → forge.lthn.ai → third-party) in cmd/forge, cmd/collect, repos, cmd/gitea files
- Add t.Setenv("HOME", t.TempDir()) to gitea testhelpers and forge/labels_test.go
- Add iterator yield guard in forge/orgs_test.go
- Convert syncutil/repo_name_test.go to table-driven tests
- Use json.Marshal in pkg/api/provider_test.go instead of string concatenation
- Fix test naming (redundant/conflicting _Good/_Bad suffixes) across 10 test files

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-07 09:25:42 +01:00
Snider
e5e6698662 Merge github/main into dev — resolve module path conflicts
Keep dappco.re module paths throughout; github/main had stale forge.lthn.ai
paths in go.mod and several source files. All conflicts resolved in favour of
dev (HEAD): AX-pattern aliased imports, SecureSSHCommandContext, syncutil,
and _Good test naming convention.

Note: go mod tidy fails — dappco.re/go/core/cli@v0.3.7 and
dappco.re/go/core/config@v0.1.8 tags still declare forge.lthn.ai module
paths. New tags with correct dappco.re paths are needed on both repos
before tidy will succeed.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-07 08:42:34 +01:00
Virgil
25667064ca fix(pkg/api): emit installed change events
Some checks failed
Security Scan / security (push) Failing after 19s
Test / test (push) Failing after 2m0s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:00:53 +00:00
Virgil
c303abbd95 refactor(marketplace): use medium for index writes
Some checks failed
Security Scan / security (push) Failing after 16s
Test / test (push) Successful in 2m24s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 13:22:14 +00:00
Virgil
5a561690be feat(ui): polish scm agent views
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Failing after 14s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 07:04:25 +00:00
Virgil
32e65b8b43 feat(ui): refresh scm views from live events
Some checks failed
Security Scan / security (push) Failing after 13s
Test / test (push) Successful in 2m20s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 06:58:47 +00:00
Virgil
6233664c5d fix(pkg/api): combine marketplace query and category filters
Some checks failed
Security Scan / security (push) Failing after 9s
Test / test (push) Successful in 2m9s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 06:40:27 +00:00
Virgil
369103f8dc feat(pkg/api): list registry repos in dependency order
Some checks failed
Security Scan / security (push) Failing after 10s
Test / test (push) Successful in 2m8s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 06:32:16 +00:00
Virgil
82c25469e8 feat(pkg/api): refresh marketplace index
Some checks failed
Security Scan / security (push) Failing after 12s
Test / test (push) Successful in 1m55s
Add marketplace index loading and a provider endpoint to refresh the in-memory catalogue from index.json.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 05:41:05 +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
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
Virgil
ae0677a046 fix(security): harden installer, marketplace, and sync path handling
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-23 14:32:11 +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
10c9e23e04 fix(dx): repair build, update CLAUDE.md, add tests for untested paths
Some checks failed
Security Scan / security (pull_request) Failing after 9s
Test / test (pull_request) Successful in 1m44s
- Fix cmd/forge build failure: remove extra locales.FS arg from
  RegisterCommands (signature takes single CommandRegistration)
- Update CLAUDE.md error handling section to document coreerr.E()
  pattern (was outdated log.E/fmt.Errorf reference)
- Add security_test.go for agentci: SanitizePath, EscapeShellArg,
  SecureSSHCommand, MaskToken (coverage 56% → 68%)
- Add provider_handlers_test.go for pkg/api: category filter, nil
  guards, manifest/verify/sign bad requests (coverage 31% → 52%)
- Audit confirms: no fmt.Errorf or os.ReadFile/WriteFile in production
  code (only in test files)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-17 08:49:55 +00:00
Snider
81deee8598 feat(api): add SCM service provider with Lit custom elements
Some checks failed
Security Scan / security (push) Failing after 7s
Test / test (push) Failing after 1m16s
ScmProvider implements Provider + Streamable + Describable + Renderable,
wrapping marketplace, manifest, installed, and registry endpoints as REST
API with WS event streaming. Includes Lit custom element bundle with
panel, marketplace browser, manifest viewer, installed manager, and
registry status display. All 14 tests pass.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 10:42:37 +00:00