Skip to content

bregctl: explain and check report structural paths with no file or line to go with them #1244

Description

@jeremi

Problem

Both bregctl check --format json findings and bregctl explain output identify configuration by structural path, for example entities[2].fields[5].constraints[0]. Neither says which file the construct came from, nor where in that file it sits.

For a single-file project a human can resolve this by reading. For a project assembled from several files, or one that a tool wants to link back to source, the structural path is not enough. Every consumer has to re-parse the project files itself and re-implement the mapping from structural path to file position, which means re-implementing assumptions about how the loader merges files.

Request

Either of:

  1. Source provenance inline: add file and range (start and end line/column) next to path in explain output and in check findings.
  2. A separate map: bregctl explain locations --format json returning structuralPath -> { file, range } for every addressable construct.

Option 2 is cheaper to add without disturbing existing payload shapes, and it lets consumers opt in.

Provenance should also distinguish authored configuration from values that came from a module or from an engine default, since "this field is not in your file because the engine supplied it" is a different answer from "this is at line 40".

Why it matters

Any tool that shows a project's configuration and wants to let a reader jump to where a rule is written needs this. Without it, the tool is guessing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:bregBReg ownership.enhancementNew feature or requestrustRust implementation work.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions