Skip to content

docs(tests): correct FileNotFoundError example message in tests/AGENTS.md#1002

Closed
0xDevNinja wants to merge 1 commit intoTracer-Cloud:mainfrom
0xDevNinja:issue/828-tests-agents-fnf-message
Closed

docs(tests): correct FileNotFoundError example message in tests/AGENTS.md#1002
0xDevNinja wants to merge 1 commit intoTracer-Cloud:mainfrom
0xDevNinja:issue/828-tests-agents-fnf-message

Conversation

@0xDevNinja
Copy link
Copy Markdown
Contributor

Fixes #828.
Closes #861.

Describe the changes you have made in this PR -

tests/AGENTS.md shows a "Separation of Concerns" example whose error message contradicts the guard above it:

def extract_and_validate(input_path: str) -> str:
    if not os.path.exists(input_path):
        raise FileNotFoundError(f"empty file not present: {input_path}")

The guard fires when the file is missing, not when it is empty, so the message misleads contributors who copy the snippet as a template for their own use-case modules. This PR rewords the message to match the actual condition (f"input file not found: {input_path}") and leaves the surrounding guidance untouched.

Same fix as the duplicate report in #861, so closing that one in this PR.

Demo/Screenshot for feature changes and bug fixes -

Diff:

-        raise FileNotFoundError(f"empty file not present: {input_path}")
+        raise FileNotFoundError(f"input file not found: {input_path}")

Local quality gate (clean tree, run from make):

  • make lintAll checks passed!
  • make format-check904 files already formatted
  • make typecheckSuccess: no issues found in 391 source files
  • make test-cov3314 passed, 2 skipped, 1 xfailed

Code Understanding and AI Usage

Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?

  • No, I wrote all the code myself
  • Yes, I used AI assistance (continue below)

Explain your implementation approach:

The example sits inside tests/AGENTS.md as contributor-facing guidance for splitting pure business logic from test orchestration. The condition if not os.path.exists(input_path) is the canonical missing-file guard, so the message has to read like a missing-file message ("input file not found: ...") rather than the original empty-file phrasing. I kept the surrounding pattern, the variable name, and the anti-pattern callout intact so the doc still teaches the same separation-of-concerns lesson; only the literal message text changed.


Checklist before requesting a review

  • I have added proper PR title and linked to the issue
  • I have performed a self-review of my code
  • I can explain the purpose of every function, class, and logic block I added
  • I understand why my changes work and have tested them thoroughly
  • I have considered potential edge cases and how my code handles them
  • If it is a core feature, I have added thorough tests
  • My code follows the project's style guidelines and conventions

…S.md

The example raises `FileNotFoundError("empty file not present: ...")`
but the guard above it is `if not os.path.exists(input_path)`, which
fires when the file is missing — not when it is empty. Update the message
to match the actual condition so contributor-facing guidance reads true.

Fixes Tracer-Cloud#828.
Closes Tracer-Cloud#861.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR corrects a misleading error message in the tests/AGENTS.md "Separation of Concerns" example: the FileNotFoundError text previously said "empty file not present" despite the guard checking for a missing file, not an empty one. The message is now "input file not found: {input_path}", which accurately reflects the os.path.exists condition and gives contributors a correct template to copy.

Confidence Score: 5/5

Safe to merge — one-line documentation correction with no functional impact.

The change is a single error-message string in a documentation/example file. It corrects an inaccurate description to match the actual guard condition; there are no logic changes, no new code paths, and no risk to runtime behaviour. All remaining findings are P2 or lower, so the score is 5.

No files require special attention.

Important Files Changed

Filename Overview
tests/AGENTS.md Single-line error message corrected from "empty file not present" to "input file not found" to accurately match the os.path.exists guard above it; no logic or structure changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["extract_and_validate(input_path)"] --> B{os.path.exists?}
    B -- "False (file missing)" --> C["raise FileNotFoundError\n'input file not found: {input_path}'"]
    B -- "True" --> D["return data"]
Loading

Reviews (1): Last reviewed commit: "docs(tests): correct FileNotFoundError e..." | Re-trigger Greptile

@hamzzaaamalik
Copy link
Copy Markdown
Collaborator

Heads up that #1004 was opened ~1 hour after this one and is fixing the same line. Your wording ("not found") feels more idiomatic to me, matching the FileNotFoundError convention, but happy to defer. cc @davincios / @VaibhavUpreti for the call on which one to merge.

@VaibhavUpreti
Copy link
Copy Markdown
Member

this has beed fixed, closing this @0xDevNinja @hamzzaaamalik

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.

Fix misleading FileNotFoundError example in tests/AGENTS.md Fix the misleading FileNotFoundError example in tests/AGENTS.md

3 participants