-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: migrate playground #1811
feat: migrate playground #1811
Conversation
WalkthroughWalkthroughThe primary change across the codebase involves removing the Changes
Assessment against linked issues
The code changes effectively address the objectives outlined in the linked issue, focusing on migrating away from the GraphiQL interface towards a new playground URL approach. The systematic removal of Recent Review DetailsConfiguration used: CodeRabbit UI Files ignored due to path filters (24)
Files selected for processing (52)
Files skipped from review as they are similar to previous changes (50)
Additional Context UsedGitHub Check Runs (1)
Path-based Instructions (1)
Additional comments not posted (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1811 +/- ##
=======================================
Coverage 86.89% 86.90%
=======================================
Files 156 156
Lines 15836 15840 +4
=======================================
+ Hits 13761 13765 +4
Misses 2075 2075 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
src/http/mod.rs
Outdated
@@ -15,7 +15,7 @@ pub use data_loader::*; | |||
pub use data_loader_request::*; | |||
pub use method::Method; | |||
pub use request_context::RequestContext; | |||
pub use request_handler::{graphiql, handle_request, API_URL_PREFIX}; | |||
pub use request_handler::{handle_request, API_URL_PREFIX}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Several files in the codebase still use the graphiql
function. This contradicts the PR's intention to remove it from the public API. The following files need attention:
src/config/server.rs
src/cli/server/mod.rs
src/cli/server/server_config.rs
src/blueprint/server.rs
Analysis chain
Removal of graphiql
from public API aligns with the migration to an external playground.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Ensure that there are no remaining references to the `graphiql` function in the codebase.
# Search for any references to the `graphiql` function across all `.rs` files.
rg --glob '*.rs' 'graphiql' --files-with-matches
Length of output: 147
src/http/request_handler.rs
Outdated
use async_graphql::ServerError; | ||
use hyper::header::{self, CONTENT_TYPE}; | ||
use hyper::header::{self}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactoring to focus on direct handling of GraphQL requests is well-implemented.
Would you like me to generate unit tests to ensure the new request handling logic works as expected?
4a54047
to
444a01d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Out of diff range and nitpick comments (1)
src/http/request_handler.rs (1)
Line range hint
56-85
: Thegraphql_request
function is robust, handling errors appropriately and using Arc for shared state in asynchronous tasks. The changes align well with the PR's objectives to streamline GraphQL handling.Would you like me to generate unit tests to ensure the new request handling logic works as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Out of diff range and nitpick comments (3)
README.md (2)
Line range hint
100-100
: Consider hyphenating "first time contributor" to "first-time contributor" for grammatical correctness.
Line range hint
114-114
: Add alt text to the image for better accessibility.src/http/request_handler.rs (1)
Line range hint
46-46
: Handling of REST API requests is well-implemented, integrating seamlessly with the application context. Consider adding more detailed logging for better traceability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
579e656
to
2a8b6b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
async fn handle_origin_tailcall<T: DeserializeOwned + GraphQLRequestLike>( | ||
req: Request<Body>, | ||
app_ctx: Arc<AppContext>, | ||
request_counter: &mut RequestCounter, | ||
) -> Result<Response<Body>> { | ||
let method = req.method(); | ||
if method == Method::OPTIONS { | ||
let mut res = Response::new(Body::default()); | ||
res.headers_mut().insert( | ||
header::ACCESS_CONTROL_ALLOW_ORIGIN, | ||
HeaderValue::from_static("https://tailcall.run"), | ||
); | ||
res.headers_mut().insert( | ||
header::ACCESS_CONTROL_ALLOW_METHODS, | ||
HeaderValue::from_static("GET, POST, OPTIONS"), | ||
); | ||
res.headers_mut().insert( | ||
header::ACCESS_CONTROL_ALLOW_HEADERS, | ||
HeaderValue::from_static("*"), | ||
); | ||
Ok(res) | ||
} else { | ||
let mut res = handle_request_inner::<T>(req, app_ctx, request_counter).await?; | ||
res.headers_mut().insert( | ||
header::ACCESS_CONTROL_ALLOW_ORIGIN, | ||
HeaderValue::from_static("https://tailcall.run"), | ||
); | ||
|
||
Ok(res) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the new CORS handling for tailcall.run
is thoroughly tested.
#!/bin/bash
# Description: Verify that the new CORS handling logic in `handle_origin_tailcall` is covered by tests.
# Find test files related to `request_handler.rs` and search for tests covering the new CORS logic.
fd 'request_handler.rs' --exec rg --files-with-matches --type rust $'test.*handle_origin_tailcall'
fixes #1790
Cors enabled for tailcall.run if no cors setting is provided