Repository navigation
fix(sandbox): make the code-source item check advisory - #172
Merged
Merged
Conversation
The token scan behind code_source_errors cannot see every binding form (rename-destructuring, Python with/except as, walrus, *args), so valid scripts were flagged and the dry run returned ok:false, telling the builder the script fails every real run. Drop it from is_failing, hedge the message, and name flagged nodes on a POSSIBLE UNDEFINED line in both the ok and the failing summary.
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(sandbox): make the code-source item check advisory. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete Features
Tests
FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
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.
Summary
v0.8.29 (#166) made
code_source_errorsfail the dry run. That check is a token scan: it decides whetheritemis bound by matching a fixed list of binding forms, and everyitemoutside that list counts as a read. Valid scripts that binditemany other way are flagged, the dry run returnsok: false, and the message tells the builder the script "fails every real run", so the builder rewrites working code. Forms it misreads include JSconst { json: item } = input[0],input.map(({ json: item }) => …), method shorthandpick(item) { … }, and Pythonwith … as item:,except E as item:,item := …,def f(*item):,for (i, item) in ….Deciding whether
itemis bound is scope analysis over two languages, and some cases cannot be decided by a token scan ({ json: item }is a binding inconst { json: item } = xbut a read inreturn { json: item }). So this makes the check advisory instead of adding more heuristics:AuthoringReport::is_failingno longer countscode_source_errors(its one non-test caller is the sandbox dry run).item; "if it does, every real run fails".POSSIBLE UNDEFINED \item`line afterCODE NOT EXECUTED, in both theokand the failing branch, so anok: true` result does not bury the hint in a JSON field. The sentence about it is removed from the failing message.code_source_errorsand the scanner are unchanged. TheCODE NOT EXECUTED … UNVERIFIEDline from fix(code): teach the input contract and flag unexecuted code in dry runs #166 still tells the builder no script ran.API Or Behavior Changes
codenode the scan flags now dry-runsok: true(with the hint and the entry incode_source_errors) instead ofok: false.code_source_errors[].messagewording is hedged. No field or type changes.Tests
Regression tests:
sandbox::tests::a_flagged_item_read_is_a_hint_and_does_not_fail_the_dry_run(new: valid rename-destructuring source must dry-runok: truewith the hint) andauthoring_report::tests::a_code_source_reading_an_undefined_item_is_reported_but_does_not_fail_the_dry_run(renamed, now asserts!is_failing()).CARGO_INCREMENTAL=0 cargo test -p tinyflows --features mock --lib -- a_flagged_item_read_is_a_hint a_code_source_reading_an_undefined_item_is_reportedBefore the fix:
FAILED. 0 passed; 2 failed(sandbox:left: Bool(false) right: true).After the fix:
ok. 4 passed; 0 failed(witha_clean_dry_run_says_its_code_nodes_never_rananda_graph_without_code_nodes_gets_no_code_summary).cargo fmt --check(touched files)N/A:
cargo clippy --all-targets -- -D warnings: left to CIN/A:
cargo clippy --all-targets --all-features -- -D warnings: left to CIN/A:
cargo build --all-targets: left to CIN/A:
cargo build --all-targets --all-features: left to CIN/A:
cargo test: only the targeted tests above ran locally; CI runs the suiteN/A:
cargo test --all-features: left to CIDocumentation
CHANGELOG
[Unreleased]entry added; thecode_sourcemodule doc now says the scan can flag working code and never fails a dry run.Summary by CodeRabbit
itemreferences reported by the source scan no longer cause a dry run to fail.inputinstead.