Skip to content

Clear pub-types cleanup backlog (stacked on #117)#118

Open
saltyskip wants to merge 1 commit intoextend-architecture-testfrom
cleanup-pub-types-backlog
Open

Clear pub-types cleanup backlog (stacked on #117)#118
saltyskip wants to merge 1 commit intoextend-architecture-testfrom
cleanup-pub-types-backlog

Conversation

@saltyskip
Copy link
Copy Markdown
Owner

Summary

Stacked on #117. Works through every entry in the PUB_TYPES_CLEANUP_BACKLOG list that PR introduced, leaving the backlog empty and every .rs file in src/ properly enforced by the architecture test.

What moved

Billing slice → services/billing/models.rs

From Types
handoff.rs BillingIntent, BillingTier (+ impl), BillingHandoffError, HandoffOutcome, BillingHandoffConfig
stripe_client.rs StripeConfig (+ impl), StripeError (+ Display), CheckoutSession, HandoffCheckoutOpts<'a>, PortalSession, WebhookVerifyError (+ Display)
limits.rs PlanLimits
repos/event_counters.rs EventCounterDoc
repos/stripe_webhook_dedup.rs StripeDedupDoc

Source files use pub use super::models::*; re-exports so external callers (crate::services::billing::stripe_client::StripeError etc.) keep working. BillingHandoffService, EventCountersRepo, StripeWebhookDedupRepo marked with impl_container!.

Core slice → new core/models.rs

From Types
core/webhook_dispatcher.rs ClickEventPayload, AttributionEventPayload, ConversionEventPayload, WebhookPayload

The WebhookDispatcher trait stays in webhook_dispatcher.rs. core/config.rs::Config marked as impl_container! (same pattern as repo containers — type with from_env() constructor).

Single-struct top-level files → directories with mod.rs + models.rs

error.rs and app.rs were single-purpose files (one struct/enum each plus impls). Converted to mini-modules so the data lives in models.rs per the rule:

  • error.rserror/{mod.rs, models.rs}ErrorResponse, AppError in models.rs; IntoResponse for AppError impl in mod.rs. mod.rs re-exports so crate::error::ErrorResponse is unchanged everywhere.
  • app.rsapp/{mod.rs, models.rs}AppState in models.rs; mod.rs re-exports. crate::app::AppState unchanged.

MCP renamed

mcp/tools.rsmcp/models.rs. The file already held DTO-shaped tool input types; the rename makes it match the pattern. mcp/server.rs and mcp/mod.rs updated.

Architecture test

PUB_TYPES_CLEANUP_BACKLOG is now &[]. The const stays in place as a holding-pen pattern in case future migrations need a temporary entry, but the comment makes clear new entries shouldn't be added.

Test plan

  • cargo fmt -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test — 112 lib + 145 integration tests pass
  • No behavior change. Pure code motion with pub use re-exports preserving every external import path.

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rift Ready Ready Preview, Comment May 1, 2026 6:37pm

Request Review

Stacks on PR #117. The backlog list introduced there held 10 files of
pre-existing pub-data-type violations. This PR works through every
entry so the backlog is empty.

**Billing slice — moved to services/billing/models.rs:**
- handoff.rs: BillingIntent, BillingTier (+ impl), BillingHandoffError,
  HandoffOutcome, BillingHandoffConfig
- stripe_client.rs: StripeConfig (+ impl), StripeError (+ Display),
  CheckoutSession, HandoffCheckoutOpts, PortalSession,
  WebhookVerifyError (+ Display)
- limits.rs: PlanLimits
- repos/event_counters.rs: EventCounterDoc (EventCountersRepo marked
  impl_container)
- repos/stripe_webhook_dedup.rs: StripeDedupDoc (StripeWebhookDedupRepo
  marked impl_container)

Source files now `pub use` from models.rs to keep external import paths
stable. BillingHandoffService also marked as impl_container.

**Core slice — new core/models.rs:**
- 4 webhook payloads (ClickEventPayload, AttributionEventPayload,
  ConversionEventPayload, WebhookPayload) extracted from
  webhook_dispatcher.rs. The trait stays.
- core/config.rs::Config marked as impl_container (env-loaded settings
  with from_env constructor — same pattern as repo containers).

**Single-struct top-level files — converted to directories:**
- error.rs → error/{mod.rs (the IntoResponse impl), models.rs
  (ErrorResponse, AppError)}. mod.rs re-exports both, so
  `crate::error::ErrorResponse` keeps working everywhere.
- app.rs → app/{mod.rs (re-export), models.rs (AppState)}. Same
  re-export pattern; `crate::app::AppState` unchanged.

**MCP renamed:**
- mcp/tools.rs → mcp/models.rs. The file already held DTO-shaped tool
  input types — name now matches the pattern. `mcp/server.rs` and
  `mcp/mod.rs` updated.

**Architecture test:**
PUB_TYPES_CLEANUP_BACKLOG drops to `&[]`. Every `.rs` under `src/`
(except models.rs, lib.rs, main.rs, architecture_tests.rs, *_tests.rs)
is now enforced and clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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