Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docs/binaries.md
Original file line number Diff line number Diff line change
@@ -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]'
Expand Down
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion docs/python-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/trailmark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"SourceRoot",
"supported_languages",
]
__version__ = "0.9.0"
__version__ = "0.9.1"
6 changes: 6 additions & 0 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pyramid_includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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


Expand Down
14 changes: 7 additions & 7 deletions tests/test_reference_literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))],
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading