[agent/codex] Fix failing tests. Run go test ./... -count=1 to see failu... #34

Open
Virgil wants to merge 17 commits from agent/fix-failing-tests--run--go-test--------c into dev
Member

Task

Fix failing tests. Run go test ./... -count=1 to see failures. The Options type changed from []Option slice to Options struct with NewOptions() constructor. data_test.go and embed_test.go have tests that fail because of embed path resolution. The embed directive is //go:embed testdata. Remove all t.Skip lines containing "@TODO Codex". Fix mount paths, fix Options literals to use NewOptions(Option{...}). Run go test ./... until green. Commit when done.

Agent: codex
Commits: 18
Branch: agent/fix-failing-tests--run--go-test--------c


Auto-created by core-agent dispatch system.
Co-Authored-By: Virgil virgil@lethean.io

## Task Fix failing tests. Run `go test ./... -count=1` to see failures. The Options type changed from []Option slice to Options struct with NewOptions() constructor. data_test.go and embed_test.go have tests that fail because of embed path resolution. The embed directive is `//go:embed testdata`. Remove all t.Skip lines containing "@TODO Codex". Fix mount paths, fix Options literals to use NewOptions(Option{...}). Run `go test ./...` until green. Commit when done. **Agent:** codex **Commits:** 18 **Branch:** `agent/fix-failing-tests--run--go-test--------c` --- Auto-created by core-agent dispatch system. Co-Authored-By: Virgil <virgil@lethean.io>
Virgil added 17 commits 2026-03-24 20:29:09 +00:00
- WithOptions copies the Options slice (constructor isolation regression)
- WithService auto-discovers service name from package path via reflect
- WithService auto-registers HandleIPCEvents if present (v0.3.3 parity)
- Add test for failing option short-circuit in New()

Co-Authored-By: Virgil <virgil@lethean.io>
- HandleIPCEvents only auto-registered for services the factory didn't
  register itself (prevents double handler registration)
- Auto-discovery only creates Service{} placeholder when factory didn't
  call c.Service() — factories that register themselves keep full lifecycle

Addresses Codex review findings 1 and 2 from third pass.

Co-Authored-By: Virgil <virgil@lethean.io>
WithService is now a simple factory call — no reflect, no auto-registration.
New() calls discoverHandlers() after all opts run, scanning Config for
service instances that implement HandleIPCEvents.

This eliminates both double-registration and empty-placeholder issues:
- Factories wire their own lifecycle via c.Service()
- HandleIPCEvents discovered once, after all services are registered
- No tension between factory-registered and auto-discovered paths

Co-Authored-By: Virgil <virgil@lethean.io>
Restores v0.3.3 service manager capabilities:
- RegisterService(name, instance) stores the raw instance
- Auto-discovers Startable/Stoppable interfaces → wires lifecycle
- Auto-discovers HandleIPCEvents → wires to IPC bus
- ServiceFor[T](c, name) for typed instance retrieval
- Service DTO gains Instance field for instance tracking

WithService is a simple factory call — no reflect, no magic.
discoverHandlers removed — RegisterService handles it inline.
No double-registration: IPC wired once at registration time.

Co-Authored-By: Virgil <virgil@lethean.io>
Options is now a proper struct with New(), Set(), Get(), typed accessors.
Result gains New(), Result(), Get() methods on the struct.
WithOption("key", value) convenience for core.New().

options_test.go: 22 tests passing against the new contract.
Other test files mechanically updated for compilation.

Co-Authored-By: Virgil <virgil@lethean.io>
App.New() creates from Options. App.Find() locates programs on PATH.
Both are struct methods — no package-level functions.
8 tests passing.

Co-Authored-By: Virgil <virgil@lethean.io>
Cli struct unchanged — already conforms.
Tests use WithOption() convenience. 9 tests passing.

Co-Authored-By: Virgil <virgil@lethean.io>
Cli{}.New(c) replaces &Cli{core: c} in contract.go.
9 tests passing.

