Worked Examples

Validate scientifically consent and retention — Contact and Engagement Platform

Validate consent and retention controls by reconciling authorization history, versioned retention policies, legal holds, processing restrictions, and verified disposition of private records. This developer guide provides reproducible synthetic tests, read-only database diagnostics, and evidence-based acceptance criteria for defensible privacy and retention decisions.

ProductContact and Engagement PlatformComponentPolicy & Legal HoldsUpdatedNovember 21, 2026Reading time20 minutes

Application: Contact and Engagement Platform
Component: Privacy and Retention Center — Consent Ledger, Policy Versioning, Legal Holds & Execution
Source-reviewed version: 2.0.2 (source tree; not evidence of the installed version)
Status: Source-reviewed and synthetic-tested; staging cases not run
Estimated reading time: 18–23 minutes

Consent and retention validation asks a narrower, testable question than “is the platform compliant?”: given a defined purpose, authorization history, versioned retention policy, privacy state, and hold status, does the system make and record the correct processing and disposition decision? This procedure tests the decision trail and controlled execution without viewing, exposing, or deleting real participant information.

Goal

Establish that each applicable record can be linked to its declared processing purpose and authorization evidence; assigned a stable, reviewable retention policy; prevented from premature or hold-prohibited disposition; and archived, redacted, or deleted only through a recorded, justified and technically verified action. The workflow must distinguish policy eligibility, queue creation, approval, execution and independently observed outcome.

Primary acceptance criterion: records can be reviewed and expired according to an approved, versioned policy, without violating active holds or treating a software status flag as proof of actual erasure. The operator may conduct review and approval where system policy permits; do not invent a mandatory second human reviewer.

Requirements

  • An isolated staging database populated with synthetic inquiries, consent events, communications and attachments; no production contact details or private narratives in the test package.
  • An authorized administrator capable of reading Privacy and Retention Center evidence; identify which WordPress capabilities govern consent, holds, policies, approval and execution rather than assuming access from a visible menu.
  • Exact plugin version, deployed commit or artifact digest, database migration state, current policy keys/versions, applicable time zone (stored dates use UTC), approved retention schedule, and backup/recovery plan.
  • A fixed observation window, explicit population inclusion/exclusion rules, a protocol ID, controlled test case IDs, and an outcome ledger that records pass, fail, not run and indeterminate separately.
  • Consent and lawful-basis terminology reviewed for the relevant jurisdiction and processing purpose. A database value labeled lawful_basis is not independent legal verification.
  • Write operations, destructive execution and fault injection restricted to staging. Production analysis should ordinarily use authorized aggregate, read-only counts.

Study design and definitions

Use a pre-registered requirements-based validation study with deterministic negative controls and a small end-to-end staging sample. Unit: one synthetic inquiry or one retention action, as specified per test. Record the numerator and denominator of every test, whether observations were independent, the build hash, and a time-bounded observation window. Stratify by consent type, inquiry status, policy version, attachment presence, hold scope and action state.

Construct Operational definition What it does not prove
Consent/authorization evidence Event type, action, version, source, basis, and timestamp attached to an inquiry A checked box alone establishes lawful processing in every jurisdiction
Retention eligibility Recorded target type, status scope, anchor timestamp, policy version, duration and due time A queued action may be executed immediately
Legal hold An active inquiry-level or attachment-level preservation record with authority and review date A review date automatically releases the hold
Verified execution Recorded action state plus independently checked postconditions (e.g., file absence, redacted fields) Every backup, email transport or downstream copy has been erased
Privacy restriction Current private processing state and consent/withdrawal chronology Every restriction is necessarily caused by consent withdrawal

Define additionality only where a real comparative evaluation exists; for reliability testing, use “improvement over baseline” instead. An observed association between policy changes and fewer errors does not establish causation without controlling for changes in volume, mixture of case types, software version and operator behavior.

Source-reviewed implementation map

Source component Reviewed behavior Validation boundary
SC_EI_Privacy_Repository Persists consent events, privacy requests, legal holds and retention-action records Callback success and audit evidence must be checked separately
SC_EI_Retention_Policy_Repository Creates immutable numbered versions; archives the previous active version when writing a successor Historic policy versions remain referenced by previously queued actions
SC_EI_Retention_Engine Previews candidates, queues actions, executes eligible actions and applies technical postconditions Candidate preview is not a delete operation
SC_EI_Retention The legacy daily cleanup hook queues candidate actions rather than deleting immediately Cron completion does not establish disposition
SC_EI_Audit_Log Writes event evidence using WordPress database calls A stored status alone does not guarantee a corresponding audit insert
SC_EI_Privacy Connects WordPress privacy export and eraser requests to the platform The eraser integration queues governed work; it does not shortcut all approval/hold checks

The source-reviewed release defines default policies including unaccepted_inquiry, withdrawn_inquiry, closed_inquiry, accepted_inquiry, private_attachment, and communication_content. Their durations are configurable and should not be presented as legally mandated retention periods.

Hypotheses and predeclared acceptance rules

  1. H1 — Consent: after an accepted synthetic public inquiry, the notice version and timestamp exist and the separate privacy_notice ledger event matches the version. A controlled ledger-write failure is discoverable by reconciliation.
  2. H2 — Withdrawal: recording a withdrawal restricts further use according to defined purpose and workflow rules. Subsequent renewal is interpreted in chronological order rather than treating all historical withdrawals as current.
  3. H3 — Policy versioning: new policy versions do not rewrite the old version or silently rebase previously queued action references.
  4. H4 — Holds: active relevant holds block queue/approval/execution as appropriate; a hold placed after a completed action is not misclassified as a historical violation.
  5. H5 — Execution: a completed action records the actor, evidence and verified postconditions; target-level dependencies and physical storage failures remain visible.
  6. H6 — Confidentiality: unauthenticated users and unauthorized roles cannot inspect the ledger, requests, hold notes, retention queue or private subject records.

Method and evidence

Use three evidence layers. Source review establishes what the pinned implementation checks and where control gaps may exist. Offline synthetic classification tests consistency of independently authored evidence packets. Staging integration testing is required to verify WordPress hooks, actual database writes, permissions, cron, storage, mail/outbox behavior and recovery. Do not substitute one layer for another.

Keep a sealed internal evidence register: protocol version, test ID, expected decision, observed decision, source commit, deployed build, actor role, target category, policy key/version, action type, timestamps, sanitized error code, and adjudication. Use synthetic subjects or authorized aggregates only; do not copy message bodies, legal-hold narratives or personal data into public publications.

Consent capture and ledger reconciliation

In the reviewed public intake path, the inquiry row can be stored before the sc_ei_public_inquiry_created hook invokes capture_public_consent(). The callback records a privacy_notice grant and may record a calendar-invitation grant, but it does not propagate a WP_Error from record_consent() to the submission response. Thus, a successful confirmation does not by itself certify consent-ledger completeness. This is a code-path risk, not evidence of a live incident.

Compare the initial notice version and timestamp in the inquiry row against consent_events by private inquiry ID, consent_type, action, and consent_version. Keep a separate count of administrative or legacy records without public-form provenance; they may not have an identical notice event contract. Never fabricate a grant to “repair” a missing event.

-- Source-reviewed table naming; adjust wp_ to your actual WordPress prefix.
-- Aggregate diagnostic, not a complete legal-consent assessment.
SELECT COUNT(*) AS anchored_inquiries,
       SUM(CASE WHEN NOT EXISTS (
         SELECT 1 FROM wp_sc_ei_consent_events c
         WHERE c.inquiry_id = i.id AND c.consent_type='privacy_notice'
           AND c.action='granted' AND c.consent_version=i.consent_version
       ) THEN 1 ELSE 0 END) AS missing_matching_notice
FROM wp_sc_ei_inquiries i
WHERE i.consent_version <> '' AND i.consent_at IS NOT NULL;

This query is a screening test; it does not establish that the event was captured at the original submission time, and it does not prove that the notice was valid for the use made of the data. The packaged PHP helper uses SC_EI_Database::table() for table names and emits only counts.

Consent withdrawal, renewal and purpose limitation

The source implements event types such as privacy_notice, request_processing, communication, calendar_invitation, and document_processing, with actions including granted, renewed, and withdrawn. The code path for a recorded withdrawal sets the inquiry to restricted; that restriction is not equivalent to deleting the underlying record.

  1. Use a synthetic inquiry with a recorded grant; capture its source, policy notice version and time.
  2. Record a withdrawal for one purpose and confirm that the private ledger contains a new event and that processing is restricted under the expected workflow.
  3. Test permitted operations separately from blocked operations, including outbound communication and downstream integrations, rather than assuming the privacy-status string enforces every action.
  4. If testing later renewed authorization, compare the most recent valid event per consent type and verify an authorized, documented privacy-state transition; never infer active permission solely from a newly recorded event.
  5. Record how legal holds, existing contracts and processing obligations were evaluated independently of consent.

