Repository navigation
fix: six v0.11.12 issues in graphics, search and CI gates - #885
Merged
Merged
Conversation
CommonMark and GitHub open a fenced code block with three or more tildes as well as backticks, but the snippet gate's extraction read backticks alone. A ~~~rust block in SKILL.md or README.md was neither compiled nor refused, so a broken one passed the gate that README and the skill say compiles every Rust block. A fence is now a run of three or more of either character, closed only by a run of the same character at least as long, so a backtick line inside a ~~~text example is content, and the reverse. ~~~rust is compiled and ~~~rust,no_run fails by name, as the backtick forms do. The selftest gains the three cases from the issue, each of which failed before the change; it passes under gawk, mawk and busybox awk. Closes #860 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
check-unsafe-blocks.sh counted `grep -rn 'unsafe {'` lines. An
`unsafe impl Send` added to the crate passed at SECURITY.md's count of
nine, and two blocks on one line counted once, so the gate accepted only
a wrong count. Both shapes survive rustfmt and clippy.
The gate now lexes the sources just far enough to skip comments, string,
raw-string and character literals, and counts every `unsafe` keyword in
what is left: one followed by `{` is a block, anything else (`unsafe
impl`, `fn`, `trait`, `extern`) fails the gate, since SECURITY.md
documents blocks alone. SECURITY.md now says what is counted.
A new selftest, tools/unsafe-gate-selftest/run.sh, runs the gate on
crafted sources: an added unsafe impl, fn or trait fails; two blocks on
one line pass only when both are documented; unsafe in comments and
literals is not counted. Run against the old gate (with its source
directory made a parameter), six of its eight crafted cases fail. It
runs in the gates-listed job and is listed in CONTRIBUTING §1.
Closes #864
Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
check-ci-gates-listed.sh stripped `RUSTDOCFLAGS='-D warnings'` and any `+toolchain` from CONTRIBUTING §1 before comparing, and only looked for CI's gates in §1. So §1 could drop `-D warnings` from both `cargo doc` lines, name `+1.70` (or no toolchain) for the MSRV checks, or keep a gate CI no longer ran, with the gate green; tools/preflight.sh runs §1 verbatim, so a contributor then ran a weaker gate than CI. The YAML reader now records each step's RUSTUP_TOOLCHAIN, RUSTFLAGS and RUSTDOCFLAGS, from the step's env or the job's, and the comparison writes them into the CI command: the msrv job's toolchain is Cargo.toml's rust-version, so its steps read `cargo +1.85 check …`, and the docs job's flags prefix its two `cargo doc` lines. §1 is compared as written. A §1 gate CI does not run now fails too, save `cargo deny check` (run by cargo-deny's action, which must be in ci.yml) and the zizmor line (which must appear in ci.yml as written). tools/preflight.sh skipped only a missing 1.85; it now skips whichever `+toolchain` §1 names, so an MSRV bump does not leave it behind. The gates-listed selftest gains six cases; the four drift cases (RUSTDOCFLAGS dropped, +1.70, no toolchain, a gate dropped from ci.yml) and a step under an unlisted RUSTUP_TOOLCHAIN failed to fail before. Closes #858 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
release.yml read the release notes only in github-release, which needs publish. A release PR that bumped the version without moving [Unreleased] passed CI, and its tag published both crates; then extract-changelog.sh failed, no GitHub Release was made, and the install job, the check of what crates.io serves, never ran. verify-version now runs extract-changelog.sh on the tag, so a missing or empty section fails before ci and publish. No new action is used. The release-notes selftest also extracts the workspace version's section, so the release PR itself goes red: with Cargo.toml at 0.11.12 and no `## [0.11.12]`, it exits 1 (it passed before). Fixture cases cover a missing and an empty section. RELEASING.md's pipeline list says so. Closes #857 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
decode_sixel gave each painted pixel the colour its register held when it was painted, but filled the background with register 0 as the stream left it. xterm stores the register number per pixel (`set_sixel` in graphics_sixel.c) and draws each one from the colour table as it stands (`refresh_graphic` in graphics.c), so a register redefined after painting recolours all of it. Here `#1;2;100;0;0#1!3~#1;2;0;0;100!3~` decoded as three red columns and three blue, where xterm shows six blue, and register 0 could decode red where painted and green where filled. Each pixel now holds its register (an Option<u16>, smaller than the RGBA it replaces, so the bound on a decode's memory is unchanged), and every pixel, painted or filled, is resolved through the registers once the data ends. The issue's integration test and a unit test of the same two sixels failed before and pass now. Recorded under Changed, with a migration sentence, since a test can observe it. Closes #842 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
The regex methods searched each row folded to NFC but used the pattern as written, while contains, find and mask_matching fold the needle too. A pattern holding `e` + U+0301, such as regex::escape of a file name from macOS, never matched the same text on screen: matches was false, find_match None, wait_until_matches timed out, and mask_matches left the text it was given to redact. The rustdoc says the pattern sees the row "as contains sees it". A pattern that is not NFC is now matched as a copy compiled from its NFC form; an ASCII or NFC pattern is used as it is, at no cost. Regex syntax is ASCII, so only literals change. The copy has the default options, since a Regex does not carry its builder's, so the rustdoc and the CHANGELOG say to give flags inline. wait_until_matches goes through Screen::matches and needs no change of its own. The issue's test (tests/search.rs) and a unit test of both forms against both forms failed before and pass now; mask_matches masks the four cells mask_matching does. Closes #847 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
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.
Six issues from the v0.11.12 milestone, one commit each, each with a test or a gate self-test case that fails without the fix.
~~~rustblock, so a broken recipe fenced with tildes passes #860: the snippet gate takes~~~fences as well as backticks, each closed only by its own character.~~~rustis compiled, and~~~rust,no_runis refused by name. Self-test cases cover all three of the issue's cases, plus a tilde block inside a backtick block.unsafe impl, and counts twounsafeblocks on one line as one #864: the unsafe gate strips comments, strings and literals, then counts everyunsafekeyword.unsafe impl,fn,traitorexternfails the gate, since SECURITY.md documents blocks only, and SECURITY.md now says what is counted.tools/unsafe-gate-selftestholds eight crafted cases and runs in thegates-listedjob.-D warningsdropped, a wrong+toolchain, or a gate CI no longer runs #858: gates-listed compares §1 with what CI runs, flags and toolchain included, in both directions.RUSTDOCFLAGSandRUSTFLAGS, and the msrv job's toolchain as Cargo.toml'srust-version.verify-versionrunsextract-changelog.shfor the tag, so a missing or empty CHANGELOG section stops the release beforeciandpublish. The release-notes self-test also extracts the workspace version's section. No action or SHA was added.contains,findandmask_matchingdo #847: a regex pattern is folded to NFC, as a needle is, soregex::escapeof decomposed text matches the screen. ASCII and NFC patterns are used as they are, with no recompile.Not verified locally: a tag run of
release.yml, beyond actionlint and zizmor.Closes #860
Closes #864
Closes #858
Closes #857
Closes #842
Closes #847