
Evaluate contextual rule coverage for structural paths
Source:R/coverage_rules_path.R
coverage_rules_path.Rdcoverage_rules_path() expands observed filesystem paths into recursive structural components and evaluates whether those components are covered by contextual path rules.
The function provides a diagnostic view of contextual coverage. It identifies which observed filesystem structures are recognised by a rulebook and which remain unmatched.
This makes it useful for:
contextual reconstruction;
semantic stabilisation workflows;
rulebook development and refinement;
coverage diagnostics;
filesystem archaeology;
exploratory analysis of operational structures.
Value
A tibble describing structural path-rule coverage.
The returned tibble includes:
- context
Contextual environment associated with the matched rule.
- root
Contextual root used for evaluation.
- explored_path
Recursively expanded structural path.
- matched_rule
Path rule evaluated against the structural path.
- activity
Rule outcome associated with the matched rule.
- matched
Logical indicator showing whether the structural path is covered by the rule.
Details
Evaluates how filesystem observations align with a contextual path-rule model.
Structural matching is recursive.
For example:
"R/import/helpers.R" expands to:
"R"
"R/import"
"tests/testthat/test-import.R" expands to:
"tests"
"tests/testthat"
Expanded structural paths are evaluated against contextual path rules associated with the matching contextual root.
The function operates on filesystem observations and explicit contextual rules. It does not infer:
Activities;
Events;
Record Sets;
provenance relationships.
Instead, it evaluates whether observed filesystem structures are covered by an existing contextual model.
Unmatched structures may indicate:
missing contextual rules;
evolving workflows;
operational noise;
areas requiring further semantic stabilisation.
Examples
small_snapshot <- tibble::tibble(
full_path = c(
"D:/packages/fscontext/R/import/helpers.R",
"D:/packages/fscontext/tests/testthat/test-import.R",
"D:/packages/fscontext/data-raw/input.csv"
),
rel_path = c(
"R/import/helpers.R",
"tests/testthat/test-import.R",
"data-raw/input.csv"
)
)
small_context <- list(
contexts = list(
fscontext = list(
roots = "D:/packages/fscontext",
rules = list(
path = c(
"R" = "software_development",
"tests/testthat" = "unit_testing",
"data-raw" = "etl"
)
)
)
)
)
coverage_rules_path(
snapshot = small_snapshot,
contexts = small_context
)
#> # A tibble: 15 × 9
#> full_path rel_path dir_path explored_path context root matched_rule activity
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 D:/packa… R/impor… R/import R fscont… D:/p… R softwar…
#> 2 D:/packa… R/impor… R/import R fscont… D:/p… tests/testt… unit_te…
#> 3 D:/packa… R/impor… R/import R fscont… D:/p… data-raw etl
#> 4 D:/packa… R/impor… R/import R/import fscont… D:/p… R softwar…
#> 5 D:/packa… R/impor… R/import R/import fscont… D:/p… tests/testt… unit_te…
#> 6 D:/packa… R/impor… R/import R/import fscont… D:/p… data-raw etl
#> 7 D:/packa… tests/t… tests/t… tests fscont… D:/p… R softwar…
#> 8 D:/packa… tests/t… tests/t… tests fscont… D:/p… tests/testt… unit_te…
#> 9 D:/packa… tests/t… tests/t… tests fscont… D:/p… data-raw etl
#> 10 D:/packa… tests/t… tests/t… tests/testth… fscont… D:/p… R softwar…
#> 11 D:/packa… tests/t… tests/t… tests/testth… fscont… D:/p… tests/testt… unit_te…
#> 12 D:/packa… tests/t… tests/t… tests/testth… fscont… D:/p… data-raw etl
#> 13 D:/packa… data-ra… data-raw data-raw fscont… D:/p… R softwar…
#> 14 D:/packa… data-ra… data-raw data-raw fscont… D:/p… tests/testt… unit_te…
#> 15 D:/packa… data-ra… data-raw data-raw fscont… D:/p… data-raw etl
#> # ℹ 1 more variable: matched <lgl>