Skip to content

feat!: explicit binary directory for postgres#22

Merged
johnchildren merged 1 commit into
Quantinuum:masterfrom
MercuryTechnologies:jade/push-wkzwklynsnuy
Jun 24, 2026
Merged

feat!: explicit binary directory for postgres#22
johnchildren merged 1 commit into
Quantinuum:masterfrom
MercuryTechnologies:jade/push-wkzwklynsnuy

Conversation

@lf-

@lf- lf- commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Motivation: we're integrating tmp-postgrust into our Buck2 builds of https://github.com/mercurytechnologies/locally-euclidean, which, in the Bazel tradition, looks dimly on resolution of executables from PATH (in fact, there's not any easy way to put something extra into the PATH of a target, and this friction is intentional).

This PR adds a field to TmpPostgrustFactoryConfig to explicitly give the postgres bin directory.

This is a breaking change, the resolution for existing users is to
change their initialization to create with Default::default(), then
modify the fields they care about. Perhaps we should have a builder?
idk.

However, this will be the last time that API breaks in the future, since we
add a #[non_exhaustive] to forbid consumers from writing code that
breaks when we add fields.

This also fixes a bug where createdb and createuser only considered PATH and not the fallback directories.

Disclosure: the code here was written with Claude, but I've reviewed it fairly carefully and added some extra clarification at some points that benefit from it. The commit message is handwritten because I have standards. The approach here is exactly what I would write by hand.

@lf- lf- force-pushed the jade/push-wkzwklynsnuy branch from 9893b8a to b77fca9 Compare June 22, 2026 18:26
Motivation: we're integrating tmp-postgrust into our Buck2 builds of
https://github.com/mercurytechnologies/locally-euclidean, which, in the
Bazel tradition, looks dimly on resolution of executables from PATH (in
fact, there's not any easy way to put something *extra* into the PATH of
a target, and this friction is intentional).

This PR adds a field to TmpPostgrustFactoryConfig to explicitly give the
postgres bin directory.

This is a breaking change, the resolution for existing users is to
change their initialization to create with `Default::default()`, then
modify the fields they care about. Perhaps we should have a builder?
idk.

However, this will be the last time that API breaks in the future, since we
add a `#[non_exhaustive]` to forbid consumers from writing code that
breaks when we add fields.

This also fixes a bug where `createdb` and `createuser` only considered
PATH and not the fallback directories.

Disclosure: the code here was written with Claude, but I've reviewed it
fairly carefully and added some extra clarification at some points that
benefit from it. The commit message is handwritten because I have
standards. The approach here is exactly what I would write by hand.
@lf- lf- force-pushed the jade/push-wkzwklynsnuy branch from b77fca9 to ba07fab Compare June 22, 2026 18:44
@lf-

lf- commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Okay, now that I've tested it with my downstream project, I feel confident to send this for review :) Let me know if we should add a builder or something.

@lf- lf- marked this pull request as ready for review June 22, 2026 19:24

@johnchildren johnchildren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for the contribution, looks good :shipit: !

Comment thread src/lib.rs
>,
{
let process = self.start_postgresql(&self.cache_dir)?;
let process = self.start_postgresql_async(&self.cache_dir).await?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah interesting catch, I guess I missed this before

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

claude review stays winning on that one, it got caught while checking my work on the rest of it :)

@johnchildren

Copy link
Copy Markdown
Collaborator

Re: breaking the API for the config, I think it's fine with a version bump, I only introduced the config option in the last release and there was only one option before. I agree that a builder API would be better longer term so I can just make an issue for that to be done later.

@johnchildren johnchildren merged commit 8c700d0 into Quantinuum:master Jun 24, 2026
1 check passed
@johnchildren

Copy link
Copy Markdown
Collaborator

#23 issue for using the builder pattern

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.

2 participants