Skip to content

Conversation

@Taffer
Copy link
Member

@Taffer Taffer commented Oct 15, 2025

The epoch_sec() function will now ignore anything after the number in an epoch line.

Addresses #24. 🤞

@Taffer Taffer requested a review from AmberArcadia October 15, 2025 19:56
Copy link
Member

@AmberArcadia AmberArcadia left a comment

Choose a reason for hiding this comment

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

Hey, this looks great, thanks for the fix!

I (well, Claude) noticed another issue that I was hoping you could fix too.

  # testing with an epoch value greater than 9 to verify all digits are captured correctly:
  echo "  epoch: 123" | sed -r 's/^[[:space:]]+epoch:[[:space:]]+([0-9])+.*$/\1/'  # Returns: 3 ❌
  echo "  epoch: 123" | sed -r 's/^[[:space:]]+epoch:[[:space:]]+([0-9]+).*$/\1/'  # Returns: 123 ✅

Otherwise though, with both fixes, I think this'll be in really good shape.

echo "  epoch: 123 # cve comment" | sed -r 's/^[[:space:]]+epoch:[[:space:]]+([0-9]+).*$/\1/'
123

@Taffer
Copy link
Member Author

Taffer commented Oct 16, 2025

Oh, yeah, that's actually correct (I don't trust the LLMs at all), I didn't have any with an epoch > 9 in my set of changes!

"Reasons why I like unit tests" 😁

Copy link
Member

@AmberArcadia AmberArcadia left a comment

Choose a reason for hiding this comment

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

Yeah I definitely had to made sure it was being honest haha, but it seemed to check out so I figured I'd mention it too. I haven't run into it failing on >9 yet either but I know some packages are like that. I'd love to have a test suite for the pre-commit scripts at some point, but for now, I think we're in pretty good shape.

@AmberArcadia AmberArcadia merged commit e4d1134 into chainguard-dev:main Oct 16, 2025
4 checks passed
@Taffer
Copy link
Member Author

Taffer commented Oct 16, 2025

For yucks I ran a grep for two-digit epochs, there are 5 in mono, 163 in enterprise-packages, 34 in extra-packages, and 153 in Wolfi. 😨

@Taffer Taffer deleted the fix-epoch-checker branch October 16, 2025 17:03
stevebeattie added a commit to stevebeattie/os that referenced this pull request Nov 7, 2025
Get latest chaingguard pre-commit hook to pick up the fix to ignore
trailing comments after epoch numbers when checking for epoch bumps.

Ref: chainguard-dev/pre-commit-hooks#25
Signed-off-by: Steve Beattie <steve.beattie@chainguard.dev>
stevebeattie added a commit to wolfi-dev/os that referenced this pull request Nov 8, 2025
Get latest chaingguard pre-commit hook to pick up the fix to ignore
trailing comments after epoch numbers when checking for epoch bumps.

Ref: chainguard-dev/pre-commit-hooks#25

Signed-off-by: Steve Beattie <steve.beattie@chainguard.dev>
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