Skip to content

test: add 32 unit tests for triage classifier#50

Closed
TerminalGravity wants to merge 6 commits intomainfrom
test/triage-unit-tests
Closed

test: add 32 unit tests for triage classifier#50
TerminalGravity wants to merge 6 commits intomainfrom
test/triage-unit-tests

Conversation

@TerminalGravity
Copy link
Copy Markdown
Collaborator

The triage system is the brain of preflight — it had zero tests. This adds comprehensive coverage:

  • Trivial: common commands, skip keywords
  • Clear: file refs, line numbers, strict mode
  • Ambiguous: vague pronouns, vague verbs, short prompts, always_check
  • Cross-service: keywords, related aliases, built-in terms
  • Multi-step: sequential language, numbered/bullet lists, multi-dir files, combined with cross-service
  • Edge cases: empty input, long prompts, priority ordering, no config

All 32 tests passing.

… and contracts

The README references .preflight/ config extensively but there were no
concrete example files to copy. This adds a ready-to-use examples/.preflight/
directory with annotated config.yml, triage.yml, and contracts/api.yml,
plus a README explaining how to use them.
Created examples/USAGE_EXAMPLES.md with 8 real-world scenarios showing
what each tool looks like in practice: preflight_check catching vague
prompts, scope_work creating execution plans, enrich_agent_task for
sub-agents, sharpen_followup resolving ambiguity, session health checks,
semantic history search, weekly scorecards, and prompt grading.

Added link to usage examples in README nav bar.
- Reorder options: npx (zero install) → npm global → clone
- Add -y flag to npx for non-interactive use
- Explain what CLAUDE_PROJECT_DIR enables
- Note that .mcp.json paths must be absolute
- Use 'absolute' in path placeholders to prevent confusion
Previously, triagePrompt() checked multi-step before cross-service and
returned early, so prompts that were BOTH multi-step AND cross-service
lost all cross-service context (no cross_service_hits, no
search-related-projects in recommended tools).

Now both signals are detected upfront and combined when co-occurring.
Also adds resetConfig() export for testing/runtime config reloads.

Adds 3 tests covering the interaction.
Cover all 5 triage levels (trivial, clear, ambiguous, cross-service, multi-step),
config overrides (skip, alwaysCheck, strictness, crossServiceKeywords, relatedAliases),
and edge cases (empty input, very long prompts, priority ordering).
Copy link
Copy Markdown
Collaborator Author

@TerminalGravity TerminalGravity left a comment

Choose a reason for hiding this comment

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

Node 18 CI failed and Node 20 was cancelled. Needs a CI re-run now that the matrix has been updated. The 32 triage tests look comprehensive — worth rebasing and re-running.

@TerminalGravity
Copy link
Copy Markdown
Collaborator Author

Closing — superseded by newer PRs.

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.

1 participant