chore(test): add a rapid property test for the --file case and backslash rules

Open
#328 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
testing

Research direction

Read filterByFile and normalizeNarrowPath in internal/query/node.go, then the two example tests TestCalleesWithTheEndOfAFilePath and TestCalleesWithABackslashFilePath in internal/query/definitions_test.go. Use TestFileSelectionPartitionsTheUnion and the drawGraph generator as the pattern for a rapid.Check test. Done when the new property test checks that the filter keeps exactly the file-bearing nodes whose normalized path contains the normalized hint, and that case and separator changes in the hint keep the same nodes, and go test ./internal/query/ passes.

Written by the indexing model from the issue text.

Description

area:ci chore priority:low
What kind of chore?

Test infrastructure

What needs doing?

Add a rapid property test for the --file rules in filterByFile (internal/query/node.go:214). The rules ignore letter case and treat a backslash as a slash, through normalizeNarrowPath (internal/query/node.go:206).

Only two example tests cover these rules: TestCalleesWithTheEndOfAFilePath (internal/query/definitions_test.go:605) and TestCalleesWithABackslashFilePath (internal/query/definitions_test.go:624).

The property: the filter keeps a node that has a file and whose normalized path contains the normalized hint. It drops every other node. A hint that differs only in case or separators keeps the same nodes.

TestFileSelectionPartitionsTheUnion (internal/query/definitions_test.go:932) already uses rapid.Check, but it tests the partition of rows by file. It does not test the case or separator rules. The new test can reuse the graph generator drawGraph (internal/query/definitions_test.go:823).

Why now?

Each case the examples miss can drop rows from callers, callees and impact without an error. filterByFile documents that those commands use it as a hard filter (internal/query/node.go:210). A property test covers every case in the rule, not only the ones someone wrote down.

Issue #221 asks for property tests as part of its test cleanup. This change adds one test and does not change the scope of #221.

Does this touch anything load-bearing?
  • The release pipeline (release.yml, .goreleaser.yaml, signing)
  • The upgrade identity (internal/upgrade/verify.go)
  • The perf baseline (tools/bench/baseline.json)
  • The graph schema / meta-key layout
  • None of these
Before submitting
  • I searched existing issues and this is not a duplicate

🤖 Generated with Claude Code

https://claude.ai/code/session_0167DcyoD2LrY4B7TBMiVJT4

Dominant language
Go
Stars
0
Forks
0
Avg merge
5h 16m
Merged PRs (30d)
107

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from seanb4t/codegraph-go

All issues in seanb4t/codegraph-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.