Skip to content

Policy import/export with validation and diff preview #30

Description

@karagozemin

Stellar Wave #6 — Apply via the Stellar Wave Program on Drips. Use the Wave application flow. Maintainers review applicants on the Drips maintainer dashboard.
Wave window: 2026-06-23 09:00 UTC → 2026-06-30 09:00 UTC.


Summary

Allow operators to export the active policy as JSON and import a new policy through the policy editor with schema validation and a diff preview before saving.

Context

  • Policy UI: src/components/policy-editor.tsx
  • Policy APIs: src/app/api/policy/route.ts, src/app/api/policy/history/route.ts
  • Schema: src/lib/validation/schemas.ts
  • Diff helpers already exist near the policy editor history UI.

Acceptance criteria

  • Add an export action that downloads the current policy JSON
  • Add an import control that accepts JSON and validates it with policyConfigSchema
  • Show a human-readable diff before the imported policy is saved
  • Invalid JSON/schema errors are displayed without mutating current policy
  • Viewer role can export but cannot import/save
  • Tests cover schema validation and import failure handling where practical
  • README policy section documents import/export usage
  • npm test and npm run lint pass
  • PR links to this issue

Notes

Keep the existing manual editor. Import/export should augment it, not replace it.

Evidence submission

## Policy import/export — Evidence

**Contributor:** @handle | **PR:** #___

- [ ] Exported policy re-imports successfully
- [ ] Invalid policy is rejected before save
- [ ] Diff preview shown before save
- [ ] Viewer cannot mutate policy

Wave complexity (maintainer)

Medium — 150 points

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar Wave programenhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions