The bug is that `splitEvenly` rounds each share independently, so the parts no longer sum to the total. The fix is to compute the base share, count the remainder, and distribute the remainder by adding one cent to the first `remainder` parts.

I will also add the missing validation for `splitEvenly` (totalCents and ways must be non-negative integers, ways must be positive).

```ts
/** Cent-exact money helpers for order totals. */

export function splitEvenly(totalCents: number, ways: number): number[] {
  if (!Number.isInteger(totalCents) || totalCents < 0) {
    throw new Error("totalCents must be a non-negative integer");
  }
  if (!Number.isInteger(ways) || ways <= 0) {
    throw new Error("ways must be a positive integer");
  }

  const baseShare = Math.floor(totalCents / ways);
  const remainder = totalCents % ways;

  const parts: number[] = [];
  for (let i = 0; i < ways; i++) {
    parts.push(baseShare + (i < remainder ? 1 : 0));
  }
  return parts;
}

export function applyBps(cents: number, bps: number): number {
  if (!Number.isInteger(cents) || cents < 0) {
    throw new Error("cents must be a non-negative integer");
  }
  if (!Number.isInteger(bps) || bps < 0) {
    throw new Error("bps must be a non-negative integer");
  }
  return Math.floor((cents * bps + 5000) / 10000);
}

export function sumParts(parts: number[]): number {
  let total = 0;
  for (const part of parts) {
    if (!Number.isInteger(part)) {
      throw new Error("parts must be integers");
    }
    total += part;
  }
  return total;
}
```