Skip to content

scripts: compile_probes.py, a driver that translates and compiles a directory of Pine sources - #300

Closed
luisleo526 wants to merge 3 commits into
ci/translate-implies-compile-r2from
ci/cr655-compile-probes
Closed

luisleo526 wants to merge 3 commits into
ci/translate-implies-compile-r2from
ci/cr655-compile-probes

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

The campaign's probe population is held outside this repository and nothing compiled it. This driver takes a directory of .pine sources and a paired engine tree, translates each source with the codegen under test, compiles the emitted C++ syntax-only through the same tests/_compile.py helper and flags the PR sweep uses, and writes one report.

  • Verdicts per source: translated_compiled, front_end_refusal (diagnostic code only), compile_failed (closed diagnostic prefix and a hash of the generated C++), internal_error.
  • Exit 0 only when every source is translated_compiled; 1 when any source fails; 2 when the driver or its environment fails.
  • The report and the logs carry ids, hashes, diagnostic codes and counts only, never source or generated C++ text. Generated C++ lives only in a temporary directory the driver removes. stderr is one fixed-phrase line on a refusal or an internal error, never an exception message or a path taken from a source.
  • It refuses an empty selection, a symlink in the tree, an output path inside the sources tree and a missing compiler or engine header, rather than skipping.
  • tests/test_compile_probes.py runs the real CLI on public fixtures, a rejection-baseline entry, the registered compile-failure control, a private-marker row, the refusals and a crash row. Nothing is mocked.

Wiring the driver to a private probe population and to a required status is a later change and is not part of this commit.

Stacked on #282; merges after it.

🤖 Generated with Claude Code

luisleo526 and others added 3 commits November 2, 2026 07:34
…irectory of Pine sources

The campaign's probe population is held outside this repository and nothing compiled it. This driver takes a directory of .pine sources and a paired engine tree, translates each source with the codegen under test, compiles the emitted C++ syntax-only through the same tests/_compile.py helper and flags the PR sweep uses, and writes one report.

- Verdicts per source: translated_compiled, front_end_refusal (diagnostic code only), compile_failed (closed diagnostic prefix and a hash of the generated C++), internal_error.
- Exit 0 only when every source is translated_compiled; 1 when any source fails; 2 when the driver or its environment fails.
- The report and the logs carry ids, hashes, diagnostic codes and counts only, never source or generated C++ text. Generated C++ lives only in a temporary directory the driver removes. stderr is one fixed-phrase line on a refusal or an internal error, never an exception message or a path taken from a source.
- It refuses an empty selection, a symlink in the tree, an output path inside the sources tree and a missing compiler or engine header, rather than skipping.
- tests/test_compile_probes.py runs the real CLI on public fixtures, a rejection-baseline entry, the registered compile-failure control, a private-marker row, the refusals and a crash row. Nothing is mocked.

Wiring the driver to a private probe population and to a required status is a later change and is not part of this commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ment both halves of the gate

The probe driver reports the first line of a g++ diagnostic for a source that translates but does not compile, and that line must never carry source-derived text. The earlier private-marker row used a Pine comment, which never reaches the generated C++, so the redaction of compiler output had no test that could fail.

- tests/test_compile_probes.py: the driver's `_compiler_first_line` is imported from its file and fed synthetic compiler output with a unique marker in every position it could appear: unquoted after every prefix of COMPILER_PREFIXES (the tuple is iterated, so a new prefix is covered), inside single, double, backtick, GCC backtick-and-quote and curly quotes, in an #error line, in the file path, in the line and column fields, in a source-excerpt line and in notes before and after the error, for both `error` and `fatal error`. Every case checks that the marker is in the input, absent from the result, that the result is one line of at most 300 characters and that it equals the severity plus the input's own closed prefix, so a function that returns a constant fails; the prefix loop also requires at least three distinct results.
- The registered compile-failure row now copies the failing source and puts the marker where it reaches the generated C++ (an alert string literal), and checks the marker is absent from the report, stdout and stderr; the branch for an empty registry is unchanged. The front-end refusal row puts the marker in the rejected call itself instead of a trailing comment. A row asserts the driver passes the shared strategy flags object of tests/_compile.py.
- scripts/compile_probes.py: docstring only, stating that the tool is a CLI and not re-entrant.
- docs/ci-compile.md: a short subsection on the two halves of the gate. Compile (what this driver does) and value: every key that newly compiles against main must also match the platform's own tape for that key, because a compile-only proof cannot tell a correct value from a silent wrong one. The driver implements the compile half only. The docs also say that the report is written once the arguments are accepted, and that a private run must use opaque ids.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the emitter does write into the C++

The registered-failure row planted its marker in the strategy title and in a top-level alert literal, and neither is written into the generated C++, so the guard assertion that the marker is in the transpiled output failed on the CLOUD run. The marker now prefixes the existing strategy.entry ID string of the copied fixture. The emitter writes that literal as a std::string next to the failing comment expression, so g++'s quoted source excerpt for the registered failure can carry it. The drawing operations and the na(txt) expression that cause the failure are untouched, and the guard assertion is kept.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@luisleo526

Copy link
Copy Markdown
Contributor Author

Closing for now: this compile-probe driver is tooling that no release path uses yet. The branch is kept; it can be reopened when a workflow adopts it.

@luisleo526 luisleo526 closed this Nov 5, 2026
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