Currently, the endpoint only returns a plain text message depending on the state of the PDS. This is behaviour that is not congruent with most other PDSes, which provide a basic JSON response containing the version number and (on third-party implementation) a prefix for the implementation's name. The result is that tools such as atproto-scraping and PDSwatch are unable to recognize tranquil or the version number. This PR fixes the behaviour (and is also my first PR with Rust so let me know if there are any changes that need to be made).
+14
-3
crates/tranquil-pds/src/api/server/meta.rs
+10
crates/tranquil-pds/src/lib.rs
+1
-10
crates/tranquil-pds/src/main.rs
History
4 rounds
7 comments
1 commit
expand
collapse
expand 2 comments
okay yea that patch looks muuuch better. thanks!
3 commits
expand
collapse
expand 2 comments
This probably needs to be squashed when merging lol
oookay yea i think ... tangled is really hating this for whatever reason. knowing tangled its maybe because your branch is made off of one commit older than the current main branch? maybe rebasing (and maybe squashing) onto current main and resubmitting will fix it?
otherwise i might merge this manually and not through tangled because this ... doesnt look great. knowing that tangled uses the generated patches to do the merge i dont want to try and merge it with tangled when the patches are this messy ...
code itself looks fine when looking directly at the repo tho so! thank you!
2 commits
expand
collapse
expand 2 comments
I couldn't figure out how to make the BUILD_VERSION constant public(crate) without getting an error about it being private so I moved it to the meta file and used it from there. If this isn't the right way to do it please let me know
ah right i forgot. its because the health endpoint handler is defined in the lib crate of that cargo package and the main.rs is the bin crate of that package. so pub(crate) makes it available to the bin crate but not the lib crate. and a plain pub wont work either since bin depends on lib so lib cant depend on bin.
putting BUILD_VERSION in meta.rs isnt a bad solution but i think id prefer it in lib.rs itself (right above the app function). so its at the top level of the lib crate just like it was at the top level of the bin crate. im a bit nitpicky heh 馃槄
1 commit
expand
collapse
expand 1 comment
hmm i think instead of reading CARGO_PKG_VERSION here make the BUILD_VERSION const in tranquil-pds/src/main.rs pub(crate) and then use that for the version here. so we keep one source of truth for the version. otherwise good! thank you!
took a while but it should be ready to merge now!