Repository navigation
[#209] Documented mock behaviour changes and fixed multi-line handling in command steps. - #210
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
=======================================
Coverage 98.12% 98.12%
=======================================
Files 16 16
Lines 2397 2401 +4
=======================================
+ Hits 2352 2356 +4
Misses 45 45 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #209
Summary
Closes #209, which reported that two mock behaviour changes on
main- literal mock responses and strict mocking by default - reach consumers with noMIGRATION.mdentry, and that the literal-response change left the step runner with no way at all to give a mock a multi-line response. Rather than the issue's preferred fix of restoring escape expansion insidemock_set_outputand friends withprintf '%b', this keeps that API literal, sincedocs/mocking.mdalready documents the literal reading as deliberate and restoring expansion there would reintroduce the mirror-image bug - a Windows path, a regular expression, or a JSON fixture piped in through-would have its backslash sequences silently rewritten, and a side effect, which is Bash code rather than text, would be rewritten too; a direct caller already has the idiomatic fix in ANSI-C quoting,mock_set_output "${mock}" $'AccessDenied\n403'. The actual capability lost was in the step runner, where a step is a single-line DSL parsed withread, so expanding backslash escapes in the step's output field alone restores a multi-line response from a step, while the arguments and the side effect stay literal. Alongside it, a@step whose text contained a real newline - previously truncated at it, silently dropping its status, output and side effect - is now rejected with a message naming the single-line rule, and the library's ownmulti-line argtest, which had fallen into exactly that trap, is corrected to assert the output it always claimed to set. All three behaviour changes are now rows in theBehaviour changestable inMIGRATION.md.Changes
Step runner (
src/steps.bash)@command step whose text contains a real newline instead of silently truncating it at the first newline during parsing, with aflunkmessage naming the single-line rule and the\nescape.printf -v mock_output '%b' "${mock_output}"), so\nin a step's output produces a multi-line mock response again; the command arguments and the side effect are read literally.steps_rundocblock to state the single-line rule and the output escape.Documentation
MIGRATION.md: adds threeBehaviour changesrows - literal mock responses (with the ANSI-C quoting workaround), strict mocking by default (with the diagnostic and both ways forward), and the rejected multi-line step.docs/mocking.md: documents the ANSI-C quoting idiom for a multi-line response and points to the step runner's escape expansion as the equivalent for a step.docs/steps.md: documents that the output field expands backslash escapes and that a step is rejected if it carries a real newline.Tests (
tests/steps.bats)multi-line argtest, which had silently dropped its# 0 # multi-line argtail to the same truncation bug this branch fixes; it now continues the argument line with a trailing\and asserts the output it always claimed to set.Before / After