Skip to content

[AUTOMATION] feat: clean up internal decision handling#293

Closed
michiosw wants to merge 1 commit into
mainfrom
feat/cleanup-internal-decision-handling
Closed

[AUTOMATION] feat: clean up internal decision handling#293
michiosw wants to merge 1 commit into
mainfrom
feat/cleanup-internal-decision-handling

Conversation

@michiosw

Copy link
Copy Markdown
Contributor

Summary
This cleans up internal decision handling by routing allow and deny normalization through the existing shared helpers.

Before this, internal/hook/domain.go and internal/guard/store/sqlite/store.go each carried their own decision definitions or normalization logic, which made the same internal concept easy to drift.

Now internal decision handling has one canonical path:

risk.Decision input
-> hook.NormalizeDecision
-> canonical hook and sqlite storage values
-> consistent allow or deny output

Why
This gives kontext-cli a cleaner maintenance path for internal guard decision handling.

What changed
Consolidated the hook Decision type onto internal/guard/decision
Removed duplicated allow and deny normalization in the SQLite store
Added tests for mixed-case and whitespace-padded decision values

Verification
go test ./internal/hook ./internal/guard/store/sqlite ./internal/guard/app/server ./internal/guard/hookruntime
go test ./internal/guard/judge
go test ./...
git diff --check

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown

Greptile Summary

This PR centralizes internal guard decision normalization. The main changes are:

  • hook.Decision now aliases the shared guard decision type.
  • SQLite decision helpers now route allow and deny normalization through hook.NormalizeDecision.
  • Tests cover mixed-case and whitespace-padded decision values.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
internal/hook/domain.go Moves hook decisions onto the shared guard decision type while preserving normalization behavior.
internal/guard/store/sqlite/store.go Uses the shared hook normalization helper while preserving fail-closed deny and unsupported adapter labels.
internal/guard/store/sqlite/store_test.go Adds coverage for case and whitespace normalization through the SQLite helper paths.

Reviews (1): Last reviewed commit: "feat: clean up internal decision handlin..." | Re-trigger Greptile

@michiosw michiosw closed this Jun 16, 2026
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