Retention policy versions and retention clocks

The policy repository stores a policy_key, monotonically increasing version, target type, status scope, retention days, anchor field, action type, legal basis and description. Creating a successor archives the previously active version and inserts a new active row in a database transaction. Attachment policies require the explicit retention_until anchor. Other target types can use creation or lifecycle anchors according to the source-reviewed candidate logic.

For a policy with retention period D days and an applicable timestamp t0, the nominal eligibility threshold is t_due = t0 + D days, subject to the implementation’s specific anchor, state predicate, time zone and exclusions. Do not use a generic calendar-month conversion in place of the configured duration. A policy change must be assessed for its impact on queued items referring to a historical version.

from datetime import datetime, timedelta, timezone
created = datetime(2026, 1, 1, 12, tzinfo=timezone.utc)
retention_days = 365  # synthetic example; not a statutory schedule
eligible_at = created + timedelta(days=retention_days)
print(eligible_at.isoformat())  # 2027-01-01T12:00:00+00:00

Candidate selection and scheduled retention

The sc_ei_cleanup_expired_attachments legacy cron hook calls a queue-only compatibility layer. SC_EI_Retention_Engine::candidates() scans policies and eligible targets; queue_candidates() constructs retention actions and records a queue report. This does not itself perform a physical deletion or redact private content.

A completed cron run with nonzero candidates is not evidence that those candidates have been approved or executed. Collect counts for candidates, new queues, already existing actions, hold blocks, failed queue attempts, and current actionable backlog. Confirm how configured limits affect coverage and whether later policies can be delayed when the per-run limit is reached.

Legal holds and dependency enforcement

An active hold can be scoped to an inquiry or to a specific attachment. The reviewed active_hold() method checks relevant holds, and the approval and execution code checks holds before proceeding. Queueing can mark an action blocked_hold. Hold records include reason, authority, placement time and review date; the review date is not an automatic release date.

Test hold creation before queueing, after queueing but before approval, and after approval but before execution. Check both target-specific holds and broad inquiry holds. Include a negative control in which an attachment-only hold is unrelated to another attachment; classify false positives independently of unauthorized execution. In incident analysis, compare hold placement/release timestamps to execution time—current active hold does not prove it existed at a prior execution.

Approval and execution policy

Whether an action requires an approved state depends on the deployed setting require_retention_approval. If enabled, only approved actions are eligible; if disabled, the source-reviewed execution method also permits queued. A separate configuration option can require a distinct proposer and approver. Neither option should be asserted as universally enabled. Record the effective settings during every staging test.

The executor re-checks hold presence, moves the action toward executing, dispatches the target-specific routine, and stores an executed or failed result with a verification timestamp. The reviewed method does not obviously re-evaluate every historic policy, current due date or changed target eligibility at the execution boundary. Treat stale policy or premature execution as a staging hypothesis to test, not as a confirmed production defect.

Verified deletion, redaction and downstream state

Attachment deletion must verify protected file absence and then persist a tombstone. A file can disappear while the tombstone write fails, yielding a partial-state incident that needs reconciliation. For inquiry redaction, the reviewed engine refuses to proceed while active private attachments remain. Communication and inquiry redaction use transactions for their own database updates, but success should still be checked against associated storage, retention metadata, and independently governed downstream systems.

Do not claim complete erasure across backups, analytics, hosted email, integrations, caches or legal archives without evidence from each system’s retention mechanism. The correct outcome may be restricted or preserved under hold, not deleted. A legal-hold exception should be documented with its authority and review cadence inside the private evidence register.

Privacy requests and identity verification

The Privacy and Retention Center supports access, erasure, correction, restriction, withdrawal and other request types. Before disclosing or erasing, verify the requestor or record a justified waiver, resolve the relevant subject records, inspect active holds and pending actions, and record any denial or partial completion. The WordPress privacy exporter/eraser bridge must not bypass the governed retention queue.

Assess false-positive identity matches, partial matches and duplicate requests using synthetic data. Document the outcome for each request; “closed” is not a scientific measure of correct disposition. When legal review is required, label it explicitly rather than turning a technical test into a legal conclusion.

Symptoms

Symptom First check Why it matters
Notice accepted but missing ledger event Inquiry notice anchors versus event table Consent persistence and evidence completeness
Withdrawal recorded, outbound still enabled Last valid consent event and privacy/communication state Purpose-specific restriction may be ineffective
Expired file is still present Queue status, hold and storage readiness Queueing does not erase
Queued retention action proceeds while held Hold scope and timestamps at execution Potential hold enforcement failure
Policy update changes disposition of old queue Queued policy_version versus current active version Unreviewed historical policy interpretation
Executed action lacks verified result Action verification timestamp and target postconditions Status alone is insufficient evidence
Attachment deleted but metadata remains active Physical absence and tombstone write result Partial execution requiring reconciliation
Erasure marked complete with private files Active attachment count and dependent systems Unsafe false-completion claim
Backlog grows despite daily cron Cron health and per-run target limit Coverage/throughput failure

Cause

Classify the first failed invariant as: evidence missing; purpose/consent mismatch; invalid policy or anchor; queue scheduling gap; hold conflict; authorization/approval mismatch; stale target/policy state; database or storage partial failure; downstream copy not covered; or an ambiguous metric or cohort. Distinguish a configuration choice from a software defect. A low aggregate error count is not proof of complete lifecycle governance.

Troubleshooting

  1. Identify the synthetic subject or authorized aggregate cohort; record the exact build and policy settings.
  2. Confirm the event sequence: notice version, grant, renewal/withdrawal and restriction status.
  3. Check policy key, version, target type, status scope and anchor; compute expected eligibility independently.
  4. Inspect queue state, dedupe key and action version; check whether an earlier action was reused.
  5. Check hold scope, placement/release timing, authority and status at approval and execution.
  6. Inspect target-specific dependencies, particularly active attachments before inquiry redaction.
  7. Read the recorded action status, error code, verification timestamp, audit event and postcondition separately.
  8. If a discrepancy remains, stop affected destructive processing, preserve a sanitized case packet, and perform fault injection only on authorized staging.

Read-only WordPress reconciliation

Use the packaged read_only_reconciliation.php from a private directory outside the public webroot. Run it under an authorized account; it uses the plugin’s known table names and four aggregate checks without updating data. The source SQL is provided separately for database administrators who must review exact query semantics. Counts may still be sensitive when small; do not publish raw output.

# On an authorized WordPress host; substitute your own private paths.
WP_PATH='/absolute/path/to/wordpress'
wp --path="$WP_PATH" plugin get sustainable-catalyst-engagement-intake --field=version
wp --path="$WP_PATH" eval-file '/absolute/private/path/read_only_reconciliation.php'
# Both commands are read-only; review your installed version before relying on conclusions.

The aggregate hold/action overlap check intentionally flags records requiring temporal review; a hold placed after completion is not a retroactive violation. The notice-ledger query counts only records with notice anchors, not a verified set of all public submissions. Use a separate source-specific cohort review before concluding that a missing anchor is a missing consent.

Synthetic diagnostic suite

The independent Python checker in this package accepts a deliberately minimal, synthetic JSON observation model. It is not a native Platform API schema, consent-law engine or live integration. It checks consistency across inquiry states, event chronology, policy references, hold timing, queue states, due times, approval evidence and storage postconditions. The evaluator does not infer purpose legitimacy from a string label or authorize real deletion.

# From the extracted package directory; Python 3.10+; no external packages.
PYTHONPATH=. python3 -m unittest discover -s tests -v
python3 consent_retention_checker.py fixtures/valid.json
python3 consent_retention_checker.py fixtures/invalid.json
# Exit code 2 means synthetic findings detected; this is expected for invalid.json.

Recorded results: 41/41 offline unit tests passed. The valid packet produced zero findings. The negative packet is intentionally inconsistent, so its reported findings are examples only—not measured defects in production. PHP syntax validation passed for the read-only reconciliation helper.

Quantitative validation and uncertainty

For a pre-specified observation period, report n_eligible correctly classified candidates / all independently adjudicated eligible candidates (sensitivity), n_ineligible_blocked / all independently adjudicated ineligible candidates (specificity complement), n_notices_matched / qualifying accepted public submissions (ledger completeness), n_hold_blocks / all attempted held executions, and n_verified / all execution attempts. Report failures and unknown results separately; never exclude failed persistence without saying so.

For a binomial endpoint with x failures among n approximately independent tests, the point estimate is x/n; always include uncertainty and dependence caveats. Even zero failures in 30 independent trials gives only an approximate 95% upper failure bound of 3/30 = 10% (rule of three). Systematic permission errors and correlated retry behavior violate independence assumptions; supplement counts with adversarial scenario coverage.

Controlled failure injection and recovery

In staging, inject failure at consent-ledger insert, legal-hold creation, queue insert, approval-state update, private-file deletion, tombstone update and action-finalization. For each failure, record the last durable state before retry and check whether the operator receives a stable error classification. Test that queue retries do not create duplicate actions and that a failed tombstone does not result in a false “fully erased” declaration.

Do not backfill a missing consent grant without authentic original evidence. Do not release legal holds because a retention clock elapsed. Do not re-execute destructive actions based on an HTTP timeout alone. Use a supported, guarded restore and a state reconciliation plan; if the actual result is unknown, classify it as indeterminate rather than successful.

Resolution

Failure Bounded correction Acceptance evidence
Missing consent event Repair ledger write reliability; preserve original records and investigate gaps Subsequent synthetic intake persists event; historic gap remains explicitly documented
Withdrawal restriction not applied Correct event-to-state enforcement and stop unauthorized downstream processing Restricted test actor denied; allowed activity documented
Wrong policy due date Review correct anchor, scope, version and UTC clock Independent calculation matches preflight queue
Hold bypass Disable affected executor, repair authorization and recheck hold immediately before execution Held synthetic action remains blocked
Failed physical deletion Repair protected-storage operation; reconcile tombstone and actual file absence Both DB and storage postconditions verified
Executed without evidence Surface and preserve partial state; repair audit/finalization path Action, timestamp and independent outcome agree
Policy version drift Review old queued actions explicitly; cancel/re-queue through governed workflow when warranted Policy lineage and actor decision preserved

Validation

Evaluate the study at three independent levels: structural validity (required records, types, version references, and event timestamps), process validity (authorized transitions, hold enforcement, approval settings, deduplicated queues, and failure visibility), and outcome validity (actual protected-file absence, database redaction, and evidence from separate downstream systems). A pass at one level cannot substitute for the next.

Use one valid control per branch, one counterexample per rejection rule, and at least one fault injection at each persistence boundary. Adjudicate each test against the predeclared expected state, not against whichever state the software happened to return. Record disagreements and exceptions, including cases that cannot be tested safely. No live validation or independent scientific review was conducted for this article.

Verification

  1. Pin the exact installed artifact and confirm all required schema tables/columns and privacy configuration.
  2. Accept a clean synthetic inquiry and match its notice event version, source and timestamp.
  3. Reject a missing or tampered authorization; verify zero newly created durable private records.
  4. Record a withdrawal and test restricted processing; separately test valid renewed authorization and controlled release of restriction.
  5. Create a new policy version and prove the prior version remains readable and still referenced by historical actions.
  6. Preview and queue eligible/younger targets; validate queue throughput and deduplication without executing real data.
  7. Test inquiry-scoped, attachment-scoped and late-placed holds through relevant action stages.
  8. Test the installed approval setting as configured, including same-actor approval when permitted, rather than imposing an unsupported reviewer requirement.
  9. Verify each simulated deletion or redaction with target-specific postconditions and independent audit evidence.
  10. Confirm anonymous and low-privilege access cannot retrieve consent narratives, legal-hold notes, private requests or retention evidence.
  11. Record every staged test as PASS, FAIL, NOT RUN or INDETERMINATE with source/version evidence and signed operator disposition.

The included staging matrix is a planning artifact. None of its staging cases was executed here. Only after environment-specific observations satisfy those gates should the Knowledge Base “last verified version” field be populated.

Reporting boundary

Publish study design, anonymized denominators, supported product versions, policy-method descriptions, privacy-preserving error classes, accepted limitations and bounded improvement recommendations. Withhold identities, correspondence, precise file locations, raw consent narratives, legal-hold reasons, access tokens, sender metadata and sensitive small-cell aggregates. A technical validation establishes whether defined state transitions behaved as tested; it does not certify global privacy-law compliance, lawful-basis judgments or participant consent quality.

One accountable operator may maintain the evidence and execute authorized review actions; when independent validation is feasible, state who checked it. When independent evaluation is not available, describe the limitation rather than asserting that a second reviewer formally approved the work.

Technical references

Evidence scope: All implementation statements are tied to the pinned source revision above. The standalone checker is an illustrative independent validation model, not proof that a live deployment has passed these controls.

Scroll to Top