fix:[mono] optimize commit_info related apis#1107
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds optimized commit-info APIs by introducing new “content-hash” and “dir-hash” endpoints, refactors the Ceres API handler to centralize commit-to-tree mapping, updates the HTTP server’s CORS handling, and improves batch inserts with conflict resolution.
- Define
CommonResultVecTreeHashItem, new client types, and two GET endpoints (/tree/content-hash,/tree/dir-hash) in the TypeScript client - Switch server CORS to dynamic origin and tighten headers/methods
- Refactor Ceres
ApiHandlerto use a singleitem_to_commit_mapand newTreeHashItem, remove duplication - Enhance batch-save in Jupiter storage to ignore specific DB errors
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| moon/packages/types/generated.ts | Added types and client methods for content-hash and dir-hash APIs |
| mono/src/server/https_server.rs | Use dynamic CORS origin header and allow all methods |
| mono/src/api/api_router.rs | Updated router to return TreeHashItem instead of commit items |
| jupiter/src/storage/mod.rs | Documented batch-save-with-conflict function for SeaORM |
| config/config.toml | Updated ui_domain default and example comment |
| ceres/src/model/git.rs | Introduced TreeHashItem and renamed commit fields |
| ceres/src/api_service/mono_api_service.rs | Centralized commit mapping into item_to_commit_map |
| ceres/src/api_service/import_api_service.rs | Aligned import service with new mapping logic |
Comments suppressed due to low confidence (5)
mono/src/api/api_router.rs:188
- The handler for
/tree/content-hashis usingCodePreviewQueryinstead of the newly generatedGetApiTreeContentHashParams. Update the signature toQuery<GetApiTreeContentHashParams>to bind the correct parameters.
Query(query): Query<CodePreviewQuery>,
mono/src/api/api_router.rs:213
- Similarly, the handler for
/tree/dir-hashshould useGetApiTreeDirHashParamsinstead ofCodePreviewQueryto match the defined query type.
Query(query): Query<CodePreviewQuery>,
jupiter/src/storage/mod.rs:84
- This comment references
sqlx, but the implementation usessea_orm. Update the comment to accurately reflect SeaORM’s behavior or remove the outdated reference.
// notice that sqlx not support packets larger than 16MB now
config/config.toml:112
- [nitpick] The example domain in this comment (
app.gitmega.com) does not match the updated defaultui_domain(local.gitmega.com). Consider aligning the example with the actual default value.
# Used for redirect to ui after login, for example: http://app.gitmega.com
ceres/src/api_service/import_api_service.rs:133
GitObjectCacheis used here but not imported. Adduse crate::api_service::GitObjectCache;(or the correct module path) to the top of the file.
let mut cache = GitObjectCache::default();
genedna
enabled auto-merge
June 10, 2025 10:17
genedna
approved these changes
Jun 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.