Skip to content

fix(#351) install via commit(-ish)/hash#352

Merged
MordechaiHadad merged 5 commits into
MordechaiHadad:masterfrom
MrDwarf7:fix/from-commit-hash
Nov 27, 2025
Merged

fix(#351) install via commit(-ish)/hash#352
MordechaiHadad merged 5 commits into
MordechaiHadad:masterfrom
MrDwarf7:fix/from-commit-hash

Conversation

@MrDwarf7

@MrDwarf7 MrDwarf7 commented Nov 15, 2025

Copy link
Copy Markdown
Contributor

Summary

Closes: #351

This pull request includes the following changes:

Details

This pull request addresses a bug identified in #351, where the commitish regex did not enforce the presence of dots between version numbers. The updated regex now requires dots, ensuring that version strings like "1.0.0" are correctly recognized.

This was done by changing the regex pattern from using a (\.)? to (\.)+, ensuring that at least one dot is present between version segments. Reaming repeats of dots are handled by the appended {_,_} number quantifier.

@blob42

blob42 commented Nov 15, 2025

Copy link
Copy Markdown

@MrDwarf7 I did not notice your PR. I also did a fix but simply switches an if statment: parse the commit first then the version. #353

@MrDwarf7

Copy link
Copy Markdown
Contributor Author

This was my initial call too.

I figured to check other sections of the CodeBase as I've been working with it on and off for awhile now & figured I'd triple check the actual RegEx that we're compiling. I would say it's a bug as we're not (originally) enforcing the existence of the full stop during parsing.

Rust aims to move as much of its validation logic, or really any logic that it can, to compile time, over procedural validations and relying on ordering of checks. Procedural validations can be dangerous in that they allow for invalid states to exist (often way too far into the program lifespan).

Rust has ample tools to enforce this via enums & matches-even things like the Ord trait are available if so desired.
I tend to favour the 'write your program in such a way that "invalid states are unpresentable"' approach as you get a logically congruent program that tends to be fairly easy to follow too.

Relying on match check ordering without a way to enforce it at compile time is bugs waiting to happen for sure.

@MrDwarf7 MrDwarf7 force-pushed the fix/from-commit-hash branch from e2866d7 to c0c74dc Compare November 15, 2025 15:57
@MrDwarf7 MrDwarf7 changed the title [FIX] install via commit(-ish)/hash fix(#351) install via commit(-ish)/hash Nov 15, 2025
@MrDwarf7 MrDwarf7 force-pushed the fix/from-commit-hash branch 2 times, most recently from 686e882 to 4306b5e Compare November 15, 2025 16:21
@MordechaiHadad

Copy link
Copy Markdown
Owner

Just so im up to date with the approach used to fix the issue, to clarify the issue, the thing that failed identifying the hash was because the previous regex pattern didn't enforce dots?

@MrDwarf7

Copy link
Copy Markdown
Contributor Author

Correct, I've tested this locally with all commands that make use of the call.

@MordechaiHadad MordechaiHadad left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Good additional rewrite, I wonder why do you prefer () unit type instead of _ placeholder for match exhaustion, and why if let Some(x) {} else {} over match

@MrDwarf7

Copy link
Copy Markdown
Contributor Author

@MordechaiHadad - The unit value ( I presume you're referring to 450-451 in use_handler.rs?) Was a clippy lint, most of these I just went through an applied them after a brief surrounding code review to make sure surrounding code wouldn't require refactoring for it. You can see it in the commit 6dd1b75.

The if let Some(i) = selection in rollback_handler.rs was also a clippy lint, I tend to prefer single instance fall-through's as they require less cognitive overhead (imo). I found this a bit of an odd one too. If you want I can add a #[clippy(allow(...))] to it and simply use a fall-through; it is after all, the last component to that function call.

@MordechaiHadad

MordechaiHadad commented Nov 27, 2025

Copy link
Copy Markdown
Owner

@MordechaiHadad - The unit value ( I presume you're referring to 450-451 in use_handler.rs?) Was a clippy lint, most of these I just went through an applied them after a brief surrounding code review to make sure surrounding code wouldn't require refactoring for it. You can see it in the commit 6dd1b75.

The if let Some(i) = selection in rollback_handler.rs was also a clippy lint, I tend to prefer single instance fall-through's as they require less cognitive overhead (imo). I found this a bit of an odd one too. If you want I can add a #[clippy(allow(...))] to it and simply use a fall-through; it is after all, the last component to that function call.

Oh damn you already changed lmao, I was okay with these changes which is why i approved just wanted to make sure before merging. If clippy says we follow clippy.

@MordechaiHadad MordechaiHadad merged commit 5432794 into MordechaiHadad:master Nov 27, 2025
21 checks passed
@MrDwarf7 MrDwarf7 deleted the fix/from-commit-hash branch November 27, 2025 10:57
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.

Installing from <commit-hash> does not work

3 participants