Skip to content

refactor: take back what only this side used from core - #41

Merged
fylorn merged 2 commits into
devfrom
refactor/shared-layer-one-side
Sep 24, 2026
Merged

fylorn merged 2 commits into
devfrom
refactor/shared-layer-one-side

Conversation

@fylorn

@fylorn fylorn commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Counterpart of ThinkWatchProject/ThinkWatch-Core#164, which keeps only what both gateways use in core's shared layer. This side now depends on tw-dialect, tw-guard and tw-breaker only, pinned to core v0.42.0.

Moved here

  • tw-crypto → think_watch_common::{crypto, json_secret}. JsonSecret returns AppError directly; SecretError and its From impl are gone (they only existed so core would not know this crate's error type).
  • tw_types::{GatewayError, parse_retry_after_seconds} → think_watch_gateway::error; tw_types::{CallCtx, substitute_template} → think_watch_gateway::call_ctx. The unused CallCtx::trace is dropped.
  • tw_upstream::{sigv4, eventstream} → think_watch_gateway::bedrock, comments translated, with core's end-to-end Converse-stream test (wire frames → SSE → Chat client + usage sniffing) moved in as a unit test.

Switched to core's new homes

  • tw_wire::{Sniffer, Usage} → tw_dialect::usage. The sniffer now parses each usage object with the dialect's own per-format parser; numbers are unchanged, and Usage additionally carries reasoning.
  • tw_upstream::upstream_url → tw_dialect::url::upstream_url.

Rebased onto dev after #40 (usage estimate): Completed::usage stays a plain Usage plus usage_estimated, now typed as tw_dialect::usage::Usage.

Checks

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo clippy --workspace --lib -- -D warnings, unit tests (677) — green.
  • Integration suite locally (own containers): 267 passed; the one failure is aws_docs_tools_list_round_trips_through_the_proxy, which calls a public AWS MCP endpoint that was unreachable from this machine.

🤖 Generated with Claude Code

fylorn and others added 2 commits September 24, 2026 15:06
Core's shared layer now holds only what both gateways use. This side
depends on tw-dialect, tw-guard and tw-breaker, and takes back the rest:

- `tw-crypto` becomes `think_watch_common::{crypto, json_secret}`.
  `JsonSecret` returns `AppError` directly; the separate `SecretError`
  only existed to keep core from knowing this crate's error type.
- `GatewayError` and `parse_retry_after_seconds` become
  `think_watch_gateway::error`; `CallCtx` and `substitute_template` become
  `think_watch_gateway::call_ctx` (the unused `CallCtx::trace` is gone).
- SigV4 signing and eventstream unframing become
  `think_watch_gateway::bedrock`, with core's end-to-end Converse stream
  test moved alongside.
- Usage sniffing is `tw_dialect::usage` and `upstream_url` is
  `tw_dialect::url`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the refactor/shared-layer-one-side branch from 30ec1c5 to 8616b82 Compare September 24, 2026 07:13
@fylorn
fylorn merged commit ad5b75b into dev Sep 24, 2026
6 checks passed
@fylorn
fylorn deleted the refactor/shared-layer-one-side branch September 24, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant