Skip to content

test: initial coverage — normalizer, governance, intent (closes #68, #66)#89

Merged
jpleva91 merged 1 commit intomainfrom
test/initial-coverage
Mar 30, 2026
Merged

test: initial coverage — normalizer, governance, intent (closes #68, #66)#89
jpleva91 merged 1 commit intomainfrom
test/initial-coverage

Conversation

@jpleva91
Copy link
Copy Markdown
Contributor

Summary

What's covered

internal/normalizer

  • classifyShellRisk — word-boundary regression guard (lock in the PR fix(normalizer): word-boundary check in classifyShellRisk — closes #63 #88 fix)
    • "catalog_tool" must return RiskMutating, not RiskReadOnly
    • "finder.sh" must return RiskMutating, not RiskReadOnly
  • Destructive command detection (rm, git push, chmod, etc.)
  • Default-mutating fallback
  • classifyTool — all 7 tool name cases
  • Normalize — struct field correctness
  • Fingerprint — determinism, hex format, 16-char length

internal/governance

  • Engine.Evaluate — enforce mode denies, monitor mode allows on same match
  • args_contain matching — git push denied, git pull allowed
  • monitor action policies always allow (even in enforce mode)
  • Default-allow when no policy matches
  • GetTimeout — policy-specified timeout vs 300s default
  • NewEngine — missing file error, invalid YAML error, default monitor mode

internal/intent

  • All 4 Parse extraction strategies: JSON block, XML tag, function_call, bare JSON
  • Plain prose returns nil
  • Tool aliases (Bash → run_shell, Read → read_file, etc.)
  • Param aliases (file_path → path, text → content)
  • Unknown tools return nil (no guessing)
  • flattenParams numeric/bool conversion

Bug fix: #66 — dead code in flattenParams

Removed 7-line unreachable block (complex string manipulation) that was
immediately overwritten by fmt.Sprintf("%g", val). No behavior change.

🤖 Generated with Claude Code

Add 25 tests across the three most security-critical packages:
- normalizer: classifyShellRisk word-boundary regression (issue #63 guard),
  classifyTool, Normalize, Fingerprint
- governance: Engine.Evaluate enforce/monitor modes, GetTimeout, NewEngine
  error paths
- intent: all Parse extraction strategies (JSON block, XML tag, function_call,
  bare JSON), tool/param alias normalization, unknown-tool rejection

Also fix dead code in flattenParams() — closes #66: remove 7-line unreachable
string-manipulation block that was immediately overwritten by fmt.Sprintf("%g").

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jpleva91 added a commit that referenced this pull request Mar 30, 2026
Sprint goal ACHIEVED: all P0/P1 governance bugs closed.
- PR #86 merged: P1 #28 (timeout override) closed
- PR #88 merged: P1 #63 (classifyShellRisk word-boundary) closed
- PR #89 open: P1 #68 (test coverage) + P2 #66 (dead code), CI green 5/5

Remaining blocker: PR #89 requires human review (@jpleva91).
Dogfood (#76) blocked on setup.sh remote Ollama gap.
Next sprint proposal: dogfood readiness + P2 batch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jpleva91 added a commit that referenced this pull request Mar 30, 2026
Sprint goal ACHIEVED: all P0/P1 governance bugs closed.
- PR #86 merged: P1 #28 (timeout override) closed
- PR #88 merged: P1 #63 (classifyShellRisk word-boundary) closed
- PR #89 open: P1 #68 (test coverage) + P2 #66 (dead code), CI green 5/5

Remaining blocker: PR #89 requires human review (@jpleva91).
Dogfood (#76) blocked on setup.sh remote Ollama gap.
Next sprint proposal: dogfood readiness + P2 batch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jpleva91 added a commit that referenced this pull request Mar 30, 2026
Sprint transition: enforcement hardening → dogfood readiness.

Previous sprint goal (P0/P1 governance hardening) ACHIEVED.
PR #89 (test coverage, closes #68 + #66) CI-green, awaiting human merge.
PR #90 (EM state run 7) CI-green, awaiting human merge.

New sprint: unblock jared-box dogfood run.
- Primary: fix setup.sh remote Ollama gap (#76)
- P2 batch: #65 (silent WriteFile), #52 (Glob **), #51 (silent run()), #50 (version compare)
- README cleanup (#53)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jpleva91 jpleva91 merged commit f34533d into main Mar 30, 2026
5 checks passed
jpleva91 added a commit that referenced this pull request Mar 30, 2026
Sprint goal ACHIEVED: all P0/P1 governance bugs closed.
- PR #86 merged: P1 #28 (timeout override) closed
- PR #88 merged: P1 #63 (classifyShellRisk word-boundary) closed
- PR #89 open: P1 #68 (test coverage) + P2 #66 (dead code), CI green 5/5

Remaining blocker: PR #89 requires human review (@jpleva91).
Dogfood (#76) blocked on setup.sh remote Ollama gap.
Next sprint proposal: dogfood readiness + P2 batch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant