Skip to content

feat: add type-level ownership checks to the layer validator #28

Open

Description

@Statyk7

Description

Some ownership rules can only be checked by looking at types, not at pubspecs or import directives. The ffca-layer-auditor agent covers them with an LLM today.

The validator stays a dependency-free script in this plugin: moving it into Very Good CLI was decided against. package:analyzer is therefore not available, since it would need dart pub get in scripts/ before the hook could run. These checks have to work from source text, the way the import checks from #25 do: read class … implements … declarations and repository method signatures, and resolve type names through the file's imports. A rule that cannot be checked reliably that way stays with the auditor.

Requirements

  • Error: a class in {f}_data implements a repository interface from another feature's _domain. The dependency on that domain is allowed, but the data layer implements only its own domain's interfaces.
  • Warning: a repository interface in {f}_domain takes or returns a model from another feature's _domain. This is what the Summary pattern in domain.md avoids. Sometimes legitimate, hence a warning (feat: add severity levels and suppressions to the layer validator #21).
  • Error: {f}_domain uses dart:ui, Flutter types, or backend types (Firebase, HTTP clients) in its public API. The domain layer is pure Dart (domain.md).
  • Each check works from source text with no new dependencies. A rule that would need full type resolution to avoid false positives stays with the auditor, and the issue says which.
  • Fixtures and tests for each rule.
  • The ffca-layer-auditor agent relies on these results instead of checking the same rules itself.
  • All CI/CD checks are passing.
  • There is no drop in the test coverage percentage.

Additional Context

Uses the severity levels from #21 and the directive scanner from #31.

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

    featureA new feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions