capsuletrace-upload

MoonBit-native data retention capsule planner

moonbit
privacy
retention
consent
lifecycle
governance
moon add SHX-ai-nb/capsuletrace-upload@0.3.0
Download zip
Author
Version
0.3.0
License
MIT
Last updated
1 hour ago
Downloads
6
README

#CapsuleTrace

CapsuleTrace is a MoonBit-native data-retention capsule planner. It helps an application team model small in-memory "data capsules", match them with retention rules, and produce deterministic keep/anonymize/delete/quarantine decisions.

This project was revised after initial-review feedback. The earlier submission looked too close to Mooncakes audit and provenance-proof tools. The current implementation deliberately moves to a different problem domain: privacy-oriented data lifecycle planning inside an application. It does not audit repositories, README files, Mooncakes packages, source provenance, contest material, or CI evidence.

#What It Solves

Applications often know that some user data should expire, be anonymized, stay in an allowed region, remain encrypted, or stop being shared with processors. Those checks are usually scattered across product notes, scripts, and manual reviews. CapsuleTrace turns the policy into deterministic MoonBit data structures and returns an action plan that can be tested locally.

#Core Use Cases

  • Build a deletion queue for capsules whose retention window has expired.
  • Find data that should be anonymized because it is old or idle.
  • Quarantine capsules stored outside an allowed region.
  • Flag sensitive capsules that are not encrypted.
  • Block or delete consent-gated capsules when consent is denied, expired, or withdrawn.
  • Render Markdown and JSON summaries for local review, CI artifacts, or operator handoff.
  • Check whether a retention catalog has duplicate IDs, uncovered capsules, invalid windows, or owner gaps.
  • Compare two retention plans to see whether risk increased or decreased after a policy change.
  • Generate owner-oriented operator playbooks with deletion, anonymization, quarantine, and block checklists.
  • Detect purpose drift when retained capsules are later reused for advertising, research, public sharing, or an unapproved actor/region.

#Install

moon add SHX-ai-nb/capsuletrace-upload

Mooncakes package name:

SHX-ai-nb/capsuletrace-upload

The package owner is configured as SHX-ai-nb.

#Minimal Example

fn main {
let plan = @capsuletrace.sample_plan()
println(plan.to_markdown())
}

Run the included smoke example:

moon run cmd/main

Run the manifest parser and retention calendar example:

moon run cmd/audit

#Data Model

RetentionRule describes a policy boundary:

let rule = @capsuletrace.retention_rule(
"analytics.behavior",
"analytics",
"behavior",
180,
30,
true,
["eu", "cn", "us"],
false,
"privacy-analytics",
"aggregate behavior capsules after short-term product analysis",
)

DataCapsule describes one retained data unit:

let capsule = @capsuletrace.data_capsule(
"cap.active-analytics",
"visitor",
"analytics",
"behavior",
200,
216,
@capsuletrace.ConsentGranted,
@capsuletrace.SensitiveData,
"cn",
true,
@capsuletrace.InternalOnly,
"active product telemetry capsule",
)

Evaluate a single capsule or a complete plan:

let decision = @capsuletrace.evaluate_capsule(capsule, [rule], 220)
let plan = @capsuletrace.plan_retention([capsule], [rule], 220)

#Purpose Drift Checks

Retention only answers whether a capsule may continue to exist. CapsuleTrace also checks whether later use still matches the purpose, actor, region, consent state, and sharing boundary that justified collection.

let report = @capsuletrace.analyze_purpose_drift(
@capsuletrace.sample_use_events(),
@capsuletrace.sample_capsules(),
@capsuletrace.sample_purpose_rules(),
225,
)
println(report.to_markdown())

This layer catches cases such as analytics data being reused for advertising, an unapproved team accessing a capsule, a data use moving to a denied region, or sensitive capsule output being made public. Actions are separate from retention actions:

allow | require-reconsent | escalate | block

#Manifest Format

CapsuleTrace can also parse a compact line manifest:

