Skip to content

Conversation

@tbg
Copy link
Member

@tbg tbg commented Nov 14, 2025

This introduces a SignedLoadVector which hides its underlying elements (primarly from the mmaprototype package). Load value arithmetic that could become negative now needs to go through helpers that make it difficult to "forget" that negative values can occur.

This isn't 100% yet, but it's a start.

Informs #157757.

Epic: CRDB-55052

@tbg tbg added the do-not-merge bors won't merge a PR with this label. label Nov 14, 2025
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg force-pushed the mma-check-neg-load branch from 1eed891 to 15018e1 Compare November 14, 2025 12:13
tbg added 6 commits November 14, 2025 13:29
I want to avoid footguns related to negative load values. Having a package for
the load primitives allows hiding the naked slice, so that use from the
mmaprototype package can be enforced to be automatically correct.

This first commit creates the package and moves the LoadValue LoadVector types.
It also creates a SignledLoad{Value,Vector} type that will be adopted as
representation for the adjusted load (which can become negative).

This commit doesn't yet have great comments on the new types and methods.
They're added in a follow-up commit in the same PR - please take a look
at the entire diff first if definitions here are unclear. Sorry about
that - I wasn't able to easily reorder the commits after the fact.

Epic: CRDB-55052
This required an update to and thus review of all arithmetic involving this type
(which was part of the point of doing this).

A few TODOs were added, and I took the opportunity to refactor the max pending
frac computation, which is now much simpler. I'm tracking writing the unit test
in cockroachdb#157757.

No AI in this workstream so far.

Epic: CRDB-55052.
@tbg tbg force-pushed the mma-check-neg-load branch from 15018e1 to 19fc940 Compare November 14, 2025 12:39
@tbg
Copy link
Member Author

tbg commented Nov 14, 2025

Need to take a step back here. As of this PR, LoadValue allows arithmetic. We should allow arithmetic with the signed values, but prevent it with the ones that we use to make decisions. A bit unclear if there's a big win here.

@github-actions
Copy link

Potential Bug(s) Detected

The three-stage Claude Code analysis has identified potential bug(s) in this PR that may warrant investigation.

Next Steps:
Please review the detailed findings in the workflow run.

Note: When viewing the workflow output, scroll to the bottom to find the Final Analysis Summary.

After you review the findings, please tag the issue as follows:

  • If the detected issue is real or was helpful in any way, please tag the issue with O-AI-Review-Real-Issue-Found
  • If the detected issue was not helpful in any way, please tag the issue with O-AI-Review-Not-Helpful

@github-actions github-actions bot added the o-AI-Review-Potential-Issue-Detected AI reviewer found potential issue. Never assign manually—auto-applied by GH action only. label Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge bors won't merge a PR with this label. o-AI-Review-Potential-Issue-Detected AI reviewer found potential issue. Never assign manually—auto-applied by GH action only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants