Skip to content

docs(#6197): document Fn suffix convention for injectable function variables - #6200

Open
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/6197-doc-fn-suffix-convention
Open

docs(#6197): document Fn suffix convention for injectable function variables#6200
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/6197-doc-fn-suffix-convention

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Documents the XxxFn suffix naming convention for injectable function variables (test seams) in docs/contributing/go-code.md. This convention has 9+ consistent instances across internal/sandbox/ and internal/dispatch/cf/ but was previously undocumented, causing agents to infer it from code patterns rather than referencing written guidance.

Changes

  • Added "Injectable function variables (test seams)" section to docs/contributing/go-code.md after the "Concurrency testing" section
  • Documents four rules: Fn suffix, default to real implementation, "Override in tests to..." doc comment pattern, and t.Cleanup restoration
  • References real examples (RetrySleepFn, BuildWASMFn, CopyWASMExecFn)

Testing

  • Documentation-only change — no Go code modified
  • Referenced example files verified to exist
  • Secret scan passed
  • Gitlint passed

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • I wrote this contribution myself and can explain all changes in it

Closes #6197

Post-script verification

  • Branch is not main/master (agent/6197-doc-fn-suffix-convention)
  • Secret scan passed (gitleaks — ed0deb850458a4eb2107b51298a569c7503295db..HEAD)
  • PR body secret scan passed (gitleaks — no-git)

…riables

Add an "Injectable function variables (test seams)" section to
docs/contributing/go-code.md documenting the naming and usage
convention for package-level function variables used as test
seams. The convention (XxxFn suffix, default to real impl, doc
comment pattern, t.Cleanup restoration) has 9+ instances with
zero violations but was previously undocumented, causing agents
to infer the pattern from code rather than referencing written
guidance.

Note: pre-commit could not run in sandbox (network restriction).
Manual verification of pre-commit is required.

Closes #6197
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner August 13, 2026 18:06
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Agent PR ready for human review label Aug 13, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 13, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:07 PM UTC · Completed 6:19 PM UTC

Commit: 1365be4 · View workflow run →

@github-actions

Copy link
Copy Markdown

Site preview

Preview: https://4e50ca7e-site.fullsend-ai.workers.dev

Commit: 1365be489a6074ab8a59563d36e00e55fec3ea62

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [accuracy] docs/contributing/go-code.md:165 — The doc comment requirement says comments must "start with 'Override in tests to...'" but every cited example in the codebase follows a different pattern: they start with the variable name per Go convention, then include "Override in tests to..." as a later sentence. For example, RetrySleepFn's comment is: "RetrySleepFn is the function called between retry attempts in CreateWithRetry. It defaults to time.Sleep. Override in tests to avoid real delays." The phrasing "starting with" is inaccurate relative to the codebase's own examples.
    Remediation: Change "Include a doc comment starting with 'Override in tests to...'" to "Include a doc comment following Go convention (starting with the variable name) that contains an 'Override in tests to...' sentence describing the override behavior."

Low

  • [stale-reference] docs/contributing/go-code.md:163 — The documentation states that injectable function variables must use an XxxFn suffix (capitalized/exported), but internal/sandbox/gateway_endpoint.go has resolveOverrideFn (lowercase/unexported) that also serves as a test seam following the same pattern. The documented convention does not account for unexported test seams.
    Remediation: Add a note that this convention applies to exported/newly-introduced test seams, or clarify that lowercase xxxFn variables are a legacy pattern.

Labels: PR modifies documentation under docs/contributing/ about Go code conventions

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the review comment for full details.

Package-level variables that hold function values for test overriding must:

- Use an `XxxFn` suffix (e.g., `BuildWASMFn`, `RetrySleepFn`, `WranglerWhoamiFn`)
- Default to the real implementation

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] accuracy

The doc comment requirement says comments must 'start with "Override in tests to..."' but every cited example in the codebase follows a different pattern: they start with the variable name per Go convention, then include 'Override in tests to...' as a later sentence. The phrasing 'starting with' is inaccurate relative to the codebase's own examples.

Suggested fix: Change 'Include a doc comment starting with "Override in tests to..."' to 'Include a doc comment following Go convention (starting with the variable name) that contains an "Override in tests to..." sentence describing the override behavior.'

## Injectable function variables (test seams)

Package-level variables that hold function values for test overriding must:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] stale-reference

The documentation states that injectable function variables must use an XxxFn suffix (capitalized/exported), but internal/sandbox/gateway_endpoint.go has resolveOverrideFn (lowercase/unexported) that also serves as a test seam following the same pattern. The documented convention does not account for unexported test seams.

Suggested fix: Add a note that this convention applies to exported/newly-introduced test seams, or clarify that lowercase xxxFn variables are a legacy pattern.

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment documentation component/docs User-facing documentation labels Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/docs User-facing documentation documentation ready-for-review Agent PR ready for human review requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document Fn suffix convention for injectable function variables in go-code.md

0 participants