Skip to content

Update CLAUDE.md around tests and recurring bad habits - #114703

Merged
alexey-milovidov merged 2 commits into
masterfrom
claude-md-tests-and-habits
Aug 14, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
claude-md-tests-and-habits

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Adds three notes to .claude/CLAUDE.md:

  • Do not use try/catch to fall back to a less-optimized case; let exceptions propagate.
  • Prefer functional (.sql/.sh) tests over unit (gtest) tests whenever possible.
  • Throwaway scripts used to test changes in CI do not need to be committed.

Split out of #114675 so that the documentation change is reviewed separately from the removal of ci/tests.

Related: #114675

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Version info

  • Merged into: 26.8.1.1387 (included in 26.8 and later)

alexey-milovidov and others added 2 commits August 13, 2026 22:59
Add three notes to `.claude/CLAUDE.md`: do not use try/catch to fall back
to a less-optimized path, prefer functional tests over `gtest` unit tests,
and throwaway CI-testing scripts do not need to be committed.

Split out of #114675

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Carries over the suggestions applied in
#114675

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
alexey-milovidov added a commit that referenced this pull request Aug 13, 2026
The `.claude/CLAUDE.md` notes are split out into
#114703 so that this pull
request only removes `ci/tests`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8f6c799]

Summary: ✅


AI Review

Summary

This PR adds three contributor/agent-instruction notes to .claude/CLAUDE.md. Two of the new notes are consistent with the existing repo guidance, but the new sentence about CI-script tests is incorrect against the current tree: the repository still has a dedicated CI Tests job and a nontrivial ci/tests/ suite, so the wording would discourage committing regression tests where they are in fact supported.

Findings

⚠️ Majors

  • [.claude/CLAUDE.md:190] The new guidance says CI-script throwaway tests never need to be committed because "we don't have automated CI tests", but the repo currently defines a dedicated CI Tests job (ci/defs/job_configs.py:203, ci/defs/defs.py:431) over ci/tests/, and that job still runs pytest ci/tests/ (ci/jobs/ci_tests_job.py:31-57). That makes the instruction false today and pushes contributors away from adding durable regression coverage for CI changes. Suggested fix: narrow this to temporary one-off probes only, or explicitly carve out reusable ci/tests/ regression tests that should still be committed.
Final Verdict

⚠️ Request changes

Fix the CI-testing sentence so it matches the current repository and does not discourage checked-in regression tests for CI changes.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 13, 2026
Comment thread .claude/CLAUDE.md

Prefer functional (.sql/.sh) tests over unit (gtest) tests whenever possible. Unit tests are larger, too specific, and they are difficult to maintain.

When you want to test changes in the CI scripts, you can write and run a throwaway test, but you don't need to commit it to the repository, because we don't have automated CI tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new rule says CI-script throwaway tests never need to be committed because "we don't have automated CI tests", but the current tree still has a dedicated CI Tests job (ci/defs/job_configs.py:203, ci/defs/defs.py:431) and a checked-in ci/tests/ suite that the job runs via pytest ci/tests/ (ci/jobs/ci_tests_job.py:31-57).

That makes the statement false today, and it pushes contributors away from adding durable regression coverage for CI changes even though the infrastructure exists. I think this should be narrowed to one-off local probes, or explicitly say that reusable ci/tests/ regressions should still be committed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe we have a few authentic tests, but I want to prevent dumping our "proof of work" there.

@alexey-milovidov alexey-milovidov self-assigned this Aug 14, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 14, 2026
Merged via the queue into master with commit 6c53bb4 Aug 14, 2026
182 checks passed
@alexey-milovidov
alexey-milovidov deleted the claude-md-tests-and-habits branch August 14, 2026 04:29
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 14, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Aug 17, 2026
Master removed ci/tests/test_log_parser.py in
ClickHouse#114675 ("Remove unit tests for CI
scripts"), which produced a modify/delete conflict against the test file this
branch extends. That pull request deleted 71 files under ci/tests and then
restored 39 of them over the following two days, each restore commit naming the
criterion: coverage that is the only focused guard for a still-live CI job or
merge gate. test_log_parser.py was not among the restored files and was not
raised in that pull request's review, so this merge honours the deletion instead
of reinstating it, and the branch now changes only
ci/jobs/scripts/log_parser.py.

The parser change itself is unaffected: master has not touched log_parser.py
since cf2cfec (2026-08-05), which this branch already merged, so the file
is byte-identical to the previously reviewed version.

The 18 assertions the deleted file carried were kept as a throwaway harness and
run against the merged tree, per the guidance added in
ClickHouse#114703 that CI script changes may
be validated with a throwaway test rather than a committed one. All 18 pass, and
each of the five behaviours this branch introduces was confirmed still pinned by
reverting it in turn: stripping the captured query id, bypassing the anchored
server pattern, applying it unconditionally, scanning for the format string with
the unanchored pattern, and dropping the query id passed to get_failed_query.
Every one reddens the corresponding assertion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants