Repository navigation
fix(gate): check the demo archive's files without building - #165
Merged
Merged
Conversation
make quality now reads the files: of the demo archive in .goreleaser.yaml without building and fails unless every non-Go file of examples/vulnerable-mcp-agent is matched by a src (a * never crossing a /, as goreleaser globs), every src under the demo matches such a file, and call.sh is given 0755 there and is executable in git. A configuration it cannot read in the shape it knows is refused, naming the line. 0.19.0 was lost because a new demo file was missing from that list, and only a release snapshot, which no pull request runs, would have shown it. check-demo-files-probe is the check's negative control: 25 staged cases, each asserting its message. Both targets join quality and the gate test's list. Signed-off-by: Konrad Karauda <konrad@karauda.com>
check-demo-files matched a src with bash's [[ == ]], which reads
brackets, ^-negation, POSIX classes and extended patterns that
goreleaser's glob reads differently or as literal text, so a src such
as scenarios/[^x]*.json passed while goreleaser would pack none of the
scenarios. A src holding any of [ ] ( ) { } | @ + ! ^ \ is now refused
by name, leaving * and ?, which neither side lets cross a /.
A demo archive whose format or format override is binary or none packs
no files:, and is refused too. The probe plants each configuration name
goreleaser reads before .goreleaser.yaml, and lists the root's demo
files before it stops using a commit's file list.
Signed-off-by: Konrad Karauda <konrad@karauda.com>
The demo files check read physical LF lines and part of their content, so a configuration YAML reads differently passed: a CR, NEL, LS or PS line break, a quoted scalar spanning lines, a second document, a decoy archive with id demo, an escaped format, a mode hidden in a quoted owner, a multibyte demo path and a link in the demo. Before any parsing the whole file is now refused, naming the line, for a byte outside printable ASCII and LF (a NUL included), a document marker or directive, a top-level line that is not a lowercase key, and a quote left open on its line or a double-quoted value with an escape. The demo archive is found by its name_template prefix, which check-demo-archive.sh now reads from scripts/lib/demo-archive.sh as well, and must have id demo; only formats: [tar.gz] is accepted, an info is a closed grammar of plain words, a demo path is [A-Za-z0-9._/-] bytes, and a link or a git mode other than 100644 or 100755 in the demo is refused. The check runs with LC_ALL=C. The probe gains 27 cases and runs the check under the caller's locale. Signed-off-by: Konrad Karauda <konrad@karauda.com>
The demo files check opened a quoted value at any quote, so a quote
inside a word could pair with one that YAML reads as opening a value
left open across lines: `{owner: r'o, group: 'root` passed while YAML
read the files: block below into the group.
A quote now opens a value only at the line's indentation, after a flow
indicator or ": ", or after "- ", "? ", an anchor or a tag that itself
stands where a value starts; elsewhere it is plain, as YAML reads it.
An opening quote must still close on its line, a double-quoted value
may hold no escape, and a quote right after a colon is refused. The
probe gains six cases, among them a plain word with an apostrophe that
now passes.
Signed-off-by: Konrad Karauda <konrad@karauda.com>
Reading YAML's quoting rules in bash kept missing a case: a doubled quote inside single quotes, a tag holding a comma and a quote, a quote after a flow key indicator, and a plain value continued on the next line each let a value span lines the check never read. The check no longer models quoting. Every line that is not blank or a full-line comment must be KEY:, KEY: VALUE, - KEY:, - KEY: VALUE or - VALUE with an optional comment, and VALUE one plain scalar without quotes, brackets, braces, # or ": ", one double-quoted scalar with no escape, or a one-line flow sequence of those. No single quote may appear outside a full-line comment, and a flow mapping is read only as a src's info. Under these shapes no value spans lines; every other line is refused by name. The probe gains the four cases and one per refused shape. Signed-off-by: Konrad Karauda <konrad@karauda.com>
A `- VALUE` line indented deeper than its key's line passed the demo files check while YAML read it as the rest of that key's plain value, so `- id: demo` followed by `- tgz` named an archive "demo - tgz". A line deeper than the content column of the line before it, counting two columns for each leading "- ", is now accepted only under a key with no value, which opens a block; anywhere else it is refused as a continuation. A single quote is now read inside a double-quoted value and in a trailing comment, where YAML opens no value, and still refused in a plain value. The line-shape helpers move to scripts/lib so the check stays within its size budget. Signed-off-by: Konrad Karauda <konrad@karauda.com>
Signed-off-by: Konrad Karauda <konrad@karauda.com>
A plain list item's value continues on any line deeper than its dash, not only past its content, and a ' #' inside a double-quoted value is part of the value, not a comment. The probe's configuration edits move to scripts/lib/probe-config.sh to keep the probe within its size budget. Signed-off-by: Konrad Karauda <konrad@karauda.com>
Signed-off-by: Konrad Karauda <konrad@karauda.com>
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
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.
What changed, and why
0.19.0was lost:.goreleaser.yaml's demo archive (id: demo) omitted a demo file, andscripts/check-demo-archive.sh(make check-demo-archive) runs only on a built snapshot, so no pull request ran it. The tag was never published.New
scripts/check-demo-files.sh(make check-demo-files, inmake quality, so on every pull request) reads.goreleaser.yamlwithout building. It fails when a git-listed non-Go file inexamples/vulnerable-mcp-agentmatches nosrcof archiveid: demo, asrcunder that directory matches no such file,call.sh'ssrclacks mode0755, orcall.shis not100755in git's index (or not executable on disk without.git). Globs match one path component at a time.The check reads configuration only as a whitelist of line shapes in printable ASCII and LF:
KEY:,KEY: VALUE,- KEY:,- KEY: VALUE, and- VALUE. Values may be plain, double-quoted without escapes, or one-line flow lists; flow mappings are permitted only as asrc'sinfo:. A line deeper than the previous line's content is allowed only under a key with no value. Anything else is refused, naming the line, so that YAML and the check read the same lines and values. It also refuses a second configuration filegoreleaserwould read first, a second archive prefixed with the demo name,**or{}insrc, and unhandled shapes. Shapes live inscripts/lib/line-shapes.sh.Negative control
scripts/check-demo-files-probe.sh(make check-demo-files-probe, inmake quality) runs 95 cases on staged copies, each asserting its refusal message or pass; config edits live inscripts/lib/probe-config.sh.Known limit: a plain value or list item starting with
:or,passes the check whilegoreleaser's YAML reader refuses the file;goreleaserfails loudly before building and never publishes a short archive.Invariant or record
ADR-0033 is amended ("Amended in 0.20"): pull requests now also read the configuration; the archive check remains the proof. No invariant changes; the gate fails closed on unread shapes ("no false green").
How it was tested
gopkg.in/yaml.v3, asgoreleaserdoes: multi-line quotes, CR and other line breaks, multi-document files, anchors, tags, decoy archives, continuations, and a#in quoted names. Every reproduced case is now a probe case.make check-demo-filespasses on today's configuration,make check-demo-files-probereports 95 cases, andmake check-shell,make check-sizes,scripts/check-brand.sh, andmake docs-checkpass. On Linux (bash 5.2), the check and probe passed on round 6 with and without.git; the last round's changes were not run on Linux.goreleaseritself was not run on refused configurations; CI'smake qualityon this pull request is the gate.Documentation
ADR-0033 amendment (with pointers in Decision and Consequences), a CHANGELOG
Addedentry, and one sentence indocs/status.md's quality-gate details.make docs-impact RANGE=origin/main..HEADnamesdocs/backlog.mdanddocs/status.md; the backlog says nothing about the demo archive, and the status page carries the new sentence.