Skip to content

fix(search): reject unknown --family values and flags with no value - #4

Merged
NullLabTests merged 1 commit into
NullLabTests:mainfrom
EmergentTechGroup:fix/search-family-validation
Dec 1, 2026
Merged

NullLabTests merged 1 commit into
NullLabTests:mainfrom
EmergentTechGroup:fix/search-family-validation

Conversation

@EmergentTechGroup

Copy link
Copy Markdown
Contributor

What was wrong

scripts/search.ts (npm run search) is the duplicate check the ontology proposal template points to. It matched --family verbatim against the family ids and didn't check flag values:

  • npm run search -- message --family action (singular) printed "No matching elements." The valid id is actions, so the search couldn't match anything. That reads as "this concept isn't in the table", which is exactly the wrong answer for a duplicate check.
  • --family Actions failed the same way, because the comparison was case-sensitive.
  • --family or --symbol with no value, --family --list, or --symbol= either swallowed the next flag or silently listed all 115 elements.

What changed

  • The family is lower-cased and checked against FAMILY_IDS. An unknown family exits 1 with Unknown family "action". Expected one of: objects, properties, actions, interfaces, intelligence, rules.
  • --family/--symbol with a missing or empty value exits 1 with Missing value for --family (or --symbol).
  • --help lists the valid families.
  • New test/search.test.ts (8 cases) runs the real script with node --import tsx and checks exit codes, stdout and stderr.
  • Added the new test to the README test inventory (test/project.test.ts requires it) and an Unreleased → Fixed entry to the CHANGELOG.

There are no dependency changes, and valid searches behave exactly as before.

How it was verified

  • npm run ci passes locally on Node 24: validate, coverage, lint (biome), type-check, 414/414 tests, build, examples and the eval self-check.
  • Running the new tests against the old scripts/search.ts gives 6 failures (case-insensitive family, unknown family, and the four missing-value cases), so the tests catch the bug.
  • Manual runs: message --family action now errors out; message --family Actions finds Mg Message; --symbol tk still finds Tk Task.

`npm run search -- message --family action` printed "No matching
elements." because the family is compared verbatim and the valid id is
`actions`. During the duplicate check the ontology proposal template asks
for, that reads as "this concept is not in the table". `--family Actions`
failed the same way, and `--family` or `--symbol` with no value (or
`--symbol=`) silently listed all 115 elements.

The family is now lower-cased and checked against FAMILY_IDS, with the
valid names in the error; a flag with no value exits 1 with "Missing
value for --family/--symbol". The help text lists the families.

Adds test/search.test.ts (8 cases, run against the real script), lists
it in the README test inventory, and notes the fix under Unreleased.
@NullLabTests
NullLabTests merged commit 44405ca into NullLabTests:main Dec 1, 2026
2 checks passed
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.

2 participants