Skip to content

Nineteen architecture rules select a package layout that no longer exists #1159

Description

@ExtraToast

ArchitecturePackages.kt declares 51 package constants. 39 of them name a package no class resides in, and 19 of those are still used by rules — so those rules select nothing and pass without checking anything.

Measured against origin/main by expanding each constant's ArchUnit pattern (.. = any depth, * = one segment) and matching it against the 109 packages that actually hold Kotlin under services/api/src/main/kotlin.

The dead constants that rules still reference, with how many rule files use each:

constant rule files refs
WEB 4 17
DTO 4 13
PERSISTENCE 4 12
APPLICATION 2 9
JOB 1 5
QUERY 1 4
DOMAIN, LISTENER 1 each 3
DOMAIN_SERVICE, REPOSITORY 2 each 5, 3
APPLICATION_VALIDATION, EVENT, FACTORY, DOMAIN_MODEL, SPECIFICATION, DOMAIN_WEB, DOMAIN_APPLICATION, DOMAIN_EVENT, DOMAIN_SURVEY 1 each 2 each

They are all shapes the flattening in architecture ADR-003 removed: a central web/application/domain/persistence layer, a domain.<feature> prefix, and the platform.integration..adapter/..application tree. A module now holds api, domain, persistence and web directly under its own name.

Why this matters beyond tidiness

#1157 found three such constants and #1158 fixes them. This is the same defect at eleven times the size, and it is invisible: a vacuous ArchUnit rule is green, so the suite reports these rules as passing. Nobody learns the rule stopped applying — they learn it when something the rule forbade turns up in review, or does not.

The twenty remaining dead constants are referenced by nothing and are clutter rather than a live problem.

Suggested order

Rule by rule, not constant by constant. For each rule, work out what it was written to check, decide whether the flattening made it redundant, and either express it against today's topology or delete it with the reason. #1158 does exactly this for its three and is worth reading first — one of its three turned out to be genuinely redundant and was deleted rather than repointed.

Worth considering as part of the fix: something that fails when a constant matches nothing. A rule that selects an empty set is almost always a mistake, and ArchUnit's allowEmptyShould(false) says so directly.

Acceptance criteria

  • No rule selects classes through a constant that matches nothing
  • Each affected rule is either expressed against today's packages or deleted with its reason recorded
  • Unused dead constants are gone
  • A constant that matches no class cannot pass silently

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

    bugSomething isn't workingready-for-agentSized and specified for an agent to pick up

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions