164 155 132 131 bytes
s=>t=>1 to 1<<s.size-1 map(i=>s.indices.map(j=>s(j)+","*(i>>j&1)).mkString.split(','))filter(_.forall(i=>i.toInt<=t&i==i.toInt+""))
Try it online!
Generating all partitions is still the most byte-consuming part, since there is no built-in for that.
The original version took a different approach (164 bytes), which was optimized by @user via three nice tricks (155 bytes), see comments for details and code. Now, I changed the strategy itself, which gives the current solution (132 bytes), and another byte removed thanks to another hint by @user (now: 131 bytes).
The current version uses the 1-bit-index-positions of a counter variable as split-positions.
The original version generated the indices of split-positions directly via combinations of all valid lengths and ranges.
Some details on the "bit-hacking":
The outer loop generates all numbers from
1 up to
2^(numDigits-1), where the upper bound is represented via bit-shifting as
(side note: as a consequence, this solution, based on signed Integer shifts, does only work for input numbers of at most 31 digits, which should be fair enough, but could easily be extended via BigInt to arbitrary input lengths).
In binary representation, the outer loop variable
i goes, for example, from
00011, ... up to
10000 for a 5-digit input such as
j'th bit position (counted from the right, starting at 0) indicates whether we should inject a "comma character" after the
j'th index position of the input string. This is executed by the inner loop:
The inner loop traverses the input string
s char by char at index
j and evaluates the expression
This expression "probes" whether the
j'th bit of
i is set by shifting
j bit-positions to the right and then bit-AND-ing it with 1, which evaluates to 0 or 1, depending on whether the
j'th bit is 1 or 0.
As a consequence, the current char
s(j) is preceeded by either the empty string
","*0 or by a comma
","*1, depending on the
j'th bit of
(side note: bit representation
10000 represents the case of not including any comma, since it is injected after the last position. This case could also be achieved via
00000 instead, but then one would have to use the longer loop expression
0 until 1<<s.size-1 instead).