Skip to content

basou: Refuse a board observation value not in its kind's shape, and print an http observation as its whole entry - #380

Merged
takashi-matsuyama merged 8 commits into
mainfrom
board/value-checks
Oct 20, 2026
Merged

takashi-matsuyama merged 8 commits into
mainfrom
board/value-checks

Conversation

@takashi-matsuyama

Copy link
Copy Markdown
Member

The first of the two changes for 0.72.0 of basou board (experimental). It changes neither board_version 3 nor record_version 3, nor the JSON basou board measure and basou board record print.

basou board record refuses 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 grammar
  • github_open_issues, github_open_prs: a whole number from 0 to Number.MAX_SAFE_INTEGER
  • http: an object of status (100 to 599), redirects (0 to 10), final_url (an absolute http or https URL) and exactly the reads the observation declares (words as many booleans as its words, count a whole number, capture a string or null, kept as the group holds it), each null when the status is not 2xx
  • a manual value, 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 again

A 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 guide makes an http observation 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 a count_pattern each give a null with the error. The display escapes are shared by the guide and the refusals (shown-text.ts).

basou board guide says what each kind of observation gives once. A board of 39 http observations, each with two words and a count_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) and pnpm test:scripts (21) exit 0 on 1ec1877; pnpm lint, pnpm typecheck, pnpm -r build and 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant