Feat/coverage test - #5
Merged
Merged
Conversation
The deploy-ABI example carries its own integration tests (state-tree height read from the contract ABI). Wire them into the ci target next to the existing dargo artifact_name_tests block.
- Add llvm-cov coverage targets (baseline + CI gate) and workflow config - Mark test_doc/psy_unit_test as slow, gated behind make test-slow - Fix assertion expectations (state_tree_height, error identifiers) - Fail constant-false assert/assert_eq eagerly at interpret time so #[should_panic] tests see Err, but only when the current branch is statically live — assertions inside a ConstantFalse arm of an if/else remain gated symbolic assertions instead of compile-time failures - Harden wasm error-offset extraction: strip ANSI CSI sequences before parsing, scan all "[ path:line:col ]" markers with Windows-path normalization and a single-source display-path fallback - Pass --nocapture to the test binaries in make test / test-slow
- psy-interpreter: add exec_edge/sema_edge/interp_exec/intrinsic_exec/ std_override/visualizer/generic_instantiation suites covering operator dispatch, symbolic index paths, size-position binding, trait-cast type positions, and the vfs/LSP entry points - psy-sema: unit tests for infer scope lifecycle, value accessors and decode/encode, symbol tables, definitions, expr/stmt visitors, types, references, and visualizer debug renderers - cli/abi/wasm: test modules for commands, ABI extraction (restructured extractor), and wasm bindings - gate: make coverage-ci now measures 94.57% lines (26747/28283)
Add dedicated edge-case suites for the remaining low-coverage modules: - psy-ast: new api_edge_tests module covering location/value/program helpers and module re-exports - psy-interpreter: sema_edge_tests (552 lines) exercising sema lookup, resolver, and type edges through the interpreter entry; visualizer tests for debug output paths - psy-parser: statement/trivia edge parsing and lib-level entry paths - psy-common: file resolver edge cases - psy-lsp-server: simple protocol handler paths - psy-abi: abi.rs wire-shape edges
…obal state Replace the process-global STD_PRIMITIVE_SCOPE_ID OnceLock with a per-SymbolTable field, removing the unsafe static_mut_refs resets scattered through the interpreter, CLI commands, and test suites. Keep an atomic compatibility export for downstream users. With the global-state mutation gone, test-slow no longer needs --test-threads=1. Raise the coverage-ci gates to 95% lines/functions.
- interpreter: dedupe the 43 identical build_report fallback closures into a report_or_fallback helper and test its Err branch - wasm: cover unknown-caller fallback, runtime assert failures, and IMT entry reads through the in-memory chain - lsp: cover non-file formatting URIs and the position_at panic path - package: cover clone_git_repo cache reuse and spawn failures - sema: cover lambda path return types, generic free-function calls, turbofish associated types, and non-callable operator members - dargo-cli: doc-mode fixtures put an item before the `// input:` comments — file-leading comments become module comments in the parser, so they never attached to the function and the metadata map stayed empty Function coverage 94.93% -> 96.91%; lines 95.43% -> 95.63%. make coverage-ci passes both 95% gates.
…e-scope global `to_input`'s tuple arm still resolved the primitive scope through the process-global STD_PRIMITIVE_SCOPE_ID, which nothing in production sets since the scope id moved into SymbolTable (a95ce43). Any entry point with a tuple-typed parameter — e.g. `fn main(t: (Felt, Felt))` — panicked with "primitive scope has not been initialized". Read the scope from the symbol table via type_scope_id(ty), the same accessor the refactor introduced for its migrated call sites, and add a regression test compiling a tuple-parameter entry point.
…nput diagnostics fn-typed entry parameters (e.g. `fn main(f: fn(Felt) -> Felt)`) and non-const array-size entry parameters panicked the compiler with "Unsupported type in to_input" / "Array size must be a numeric constant". Convert to_input to return Result and thread the parameter location through so these surface as located diagnostics instead. Pre-existing on mainnet-beta; regression test added in psy-wasm.
current_branch_definitely_executes() treated any non-ConstantFalse
condition — including symbolic ones like `if a > b` on entry inputs — as
"definitely executes". The eager constant-assert failure then wrongly
rejected satisfiable programs:
fn main(a: Felt, b: Felt) -> Felt {
if a > b { assert(false, "only reachable when a > b"); };
return a + b;
}
compilation failed with an eager assertion failure even though choosing
a <= b satisfies it. Eager failure must be a positive proof: only a
provably constant-true condition (constant-folding the whole enclosing
condition stack) counts. A symbolic arm's assertions stay gated and
satisfiable, matching the VM's op_select-gated assert semantics.
Nested `if false` under a symbolic arm also stays gated (the conjunction
with a symbolic condition does not fold), which is the conservative and
correct choice.
Seeded, boundary-biased DAGs over u32/Felt/bool (arithmetic, bitwise, shifts, casts, select) are printed as psy programs and must match a native Rust mirror exactly, including error classes (overflow, div-by-zero, invalid cast). A crypto companion suite differentials hash / hash_two_to_one / keccak256 / secp256k1_verify / split_bits / sum_bits against plonky2, tiny-keccak and k256 mirrors, pins the Constant* op routing and VM const-fold regressions, and adds deterministic boundary pins: TargetAt element access, all-ones splits, 64-element sums and the 65-element rejection, felt wrap-around arithmetic, degenerate secp keys. Expected rejection panics are silenced via a scoped panic-hook swap so a green --nocapture run does not look like a crash. Cargo deps temporarily point at the local ../psy-node checkout (fix/vm-const-fold) that carries the VM fixes under test; psy-wasm ExecutionContext literals gain the new session_proof_tree_root field.
Replace the Hash/QHashOut deployer identity with the deployer's u64 user id across sema, interpreter, std, CLI, wasm, and precompiles: - get_contract_deployer now returns Felt (user id) instead of Hash - gen_deploy_json/gen_deploy_abi_json take a deployer_user_id (u64); default genesis deployer is the reserved id 0 so genesis precompiles can never be updated by an on-chain deployer - doc/execute/test commands and interpreter tests use a fixed u64 deployer instead of QHashOut::rand() - token/usdt_token mint checks deployer against get_user_id()
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.
No description provided.