day: 220 rule: analytics.behavior | analytics | behavior | 180 | 30 | consent | eu,cn,us | internal-only | privacy-analytics | Aggregate visitor behavior quickly. capsule: cap.active-analytics | visitor | analytics | behavior | 200 | 216 | granted | sensitive | cn | encrypted | internal | Active telemetry.

Supported records:

  • day: logical day used for deterministic tests.
  • rule: retention policy with purpose, data kind, max age, anonymization window, consent requirement, allowed regions, sharing boundary, owner, and note.
  • capsule: retained data unit with subject kind, purpose, data kind, collection day, last-used day, consent state, sensitivity, region, encryption state, sharing mode, and note.

#Main API

  • retention_rule(...) creates a policy rule.
  • data_capsule(...) creates a capsule record.
  • evaluate_capsule(capsule, rules, today) returns one CapsuleDecision.
  • plan_retention(capsules, rules, today) returns a RetentionPlan.
  • parse_retention_manifest(raw) parses line records.
  • plan_manifest(raw) parses and evaluates in one call.
  • RetentionPlan::deletion_queue() returns due deletions.
  • RetentionPlan::anonymization_queue() returns due anonymization work.
  • RetentionPlan::quarantine_queue() returns records that need operator review.
  • RetentionPlan::purpose_summaries() and region_summaries() group risk.
  • RetentionPlan::build_calendar() creates a deterministic action calendar.
  • analyze_catalog(rules, capsules) checks rule/catalog health.
  • compare_retention_plans(before, after) compares two plan snapshots.
  • build_operator_playbook(plan) groups decisions into owner-oriented tasks.
  • purpose_rule(...) creates a secondary-use purpose rule.
  • capsule_use_event(...) creates a structured use event.
  • evaluate_use_event(event, capsules, rules) checks one runtime use event.
  • analyze_purpose_drift(events, capsules, rules, today) reports allowed, reconsent, escalated, and blocked use.
  • RetentionPlan::to_markdown() and to_json_string() export reports.

#Explicit Non-Goals

CapsuleTrace does not:

  • audit Mooncakes packages, GitHub repositories, README examples, CI status, or open-source provenance;
  • generate contest submission proof or acceptance evidence;
  • scan a runtime file system or call a network API;
  • perform legal compliance certification;
  • de-identify media, medical images, logs, or free-form documents;
  • decide whether a real company is legally compliant;
  • replace a privacy lawyer, DPO, or security review.

#Local Verification

moon fmt --check moon check --deny-warn moon build moon test --deny-warn moon run cmd/main moon run cmd/audit moon publish --dry-run

Current local verification after the uniqueness revision:

moon fmt --check: passed moon check --deny-warn: passed moon build: passed moon test --deny-warn: 36 passed, 0 failed moon run cmd/main: passed moon run cmd/audit: passed moon package: passed effective MoonBit LOC: 3,861

moon publish --dry-run and a real moon publish should be rerun after the GitHub update, using the SHX-ai-nb Mooncakes account.

#Mooncakes Release

The previous public release is 0.2.0. This revised privacy-retention implementation is prepared as 0.3.0. After pushing the revision, publish:

moon publish --frozen

Then verify:

https://mooncakes.io/docs/SHX-ai-nb/capsuletrace-upload https://mooncakes.io/api/v0/manifest/SHX-ai-nb/capsuletrace-upload

#License And Third-Party Notice

CapsuleTrace is licensed under MIT. The current implementation is original MoonBit code and does not include third-party source code, private code, external datasets, images, fonts, audio, or other media assets.

#
CapsuleDecision

pub(all) struct CapsuleDecision {
capsule : DataCapsule
rule_id : String
action : RetentionAction
severity : RetentionSeverity
age_days : Int
idle_days : Int
days_until_delete : Int
reasons : Array[RetentionReason]
owner : String
} derive(Eq,
Debug
)

#
CapsuleDecision::needs_operator_action

fn CapsuleDecision::needs_operator_action(self : CapsuleDecision) -> Bool

#
CapsuleDecision::reason_summary

fn CapsuleDecision::reason_summary(self : CapsuleDecision) -> String

#
CapsuleSensitivity

pub(all) enum CapsuleSensitivity {
PublicData
InternalData
ConfidentialData
SensitiveData
RestrictedData
} derive(Eq,
Debug
)

CapsuleTrace models data-retention capsules, not repository acceptance proof.

The library is intentionally deterministic and offline: callers pass a logical day number, retention rules, and in-memory capsule records. The result is a deletion/anonymization/quarantine plan that can be rendered for review, tests, or CI artifacts without scanning a repository or calling a remote service.

#
CapsuleSensitivity::label

fn CapsuleSensitivity::label(self : CapsuleSensitivity) -> String

#
CapsuleSensitivity::requires_encryption

fn CapsuleSensitivity::requires_encryption(self : CapsuleSensitivity) -> Bool

#
CapsuleSensitivity::risk_weight

fn CapsuleSensitivity::risk_weight(self : CapsuleSensitivity) -> Int

#
CapsuleUseEvent

pub(all) struct CapsuleUseEvent {
id : String
capsule_id : String
day : Int
use_purpose : String
actor : String
region : String
sharing : SharingMode
note : String
} derive(Eq,
Debug
)

#
CatalogFinding

pub(all) struct CatalogFinding {
kind : CatalogFindingKind
severity : RetentionSeverity
subject : String
message : String
remedy : String
} derive(Eq,
Debug
)

#
CatalogFindingKind

pub(all) enum CatalogFindingKind {
DuplicateRuleId
DuplicateCapsuleId
InvalidRetentionWindow
MissingAllowedRegion
MissingRuleOwner
RuleWithoutCapsule
CapsuleWithoutRule
SensitiveExternalSharing
SensitivePlainCapsule
PublicSharedRestrictedCapsule
} derive(Eq,
Debug
)

Catalog-level checks for retention rules and capsule inventories.

This module audits application data-lifecycle metadata only. It does not inspect repositories, package registries, CI systems, or open-source provenance.

#
CatalogFindingKind::label

fn CatalogFindingKind::label(self : CatalogFindingKind) -> String

#
CatalogReport

pub(all) struct CatalogReport {
rules : Array[RetentionRule]
capsules : Array[DataCapsule]
findings : Array[CatalogFinding]
covered_capsules : Int
uncovered_capsules : Int
} derive(Eq,
Debug
)

#
CatalogReport::count_by_kind

fn CatalogReport::count_by_kind(self : CatalogReport, kind : CatalogFindingKind) -> Int

#
CatalogReport::count_by_severity

fn CatalogReport::count_by_severity(self : CatalogReport, severity : RetentionSeverity) -> Int

#
CatalogReport::coverage_percent

fn CatalogReport::coverage_percent(self : CatalogReport) -> Int

#
CatalogReport::findings_for_subject

fn CatalogReport::findings_for_subject(self : CatalogReport, subject : StringView) -> Array[CatalogFinding]

#
CatalogReport::is_ready

fn CatalogReport::is_ready(self : CatalogReport) -> Bool

#
CatalogReport::to_json_string

fn CatalogReport::to_json_string(self : CatalogReport) -> String

#
CatalogReport::to_markdown

fn CatalogReport::to_markdown(self : CatalogReport) -> String

#
ConsentState

pub(all) enum ConsentState {
ConsentGranted
ConsentDenied
ConsentExpired
ConsentWithdrawn
ConsentNotRequired
} derive(Eq,
Debug
)

#
ConsentState::allows_processing

fn ConsentState::allows_processing(self : ConsentState) -> Bool

#
ConsentState::label

fn ConsentState::label(self : ConsentState) -> String

#
DataCapsule

pub(all) struct DataCapsule {
id : String
subject_kind : String
purpose : String
data_kind : String
collected_day : Int
last_used_day : Int
consent : ConsentState
sensitivity : CapsuleSensitivity
region : String
encrypted : Bool
sharing : SharingMode
note : String
} derive(Eq,
Debug
)

#
OperatorPlaybook

pub(all) struct OperatorPlaybook {
generated_day : Int
tasks : Array[OperatorTask]
} derive(Eq,
Debug
)

#
OperatorPlaybook::count_by_action

fn OperatorPlaybook::count_by_action(self : OperatorPlaybook, action : RetentionAction) -> Int

#
OperatorPlaybook::is_empty

fn OperatorPlaybook::is_empty(self : OperatorPlaybook) -> Bool

#
OperatorPlaybook::mark_blocked

fn OperatorPlaybook::mark_blocked(self : OperatorPlaybook, task_id : StringView) -> OperatorPlaybook

#
OperatorPlaybook::mark_done

fn OperatorPlaybook::mark_done(self : OperatorPlaybook, task_id : StringView) -> OperatorPlaybook

#
OperatorPlaybook::tasks_for_owner

fn OperatorPlaybook::tasks_for_owner(self : OperatorPlaybook, owner : StringView) -> Array[OperatorTask]

#
OperatorPlaybook::to_json_string

fn OperatorPlaybook::to_json_string(self : OperatorPlaybook) -> String

#
OperatorPlaybook::to_markdown

fn OperatorPlaybook::to_markdown(self : OperatorPlaybook) -> String

#
OperatorPlaybook::urgent_tasks

#
OperatorTask

pub(all) struct OperatorTask {
id : String
owner : String
action : RetentionAction
severity : RetentionSeverity
due_day : Int
capsule_ids : Array[String]
reason_kinds : Array[String]
checklist : Array[String]
status : OperatorTaskStatus
} derive(Eq,
Debug
)

#
OperatorTaskStatus

pub(all) enum OperatorTaskStatus {
TaskTodo
TaskBlocked
TaskDone
} derive(Eq,
Debug
)

Convert retention decisions into owner-oriented operator tasks.

#
OperatorTaskStatus::label

fn OperatorTaskStatus::label(self : OperatorTaskStatus) -> String

#
PlanDelta

pub(all) struct PlanDelta {
before_day : Int
after_day : Int
shifts : Array[PlanShift]
increased_count : Int
reduced_count : Int
review_count : Int
stable_count : Int
} derive(Eq,
Debug
)

#
PlanDelta::changed_shifts

fn PlanDelta::changed_shifts(self : PlanDelta) -> Array[PlanShift]

#
PlanDelta::has_risk_increase

fn PlanDelta::has_risk_increase(self : PlanDelta) -> Bool

#
PlanDelta::is_empty

fn PlanDelta::is_empty(self : PlanDelta) -> Bool

#
PlanDelta::to_json_string

fn PlanDelta::to_json_string(self : PlanDelta) -> String

#
PlanDelta::to_markdown

fn PlanDelta::to_markdown(self : PlanDelta) -> String

#
PlanShift

pub(all) struct PlanShift {
capsule_id : String
kind : PlanShiftKind
impact : PlanShiftImpact
before_action : String
after_action : String
before_severity : String
after_severity : String
message : String
} derive(Eq,
Debug
)

#
PlanShiftImpact

pub(all) enum PlanShiftImpact {
RiskIncreased
RiskReduced
ReviewNeeded
NoImpact
} derive(Eq,
Debug
)

#
PlanShiftImpact::label

fn PlanShiftImpact::label(self : PlanShiftImpact) -> String

#
PlanShiftKind

pub(all) enum PlanShiftKind {
CapsuleAdded
CapsuleRemoved
ActionChanged
SeverityChanged
DecisionStable
} derive(Eq,
Debug
)

Compare two retention plans by capsule id.

This is useful when an application changes retention rules or imports a new inventory snapshot and wants to know whether operator work increased, decreased, or stayed stable.

#
PlanShiftKind::label

fn PlanShiftKind::label(self : PlanShiftKind) -> String

#
PlanSummary

pub(all) struct PlanSummary {
total : Int
keep_count : Int
anonymize_count : Int
delete_count : Int
quarantine_count : Int
block_count : Int
critical_count : Int
high_count : Int
medium_count : Int
encrypted_count : Int
external_shared_count : Int
risk_score : Int
} derive(Eq,
Debug
)

#
PurposeDriftReport

