Repository navigation
basou: Observe the response to an HTTP GET on a board, and move boards and records to version 3 - #361
Merged
Merged
Conversation
…s and records to version 3
- board.yaml: board_version 3 adds the observation kind http: an https://
URL (held to the shape of a page_version's), and optionally words, a
count_pattern (flags gu, matched against the whole body; one that matches
the empty string is refused) and a capture_pattern (flag u, with at least
one capturing group). GET only. A word or a pattern that is empty, holds
a control character or a quote, or starts with '-' is refused, as is a
word given twice.
- A board of version 1 or 2 that uses what a later version reads is told
so on a line of its own for a kind or a value as for a key: each problem
is put down to the first version that reads that part as written, and a
key, when none does, to the first version that takes it.
- board guide: a curl without -f that prints the status, the redirects and
the URL it ended at, and a node line that reads the body whole as UTF-8
(without a leading BOM), is given the patterns and words after --, and
stops at an empty match. The value is { status, redirects, final_url }
with words, count and capture as declared, null when the status is not
2xx.
- board init prints board_version 3, and its comment names http.
- Records are written as record_version 3, whatever the version of the
board; versions 1 and 2 are still read and drawn.
…lls off 2xx, a kind under an older key, and the guide's code spans - board record: the keys of an http observation's value (status, redirects, final_url, words, count, capture) are words of the input's shape, so the check for other workspaces' names no longer refuses a value written as the guide says when a registered workspace is named like one of them. What they hold is still looked at. - board guide: off 2xx, say "words": null and not a list of nulls, naming only what the board declares; capture is null also when its first group takes no part in the match; words and patterns are written as Markdown code that shows backquotes and spaces as they are. - A board of version 1 whose observe holds an http observation with a problem inside it is told version 3, not 2: a key is put down to a later version when what is wrong inside it is what that version reads. - Only an empty word or pattern is empty: one of spaces is taken. - The record version's comment says a record of version 3 may hold a declaration of version 3. - Tests for the u flag in the guide's line, case, a word at the body's start, a BOM inside the body, an http key that is not an id, a word given twice outside http, a file with no version, empty matches only under u or only in the empty text, and the guide's text with nothing observed.
This was referenced Oct 18, 2026
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.
This is the first of the changes that move
basou board(experimental) to a new shape of its declaration and its records. They land on the integration branchboard/shape-v3, not onmain, and go tomainand out in one release once all of them are in, so the shape changes once.What changes
board_version: 3andrecord_version: 3.basou board initprints version 3. Boards of version 1 and 2 are read as before; every record is now written as version 3, whatever the version of its board; records of version 1 and 2 are still read, compared with and drawn.The observation kind
http(fromboard_version: 3): anhttps://URL, held to the shape of apage_version's, and optionally:words: whether the body holds each word, as written (no HTML entity decoded);count_pattern: how many times it matches the whole body (flagsgu; one that matches the empty string is refused);capture_pattern: what its first group holds in the first match (flagu; it needs a capturing group).GET only, with no method to declare. A word or a pattern that is empty, holds a control character or a
', or starts with-is refused, as is a word given twice.basou board guidegives the commands for it; basou still sends nothing:curl -sS -L --max-redirs 10 --max-time 20 -o "$W/http-<key>.body" -w '%{http_code} %{num_redirects} %{url_effective}\n' '<url>', without-f, so a 404 prints404 0 <url>and exits 0 (more than 10 redirects exits 47);node -eline that reads the body whole withreadFileSync(0, "utf8")(so a character is never cut where a 64 KiB chunk ends), takes off a leading BOM, is given the patterns and the words after--(so a word is never read as an option of node's), and stops at an empty match rather than count positions.The value is
{ status, redirects, final_url }, withwords(true or false in the order declared),countandcaptureas declared. A 4xx or 5xx is a value, not an observation not made; when the status is not 2xx, what the body would give is null ("words": null, not a list of nulls).basou board recordtakes the keys of anhttpvalue (status,redirects,final_url,words,count,capture) as words of the input's shape: its check for the names of other registered workspaces no longer refuses a value written as the guide says when a workspace is named like one of them, and still looks at what they hold.A board of version 1 or 2 that uses what a later version reads is told so on a line of its own, for a kind or a value as for a key (
observe[0].kind: 'http' is read from board_version 3 on; this file is board_version 2). Until now only a key was. Each problem is put down to the first version that reads that part of the file as written. A key no version reads so is put down to the first version that takes the key, or to a later one when what is wrong inside it is what that version reads (anhttpobservation under theobserveof a version 1 board is told version 3, not 2). Problems no version would take are reported as before.Tests
httptakes and refuses (words, both patterns, the URL, a method or any other key), and which version a problem of a version 1 or 2 board is put down to.nodeline over bodies (the words in order, the count, the capture, a BOM, a word starting one byte before 64 KiB, an empty match), and thecurlline against a local server (a redirect, a 404 with exit 0, exit 47 past 10 redirects).httpobservation as declared and its value as given; the page draws one;board recordtakes a value whose keys are named like a registered workspace.pnpm -r build,pnpm typecheck,pnpm -r test:coverage,pnpm test:scripts,pnpm lint,pnpm lint:langandpnpm lint:pathspass locally.