Add query provenance tracking to DSL v2 and legacy DSL#988
Merged
SkBlaz merged 3 commits intomasterSkBlaz/py3plex:masterfrom Jan 5, 2026
copilot/add-provenance-to-queryresultSkBlaz/py3plex:copilot/add-provenance-to-queryresultCopy head branch name to clipboard
Merged
Add query provenance tracking to DSL v2 and legacy DSL#988SkBlaz merged 3 commits intomasterSkBlaz/py3plex:masterfrom copilot/add-provenance-to-queryresultSkBlaz/py3plex:copilot/add-provenance-to-queryresultCopy head branch name to clipboard
SkBlaz merged 3 commits intomasterSkBlaz/py3plex:masterfrom
copilot/add-provenance-to-queryresultSkBlaz/py3plex:copilot/add-provenance-to-queryresultCopy head branch name to clipboard
Conversation
- Implement provenance schema in py3plex/dsl/provenance.py with ProvenanceRecord dataclass - Add timing instrumentation to DSL v2 executor (execute_ast and _execute_select) - Add provenance tracking to legacy DSL execute_query function - All provenance stored in QueryResult.meta["provenance"] with stable schema - Add comprehensive tests in tests/test_dsl_provenance.py (23 passing) - Update AGENTS.md documentation with provenance structure and examples - Provenance includes: engine, version, timestamp, network fingerprint, query hash, performance timings, backend info - Fully backward compatible - existing code continues to work without changes Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
- Create example_provenance_demo.py demonstrating query provenance features - Shows DSL v2 and legacy DSL provenance tracking - Demonstrates JSON export of provenance metadata - Includes performance timing breakdown and network fingerprinting Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add provenance and performance tracing to QueryResult
Add query provenance tracking to DSL v2 and legacy DSL
Jan 5, 2026
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.
Query results now include execution provenance for reproducibility, debugging, and performance analysis. Every
QueryResult(DSL v2) and result dict (legacy) containsmeta["provenance"]with AST hash, timing breakdown, network fingerprint, and execution metadata.Changes
Core Infrastructure (
py3plex/dsl/provenance.py)ProvenanceRecorddataclass with stable schema: engine, version, timestamp, network fingerprint, query AST hash, performance timings, backend info, warningsProvenanceBuilderfor incremental construction during executionDSL v2 Instrumentation (
py3plex/dsl/executor.py)execute_ast()and_execute_select(): bind_parameters, get_items, filter_layers, filter_where, compute, group_aggregate, limit, materializeQueryResult.meta["provenance"]with complete metadataProvenanceBuilderpassed through execution pipelineLegacy DSL Instrumentation (
py3plex/dsl_legacy.py)execute_query()with same structure as v2Documentation (
AGENTS.md)Tests (
tests/test_dsl_provenance.py)Example Usage
Backward Compatibility
All existing code works unchanged.
QueryResultiteration, exports (to_pandas(),to_networkx()), and attribute access remain unaffected. Provenance is additive metadata.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.