diff --git a/CHANGELOG.md b/CHANGELOG.md index 1747915..6228b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,32 @@ # Changelog -## Unreleased +## 0.9.1 (2026-11-24) + +This release adds reloadable analysis snapshots, extends Python import resolution +across selected source roots, and strengthens mutation testing. ### Added +- Save and reload complete analysis with `to_snapshot()` and `from_snapshot()` + on `CodeGraph`, `GraphStore`, and `QueryEngine`. Snapshots preserve source + policy, annotations, entrypoint evidence, diagnostics, subgraphs, and binary + evidence. Validate the format and graph references on load, and optionally + verify inspected source files against their parse-time SHA-256 digests. - Detect Python functions and methods decorated with `pyramid.view.view_config` as external API entrypoints, including through resolved import aliases. - Emit Python `imports` edges from module and callable scopes to inspected modules during directory parsing, including parent packages initialized by dotted imports. Retain conditional imports as static import sites. +### Changed + +- Resolve Python imports and calls across explicitly selected application and + dependency roots, retaining source-policy boundaries and conservative evidence + for dynamic, ambiguous, or uninspected targets. +- Use coverage-driven mutation selection and share validated baseline data across + CI shards. Reject inconclusive outcomes throughout each campaign and replace + wall-clock timing assertions with deterministic work bounds. + ### Fixed - Resolve Python calls through definite lexical import bindings, including @@ -26,6 +43,14 @@ diagnostic pragmas. Preserve calls inside cast operands and callback calls through parameters or local variables that shadow typedef names. +### Upgrade notes + +- Rebuild source graphs to pick up corrected Python imports and call ownership. + Graph JSON schema version 1 and Python 3.12 or newer remain supported. +- Reloadable snapshots require matching Trailmark package versions. Rebuild and + re-export snapshots after upgrading; lightweight `to_json()` exports remain a + separate format. + ## 0.9.0 (2026-11-21) This release adds eight language frontends for verification and specification diff --git a/docs/binaries.md b/docs/binaries.md index 4e0e8d2..ad0dfc1 100644 --- a/docs/binaries.md +++ b/docs/binaries.md @@ -1,9 +1,9 @@ # Compiled binary evidence Native ingestion connects source functions and lines to compiled bytes in linked -ELF executables/shared libraries, Mach-O images, and PE images. This feature is -unreleased. Install `trailmark[binary]` and host disassembly/symbolization tools; -the inspected image is never executed. +ELF executables/shared libraries, Mach-O images, and PE images. This feature has +been available since 0.8.0. Install `trailmark[binary]` and host +disassembly/symbolization tools; the inspected image is never executed. ```bash uv tool install 'trailmark[binary]' diff --git a/docs/cli.md b/docs/cli.md index 3adb0e1..fc0c5a5 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -203,7 +203,7 @@ trailmark binary build/app --source-root . --function verify --disassemble --jso ``` Inspect a linked ELF, Mach-O, or PE image, optionally connecting it to a source -graph from `--source-root`. This command is unreleased and requires +graph from `--source-root`. This command has been available since 0.8.0 and requires `trailmark[binary]`. Its source `--language`/`-l` default is `auto`; other source-reading commands keep their existing defaults. `--allow-empty` permits an empty source root. `--strict` rejects incomplete source or binary evidence. diff --git a/docs/python-api.md b/docs/python-api.md index 42c5303..7c521e6 100644 --- a/docs/python-api.md +++ b/docs/python-api.md @@ -236,7 +236,7 @@ counts as a read or write. | `source_at_address(artifact, address, *, address_kind="va")` | Source mappings and inline frames at a link-time VA, RVA, or file offset | | `disassemble_binary(artifact, start, end, *, address_kind="va", max_instructions=256)` | Bounded instructions, source mappings, truncation, completeness, and diagnostics | -Native methods are unreleased and require the optional `trailmark[binary]` +Native methods have been available since 0.8.0 and require the optional `trailmark[binary]` extra plus host tools for ingestion/disassembly. Frozen `BinaryImportOptions`, `BinaryLimits`, and `BinarySelection` configure tool families, exact slices, verified local debug companions, path remapping, explicit ranges, and strictness. @@ -428,6 +428,9 @@ with older releases can check `trailmark.__version__` or probe with `hasattr()`. | 0.4.0 | `connect_subgraphs`, `subgraph_edges`, `generic_parameters`, `type_references`, `augment_binary`, proxy nodes | | 0.7.0 | `state_read_by`, `state_written_by`, `readers_of`, `writers_of`, `unresolved_calls`, `call_resolution`; `replace_existing` on the finding importers; keyword-only `max_depth` on `paths_between`; directory `allow_empty`, source-file coverage in summaries and diffs, and the expanded structural diff fields above | | 0.7.1 | `SourceRoot`, `SourcePolicy`, `parse_roots`, directory `source_policy`; `source_policy()`, `entrypoint_evidence()`, `entrypoint_candidates()`, `add_entrypoint_evidence()`, `EntrypointEvidence`, and `EdgeKind.REFERENCES` | +| 0.8.0 | `augment_binary_file`, `binary_artifacts`, `binary_ranges`, `source_at_address`, `disassemble_binary`; `BinaryImportOptions`, `BinaryLimits`, and `BinarySelection` | +| 0.9.0 | `edge_kinds` on `reachable_from`, `ancestors_of`, and `paths_between` | +| 0.9.1 | Reloadable `to_snapshot()` and `from_snapshot()` on `CodeGraph`, `GraphStore`, and `QueryEngine` | ## Source analysis diagnostics diff --git a/pyproject.toml b/pyproject.toml index 8489930..b62c503 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ reinstall-package = ["trailmark"] [project] name = "trailmark" -version = "0.9.0" +version = "0.9.1" description = "Parse source code into a queryable graph of functions, classes, calls, and semantic annotations" readme = "README.md" requires-python = ">=3.12" diff --git a/src/trailmark/__init__.py b/src/trailmark/__init__.py index 478990f..c2ddebd 100644 --- a/src/trailmark/__init__.py +++ b/src/trailmark/__init__.py @@ -18,4 +18,4 @@ "SourceRoot", "supported_languages", ] -__version__ = "0.9.0" +__version__ = "0.9.1" diff --git a/tests/test_docs.py b/tests/test_docs.py index c129dff..d76c273 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -345,6 +345,12 @@ def pyproject_data() -> dict[str, object]: ("docs/python-api.md", "calls with existing lexical import bindings"), ("docs/python-api.md", "Relative imports stay within their root"), ("docs/python-api.md", "| 0.7.1 | `SourceRoot`, `SourcePolicy`, `parse_roots`"), + ("docs/python-api.md", "| 0.8.0 | `augment_binary_file`"), + ("docs/python-api.md", "| 0.9.0 | `edge_kinds`"), + ("docs/python-api.md", "| 0.9.1 | Reloadable `to_snapshot()` and `from_snapshot()`"), + ("docs/python-api.md", "Native methods have been available since 0.8.0"), + ("docs/cli.md", "This command has been available since 0.8.0"), + ("docs/binaries.md", "been available since 0.8.0"), ("CONTRIBUTING.md", "tests.run_mutations --reviewed --workers=4"), ("CONTRIBUTING.md", "tests.run_mutations --workers=4"), ("CONTRIBUTING.md", "tests.mutation_gate"), diff --git a/tests/test_pyramid_includes.py b/tests/test_pyramid_includes.py index e9ca36c..8c9804b 100644 --- a/tests/test_pyramid_includes.py +++ b/tests/test_pyramid_includes.py @@ -18,7 +18,7 @@ def test_literal_includes_follow_a_proven_registrar_and_its_included_configurato (package / "setup.py").write_text("def includeme(config):\n config.include('.csrf')\n") (package / "csrf.py").write_text("def includeme(config): pass\n") (package / "unrelated.py").write_text("def custom(config):\n config.include('app.csrf')\n") - engine = QueryEngine.from_directory(str(tmp_path)) + engine, _ = count_work(lambda: QueryEngine.from_directory(str(tmp_path)), max_work=100_000) graph = engine._store._graph references = [ e for e in graph.edges if dict(e.attributes).get("reference_context") == "pyramid_include" @@ -30,7 +30,7 @@ def test_literal_includes_follow_a_proven_registrar_and_its_included_configurato assert all(e.kind == EdgeKind.REFERENCES and e.location is not None for e in references) assert not engine.paths_between("app:main", "app.csrf:includeme") before = list(graph.edges) - discover_pyramid_includes(graph) + count_work(lambda: discover_pyramid_includes(graph), max_work=100_000) assert graph.edges == before diff --git a/tests/test_reference_literals.py b/tests/test_reference_literals.py index d065a4f..ec209ba 100644 --- a/tests/test_reference_literals.py +++ b/tests/test_reference_literals.py @@ -30,13 +30,6 @@ def test_yaml_flow_character_returns_the_next_unconsumed_index( assert _reference_literals._yaml_flow_char(text, 0, quote) == expected -@pytest.mark.parametrize(("text", "expected"), [("\n", " "), ("\n\n", "\n")]) -def test_yaml_flow_folding_distinguishes_one_break_from_an_empty_line( - text: str, expected: str -) -> None: - assert _reference_literals._yaml_fold(text, "") == expected - - @pytest.mark.parametrize( ("text", "expected"), [("\n value", (3, 1)), ("\n \n\tvalue", (4, 2)), ("\n \n\t", (4, 2))], @@ -47,6 +40,13 @@ def test_yaml_line_break_scanner_advances_to_content_or_end( assert _reference_literals._yaml_skip_breaks(text, 0) == expected +@pytest.mark.parametrize(("text", "expected"), [("\n", " "), ("\n\n", "\n")]) +def test_yaml_flow_folding_distinguishes_one_break_from_an_empty_line( + text: str, expected: str +) -> None: + assert _reference_literals._yaml_fold(text, "") == expected + + _GRAPHQL = r'''# comment "App\\Comment::nope" App\Hidden::nope """Type description "App\\Doc::nope" with \""" inside.""" type Query { diff --git a/uv.lock b/uv.lock index 62918c4..36ce859 100644 --- a/uv.lock +++ b/uv.lock @@ -467,7 +467,7 @@ wheels = [ [[package]] name = "trailmark" -version = "0.9.0" +version = "0.9.1" source = { editable = "." } dependencies = [ { name = "rustworkx" },