Skip to content

fix(gate): check the demo archive's files without building - #165

Merged
karauda merged 9 commits into
mainfrom
fix/s29-demo-files-check
Nov 28, 2026
Merged

karauda merged 9 commits into
mainfrom
fix/s29-demo-files-check

Conversation

@karauda

@karauda karauda commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

What changed, and why

0.19.0 was lost: .goreleaser.yaml's demo archive (id: demo) omitted a demo file, and scripts/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, in make quality, so on every pull request) reads .goreleaser.yaml without building. It fails when a git-listed non-Go file in examples/vulnerable-mcp-agent matches no src of archive id: demo, a src under that directory matches no such file, call.sh's src lacks mode 0755, or call.sh is not 100755 in 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 a src's info:. 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 file goreleaser would read first, a second archive prefixed with the demo name, ** or {} in src, and unhandled shapes. Shapes live in scripts/lib/line-shapes.sh.

Negative control scripts/check-demo-files-probe.sh (make check-demo-files-probe, in make quality) runs 95 cases on staged copies, each asserting its refusal message or pass; config edits live in scripts/lib/probe-config.sh.

Known limit: a plain value or list item starting with : or , passes the check while goreleaser's YAML reader refuses the file; goreleaser fails 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

  • Six adversarial review rounds reproduced cases with gopkg.in/yaml.v3, as goreleaser does: 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.
  • Mutants of the check, each killed by the probe: 29 in all, including column rules off or loosened by one column, sequence item columns not stepped back to the dash, and comments cut inside double quotes. The previous check is red on the new probe.
  • On macOS, make check-demo-files passes on today's configuration, make check-demo-files-probe reports 95 cases, and make check-shell, make check-sizes, scripts/check-brand.sh, and make docs-check pass. 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.
  • Not verified: goreleaser itself was not run on refused configurations; CI's make quality on this pull request is the gate.

Documentation

ADR-0033 amendment (with pointers in Decision and Consequences), a CHANGELOG Added entry, and one sentence in docs/status.md's quality-gate details.

make docs-impact RANGE=origin/main..HEAD names docs/backlog.md and docs/status.md; the backlog says nothing about the demo archive, and the status page carries the new sentence.

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>
@karauda
karauda requested a review from a team November 28, 2026 20:57
@karauda
karauda requested a review from a team as a code owner November 28, 2026 20:57
@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
43bc94a 2026-11-28T20:46:00.284Z View logs ↗

@karauda
karauda merged commit 7747b80 into main Nov 28, 2026
12 of 13 checks passed
@karauda
karauda deleted the fix/s29-demo-files-check branch November 28, 2026 21:16
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