Skip to content

refactor: structural cleanups + datasource-selector consistency#115

Merged
samcm merged 6 commits into
masterfrom
preship-refactors
Jun 4, 2026
Merged

refactor: structural cleanups + datasource-selector consistency#115
samcm merged 6 commits into
masterfrom
preship-refactors

Conversation

@samcm
Copy link
Copy Markdown
Member

@samcm samcm commented Jun 3, 2026

Builds on #114 with the structural refactors and datasource-selector consistency work split out of the housekeeping PR: ClickHouse's query selector renamed to datasource to match the other modules, a unified {name, description, url, type, extra} listing envelope across all list_datasources/list_networks operations, a generic reverse-proxy handler replacing the duplicated ClickHouse/Prometheus/Loki handlers, and auth_simple.go split into cohesive files with SimpleService renamed to AuthorizationServer. Also dedupes the eips/consensusspecs on-disk cache, reuses pkg/observability in the proxy binary, aligns prometheus/loki query args, removes a dead executionID parameter, renames Example.Cluster to Target, and adds unit tests for searchsvc/searchruntime/consensusspecs.

Stacked on #114 (base is preship-housekeeping, not master); rebase onto master once #114 merges.

samcm added 6 commits June 4, 2026 14:47
- clickhouse: rename the query/query-raw datasource selector from "cluster"
  to "datasource", matching prometheus/loki/dora (CLI arg, op key, Python
  wrapper + docs). Schema-side "cluster" (the logical CH cluster term from
  #110) is left intact; identifiers remain xatu/xatu-cbt.
- eips/consensusspecs: extract the duplicated on-disk JSON cache scaffold into
  internal/githubapi (generic ReadCache/WriteCache)
- proxy binary: serve metrics via pkg/observability so it also exposes
  /health and /ready
- add unit tests for searchsvc, searchruntime, and consensusspecs
All *.list_datasources / *.list_networks operations now emit one item shape
{name, description, url, type, extra}, rendered by a single CLI helper
(printListing) and documented uniformly in the Python wrappers. Type-specific
fields (clickhouse database; block_archive status/source/chain_id/polling) move
into `extra`. datasource vs network top-level keys are kept where the concept
genuinely differs.
…wave 2b)

- extract a generic datasourceHandler (X-Datasource lookup, 404/error handling,
  prefix strip, ReverseProxy build) that the ClickHouse/Prometheus/Loki handlers
  configure with their per-type target/director and transport; routing,
  credential-strip-then-SetBasicAuth, timeouts and TLS are unchanged and the
  existing handler tests pass
- route proxy datasource handler errors through the JSON writeError helper
- Client now embeds Service (removes the duplicated 11-method block)
- drop the unused PrometheusDatasources()/LokiDatasources() from the Service
  interface (concrete methods kept for the status endpoint)
…ve 2c)

Pure refactor of the GitHub-backed OAuth authorization server, no behavior
change.

- rename SimpleService/simpleService/NewSimpleService ->
  AuthorizationServer/authorizationServer/NewAuthorizationServer, and the
  pkg/proxy alias simpleauth -> auth (+ the wrapper authenticator names)
- split the ~1334-line auth_simple.go into cohesive files: authorization_server
  (type + lifecycle + routing), middleware, metadata, authorization_code,
  device, token, response
- cbt: centralize the per-network base URL in cbt.NetworkBaseURL (was duplicated
  in the module's SandboxEnv and the server cbtNetworks operation)
- ethnode: add proxy.Service.EthNodeDatasourceInfo so the app kernel no longer
  fabricates a synthetic datasource entry
- proxy: drop the dead executionID param from RegisterToken/RevokeToken (the
  per-execution token lifecycle went away with AuthModeToken); replace the
  "none" sentinel with proxy.NoAuthToken
- prometheus: default query-range --start/--end like loki, and accept
  --start/--end on labels/label-values (parity with loki)
- version: extract shared print logic into internal/version (cli/server/proxy)
- types: rename Example.Cluster -> Example.Target (it labels non-cluster
  datasources too); examples.yaml cluster: -> target:
…cal mode, enforced by topology in hosted-proxy mode
@samcm samcm force-pushed the preship-housekeeping branch from b5d0f46 to d27989f Compare June 4, 2026 04:49
@samcm samcm force-pushed the preship-refactors branch from 63d9090 to 9848241 Compare June 4, 2026 04:50
@samcm samcm changed the base branch from preship-housekeeping to master June 4, 2026 06:16
@samcm samcm merged commit 4f413f1 into master Jun 4, 2026
3 checks passed
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.

1 participant