Skip to content

docs: add rules for deciding what to test - #2816

Merged
Quick104 merged 1 commit into
mainfrom
docs/test-guidance
Oct 21, 2026
Merged

Quick104 merged 1 commit into
mainfrom
docs/test-guidance

Conversation

@Quick104

@Quick104 Quick104 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

CONTRIBUTING.md tells every change to add a test that fails before the fix, and docs/ai-contributions.md says to add tests for changed behavior. Nothing says what not to test. Coding agents, which write most changes here, take that literally: they add a test for every change and repeat it at every layer. Go and web test code reached about 876,000 lines, as large as the production Go code, and much of it catches nothing while adding CI time and slowing every change. This change gives contributors and agents rules for when a test earns its place.

Approach

  • CONTRIBUTING.md gets a "Decide what to test" section. Add or extend a test for security and authority, data integrity, public contracts, failure handling, and logic with real edge cases, and for bug fixes in those areas. Skip tests elsewhere. Keep the tests you add cheap: test a behavior once in the package that owns it, write one case per branch, assert outcomes rather than incidental detail, don't scan source files for strings or assert that a fake received the test's own inputs, don't wait on the real clock, and name any Postgres test in a CI list or don't write it. Step 4 of "Prepare a focused change" now points to that section instead of asking for a test on every change.
  • AGENTS.md gets a short "Tests" section with the same rules, since agents read it first.
  • docs/ai-contributions.md drops the blanket "add tests for changed behavior" and names the pattern agents fall into.
  • The PR template gets one checklist line.

The rules come from what the test-suite audit in #2817 found most often among low-value tests: tests that only echo a fake, the same behavior tested at several layers and on both /api/v1 and /api/v2, pins on SQL statements, copy, or CSS, Postgres and Redis tests that no CI job runs, and retry tests that sleep through real backoff. silo-android's AGENTS.md already has a narrower rule of this kind.

Validation

  • make verify-local-paths: passes.
  • Documentation only; no code or tests change.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-2816/

Risks

Reviewers and agents will ask for fewer tests than before. The rules still require tests for security, data integrity, public contracts, and failure handling.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code, run inside T3 Code
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated; the maintainer reviews before merge
  • Adversarial review: n/a

🤖 Generated with Claude Code

@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 21, 2026
@silo-kody

silo-kody Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 1 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers

@silo-triage silo-triage Bot added documentation Improvements or additions to documentation priority: P2 Limited scope, workaround exists, or polish labels Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b30105fc-fff3-421e-a884-cd7dc24f4cdc
📥 Commits

Reviewing files that changed from the base of the PR and between c9082ba and b41b138.

📒 Files selected for processing: 4
  • .github/PULL_REQUEST_TEMPLATE.md
  • AGENTS.md
  • CONTRIBUTING.md
  • docs/ai-contributions.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The PR adds criteria for deciding when to add or remove tests. It also aligns agent guidance, AI contribution instructions, and the pull request checklist with those criteria.

Changes: Testing Guidance

Layer / File(s) Summary
Define testing criteria
CONTRIBUTING.md, AGENTS.md
The guidance covers when tests are needed, test scope and assertions, redundant tests, and database requirements.
Apply testing criteria
docs/ai-contributions.md, .github/PULL_REQUEST_TEMPLATE.md
The AI contribution guidance refers to the testing criteria, and the pull request checklist requires added tests to follow them.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: blurbery, darthshadow

Merge Risk: ⚪ Minimal · up to b41b1

The documentation-only change is safe to merge; its linked testing guidance is already consistent.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding rules for deciding what to test.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description directly explains the documentation changes that define rules for deciding when tests should be added, updated, or omitted.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread AGENTS.md
received the test's own inputs.
- A new test that needs Postgres goes in `scripts/ci/db-contracts.txt` (or `db-pins.txt` for a
query budget) in the same change, or isn't written; CI skips database tests no list or job
selects. CI has no Redis, so don't add tests that need one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

The blanket prohibition on Redis-dependent tests in AGENTS.md conflicts with rule 22, which requires Go lookup query-count regression tests through production handlers backed by real PostgreSQL and Redis. Restrict the prohibition to CI jobs without Redis and explicitly preserve those integration tests.

Also found in:

  • CONTRIBUTING.md:178-178

Kody rule violation: Batch scoped Go lookups and bound dependency fan-out

selects. Keep Redis-dependent tests separate from CI jobs without Redis, but pin Go lookup
query-count regressions through production handlers backed by real PostgreSQL and Redis.
Prompt for LLM

File AGENTS.md:

Line 207:

The blanket prohibition on Redis-dependent tests in AGENTS.md conflicts with rule 22, which requires Go lookup query-count regression tests through production handlers backed by real PostgreSQL and Redis. Restrict the prohibition to CI jobs without Redis and explicitly preserve those integration tests.

**Also found in:**
- `CONTRIBUTING.md:178-178`

Suggested Code:

  selects. Keep Redis-dependent tests separate from CI jobs without Redis, but pin Go lookup
  query-count regressions through production handlers backed by real PostgreSQL and Redis.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this as written. No CI job runs Redis, so a test that needs a live Redis never runs in CI, which is why the section says not to add one. Query-count regressions still have a CI home: they go in scripts/ci/db-pins.txt, which the Go DB pins job runs against Postgres, and the CONTRIBUTING.md bullet names that list. The Redis half of the Kody rule cannot be met in CI as it is set up today.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed—my suggestion was not actionable with the current CI setup. Requiring live Redis would add tests that CI never runs, while query-count regressions already have a CI path through scripts/ci/db-pins.txt against Postgres.

I withdraw the suggested documentation change. The mismatch is in the Kody rule’s Redis requirement, not this PR. If you’d like, I can propose a rule update that preserves query-count regression coverage without requiring Redis where CI does not provide it.

@Quick104 Quick104 mentioned this pull request Oct 21, 2026
3 tasks done
@Quick104
Quick104 merged commit 784f2e4 into main Oct 21, 2026
20 checks passed
@Quick104
Quick104 deleted the docs/test-guidance branch October 21, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant