Skip to content
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(cdp): spike out new REST API in property-defs-rs #29096

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

eli-r-ph
Copy link
Contributor

@eli-r-ph eli-r-ph commented Feb 22, 2025

Problem

CDP team aims to replace the property definitions API in the Django monolith with a new API implemented in the new property-defs-rs service.

Changes

The PR scaffolds out the basic API, including new axum GET route, request parameter extraction, and a pair of queries that for the core of the project-scoped property definitions APIs in the Django service.

There's lots more to do here, but I want to land this first iteration before it gets too large. TODOs include:

  • Finish populating response object from query results in more axum/serde_json friendly way
  • Sanity check API behavior and query generation in local dev env
  • Implement the rest of the prop def APIs and point-update CRUD handlers
  • Write lots of unit tests

How did you test this code?

Locally, so far (see above)

@eli-r-ph eli-r-ph self-assigned this Feb 22, 2025
@eli-r-ph eli-r-ph changed the title Spike out new REST API in property-defs-rs feat(cdp): spike out new REST API in property-defs-rs Feb 22, 2025
@eli-r-ph eli-r-ph force-pushed the eli.r/prop-defs-rs-1 branch 3 times, most recently from 12347d0 to eab1854 Compare February 23, 2025 21:59
@eli-r-ph eli-r-ph marked this pull request as ready for review February 24, 2025 02:42
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces a new REST API in the property-defs-rs service to replace Django's property definitions API, implementing query building, routing, and constants management.

  • Critical bug in routing.rs: gen_url function hardcodes "new_value" instead of using actual new_offset value for pagination
  • Missing error handling in routing.rs: URI unwrapping can panic when scheme/authority are missing
  • Incorrect type in routing.rs: is_seen_on_filtered_events defined as String but used as boolean
  • Syntax error in Cargo.toml: url.workspace = true should be url = { workspace = true }
  • Empty results array in routing.rs: Query results not being populated into PropDefResponse

8 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile

@eli-r-ph eli-r-ph force-pushed the eli.r/prop-defs-rs-1 branch 2 times, most recently from 4d3ab9f to 67b3207 Compare February 25, 2025 00:41
@eli-r-ph eli-r-ph requested a review from oliverb123 February 25, 2025 01:19
@eli-r-ph
Copy link
Contributor Author

👋 added you as a reviewer @oliverb123 🙇 my goal is to (among other things) do a quick walkthrough of this iteration of the new API tomorrow at our huddle, get anything that concerns you straightened out, then hopefully land it and iterate in follow-on PRs from there.

At this point the API/query plumbing should be a no-op, so I assume this plan is safe 🤞 ...but I'm just getting back into Rust now, so feel free to push back on this idea if you see something ghastly!

@eli-r-ph eli-r-ph force-pushed the eli.r/prop-defs-rs-1 branch from 16fd8f4 to 464892b Compare February 25, 2025 17:31
@eli-r-ph
Copy link
Contributor Author

👋 @oliverb123 FYI for your review pass on this:

  • I updated the PR to reflect all but one of the changes we discussed
  • Some of them I just made the initial change and will iterate further after this is landed
  • In one case (moving to pass QueryBuilders around by mutable ref) I hit the same trouble as last time around, so I didn't push that change...
    • Here's a gist of what I sketched out on the branch
    • With that patch, I got the same error[E0499]: cannot borrow '*qb' as mutable more than once at a time due to the 'a lifetime, which I've sidestepped so far by passing ownership of the qb in and out of each helper function instead 🤷

☝️ I'm fine iterating on that later as it isn't blocking anything, but I'm sure I'm missing something conceptual (and perhaps simple?) about the lifetimes of the builder vs. parameters I'm binding to it right now

Thanks again!

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