Skip to content

fix(policy): surface all rule fields in CLI and Telegram listings#31

Merged
nnemirovsky merged 1 commit intomainfrom
fix-policy-display-parity
Apr 13, 2026
Merged

fix(policy): surface all rule fields in CLI and Telegram listings#31
nnemirovsky merged 1 commit intomainfrom
fix-policy-display-parity

Conversation

@nnemirovsky
Copy link
Copy Markdown
Owner

@nnemirovsky nnemirovsky commented Apr 13, 2026

Summary

Telegram /policy show and CLI sluice policy list were both hiding rule fields, so operators couldn't see protocols, replacement strings, or rule metadata from those surfaces. API was already complete via storeRuleToAPI.

Gaps before:

Layer Missing fields
CLI policy list replacement (for redact rules)
API GET /api/rules none
Telegram /policy show protocols, replacement, name, source

Gaps after: none.

Changes

  • internal/telegram/commands.go: both policyShow (engine-snapshot fallback) and policyShowFromStore now print protocols=.... Store path also prints -> "replacement", (name), [source].
  • cmd/sluice/policy.go: policy list now prints -> "replacement" after protocols for redact rules.
  • New tests: TestPolicyShowIncludesAllFields (Telegram), TestHandlePolicyListShowsReplacement (CLI).

Test plan

  • go test ./... passes (12/12 packages)
  • go build ./... clean
  • gofumpt clean
  • Manual Telegram check: /policy shows protocols for any scoped rule, source tags like [manual] / [approval] visible
  • Manual CLI check: sluice policy list shows replacement for a seeded redact rule

Telegram `/policy show` only printed id, target, and ports. Protocols,
replacement, name, and source were hidden, so scoped rules and redact
substitutions were invisible to operators. CLI `policy list` also
omitted replacement for redact rules.

- `internal/telegram/commands.go`: add protocols to both store and
  snapshot paths. Store path also prints `-> "replacement"`, `(name)`,
  `[source]`.
- `cmd/sluice/policy.go`: append `-> "replacement"` after protocols.
- Tests: `TestPolicyShowIncludesAllFields`,
  `TestHandlePolicyListShowsReplacement`.

API is unchanged, `storeRuleToAPI` already exposes every field.
@nnemirovsky nnemirovsky merged commit b519e2c into main Apr 13, 2026
6 checks passed
@nnemirovsky nnemirovsky deleted the fix-policy-display-parity branch April 13, 2026 05:40
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