[PR #692] [MERGED] fix(reference): classify test suffixes before extensions #2173

Closed
opened 2026-10-16 21:15:12 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/692
Author: @kaoru0822-kitauji
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/reference-test-stems


📝 Commits (1)

  • 8b228ae fix(reference): classify test suffixes before extensions

📊 Changes

3 files changed (+167 additions, -1 deletions)

View changed files

📝 src/domain/referenceSourceClassification.ts (+2 -1)
➕ src/domain/referenceSourceTestClassification.test.ts (+60 -0)
➕ tests/boundary/filesystem/referenceSourceTestFilenames.test.ts (+105 -0)

📄 Description

Summary

Recognize test suffixes before the filename extension in historical-source inventories.

No separate issue: this is a reproduced filename-classification defect.

Problem and expected behavior

main_test.go and main_test.py are imported with only the source tag, while test_main.py and main.test.js already receive test. The suffix branch checks _test/_spec against the whole filename, so it misses ordinary extension-bearing test names. Go's test command documentation explicitly identifies *_test.go files.

Change and scope

Apply the existing suffix heuristic to the final basename stem as well. Preserve all existing prefix, dotted-marker, whole-filename suffix and case-insensitive rules.

This is filename classification, not proof that a test runner will execute the file. Language detection and other classifications remain unchanged. The change is independent of #665's manifest correction; both patches were also tested together.

Contract and boundary impact

  • Semantic owner: reference-source filename classification.
  • CLI/MCP: affected existing inventory entries gain the test tag; no schemas or tool changes.
  • Provider/platform: unchanged; POSIX source paths remain the input contract.
  • Evidence/provenance: original paths, hashes, sizes, languages, parse failures and unknown dependencies remain intact. Content-derived graph identifiers may change with corrected classifications.
  • Process/authorization/cleanup: source is only read and parsed, never executed.
  • Generated metadata/package: unchanged.

Evidence and regression coverage

On unchanged main b6c21b1, the new suites have 16 failing tests and 22 passing controls. The public import regression also demonstrates the absent test tags while preserving exact file hashes and parser uncertainty.

Coverage includes extension-bearing and extensionless suffixes, case variants, final-extension handling, existing rules, near-name negatives, secondary classifications, and public import output.

Validation performed

  • Seven focused classification, import, graph, parser and source-to-bundle suites: 67 tests passed.
  • npm run check: all five tasks passed (93 existing lint warnings, no errors); changed-file lint is clean.
  • npm run jscpd, npm run scan:todos, and git diff --check: passed.
  • Combined #665 + this patch: 59 focused tests passed in a separate tree.
  • Independent review completed before publication with no blocking findings.

Node.js 24.19.0, npm 11.9.0, exact current locked dependencies. Hosted CI is tracked separately; no full local suite pass is claimed.

Compatibility, safety, and release

No new classification vocabulary, schema, packaging or provider behavior. Package-install and real Hopper/Ghidra lanes were not rerun for this filename-only correction.

Prepared with AI assistance.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/692 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/reference-test-stems` --- ### 📝 Commits (1) - [`8b228ae`](https://github.com/morluto/rea/commit/8b228ae7010144b69a243c9682aeb0a1dc4249a3) fix(reference): classify test suffixes before extensions ### 📊 Changes **3 files changed** (+167 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/referenceSourceClassification.ts` (+2 -1) ➕ `src/domain/referenceSourceTestClassification.test.ts` (+60 -0) ➕ `tests/boundary/filesystem/referenceSourceTestFilenames.test.ts` (+105 -0) </details> ### 📄 Description ## Summary Recognize test suffixes before the filename extension in historical-source inventories. No separate issue: this is a reproduced filename-classification defect. ## Problem and expected behavior `main_test.go` and `main_test.py` are imported with only the `source` tag, while `test_main.py` and `main.test.js` already receive `test`. The suffix branch checks `_test`/`_spec` against the whole filename, so it misses ordinary extension-bearing test names. Go's [test command documentation](https://pkg.go.dev/cmd/go#hdr-Test_packages) explicitly identifies `*_test.go` files. ## Change and scope Apply the existing suffix heuristic to the final basename stem as well. Preserve all existing prefix, dotted-marker, whole-filename suffix and case-insensitive rules. This is filename classification, not proof that a test runner will execute the file. Language detection and other classifications remain unchanged. The change is independent of #665's manifest correction; both patches were also tested together. ## Contract and boundary impact - Semantic owner: reference-source filename classification. - CLI/MCP: affected existing inventory entries gain the `test` tag; no schemas or tool changes. - Provider/platform: unchanged; POSIX source paths remain the input contract. - Evidence/provenance: original paths, hashes, sizes, languages, parse failures and unknown dependencies remain intact. Content-derived graph identifiers may change with corrected classifications. - Process/authorization/cleanup: source is only read and parsed, never executed. - Generated metadata/package: unchanged. ## Evidence and regression coverage On unchanged main `b6c21b1`, the new suites have 16 failing tests and 22 passing controls. The public import regression also demonstrates the absent test tags while preserving exact file hashes and parser uncertainty. Coverage includes extension-bearing and extensionless suffixes, case variants, final-extension handling, existing rules, near-name negatives, secondary classifications, and public import output. ## Validation performed - Seven focused classification, import, graph, parser and source-to-bundle suites: 67 tests passed. - `npm run check`: all five tasks passed (93 existing lint warnings, no errors); changed-file lint is clean. - `npm run jscpd`, `npm run scan:todos`, and `git diff --check`: passed. - Combined #665 + this patch: 59 focused tests passed in a separate tree. - Independent review completed before publication with no blocking findings. Node.js 24.19.0, npm 11.9.0, exact current locked dependencies. Hosted CI is tracked separately; no full local suite pass is claimed. ## Compatibility, safety, and release No new classification vocabulary, schema, packaging or provider behavior. Package-install and real Hopper/Ghidra lanes were not rerun for this filename-only correction. Prepared with AI assistance. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:15:12 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2173
No description provided.