refactor: migrate to ceres application/transport paths and centralize HTTP errors#2139
Conversation
…er builds Move mono HTTP DTOs into ceres/model (admin, webhook, bot, note, group) and route label/group logic through MonoApiService facades so mono no longer imports jupiter::model. Add CI guard for the DTO boundary, document the three-layer model rules in ceres/README, and relocate ProtocolError HTTP mapping to mono. Extract SeaORM migrations into jupiter-migrate with optional jupiter/migrate feature gating, fold context into mono/bootstrap, and slim common by removing axum. Update mono routers, storage init, and workspace deps accordingly.
…main modules Introduce MonoAppServices and TransportContext so mono routers stop calling storage directly, and split MonoApiService into domain modules (user, issue, conversation, code review, gpg, note, reviewer, cl_list, etc.). Move notification dispatch/triggers and webhook admin/delivery into ceres application, relocate pack helpers to infra, and extend CI guards for callisto, jupiter::service, transport/application, and router storage access.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce12185a4f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let tag_info = api | ||
| .create_tag( |
There was a problem hiding this comment.
Validate tag names before dispatching to imported repos
When req.path_context selects an imported repository, this now forwards req.name directly to ImportApiService::create_tag; the router-level validate_tag_name(&req.name)? was removed, and only the monorepo implementation validates internally. That lets imported-repo requests create tags such as bad tag, foo..bar, or .lock names and persist invalid refs/tags/... rows, whereas the same inputs were previously rejected before dispatch.
Useful? React with 👍 / 👎.
| // Preserve HTTP semantics across crates: ApiError can parse [code:404]. | ||
| MegaError::NotFound(msg) => GitError::CustomError(format!("[code:404] {msg}")), | ||
| MegaError::NotFound(msg) => GitError::CustomError(msg), | ||
| MegaError::BadRequest(msg) => GitError::CustomError(msg), |
There was a problem hiding this comment.
Preserve client status when converting MegaError to GitError
When a typed client error crosses an ApiHandler boundary that returns GitError (for example create_tag_impl uses ? on tag-name validation and duplicate-tag errors), this branch strips the 400/409 semantics and leaves only a free-form CustomError string. The later ApiError mapping does not recognize messages like Tag name must not be empty or Tag 'x' already exists, so these user errors become generic 500 responses instead of the documented client errors.
Useful? React with 👍 / 👎.
… HTTP errors Deprecate ceres legacy re-exports (api_service, pack, protocol, build_trigger, code_edit) and switch mono/ceres call sites to application::* and transport::*. Add typed MegaError variants with shared HTTP status mapping in common, simplify mono ApiError, and improve Git SSH protocol error handling. Further thin group/tag/artifacts routers via MonoApiService facades and extend CI guards to block legacy ceres import paths in mono.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c4108a202
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| fn note_stg(&self) -> NoteStorage { | ||
| self.storage.note_storage() | ||
| pub(crate) fn lfs_service(&self) -> jupiter::service::lfs_service::LfsService { |
There was a problem hiding this comment.
Keep jupiter service types out of mono
The new boundary step in .github/workflows/base.yml runs rg -q 'jupiter::service::' mono/src/ and exits 1 on any match; I checked that exact command and it matches this helper. As a result, the clippy job fails before clippy runs on every PR until this type is hidden behind a facade/type alias outside mono/src or the workflow rule is adjusted.
Useful? React with 👍 / 👎.
| validate_webhook_target_url(&payload.target_url) | ||
| .map_err(|e| MegaError::Other(e.to_string()))?; |
There was a problem hiding this comment.
Return bad request for invalid webhook input
For create-webhook requests with an invalid target URL, this now maps validate_webhook_target_url failures to MegaError::Other; ApiError treats Other without a legacy code as a 500 and hides the message. Before the refactor the router used ApiError::bad_request, so invalid URLs (and similarly empty secrets/invalid event types in this method) regress from client-visible 400s to generic 500s.
Useful? React with 👍 / 👎.
| #[cfg(feature = "migrate")] | ||
| apply_migrations(&connection, true).await.unwrap(); |
There was a problem hiding this comment.
Run test migrations for default jupiter tests
Because jupiter now has empty default features, the #[cfg(feature = "migrate")] gate means cargo test --manifest-path jupiter/Cargo.toml builds test_storage without creating any schema, while many jupiter tests call test_storage and immediately access migrated tables. Before the migration extraction this helper always applied migrations, so default local test runs now fail with missing-table database errors unless callers remember --all-features.
Useful? React with 👍 / 👎.
No description provided.