Skip to content

docs: record the test-secret convention in the project guidelines - #6658

Open
mzxchandra wants to merge 1 commit into
stagingfrom
docs/test-secret-convention
Open

docs: record the test-secret convention in the project guidelines#6658
mzxchandra wants to merge 1 commit into
stagingfrom
docs/test-secret-convention

Conversation

@mzxchandra

Copy link
Copy Markdown
Contributor

Summary

Records the convention this repo's tests already follow for credential-shaped fixtures, plus the part that was not written down anywhere.

Split out of #6650, where it was unrelated to the connector work.

Why

Secret scanning reads every commit in a PR, not the final tree. A fixture that merely looks like a real credential fails CI, and it keeps failing after you remove it — because the commit that introduced it is still in the branch history. Clearing it costs a history rewrite and a force-push.

That happened on #6650: a test built a fake session token out of a real JWT header segment. The value was inert and never a live credential, but it read as one to the scanner, and removing it in a later commit did not clear the check.

What it says

The existing convention, which seven test files already follow:

/** Obvious non-secret so credential scanners do not flag these fixtures. */
const PLACEHOLDER_PASSWORD = 'not-a-real-password'

And the rule that was missing: never build a fixture out of a real credential's structure. When a test needs a value with internal structure, keep the structure it actually exercises and make everything else unmistakably fake.

The paragraph describes those shapes rather than quoting one, since a document warning about credential-shaped literals is a poor place to leave one.

Test plan

  • Documentation only, no code paths touched

Secret scanning reads every commit in a PR, not the final tree, so a fixture
that merely looks like a real credential fails CI and keeps failing until the
commit that introduced it is rewritten out of the branch history. That is an
expensive lesson to learn per-person, and it was learned the expensive way.

Writes down what the existing tests already do - a named PLACEHOLDER_ constant
with an obviously-fake value and the TSDoc line seven test files already carry
- and the part that was not written down anywhere: never build a fixture out
of a real credential's structure, because a JWT header segment or a plausible
base64 blob reads as a live secret to the scanner.

The paragraph describes those shapes rather than quoting one, since a document
warning about credential-shaped literals is a poor place to leave one.
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 13, 2026 5:07am

Request Review

@cursor

cursor Bot commented Aug 13, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation-only change to CLAUDE.md; no runtime, API, or test code paths are modified.

Overview
Adds a Test Secrets subsection under Testing in CLAUDE.md, documenting conventions that several tests already follow but were not written down in project guidelines.

The new text explains that secret scanning evaluates every commit in a PR, not only the final tree, so removing a bad fixture later still leaves CI red until that commit is rewritten out of branch history. It standardizes naming and TSDoc for obvious placeholders (e.g. PLACEHOLDER_PASSWORD with 'not-a-real-password') and extends the rule to tokens and keys with clearly fake values.

It also adds the missing rule: do not build fixtures from real credential structure (JWT header segments, common key prefixes, plausible base64 blobs). When structure matters for the test, keep only what the test exercises and make the rest unmistakably fake—and the doc describes those shapes without embedding literal examples.

Reviewed by Cursor Bugbot for commit c3fe57d. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds project guidance for credential-shaped test fixtures to prevent false-positive secret-scanning failures.

  • Documents the established placeholder-password declaration and comment.
  • Recommends unmistakably fake token and key values.
  • Warns against reproducing realistic credential structures in fixtures.

Confidence Score: 5/5

The documentation-only change appears safe to merge.

The added guidance matches established placeholder patterns and introduces no runtime, build, security, or public-contract failure.

Important Files Changed

Filename Overview
CLAUDE.md Documentation-only addition accurately records safe test-secret fixture conventions without changing runtime behavior.

Reviews (1): Last reviewed commit: "docs: record the test-secret convention ..." | Re-trigger Greptile

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