Skip to content

[ci18-7417] Run the tests that already existed - #13

Closed
pavel-te wants to merge 2 commits into
mainfrom
ci18-7417-self-test
Closed

[ci18-7417] Run the tests that already existed#13
pavel-te wants to merge 2 commits into
mainfrom
ci18-7417-self-test

Conversation

@pavel-te

@pavel-te pavel-te commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Closes ci18-7417. There was no CI in this repository at all — no workflow file, nothing ran the suites on a push or a PR.

That matters more here than in a normal repo: this ships the script customers download by tag, the recipes the product prints on the in-product on-ramp, and the copy ptc-action vendors and republishes as @v1. A broken main becomes a release, and a release becomes what every customer's pipeline fetches.

The suites already existed — 230 assertions, 4 seconds, fully offline (four stub curl, the rest only use --dry-run, which skips preflight). They just never ran on their own.

suites — the same tests, twice

runner bash
macos-latest /bin/bash, still 3.2.57
ubuntu-latest current bash

The macOS leg is not decoration. The CLI targets bash 3.2 deliberately (busybox mktemp, ci18-7277), and current bash quietly accepts syntax 3.2 rejects — a contributor on Linux cannot see that break. Each suite gets its own log group, and one failure does not mask the rest.

checks — the ci18-7398 defect classes, mechanised

Each of these is something that ticket found by hand:

  • --version agrees with the VERSION constant.
  • No config/examples/*.config comes back — those were KEY=VALUE files the parser rejected, and the extension is what suggested the wrong format.
  • Every fenced block in README.md and docs/*.md is what it claims to be: yaml parses, bash survives bash -n. Output samples and fragments belong in text.
  • Only {{lang}} appears — a single-brace one is taken literally and yields a path nobody has.

Verified the guards can fail, not just pass:

  • Ran the block check against the pre-fix README (920f458): it catches both blocks that were tagged bash while showing CLI output.
  • Single-braced a placeholder in react-app.yml: caught.
  • Dropped a deliberately failing suite into tests/: the step went red and reported which one.

links — advisory

Separate job, continue-on-error: true. A dead link is a real defect, but an upstream hiccup must not turn main red. The API base URL answers 404 by design and is allowed for.

Fixes the new checks found immediately

In docs/DEVELOPMENT.md, which nothing had ever validated:

  • git clone <repository-url> is not valid shell — < is a redirect — and the directory it then cds into was never the repository name.
  • Two debugging examples used {lang}.
  • The --timeout illustration is a case fragment, not a script; it is text now.

Also documented the CI and the offline property of the suites there, and added the status badge to the README.

pavel-te and others added 2 commits August 6, 2026 10:19
#12)

Three surfaces claimed things that were not true, and the one command we
recommend first was gated behind a note telling the reader it would not work.

**The QA note was false.** README and the CLI both said detect_config lives on
the QA environment and that --api-url must be pointed there. Checked against
production: POST https://app.ptc.wpml.org/api/v1/detect_config returns 200 with
a real body, anonymously, no token. `ptc init` completes against the default
URL. Removed from the README, from `show_init_help` and from the 404 hint,
which now says what a 404 there actually means. While there: the quick start
passed PTC_API_TOKEN to `init`, which does not need one — detect_config is
anonymous, and the CLI itself logs that.

**A README example failed on copy-paste.** `--file-tag-name=feature-branch`
exits 1 with "Unknown option". The `=` form is implemented for --api-url,
--api-token, --monitor-interval, --monitor-max-attempts and --action only, and
README:85 uses a working --api-url=..., so the rule cannot be inferred. Fixed
the example and wrote the rule down under Main Options. Widening the parser is
the other way to resolve this; it changes CLI behaviour and needs a release, so
it is not in a documentation fix.

**Both CI blocks were stale.** The GitHub one pinned v1.0.0, used
actions/checkout@v4 and peter-evans/create-pull-request@v5, and opened a fresh
PR per run; the GitLab one never downloaded the CLI and triggered on
merge_requests, which is not loop-safe. Both are now what `ptc init` prints,
verified by running it. The version-pinning example moved v1.0.0 -> v1.0.3.

**Dependencies.** The generated GitLab job installed `jq`, which appears
nowhere in this script, and omitted `unzip`, which unpacks every download.
Checked alpine:3.22: unzip is present as a busybox applet and extraction works,
so the recipe was not broken — but it is named now so it survives an image
swap. git stays: the push step needs it, the CLI does not.

**Three of five examples did not parse.** java-app, react-app and
wordpress-wpsite were KEY=VALUE files using {lang}; each died with "Missing
'files:' section", and only {{lang}} is ever substituted. Rewritten as YAML the
parser accepts, renamed .config -> .yml since the extension is what suggested
the wrong format. config.local.yml.example taught api_token:, deprecated and
ignored since v1.0.x — it now shows the env var instead.

**Why nothing caught this:** no test ever fed an example to the parser. Added
tests/test-config-examples.sh, which builds a scratch project from each config
and runs a real --dry-run. Confirmed it fails on the old files before trusting
it: dropping the previous java-app.config back in turns it red on both the
format and the placeholder.

Suite: 230 assertions across 7 files, 0 failures. `bash -n` clean. Every fenced
block in the README parses as what it is labelled (four Troubleshooting blocks
showed CLI output while tagged bash; they are `text` now), and every link
resolves. The wiki half of this ticket is pushed separately as 3d3282d.

Co-authored-by: Pavel Tkachenko <tpepost@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was no CI here at all — no workflow file, nothing ran the suites on a
push. They took four seconds and were fully offline; they simply never ran
unless someone remembered. Meanwhile this repository ships the script customers
download by tag, the recipes the product prints, and the copy ptc-action
vendors and republishes as @v1, so a broken main becomes a release and a
release becomes what every customer's pipeline fetches.

The suites run twice. Once on ubuntu-latest with current bash, and once on
macos-latest against /bin/bash, which is still 3.2.57 — the CLI targets 3.2 on
purpose (busybox mktemp, ci18-7277) and current bash quietly accepts syntax 3.2
rejects, so a contributor on Linux cannot see that break. Each suite runs in
its own log group and a failure in one does not hide the others.

Three repository checks beyond the suites, each one a defect class ci18-7398
found by hand:

- --version must agree with the VERSION constant.
- No config/examples/*.config may come back; those were KEY=VALUE files that
  the parser rejected, and the extension is what suggested the wrong format.
- Every fenced block in README.md and docs/*.md must be what it claims: yaml
  parses, bash survives bash -n. Output samples and code fragments belong in
  text. Verified against the pre-fix README: it catches both blocks that were
  tagged bash while showing CLI output.
- Only {{lang}} may appear; a single-brace {lang} is taken literally and yields
  a path nobody has.

Link checking is a separate advisory job. A dead link is a real defect, but an
upstream hiccup must not turn main red.

Fixing what the new checks found in docs/DEVELOPMENT.md: `git clone
<repository-url>` is not valid shell (< redirects) and the directory it cd'd
into was never the repository name; two debugging examples used {lang}; the
--timeout illustration is a case fragment, not a script, so it is text now.
Also documented the CI and the offline property of the suites there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pavel-te

pavel-te commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded — reopening from a branch with a cleaner history.

@pavel-te pavel-te closed this Aug 6, 2026
@pavel-te
pavel-te deleted the ci18-7417-self-test branch August 6, 2026 07:48
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.

2 participants