Skip to content

[codex] Convert client signals to monorepo#1

Merged
dangra merged 2 commits into
mainfrom
codex/monorepo-language-packages
Jul 7, 2026
Merged

[codex] Convert client signals to monorepo#1
dangra merged 2 commits into
mainfrom
codex/monorepo-language-packages

Conversation

@dangra

@dangra dangra commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Convert client-signals from a Go-only repository into a shared-contract monorepo with language packages for Go, JavaScript, Python, and Elixir.

What changed

  • Moved the Go module into go/ and updated its module path to github.com/superfly/client-signals/go.
  • Added shared contract fixtures under spec/ for markers, sanitization, parent classification, headers, and User-Agent suffixes.
  • Added library-only implementations for JavaScript, Python, and Elixir.
  • Added package-specific README.md and AGENTS.md files, keeping root docs language-neutral.
  • Updated shared docs and GitHub Actions checks for the monorepo layout.

Impact

This intentionally changes the Go import path. Existing Go consumers must update from github.com/superfly/client-signals to github.com/superfly/client-signals/go.

Package publishing for npm, PyPI, and Hex is documented but not automated in this PR.

Validation

  • (cd go && go test ./...)
  • (cd javascript && npm test)
  • (cd python && python3 -m unittest)
  • (cd elixir && mix test)
  • (cd go && GOOS=linux GOARCH=amd64 go build ./...)
  • (cd go && GOOS=darwin GOARCH=arm64 go build ./...)
  • (cd go && GOOS=windows GOARCH=amd64 go build ./...)

@dangra dangra marked this pull request as ready for review July 7, 2026 19:06
Copilot AI review requested due to automatic review settings July 7, 2026 19:06
@dangra dangra merged commit 2d72a10 into main Jul 7, 2026
8 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Convert client-signals into a shared-contract monorepo, with spec/ fixtures defining cross-language behavior and new library implementations for Go, JavaScript, Python, and Elixir (with Go moved under go/ and a new import path).

Changes:

  • Introduced spec/ JSON fixtures for markers, sanitization, parent classification, and header/User-Agent behavior, and updated docs to describe the shared contract.
  • Added new JavaScript, Python, and Elixir library implementations plus fixture-driven test suites to keep behavior aligned.
  • Moved the Go module into go/, updated its module path, and updated CI to run per-language test jobs in the monorepo layout.

Reviewed changes

Copilot reviewed 34 out of 53 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/sanitize-fixtures.json Adds shared sanitization fixtures for self-declared agent values.
spec/README.md Documents the purpose and intended usage of shared spec fixtures.
spec/parent-fixtures.json Adds shared fixtures for parent process name bucketing.
spec/markers.json Defines the shared known agent-marker table used across languages.
spec/header-fixtures.json Adds shared fixtures for emitted headers and UA suffix behavior.
README.md Updates root documentation for monorepo layout and shared contract.
python/test_client_signals.py Adds Python unittest coverage, including fixture alignment checks.
python/README.md Documents Python package usage and API surface.
python/pyproject.toml Adds Python package metadata for the monorepo layout.
python/client_signals/core.py Implements Python detection + header/UA helpers per shared contract.
python/client_signals/init.py Exposes the Python public API surface.
python/AGENTS.md Adds Python package agent/dev constraints and commands.
javascript/test/index.test.js Adds Node test coverage, including shared fixture checks.
javascript/src/index.js Implements JavaScript detection + header/UA helpers per shared contract.
javascript/README.md Documents JavaScript package usage and API surface.
javascript/package.json Adds JavaScript package metadata and test script.
javascript/AGENTS.md Adds JavaScript package agent/dev constraints and commands.
go/transport.go Adds Go header helpers and RoundTripper wrapper for attaching signals.
go/transport_test.go Adds Go tests for transport/header/UA behavior.
go/spec_contract_test.go Adds Go fixture-driven contract tests against spec/.
go/signals.go Adds Go Signals, Detect, and DetectOnce implementation under go/.
go/signals_test.go Adds Go tests for signal composition and caching behavior.
go/README.md Documents Go module import path change and updated API usage.
go/parent.go Adds Go parent process classification helpers.
go/parent_windows.go Adds Windows parent process lookup via Toolhelp32 snapshot.
go/parent_test.go Adds Go tests for parent classification and smoke-test lookup.
go/parent_other.go Adds fallback parent lookup behavior for unsupported platforms.
go/parent_linux.go Adds Linux parent process lookup via /proc/<ppid>/comm.
go/parent_darwin.go Adds macOS parent process lookup via sysctl.
go/markers.go Adds Go mirror of the shared known marker table.
go/interactive.go Adds Go stdout “interactive” detection helper.
go/interactive_test.go Adds Go test for interactive detection behavior.
go/go.sum Adds Go dependency sums (x/sys).
go/go.mod Moves Go module path under go/.
go/cmd/main.go Updates CLI to import the new Go module path.
go/ci.go Adds Go CI detection helper.
go/ci_test.go Adds Go tests for CI detection semantics.
go/AGENTS.md Adds Go package agent/dev constraints and commands.
go/agent.go Adds Go agent detection + invoked-by sanitization.
go/agent_test.go Adds Go tests for agent detection precedence and sanitization.
go/.golangci.yml Updates Go lint config for the new module path.
elixir/test/test_helper.exs Adds ExUnit bootstrap for Elixir tests.
elixir/test/client_signals_test.exs Adds Elixir tests, including shared fixture checks.
elixir/README.md Documents Elixir package usage and API surface.
elixir/mix.exs Adds Elixir project/package metadata.
elixir/lib/client_signals.ex Implements Elixir detection + header/UA helpers per shared contract.
elixir/AGENTS.md Adds Elixir package agent/dev constraints and commands.
elixir/.formatter.exs Adds Elixir formatter configuration.
docs/signals.md Updates shared signal rationale docs for multi-language context.
docs/markers.md Updates marker rationale docs to reference shared spec/ source of truth.
AGENTS.md Updates repository-wide agent guidance for monorepo structure.
.gitignore Ignores language-specific build/test artifacts (node/python/elixir).
.github/workflows/checks.yml Updates CI workflow for monorepo layout and per-language test jobs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +206 to +223
defp parent_bucket do
self()
|> Process.info(:dictionary)
|> elem(1)
|> Keyword.get(:"$ancestors", [])
|> List.first()
|> parent_name()
|> classify_parent_name()
end

defp parent_name(_) do
ppid = :os.getpid() |> to_string() |> parent_pid()

case File.read("/proc/#{ppid}/comm") do
{:ok, name} -> String.trim(name)
{:error, _} -> ""
end
end
Comment on lines +225 to +235
defp parent_pid(pid) do
case File.read("/proc/#{pid}/stat") do
{:ok, stat} ->
stat
|> String.split()
|> Enum.at(3, "")

{:error, _} ->
""
end
end
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