coverage_rules_path: Evaluate contextual rule coverage for structural paths

View source: R/coverage_rules_path.R

coverage_rules_pathR Documentation

Evaluate contextual rule coverage for structural paths

Description

coverage_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.

Usage

coverage_rules_path(snapshot, contexts)

Arguments

snapshot

A filesystem snapshot data.frame containing at least:

  • full_path;

  • rel_path.

contexts

A contextual reconstruction object containing contextual roots and path rules.

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.

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.

See Also

construct_structural_paths(), refine_by_rulebook(), compile_rulebook()

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
)


fscontext documentation built on Nov. 19, 2026, 5:11 p.m.