pub(all) struct PurposeDriftReport {
generated_day : Int
decisions : Array[UseDecision]
total_events : Int
allowed_count : Int
reconsent_count : Int
blocked_count : Int
escalated_count : Int
} derive(Eq,
Debug
)

#
PurposeDriftReport::decision

fn PurposeDriftReport::decision(self : PurposeDriftReport, event_id : StringView) -> UseDecision?

#
PurposeDriftReport::decisions_for_action

fn PurposeDriftReport::decisions_for_action(self : PurposeDriftReport, action : UseAction) -> Array[UseDecision]

#
PurposeDriftReport::is_ready

fn PurposeDriftReport::is_ready(self : PurposeDriftReport) -> Bool

#
PurposeDriftReport::to_json_string

fn PurposeDriftReport::to_json_string(self : PurposeDriftReport) -> String

#
PurposeDriftReport::to_markdown

fn PurposeDriftReport::to_markdown(self : PurposeDriftReport) -> String

#
PurposeRule

pub(all) struct PurposeRule {
id : String
source_purpose : String
allowed_use_purposes : Array[String]
allowed_actors : Array[String]
allowed_regions : Array[String]
allow_processor : Bool
allow_public : Bool
requires_fresh_consent : Bool
owner : String
note : String
} derive(Eq,
Debug
)

#
PurposeSummary

pub(all) struct PurposeSummary {
purpose : String
total : Int
keep_count : Int
anonymize_count : Int
delete_count : Int
quarantine_count : Int
} derive(Eq,
Debug
)

#
RegionSummary

pub(all) struct RegionSummary {
region : String
total : Int
encrypted_count : Int
external_shared_count : Int
high_or_critical_count : Int
} derive(Eq,
Debug
)

#
RetentionAction

pub(all) enum RetentionAction {
KeepData
AnonymizeData
DeleteData
QuarantineData
BlockCollection
} derive(Eq,
Debug
)

#
RetentionAction::label

fn RetentionAction::label(self : RetentionAction) -> String

#
RetentionAction::priority

fn RetentionAction::priority(self : RetentionAction) -> Int

#
RetentionCalendar

pub(all) struct RetentionCalendar {
generated_day : Int
windows : Array[RetentionWindow]
} derive(Eq,
Debug
)

#
RetentionCalendar::to_markdown

fn RetentionCalendar::to_markdown(self : RetentionCalendar) -> String

#
RetentionIssueKind

pub(all) enum RetentionIssueKind {
MissingRule
ConsentInvalid
RetentionExpired
AnonymizationDue
RegionDenied
EncryptionMissing
SharingDenied
CollectionBlocked
} derive(Eq,
Debug
)

#
RetentionIssueKind::label

fn RetentionIssueKind::label(self : RetentionIssueKind) -> String

#
RetentionManifest

pub(all) struct RetentionManifest {
today : Int
rules : Array[RetentionRule]
capsules : Array[DataCapsule]
issues : Array[RetentionParseIssue]
} derive(Eq,
Debug
)

#
RetentionManifest::is_parseable

fn RetentionManifest::is_parseable(self : RetentionManifest) -> Bool

#
RetentionManifest::to_markdown

fn RetentionManifest::to_markdown(self : RetentionManifest) -> String

#
RetentionParseIssue

pub(all) struct RetentionParseIssue {
line : Int
record : String
message : String
} derive(Eq,
Debug
)

#
RetentionPlan

pub(all) struct RetentionPlan {
generated_day : Int
decisions : Array[CapsuleDecision]
rules : Array[RetentionRule]
summary : PlanSummary
} derive(Eq,
Debug
)

#
RetentionPlan::action_count

fn RetentionPlan::action_count(self : RetentionPlan, action : RetentionAction) -> Int

#
RetentionPlan::anonymization_queue

fn RetentionPlan::anonymization_queue(self : RetentionPlan) -> Array[CapsuleDecision]

#
RetentionPlan::blocked_collection

fn RetentionPlan::blocked_collection(self : RetentionPlan) -> Array[CapsuleDecision]

#
RetentionPlan::build_calendar

fn RetentionPlan::build_calendar(self : RetentionPlan) -> RetentionCalendar

#
RetentionPlan::decision

fn RetentionPlan::decision(self : RetentionPlan, capsule_id : StringView) -> CapsuleDecision?

#
RetentionPlan::deletion_queue

fn RetentionPlan::deletion_queue(self : RetentionPlan) -> Array[CapsuleDecision]

#
RetentionPlan::has_action

fn RetentionPlan::has_action(self : RetentionPlan, action : RetentionAction) -> Bool

#
RetentionPlan::is_ready

fn RetentionPlan::is_ready(self : RetentionPlan) -> Bool

#
RetentionPlan::keep_queue

#
RetentionPlan::purpose_summaries

fn RetentionPlan::purpose_summaries(self : RetentionPlan) -> Array[PurposeSummary]

#
RetentionPlan::quarantine_queue

fn RetentionPlan::quarantine_queue(self : RetentionPlan) -> Array[CapsuleDecision]

#
RetentionPlan::region_summaries

fn RetentionPlan::region_summaries(self : RetentionPlan) -> Array[RegionSummary]

#
RetentionPlan::to_json_string

fn RetentionPlan::to_json_string(self : RetentionPlan) -> String

#
RetentionPlan::to_markdown

fn RetentionPlan::to_markdown(self : RetentionPlan) -> String

#
RetentionReason

pub(all) struct RetentionReason {
kind : RetentionIssueKind
severity : RetentionSeverity
message : String
remedy : String
} derive(Eq,
Debug
)

#
RetentionRecordKind

pub(all) enum RetentionRecordKind {
DayRecord
RuleRecord
CapsuleRecord
UnknownRetentionRecord
} derive(Eq,
Debug
)

A compact data-retention manifest parsed by CapsuleTrace.

Records:

  • day: <logical day>
  • rule: id | purpose | data-kind | max-days | anonymize-after | consent/no-consent | regions | internal-only/external-ok | owner | note
  • capsule: id | subject | purpose | data-kind | collected-day | last-used-day | consent | sensitivity | region | encrypted/plain | sharing | note

#
RetentionRecordKind::label

fn RetentionRecordKind::label(self : RetentionRecordKind) -> String

#
RetentionRule

pub(all) struct RetentionRule {
id : String
purpose : String
data_kind : String
max_keep_days : Int
anonymize_after_days : Int
requires_consent : Bool
allowed_regions : Array[String]
allow_external_sharing : Bool
owner : String
note : String
} derive(Eq,
Debug
)

#
RetentionSeverity

pub(all) enum RetentionSeverity {
RetentionCritical
RetentionHigh
RetentionMedium
RetentionLow
RetentionInfo
} derive(Eq,
Debug
)

#
RetentionSeverity::label

fn RetentionSeverity::label(self : RetentionSeverity) -> String

#
RetentionSeverity::weight

fn RetentionSeverity::weight(self : RetentionSeverity) -> Int

#
RetentionWindow

pub(all) struct RetentionWindow {
day : Int
action : RetentionAction
capsule_ids : Array[String]
} derive(Eq,
Debug
)

#
SharingMode

pub(all) enum SharingMode {
InternalOnly
ProcessorShared
PublicShared
} derive(Eq,
Debug
)

#
SharingMode::is_external

fn SharingMode::is_external(self : SharingMode) -> Bool

#
SharingMode::label

fn SharingMode::label(self : SharingMode) -> String

#
UseAction

pub(all) enum UseAction {
AllowUse
RequireReconsent
BlockUse
EscalateUse
} derive(Eq,
Debug
)

Purpose-drift checks for retained data capsules.

A capsule can be retained correctly but still be misused later for a purpose, actor, region, or sharing mode outside the reason it was collected. This module checks structured use events against explicit purpose rules.

#
UseAction::label

fn UseAction::label(self : UseAction) -> String

#
UseAction::priority

fn UseAction::priority(self : UseAction) -> Int

#
UseDecision

pub(all) struct UseDecision {
event : CapsuleUseEvent
capsule_id : String
rule_id : String
action : UseAction
severity : RetentionSeverity
issues : Array[UseIssue]
owner : String
} derive(Eq,
Debug
)

#
UseDecision::issue_summary

fn UseDecision::issue_summary(self : UseDecision) -> String

#
UseIssue

pub(all) struct UseIssue {
kind : UseIssueKind
severity : RetentionSeverity
message : String
remedy : String
} derive(Eq,
Debug
)

#
UseIssueKind

pub(all) enum UseIssueKind {
UnknownCapsule
MissingPurposeRule
PurposeMismatch
ActorDenied
UseRegionDenied
ConsentForUseInvalid
UseSharingDenied
SensitivePublicUse
} derive(Eq,
Debug
)

#
UseIssueKind::label

fn UseIssueKind::label(self : UseIssueKind) -> String

#
analyze_catalog

fn analyze_catalog(rules : Array[RetentionRule], capsules : Array[DataCapsule]) -> CatalogReport

#
analyze_purpose_drift

fn analyze_purpose_drift(events : Array[CapsuleUseEvent], capsules : Array[DataCapsule], rules : Array[PurposeRule], today : Int) -> PurposeDriftReport

#
build_operator_playbook

fn build_operator_playbook(plan : RetentionPlan) -> OperatorPlaybook

#
capsule_use_event

fn capsule_use_event(id : String, capsule_id : String, day : Int, use_purpose : String, actor : String, region : String, sharing : SharingMode, note : String) -> CapsuleUseEvent

#
compact_sample

fn compact_sample() -> String

#
compare_retention_plans

fn compare_retention_plans(before : RetentionPlan, after : RetentionPlan) -> PlanDelta

#
data_capsule

fn data_capsule(id : String, subject_kind : String, purpose : String, data_kind : String, collected_day : Int, last_used_day : Int, consent : ConsentState, sensitivity : CapsuleSensitivity, region : String, encrypted : Bool, sharing : SharingMode, note : String) -> DataCapsule

#
evaluate_capsule

fn evaluate_capsule(capsule : DataCapsule, rules : Array[RetentionRule], today : Int) -> CapsuleDecision

#
evaluate_use_event

fn evaluate_use_event(event : CapsuleUseEvent, capsules : Array[DataCapsule], rules : Array[PurposeRule]) -> UseDecision

#
parse_retention_manifest

fn parse_retention_manifest(raw : StringView) -> RetentionManifest

#
plan_manifest

fn plan_manifest(raw : StringView) -> RetentionPlan

#
plan_retention

fn plan_retention(capsules : Array[DataCapsule], rules : Array[RetentionRule], today : Int) -> RetentionPlan

#
purpose_rule

fn purpose_rule(id : String, source_purpose : String, allowed_use_purposes : Array[String], allowed_actors : Array[String], allowed_regions : Array[String], allow_processor : Bool, allow_public : Bool, requires_fresh_consent : Bool, owner : String, note : String) -> PurposeRule

#
retention_rule

fn retention_rule(id : String, purpose : String, data_kind : String, max_keep_days : Int, anonymize_after_days : Int, requires_consent : Bool, allowed_regions : Array[String], allow_external_sharing : Bool, owner : String, note : String) -> RetentionRule

#
sample_capsules

fn sample_capsules() -> Array[DataCapsule]

#
sample_catalog_report

fn sample_catalog_report() -> CatalogReport

#
sample_plan

fn sample_plan() -> RetentionPlan

#
sample_plan_delta

fn sample_plan_delta() -> PlanDelta

#
sample_playbook

fn sample_playbook() -> OperatorPlaybook

#
sample_purpose_drift_report

fn sample_purpose_drift_report() -> PurposeDriftReport

#
sample_purpose_rules

fn sample_purpose_rules() -> Array[PurposeRule]

#
sample_retention_manifest

fn sample_retention_manifest() -> String

#
sample_rules

fn sample_rules() -> Array[RetentionRule]

#
sample_use_events

fn sample_use_events() -> Array[CapsuleUseEvent]