Repository navigation
basou: Refuse a board observation value not in its kind's shape, and print an http observation as its whole entry - #380
Merged
Conversation
…ay what each kind gives once in the guide
…e and the http entry the guide prints
…, refuse hidden characters in a string, show what was received escaped, and escape the http entry line
…has, and what a refusal shows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first of the two changes for 0.72.0 of
basou board(experimental). It changes neitherboard_version3 norrecord_version3, nor the JSONbasou board measureandbasou board recordprint.basou board recordrefuses an observation value not in the shape its kind gives it. On a board that declares observations, a value that is not null is held against its kind (observed-shape.ts):npm_version,github_release,github_ci,github_check,page_version: a non-empty string with no white space at either end and no control character or one a terminal hides (a zero-width or direction mark, a line separator, a byte order mark); what the string says is not held to a grammargithub_open_issues,github_open_prs: a whole number from 0 toNumber.MAX_SAFE_INTEGERhttp: an object ofstatus(100 to 599),redirects(0 to 10),final_url(an absolute http or https URL) and exactly the reads the observation declares (wordsas many booleans as its words,counta whole number,capturea string or null, kept as the group holds it), each null when the status is not 2xxmanualvalue, a null value with its error, and the values of a board that declares no observation are not checked; a value that is not a JSON value or nests too deep is refused for that alone, as before; records already written are not checked againA refusal names where in the value, and one of what a key holds shows up to 60 characters of the JSON it received, with what a terminal would act on or hide escaped.
basou board guidemakes anhttpobservation in one block that prints its whole entry ({"value", "observed_at", "source"}, or a null with its error) on one line, read by a script the guide writes once to the working directory, named by the hash of what it holds. The block keeps curl's status line and exit code in files beside the body, so neither the URL curl ended at nor anything else not declared becomes a word of a command. curl exiting other than 0, a status outside 100 to 599 and an empty match of acount_patterneach give a null with the error. The display escapes are shared by the guide and the refusals (shown-text.ts).basou board guidesays what each kind of observation gives once. A board of 39httpobservations, each with two words and acount_pattern: 143,708 bytes before, 70,849 now (in one workspace; the bytes vary with its path).docs/spec/board.md(2.7, 3.1, 3.2) and the CHANGELOG say what changes from 0.72.0.Verification:
pnpm install --frozen-lockfile,pnpm -r build,pnpm typecheck,pnpm lint:lang,pnpm lint:paths,pnpm test(core 2950 passed and 1 skipped, sdk 67, cli 1592) andpnpm test:scripts(21) exit 0 on 1ec1877;pnpm lint,pnpm typecheck,pnpm -r buildand the board tests of core (676) exit 0 on f8ea192 (a formatting commit). The http tests run the guide's blocks with curl against a server on 127.0.0.1 (200 with a 64 KiB body and a BOM, 204, 299, 300, 404, 600, a redirect loop, a closed port, an empty match, a line separator in a capture). A review (one round, review-only) found a regression (a value nested past 100 deep threw instead of being refused) and mutants of the refused ranges that the tests let through; both are fixed, and the mutants were run again: 19 of 20 are caught, and the one left (a capture run on a body the script never reads) changes nothing.