034 graph classifier#61
Merged
akollegger merged 7 commits intomainfrom Feb 20, 2026
Merged
Conversation
… graph elements from Patterns
…ns updated to adopt it
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a new, pluggable GraphClassifier vocabulary (GraphClass + GraphClassifier) and refactors PatternGraph / GraphLens to use classifier-driven categorization, updating tests and build metadata to support canonical + custom classification and improved walk validation.
Changes:
- Added
Pattern.Graph.GraphClassifierwith canonical shape-based classification (including walk chain validation). - Refactored
Pattern.PatternGraphto be parameterized byextra, store non-canonical elements inpgOther, and require aGraphClassifierfor construction/merge. - Reworked
Pattern.Graph(GraphLens) to be backed by a classifier and addedmkGraphLens; updated affected tests and cabal module lists.
Reviewed changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| specs/034-graph-classifier/tasks.md | Task breakdown for implementing/refactoring graph classification. |
| specs/034-graph-classifier/spec.md | Feature spec describing goals, scenarios, and requirements for graph classification. |
| specs/034-graph-classifier/research.md | Design decisions for pgOther, GraphLens re-derivation, and walk validation. |
| specs/034-graph-classifier/quickstart.md | Usage examples for canonical and custom classifiers + legacy lens usage. |
| specs/034-graph-classifier/plan.md | Implementation plan artifact (currently template-like). |
| specs/034-graph-classifier/data-model.md | Data model definitions for GraphClass, GraphClassifier, and updated PatternGraph. |
| specs/034-graph-classifier/contracts/GraphClassifier.hs | Contract stub for the classifier API. |
| specs/034-graph-classifier/checklists/requirements.md | Spec-quality checklist for the feature. |
| proposals/pipeline-scenarios.md | Adds motivating scenarios for graph pipelines using GraphClassifier/GraphView concepts. |
| proposals/graph-transform.md | Design-only proposal building on GraphClassifier (introduces GraphView, transforms). |
| proposals/graph-query.md | Design-only proposal updated to reference follow-on proposals and context helpers. |
| proposals/graph-mutation.md | Design-only proposal updated to depend on GraphTransform and use GraphView. |
| proposals/graph-classifier.md | Design-only proposal updated with implementation ordering notes. |
| proposals/files.zip | Adds a zip archive containing proposal markdown files. |
| libs/pattern/tests/Test.hs | Registers new GraphClassifierSpec in the pattern test suite. |
| libs/pattern/tests/Spec/Pattern/PatternGraphSpec.hs | Updates PatternGraph tests to use canonicalClassifier and validates pgOther + custom classifier behavior. |
| libs/pattern/tests/Spec/Pattern/PatternGraphProperties.hs | Updates property tests to pass canonicalClassifier into merges/builds. |
| libs/pattern/tests/Spec/Pattern/GraphSpec.hs | Updates GraphLens tests to construct lenses via mkGraphLens. |
| libs/pattern/tests/Spec/Pattern/Graph/GraphClassifierSpec.hs | New unit tests for classifyByShape walk validation and canonical behavior. |
| libs/pattern/src/Pattern/PatternGraph.hs | Refactors PatternGraph to use GraphClassifier, adds pgOther, and updates merge/build APIs. |
| libs/pattern/src/Pattern/Graph/GraphClassifier.hs | New classifier module with GraphClass, GraphClassifier, shape classification, and walk validation. |
| libs/pattern/src/Pattern/Graph.hs | Re-derives GraphLens around a classifier, adds mkGraphLens, rewires node/rel/walk detection. |
| libs/pattern/pattern.cabal | Exposes the new classifier module and adds the new spec module to test suite modules. |
| libs/gram/tests/Spec/Gram/RoundtripSpec.hs | Updates roundtrip tests to build graphs using canonicalClassifier. |
| .gitignore | Adds ignores for Thumbs.db and *.tmp. |
| .cursor/rules/specify-rules.mdc | Documents the new feature in the Cursor/specify rules index. |
The documentation originally described `canonicalClassifier` as using `GraphClassifier Void ...` to make `GOther` unreachable. However, the implementation actually uses `()` because `canonicalClassifier` must be able to classify structurally invalid shapes (like non-chaining "star patterns" or broken walks) as `GOther ()` so they can be stored in `pgOther` without data loss. This updates the feature docs and proposals to align with the `()` design, explaining that `GOther ()` is an intentional bucket for these fallback cases. Co-authored-by: Cursor <cursoragent@cursor.com>
Replaces placeholder tokens ([FEATURE], [###-feature-name], [DATE], [link]) with actual metadata for the GraphClassifier feature, so the documentation appears complete rather than generated from a template. Co-authored-by: Cursor <cursoragent@cursor.com>
…ph value instances
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.
This pull request introduces a new, extensible graph classification system for pattern graphs, refactoring the core graph logic to use a pluggable
GraphClassifierand updating related APIs and tests. The changes enable more flexible and canonical graph element categorization, improve compatibility, and simplify classification logic across the codebase.Graph classification refactor
Pattern.Graph.GraphClassifiermodule, which defines theGraphClasstype and pluggableGraphClassifierrecord, as well as canonical and shape-based classification logic. (libs/pattern/src/Pattern/Graph/GraphClassifier.hs)PatternGraphand related functions to use the newGraphClassifier, updating the data structure to store "other" elements and removing legacy classification logic. (libs/pattern/src/Pattern/PatternGraph.hs) [1] [2] [3] [4]Pattern.Graphto use the new classifier, including adding themkGraphLensconstructor for backward compatibility and rewiring node, relationship, and walk detection to use classification results. (libs/pattern/src/Pattern/Graph.hs) [1] [2] [3] [4] [5] [6]Test and build system updates
libs/gram/tests/Spec/Gram/RoundtripSpec.hs) [1] [2] [3]libs/pattern/pattern.cabal) [1] [2]Documentation and rule specification
.cursor/rules/specify-rules.mdc) [1] [2]