Skip to content

Jason/arch unit split#352

Draft
jasonmorais wants to merge 3 commits intomainfrom
jason/arch-unit-split
Draft

Jason/arch unit split#352
jasonmorais wants to merge 3 commits intomainfrom
jason/arch-unit-split

Conversation

@jasonmorais
Copy link
Contributor

@jasonmorais jasonmorais commented Feb 27, 2026

Summary by Sourcery

Split and generalize architectural fitness tests into a reusable @cellix/arch-unit-tests package and a ShareThrift-specific arch test suite, and wire them into the monorepo test pipeline.

New Features:

  • Introduce a generic @cellix/arch-unit-tests package exposing reusable architectural checks and test-suite helpers for domain, GraphQL, frontend, layering, and member-ordering conventions.
  • Add ShareThrift-specific arch-unit test suite under packages/sthrift/arch-unit-tests that consumes the shared Cellix arch test utilities.

Enhancements:

  • Relax class member ordering rules to group all instance methods and accessors together while keeping fields, constructor, static methods, and static accessors ordered.
  • Refine frontend and GraphQL resolver convention checks to enforce directory structure, naming, typing, and dependency boundaries without yet enforcing aspirational code metrics and quality thresholds.

Build:

  • Add build configuration, TypeScript config, vitest config, and scripts for the new @cellix/arch-unit-tests and @sthrift/arch-unit-tests packages and include arch coverage in the root test pipeline.

Tests:

  • Replace the previous monolithic arch-unit tests package with framework-level and app-level test suites, covering domain conventions, GraphQL resolver conventions, frontend architecture, dependency rules, naming conventions, member ordering, and placeholder code-metric/quality checks.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 27, 2026

Reviewer's Guide

Splits the generic Cellix architectural test utilities into a reusable @cellix/arch-unit-tests package and a ShareThrift-specific @sthrift/arch-unit-tests test harness, wires them into the workspace test/coverage flows, and slightly loosens the member ordering rule while updating a domain adapter to comply.

Class diagram for ConversationDomainAdapter message handling changes

classDiagram
  class MongooseDomainAdapter {
  }

  class ConversationProps {
  }

  class MessageEntityReference {
  }

  class ConversationDomainAdapter {
    - MessageEntityReference[] _messages
    + MessageEntityReference[] get messages()
    + void set messages(MessageEntityReference[] value)
    + Promise~MessageEntityReference[]~ loadMessages()
  }

  ConversationDomainAdapter --|> MongooseDomainAdapter
  ConversationDomainAdapter ..|> ConversationProps
Loading

File-Level Changes

Change Details Files
Relax member-ordering rule to treat instance methods/accessors as a single unordered group and update the supporting utility location.
  • Adjust default member order so static accessors come before a combined "instance members" group where methods and accessors are not ordered relative to each other.
  • Update the matching predicate to treat any non-static method/get/set as an instance member.
  • Move the member-ordering rule utility from the old arch-unit-tests package path into the new @cellix/arch-unit-tests utils directory and normalize comment quotes.
packages/arch-unit-tests/src/member-ordering-rule.ts
packages/cellix/arch-unit-tests/src/utils/member-ordering-rule.ts
Create a reusable @cellix/arch-unit-tests library that exposes generic checks and higher-level test-suite helpers.
  • Introduce a new package.json and tsconfig for @cellix/arch-unit-tests configured as a buildable TS library with dist exports.
  • Implement check functions for member ordering, naming conventions, circular dependencies, layered architecture, UI isolation, GraphQL resolver conventions, frontend architecture, and placeholder code metrics/quality checks.
  • Add frontend helper utilities for filesystem traversal and kebab-case validation.
  • Expose all checks and reusable describe* test-suite helpers via src/index.ts.
  • Add local vitest config and turbo.json scaffolding (empty in diff) for the new package.
packages/cellix/arch-unit-tests/package.json
packages/cellix/arch-unit-tests/tsconfig.json
packages/cellix/arch-unit-tests/src/index.ts
packages/cellix/arch-unit-tests/src/checks/member-ordering.ts
packages/cellix/arch-unit-tests/src/checks/domain-conventions.ts
packages/cellix/arch-unit-tests/src/checks/graphql-resolver-conventions.ts
packages/cellix/arch-unit-tests/src/checks/circular-dependencies.ts
packages/cellix/arch-unit-tests/src/checks/frontend-architecture.ts
packages/cellix/arch-unit-tests/src/checks/naming-conventions.ts
packages/cellix/arch-unit-tests/src/checks/code-metrics.ts
packages/cellix/arch-unit-tests/src/checks/code-quality.ts
packages/cellix/arch-unit-tests/src/utils/frontend-helpers.ts
packages/cellix/arch-unit-tests/src/test-suites/member-ordering.ts
packages/cellix/arch-unit-tests/src/test-suites/frontend-architecture.ts
packages/cellix/arch-unit-tests/src/test-suites/naming-conventions.ts
packages/cellix/arch-unit-tests/src/test-suites/code-metrics.ts
packages/cellix/arch-unit-tests/src/test-suites/code-quality.ts
packages/cellix/arch-unit-tests/vitest.config.ts
packages/cellix/arch-unit-tests/turbo.json
packages/cellix/arch-unit-tests/src/cellix.test.ts
Introduce a ShareThrift-specific @sthrift/arch-unit-tests package that consumes the generic Cellix checks and defines concrete test suites for this app.
  • Rename/move the old monorepo-level arch-unit-tests package into packages/sthrift/arch-unit-tests with updated package.json metadata and scripts wired to @cellix/arch-unit-tests.
  • Adjust its tsconfig include paths to point at cellix and sthrift source correctly from the new location.
  • Create vitest.config.ts with longer test timeout for heavier archunit runs.
  • Add ShareThrift-focused test files that call the generic @cellix/arch-unit-tests helpers to assert domain conventions, GraphQL resolver conventions, dependency rules, member ordering, naming conventions, frontend architecture, and (placeholder) code metrics/quality.
packages/sthrift/arch-unit-tests/package.json
packages/sthrift/arch-unit-tests/tsconfig.json
packages/sthrift/arch-unit-tests/vitest.config.ts
packages/sthrift/arch-unit-tests/src/domain-conventions.test.ts
packages/sthrift/arch-unit-tests/src/graphql-resolver-conventions.test.ts
packages/sthrift/arch-unit-tests/src/dependency-rules.test.ts
packages/sthrift/arch-unit-tests/src/frontend-architecture.test.ts
packages/sthrift/arch-unit-tests/src/member-ordering.test.ts
packages/sthrift/arch-unit-tests/src/naming-conventions.test.ts
packages/sthrift/arch-unit-tests/src/code-metrics.test.ts
packages/sthrift/arch-unit-tests/src/code-quality.test.ts
Wire the new arch-unit test packages into the monorepo tooling and workspace layout.
  • Remove the old packages/arch-unit-tests from pnpm-workspace and move its turbo.json to the ShareThrift-specific package.
  • Add packages/sthrift/arch-unit-tests to pnpm workspace implicitly via existing glob and add @cellix/arch-unit-tests as a devDependency of the Sthrift testing package.
  • Update root package.json scripts to introduce test:coverage:arch and include it in the aggregate test:coverage flow.
  • Simplify the Cellix arch-unit vitest config and ensure both packages have consistent node-based test setup.
pnpm-workspace.yaml
package.json
packages/arch-unit-tests/turbo.json
packages/arch-unit-tests/vitest.config.ts
packages/sthrift/arch-unit-tests/turbo.json
Minor refactor of ConversationDomainAdapter to satisfy the new member ordering convention without behavioral change.
  • Move the private _messages field to the top of the class body so it appears with other instance fields.
  • Relocate the messages accessor pair so getter and setter are grouped together while preserving their implementation (currently returning/storing an in-memory array).
packages/sthrift/persistence/src/datasources/domain/conversation/conversation/conversation.domain-adapter.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant