Skip to content

feat(console): add guided policy form editor with semantic hash and redacted preview (#100) - #311

Merged
jusso-dev merged 1 commit into
mainfrom
feat/console-policy-form-editor
Nov 21, 2026
Merged

jusso-dev merged 1 commit into
mainfrom
feat/console-policy-form-editor

Conversation

@jusso-dev

Copy link
Copy Markdown
Owner

Summary

Closes #100.

Adds a guided, form-based policy editor to the Management API and console so operators can author and validate Bower telemetry policies without editing raw YAML, while preserving semantic hash identity, population diffs, and built-in post-redaction sample previews:

  • Server-side policy form API (src/Bower.Management.Api/PolicyFormEndpoints.cs, ManagementApplication.cs, ManagementJson.cs, Bower.Management.Api.csproj):
    • GET /api/policies/templates (View): returns built-in starter policy templates from policies/default (or safe fallback).
    • POST /api/policies/form (Operate): parses baseline policy YAML into structured form fields (metadata, match categories/types, required/recommended/at-least-one fields, decision action accept/redact-and-accept/aggregate/quarantine/reject, minimum value score, neverSample, and suppression window keyFields/windowSeconds/allowPerWindow), compiles edited forms back to canonical YAML validated through PolicyLoader.Parse, verifies semantic hash stability (PolicyLoader.Hash), produces a structured change diff, and evaluates a synthetic sample after running PrivacyEngine(PrivacyPolicy.CreateDefault()) so sensitive values (passwords, TFNs) are redacted before preview.
    • Zero new NuGet dependencies (Bower.Management.Api adds a project reference to Bower.PolicyEngine).
  • Console Policies page (ui/Bower.Management.Web/src/pages/PoliciesPage.tsx, src/App.tsx, src/pages/PoliciesPage.test.tsx):
    • Adds /policies route with template picker, guided form controls for all policy sections (including suppression windows for aggregate / rate-limiting), real-time semantic hash & diff summary, post-redaction sample preview, and read-only compiled YAML inspection.

Verification

  • dotnet build --configuration Release — 0 warnings, 0 errors
  • dotnet test (PolicyFormApiTests, ManagementApiTests) — 14 passed, 0 failed
  • dotnet format --verify-no-changes — passed
  • cd ui/Bower.Management.Web && npm run lint && npm test && npm run build — 17/17 test files (109/109 tests) passed, production bundle built cleanly

Security and compatibility impact

  • Strictly additive API routes, UI route, and Native AOT JSON context entries (ManagementJsonContext).
  • Server enforces Operate RBAC on POST /api/policies/form; preview always runs PrivacyEngine with default redaction rules before returning sample output and never accepts or persists raw production payloads.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f95d3a90-21e7-443d-9bad-48bc6b6b8ac3
Commits

Reviewing files that changed from the base of the PR and between 38b71e9 and 715c0c2.

Files selected for processing: 10

  • src/Bower.Management.Api/Bower.Management.Api.csproj
  • src/Bower.Management.Api/ManagementApplication.cs
  • src/Bower.Management.Api/ManagementJson.cs
  • src/Bower.Management.Api/PolicyFormEndpoints.cs
  • src/Bower.Management.Api/packages.lock.json
  • tests/Bower.UnitTests/PolicyFormApiTests.cs
  • tests/Bower.UnitTests/packages.lock.json
  • ui/Bower.Management.Web/src/App.tsx
  • ui/Bower.Management.Web/src/pages/PoliciesPage.test.tsx
  • ui/Bower.Management.Web/src/pages/PoliciesPage.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@jusso-dev
jusso-dev merged commit 7dd9f69 into main Nov 21, 2026
22 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.

Console: no-code policy and privacy-profile editor with redacted preview

1 participant