Skip to content

feat(config): repo/path-scoped test-coverage instructions for e2eTests generation #4200

Description

@JSONbored

Part of #4189. Depends on #4190. Feeds into #4191 (the prompt builder consumes these instructions directly).

Context

CodeRabbit's own test-generation config isn't a framework dropdown — it's free-text path_instructions attached to glob patterns in .coderabbit.yaml (e.g. "use vitest for **/*.ts," "use React Testing Library for component dirs"), which CodeRabbit says "become part of CodeRabbit's context for future test generation." Maintainers here have the same need: test-coverage expectations vary per repo and per path (e.g. "always test the payment-failure retry path, not just the happy path" for a checkout module), and that guidance needs to be config-as-code, not something re-typed into every @gittensory generate-tests invocation.

This is additive to #4190's plain features.e2eTests: true/false toggle — a boolean can't hold free-text instructions, so this issue adds a richer config surface alongside it, following the exact same global-default → per-repo-override precedence already established for every other .gittensory.yml block (src/selfhost/private-config.ts).

Requirements

  • Add a review.e2eTestGeneration config block: a repo-wide free-text instructions string, plus an optional pathInstructions: [{ path: string, instructions: string }] list for glob-scoped rules — mirroring the shape (not necessarily the exact key names) of CodeRabbit's path_instructions.
  • Global default in config/examples/global.gittensory.yml, per-repo override in config/examples/repo-override.gittensory.yml, public schema documented in .gittensory.yml.example — same three-file pattern feat(review): register e2eTests as the sixth converged-feature key #4190 already establishes for features:.
  • Array-vs-object merge semantics must follow the existing convention: array fields (pathInstructions) REPLACE the global default wholesale when a per-repo file sets them, never concatenate (see the existing wantedPaths precedent in config/examples/repo-override.gittensory.yml).
  • Parse and validate path-instruction globs the same way other path-glob config is validated elsewhere in the codebase (reuse existing glob-matching utilities — do not add a second glob engine).
  • Feed the resolved instructions (repo-wide + any path-instructions matching the PR's changed files) into feat(review): LLM core to turn a PR diff into Playwright E2E test source #4191's prompt builder as a distinct, clearly-labeled prompt section, analogous to how buildTestEvidencePromptSection already isolates test-related context.
  • Cap total instruction text length fed into the prompt (defense against a maintainer accidentally pasting megabytes of text, and keeps feat(review): LLM core to turn a PR diff into Playwright E2E test source #4191's prompt-size cap meaningful).

Deliverables

  • review.e2eTestGeneration.instructions + pathInstructions parsed from .gittensory.yml with the standard global/per-repo precedence.
  • Public + self-host config examples updated.
  • Wired into feat(review): LLM core to turn a PR diff into Playwright E2E test source #4191's prompt builder as its own section.
  • Unit tests: repo-wide instructions apply to every generation; path-scoped instructions apply only when the PR touches a matching path; a per-repo file with no pathInstructions set inherits the global default's list (not an empty one) per the standard deep-merge rule; a per-repo file that DOES set pathInstructions replaces the global list wholesale.

Expected outcome

A maintainer can steer what "good test coverage" means for their repo (or a specific area of it) once, in config, and every future generation — whether auto-triggered or explicitly commanded — respects it, the same way CodeRabbit's path_instructions work today.

Resources / examples

  • CodeRabbit's path_instructions: https://docs.coderabbit.ai/configuration/path-instructions
  • config/examples/global.gittensory.yml, config/examples/repo-override.gittensory.yml, .gittensory.yml.example (the three-file pattern to extend)
  • src/services/ai-review.ts:823 (buildTestEvidencePromptSection — the pattern for isolating a labeled context section in the prompt)

Effort

M — config parsing follows established patterns; the prompt-integration and glob-matching-reuse parts need care.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.orbGittensory Orb related - maintainer self-hosting analytics.roadmapOn the Wave-2 agent-layer roadmap board (project 9)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions