Skip to content

deps: switch shared types to common#4

Merged
TeoSlayer merged 2 commits into
mainfrom
migrate-to-common
May 28, 2026
Merged

deps: switch shared types to common#4
TeoSlayer merged 2 commits into
mainfrom
migrate-to-common

Conversation

@TeoSlayer
Copy link
Copy Markdown
Contributor

Summary

Mechanical migration: every github.com/TeoSlayer/pilotprotocol/pkg/{coreapi,protocol,driver,registry/{client,wire},config,logging,urlvalidate,secure} import (and the previously-internal ipcutil) is rewritten to use the canonical github.com/pilot-protocol/common/<pkg> module.

This is Phase 2 of the common-extraction migration. See pilot-protocol/common PR for Phase 1 (the actual package moves) and TeoSlayer/pilotprotocol PR for Phase 3 (web4 cleanup + duplicate deletion).

Why

Today every sibling repo requires the TeoSlayer/pilotprotocol hub for shared types. The hub in turn requires every sibling for its cmd/daemon assembly. That's a locally-circular dep that only works because every repo has replace ... => ../web4 for dev. At release time it forces coordinated tagging on every sibling+hub edit.

Moving the shared types into common breaks that cycle for the 13 leaf siblings (everything except handshake/runtime/libpilot which extend the daemon engine and stay tightly coupled to pkg/daemon).

What's in this PR

  • Sed sweep across every .go file replacing 10 import paths.
  • Adds replace github.com/pilot-protocol/common => ../common so local dev resolves against the local common checkout.
  • go mod tidy clean.
  • go build ./... passes.

Merge order

This PR depends on the common-side PR (Phase 1) landing first so the new module paths actually resolve at the common@vX.X.X tag. Until then, local replace keeps everything working.

🤖 Generated with Claude Code

teovl added 2 commits May 28, 2026 15:57
Same migration as the other siblings: replace
github.com/TeoSlayer/pilotprotocol/pkg/{coreapi,protocol,driver,registry/{client,wire},config,logging,urlvalidate,secure}
and the ipcutil import path with the canonical common module.

Unlike the leaf siblings, this repo keeps its
github.com/TeoSlayer/pilotprotocol/pkg/daemon import because the
sibling implements daemon plugin code that is tightly coupled to the
daemon engine. That cycle is intentional for now — handshake, runtime,
and libpilot are co-built with web4, not independent releases.

go build ./... passes.
@TeoSlayer TeoSlayer merged commit 77e4a73 into main May 28, 2026
1 check failed
TeoSlayer pushed a commit that referenced this pull request May 29, 2026
PR #4 (deps: switch shared types to common) migrated production code to common/*
but introduced new test code in zz_helpers_test.go / zz_handshake_manager_bootstrap_test.go
with type mismatches:
- testRuntime.regClient was declared as *common/registry/client.Client but
  regtestutil.StartTestRegistry returns *TeoSlayer/pilotprotocol/pkg/registry/client.Client,
  and tests call .SetSigner / .RegisterWithKey which only exist on the concrete TeoSlayer type
- daemon.Connection.RemoteAddr field is TeoSlayer/pkg/protocol.Addr (web4 hasn't migrated)
  but the test was constructing common/protocol.Addr
- testStreamAdapter / testDaemonListener returned TeoSlayer Addr where coreapi.Addr expected

Fixes:
- testRuntime.regClient: change to *tregistryclient.Client (TeoSlayer concrete) — implicit
  RegistryClient interface satisfaction is structural so production code continues to work
- bootstrap_test: import tprotocol alias and construct tprotocol.Addr for daemon fields
- helpers_test: convert TeoSlayer Addr → coreapi.Addr via struct literal (fields identical)

Verified locally: go test ./... → PASS
TeoSlayer added a commit that referenced this pull request May 29, 2026
* fix(ci): checkout pilot-protocol/common so go test resolves replace path

The 'deps: switch shared types to common' merge added github.com/pilot-protocol/common
as a dependency with 'replace .. => ../common', but didn't update ci.yml to check
that sibling out. Result: every main CI run since then has been red on go test with
'../common/go.mod: no such file or directory'.

Fix: add a 'Checkout common' step before setup-go, mirroring the existing
'Checkout web4' pattern.

Closes PILOT-349.

* fix(ci): also checkout transitive replace siblings

* fix(ci): strip literal quotes from sibling repo names in checkout steps

* fix(ci): run go mod tidy before tests to absorb transitive deps

* fix(ci): checkout the full set of pilot-protocol siblings for transitive replaces

* fix(tests): repair half-migrated types after PR #4

PR #4 (deps: switch shared types to common) migrated production code to common/*
but introduced new test code in zz_helpers_test.go / zz_handshake_manager_bootstrap_test.go
with type mismatches:
- testRuntime.regClient was declared as *common/registry/client.Client but
  regtestutil.StartTestRegistry returns *TeoSlayer/pilotprotocol/pkg/registry/client.Client,
  and tests call .SetSigner / .RegisterWithKey which only exist on the concrete TeoSlayer type
- daemon.Connection.RemoteAddr field is TeoSlayer/pkg/protocol.Addr (web4 hasn't migrated)
  but the test was constructing common/protocol.Addr
- testStreamAdapter / testDaemonListener returned TeoSlayer Addr where coreapi.Addr expected

Fixes:
- testRuntime.regClient: change to *tregistryclient.Client (TeoSlayer concrete) — implicit
  RegistryClient interface satisfaction is structural so production code continues to work
- bootstrap_test: import tprotocol alias and construct tprotocol.Addr for daemon fields
- helpers_test: convert TeoSlayer Addr → coreapi.Addr via struct literal (fields identical)

Verified locally: go test ./... → PASS

---------

Co-authored-by: Teodor Calin <teodor@vulturelabs.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants