Skip to content

Make checkSamples fail loudly on embed-code errors#84

Open
alexander-yevsyukov wants to merge 2 commits into
masterfrom
claude/nifty-northcutt-1537c8
Open

Make checkSamples fail loudly on embed-code errors#84
alexander-yevsyukov wants to merge 2 commits into
masterfrom
claude/nifty-northcutt-1537c8

Conversation

@alexander-yevsyukov

@alexander-yevsyukov alexander-yevsyukov commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

./gradlew checkSamples — and CI's Check Code Embedding workflow — was passing while verifying nothing: on argument errors the embed-code binary prints an error but exits 0, and docs/_script/check-samples trusted that exit code. This PR makes the check fail loudly so those errors can no longer pass silently.

What this changes

  • docs/_script/check-samples — a fail-closed guard. The check now passes only when the binary exits 0 and prints its success sentinel (documentation files are up-to-date with code files). A zero exit without that sentinel (an argument error), or any non-zero exit (stale embedding, missing code file), now fails with an actionable message.

Fail-closed was chosen over blocklisting ERROR output because the binary's exit-code discipline is inconsistent — argument errors exit 0, while stale embeddings and missing files panic with exit 1. Asserting the positive success signal catches every silent-exit-0 mode.

The docs/_settings/v1.embed-code.yml config is intentionally left pointing at ../content/docs/1 per the project's documentation versioning, so the net diff of this PR is check-samples only.

⚠️ Expected consequence: this check now fails until /1 is restored

Commit b184e4d ("Move the main documentation version to the root") moved all v1 content from docs/content/docs/1/ to docs/content/docs/ without updating this config, and docs/data/versions.yml reflects that layout (v1 → content_path: docs). There is currently no docs/content/docs/1/ directory, so with the guard in place checkSamples now correctly reports:

ERROR - User arguments are not valid: the given path ../content/docs/1 does not exist
ERROR: embed-code check did not confirm success (exit status 0).

This is the guard doing its job — surfacing a real, previously-hidden breakage rather than passing over it. Restoring the /1 directory (or otherwise reconciling the path) is handled separately. Until then this job is red by design.

Behavior matrix (via ./gradlew :checkSamples, what CI runs)

Scenario checkSamples result
Valid config + up-to-date embeddings exit 0 — BUILD SUCCESSFUL
Stale embedding exit 1 — BUILD FAILED
Invalid docs-path (current repo state) exit 1 — BUILD FAILED (was exit 0 before)

The success sentinel is present in all three committed binaries (embed-code-ubuntu, embed-code-macos, embed-code-macos-x86_64), so the guard holds on the Ubuntu binary CI uses.

Notes for reviewers

  • The root cause (exit 0 on argument errors) is upstream in SpineEventEngine/embed-code-go; this guard protects the repo regardless.
  • A pre-existing, unrelated line-ending change to gradlew.bat (dirty before this work) was deliberately left out of this PR.

🤖 Generated with Claude Code

`./gradlew checkSamples` was exiting 0 while verifying nothing, so CI's
"Check Code Embedding" workflow stayed green regardless of embedding drift.
Two compounding bugs:

1. Stale config: `docs/_settings/v1.embed-code.yml` set `docs-path` to
   `../content/docs/1`, a directory removed in the site restructure. The
   embed-code binary rejected it with an argument-validation error.

2. Swallowed failure: on argument-validation errors the embed-code binary
   prints an ERROR line but still exits 0, so `set -e` in
   `docs/_script/check-samples` had no non-zero status to trip on.

Changes:
- Repoint `docs-path` to `../content/docs` (top-level key and embed-mappings).
- Harden `check-samples` to fail closed: the check now passes only when the
  binary exits 0 AND prints its success sentinel ("documentation files are
  up-to-date with code files"). An argument error (exit 0), a stale embedding,
  or any other silent-exit-0 failure is now reported and fails the build.

Verified via `./gradlew :checkSamples` (what CI runs): passes on a clean tree,
and now fails with exit 1 both on a deliberately stale embedding and on a bad
`docs-path`. The embeddings themselves were already up to date, so no
regeneration was needed.

The root cause (exit 0 on argument errors) lives upstream in
SpineEventEngine/embed-code-go; the guard protects this repo regardless.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@alexander-yevsyukov alexander-yevsyukov self-assigned this Jul 24, 2026
@alexander-yevsyukov alexander-yevsyukov moved this to 🏗 In progress in v2.0 Jul 24, 2026
Reverts the docs-path change from the prior commit on this branch. Per the
project's documentation versioning, the v1 embed-code config stays pointed at
the `/1` subfolder, so the net change of this branch is just the fail-loud
guard in check-samples.

Because commit b184e4d ("Move the main documentation version to the root")
moved v1 content to the root and no docs/content/docs/1 directory exists yet,
checkSamples now fails loudly via that guard, reporting the missing path.
Restoring `/1` is handled separately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@alexander-yevsyukov alexander-yevsyukov changed the title Fix silently-passing checkSamples code-embedding check Make checkSamples fail loudly on embed-code errors Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

1 participant