docs(claude+tests): codify test-comment and Symfony-defer practices#74
Merged
Conversation
Each test method now opens with a single-line "Tests …", "Ensures …", or "Verifies …" comment naming what the test asserts. The convention mirrors the comments added to the catalogue PR's new test files and applies the same treatment to every test method that pre-dated it. Pure documentation change — no test logic touched, no assertions added or removed. `task test` and `task coding-standards-check` green. The existing block-level docblock on KernelTest is kept and the one-line comment sits beneath it; both audiences (skim-readers and people chasing the "why") are served. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Martin Yde Granath <yde001@gmail.com>
…ntion Carves a new top-level "Coding practices" section in CLAUDE.md and moves the existing "Controllers stay thin" and "Service classes are fully documented" subsections under it. Adds a third subsection codifying the one-line `// Tests …` / `// Ensures …` / `// Verifies …` comment convention that this PR applies across the suite. The split separates two kinds of rule: - "Coding standards" stays the home for mechanically-enforced formatting (php-cs-fixer, twig-cs-fixer, prettier, markdownlint) plus the "Tests are not modified without approval" policy gate. - "Coding practices" collects style conventions humans and agents follow on top of the linters — what a controller, service, or test method looks like in this codebase. The "Tests are not modified" rule stays in "Coding standards" because it's a policy / process gate (enforced via the `guard-tests.sh` hook discussion in earlier sessions), not a style convention. The new "Test methods carry a one-line intent comment" rule is purely a style convention and lives in "Coding practices". Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Martin Yde Granath <yde001@gmail.com>
Adds a new "Defer to symfony.com/doc when implementing Symfony features" subsection under Coding practices. When an agent (or a human) adds or changes functionality that sits on top of a Symfony component — controllers, routing, security, forms, validation, Doctrine integration, console commands, messenger, mailer, translation, asset mapping, Twig extensions, etc. — the rule is to open the relevant chapter on symfony.com/doc first and follow the documented approach. Three operational sub-rules: - When the docs offer multiple paths, pick the one that matches what's already in this codebase. - When nothing comparable exists yet, prefer the most recent idiom shown in the docs (attribute-driven, autoconfigured, autowired). - Cite the relevant doc URL in the PR description for any change that introduces a Symfony-component idiom for the first time. Keeps the code in step with the framework instead of drifting into bespoke shapes that look reasonable but miss built-in conventions. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Martin Yde Granath <yde001@gmail.com>
This was referenced Jun 18, 2026
tuj
previously approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Links to issues
No issue — follow-up to the comment style introduced in
PR #72, bringing every
other test method in the project under the same convention.
Description
Adds a single-line
// Tests …,// Ensures …, or// Verifies …comment above every test method that didn't already have one. Each
comment names what the test asserts so a reader can scan a test
file's table of contents without reading the bodies.
Touches every test file in the project:
tests/Integration/Command/UserChangePasswordCommandTest.phptests/Integration/Command/UserCreateCommandTest.phptests/Integration/Controller/AssistantControllerTest.phptests/Integration/Controller/FrontpageControllerTest.phptests/Integration/Controller/SecurityControllerTest.phptests/Integration/Repository/AssistantRepositoryTest.phptests/Integration/Repository/UserRepositoryTest.phptests/Integration/Security/UserManagerTest.phptests/Integration/SmokeTest.phptests/Unit/DataFixtures/AssistantFixturesTest.phptests/Unit/DataFixtures/UserFixturesTest.phptests/Unit/Entity/AssistantTest.phptests/Unit/Entity/UserTest.phptests/Unit/KernelTest.phptests/Unit/Twig/DevTemplateMarkerExtensionTest.phptests/Unit/Twig/DevTemplateMarkerNodeVisitorTest.phpThe existing block-level docblock on
KernelTestis kept and thenew one-liner sits beneath it. The docblock explains why the
override matters; the new line names what the test verifies.
Both audiences (skim-readers and people chasing rationale) are
served.
Screenshot of the result
N/A — documentation comments only, no rendered output changes.
Checklist
If your code does not pass all the requirements on the checklist you have to add a comment explaining why this change
should be exempt from the list.
Additional comments or questions
task test→ 48 tests, 172 assertions pass.task coding-standards-check→ green.Pure documentation change — no test logic, assertions, or
production code touched. The "covered by test cases" box stays
ticked because the tests themselves are the tests; the comment
addition doesn't introduce any new untestable code.
The five test files added on
PR #72
(
QueryStringListTest,PageMetadataTest,CatalogCriteriaTest,AssistantCatalogControllerTest, and the methods added toAssistantRepositoryTestthere) already follow this convention —they were the trigger for adopting it project-wide.
Details - AI specificities
Goal and motivation
the convention emerged of opening each test method with a
one-line
// Tests …/// Ensures …/// Verifies …comment.This PR backfills the same convention across every other test
file already on
developso the project reads consistently fromhere on.
Scope
production code touched. No fixtures touched.
Non-goals
paraphrase the existing method name in plainer prose — that's
deliberate; the comment is for a reader scanning the file, not a
rename trigger.
comments only. Where a block docblock already exists
(
KernelTest), it stays and the one-liner sits beneath it.Conventions applied
// Tests …,// Ensures …, or// Verifies …. The verb choice is unbinding — pick whicheverreads most naturally for the assertion in question.
public function test…declaration.Areas needing scrutiny
the same assertions it did before.
Follow-up work intentionally out of scope
convention applied; future additions only need to follow it.
Related
the convention; the test files added on that branch already
follow it.