fix: review follow-ups for #5 and the Swift lexical preview #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/review-followups"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR fixes the code-review findings on the merged #5 audit fixes, and the Swift lexical-preview bugs. There is one commit per fix, and each commit body gives the problem, the fix and the test. Every new test was run first and failed for the reason its finding describes.
Commits
fix(fold): decode SARIF escapes safely, keep the lane per run, and follow symlinked absolute paths (findings 1, 6 and 7)%escape that was not two hex digits (such asfile:///src/%aé.c) panicked by slicing through a UTF-8 character. Decoding now works on bytes, and a%escape is decoded only when two hex digits follow it.tool.driver.name. In a mixed log, only the Fold runs are Symbolic...after a symlink. Absolute andfile://paths containing..were normalized lexically. Now, when such a path exists, it is canonicalized and the canonical root is stripped, the same way repository-relative paths are handled.src/fold.rs.refactor: one definition of "the model scanned a source file" (finding 9)model::has_source_filesandBuilding::has_source_filesreplace the two copies of this check inscanandcheck.fix(check): warn instead of failing when stored metrics differ from recomputed (finding 4)metrics.resolutionblock, andcheckrejected it.a_model_from_an_older_build_passes_check_on_recomputed_metrics.fix(swift): give the lexical preview Swift's own forms and mask block comments (part B)/* */comments became edges;func,class funcandclass vardeclarations were counted as calls;class funcandclass varare treated as members.543bafcand2c66bec.tests/swift_preview.rs, with a positive fixture and a clean-negative fixture.fix(python): resolve relative, package and dotted imports to the right file (finding 2)from .util import x,from .. import,pkg/__init__.pyandsrc/layouts now resolve by path.common.pyfiles no longer shadow each other.tests/python_imports.rs, 2 tests.perf(scan): index import edges once instead of scanning them for every file (finding 8)imported_pathswas O(files × edges). It now builds a file → imports index lazily, once.fix(rust): keep impls written on a qualified path when leaf names collide (finding 3)impl crate::a::T { fn run() }, the qualified path was dropped. When another file also had aT, the methods were lost.an_impl_on_a_qualified_path_in_another_file_keeps_its_methods.fix(dart): honour import prefixes,show/hide, and one level ofexport(finding 5)import 'a.dart' as p;still boundfoo(), andhideandshowwere ignored.asprefix whose combinators let the name through, plus those libraries' ownexports, one level deep. The README is updated to match.tests/dart_imports.rs, which covers prefixed,hide,showand barrel imports.Deferred
.hstill uses the C++ grammar. Choosing C for a header needs the include graph: the same header can be included from both.cand.cpptranslation units.compile_commands.json. Both are better done as their own PR, with a corpus case.Tests
cargo test: 126 passed, 0 failed.cargo clippy --all-targets -- -D warnings: clean../scripts/quality-gate.sh: passed. It covers fmt, clippy, tests with and without the P4 pilot, the Python unit tests, and the benchmark self-tests and runs.Before / after
I re-ran the review's reproduced cases. "Before" is the #5 merge build; "after" is this branch. The calls listed are resolved call edges.
file:///src/%aé.csrc/fold.rs:298, exit 101from .util import helper, and duplicatecommon.pygo -> helper,use -> only_here(the right file)f -> runcheck --min-score 0on an older modela.swift -> realTarget @ a.swift:1(from a comment, attributed to the file)caller -> realTarget @ a.swift:7as p,hide hidden, barrelexportfoo,hidden,visiblevisible,exportedLanguage-parity branch
The remaining lexical work on the language-parity branch is superseded. Python and Swift should move to Tree-sitter frontends rather than get more lexical patterns, and the useful pieces of that branch (the Swift comment masking) are salvaged here. That branch can be closed.
AI usage