feat(provenance): add core data structures and traits#8970
feat(provenance): add core data structures and traits#8970ematipico wants to merge 1 commit intofeat/config-debuggingfrom
Conversation
Phase 1 of Configuration Provenance Tracking feature. Adds foundational types for tracking where configuration values come from: - FieldQuery: Represents field paths using AstPtr for thread-safe, memory-efficient storage - ProvenanceSource: Enum identifying config sources (base, extends, overrides, etc.) - ProvenanceEntry: Records a field being set with its source and merge order - OverrideProvenanceMetadata: Stores override patterns for lazy file-specific evaluation All types include comprehensive unit tests. No integration with config loading yet.
🦋 Changeset detectedLatest commit: 3fd4971 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
52149fa to
6ccd85c
Compare
| pub enum FieldQuerySegment { | ||
| /// A named field: stores a pointer to the JsonMemberName node | ||
| /// AstPtr is thread-safe (Send + Sync) and only 8 bytes | ||
| Field(AstPtr<JsonMemberName>), |
There was a problem hiding this comment.
This is a crucial part of the design. A query e.g. formatter.indentStyle is resolved against its a configuration file. A configuration file is resolved using its CST, so we store a pointer to possible node, so we store strings all over. It's possible this design will change once we're closer to its completion
|
|
||
| /// Check if this override applies to the given file path | ||
| pub fn matches_file(&self, path: &Utf8Path) -> bool { | ||
| self.matchers.iter().any(|m| m.matches(path)) |
There was a problem hiding this comment.
it seems iter().any() is not the same as matches_with_exceptions. matches_with_exceptions checks patterns from the end so the last matching pattern decides the result, and it supports ! exclude patterns. any() returns true on the first match, so it can be wrong for patterns like ["**/*.js", "!**/*.test.js"]?
Summary
This PR starts a feature that will allow for debugging configuration files, and discover which configuration changed a certain default.
This work is going to be shipped using stacked PRs using graphite (first time).
All PRs are going to be merged into
feat/config-debugging. That branch, at the moment, contains some MD files that I used to generate a plan using AI.This PR starts by creating the necessary traints for tracking the changed properties, using a trait called
ProvenanceCode is generated with AI and reviewed by me.
Test Plan
N/A
Docs