Co-Authored-By: Virgil <virgil@lethean.io>
Cli as service with ServiceRuntime, incomplete.
Need to properly port v0.3.3 service_manager, message_bus,
WithService with full name/IPC discovery.

Co-Authored-By: Virgil <virgil@lethean.io>
- WithService now calls factory, discovers service name from package path via
  reflect/runtime (last path segment, _test suffix stripped, lowercased), and
  calls RegisterService — which handles Startable/Stoppable/HandleIPCEvents
- If factory returns nil Value (self-registered), WithService returns OK without
  a second registration
- Add contract_test.go with _Good/_Bad tests covering all three code paths
- Fix core.go Cli() accessor: use ServiceFor[*Cli](c, "cli") (was cli.New())
- Fix pre-existing })) → }}) syntax errors in command_test, service_test, lock_test
- Fix pre-existing Options{...} → NewOptions(...) in core_test, data_test,
  drive_test, i18n_test (Options is a struct, not a slice)

Co-Authored-By: Virgil <virgil@lethean.io>
WithService now: calls factory, discovers service name from instance's
package path via reflect.TypeOf, discovers HandleIPCEvents method,
calls RegisterService. If factory returns nil Value, assumes self-registered.

Also fixes: Cli() accessor uses ServiceFor, test files updated for Options struct.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Virgil <virgil@lethean.io>
WithService: full name discovery + IPC handler auto-registration via reflect
WithName: explicit service naming
RegisterService: Startable/Stoppable/HandleIPCEvents auto-discovery
MustServiceFor[T]: panics if not found
WithServiceLock: enable/apply split (v0.3.3 parity)
Cli: registered as service via CliRegister, accessed via ServiceFor

@TODO Codex: Fix data_test.go and embed_test.go — embed path resolution
after Options changed from []Option to struct. Mount paths need updating.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Virgil <virgil@lethean.io>
Author
Member

Tests Passed — Merge Failed

go test ./... passed but merge failed: forgeMergePR: HTTP 409: merge push out of date

## Tests Passed — Merge Failed `go test ./...` passed but merge failed: forgeMergePR: HTTP 409: merge push out of date
Author
Member

Tests Passed — Merge Failed

go test ./... passed but merge failed: forgeMergePR: HTTP 409: merge push out of date

## Tests Passed — Merge Failed `go test ./...` passed but merge failed: forgeMergePR: HTTP 409: merge push out of date
Virgil added the
needs-review
label 2026-03-24 20:29:14 +00:00
Author
Member

Needs Review

Merge conflict persists after rebase. Auto-merge gave up after retry.

Labelled needs-review for human attention.

## Needs Review Merge conflict persists after rebase. Auto-merge gave up after retry. Labelled `needs-review` for human attention.
This pull request has changes conflicting with the target branch.
  • app.go
  • app_test.go
  • cli.go
  • cli_test.go
  • command_test.go
  • contract.go
  • contract_test.go
  • core.go
  • core_test.go
  • data_test.go
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin agent/fix-failing-tests--run--go-test--------c:agent/fix-failing-tests--run--go-test--------c
git checkout agent/fix-failing-tests--run--go-test--------c

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout dev
git merge --no-ff agent/fix-failing-tests--run--go-test--------c
git checkout agent/fix-failing-tests--run--go-test--------c
git rebase dev
git checkout dev
git merge --ff-only agent/fix-failing-tests--run--go-test--------c
git checkout agent/fix-failing-tests--run--go-test--------c
git rebase dev
git checkout dev
git merge --no-ff agent/fix-failing-tests--run--go-test--------c
git checkout dev
git merge --squash agent/fix-failing-tests--run--go-test--------c
git checkout dev
git merge --ff-only agent/fix-failing-tests--run--go-test--------c
git checkout dev
git merge agent/fix-failing-tests--run--go-test--------c
git push origin dev
Sign in to join this conversation.
No description provided.