Troubleshooting
Troubleshoot consent and retention — Contact and Engagement Platform
Diagnose consent and retention failures by reconciling purpose-specific authorization events, versioned policy clocks, legal holds, queued actions, protected erasure, and audit evidence. This developer troubleshooting guide provides read-only WordPress diagnostics, reproducible synthetic tests, and controlled recovery criteria for preserving privacy and traceability.
Application: Contact and Engagement Platform
Component: Privacy and Retention Center — Consent, Policy & Legal Holds
Source-reviewed version: 2.0.2 (source candidate, not a confirmed deployed build)
Verification status: Source-reviewed; offline test evidence recorded separately; staging and live verification pending
Article type: Troubleshooting / Technical Reference
Estimated reading time: 19–23 minutes
Consent and retention incidents must be diagnosed as a sequence of documented state transitions, not as a single checkbox or expiration date. A private inquiry may have a consent acknowledgment, a later withdrawal, an applicable legal basis independent of consent, a versioned retention rule, a queued action, an active legal hold, and multiple dependent documents or communications. These records answer different questions. This procedure helps locate the first unverified transition, preserve private evidence and recover without fabricating permission or deleting records blindly.
Goal
Identify and correct the first failed consent or retention invariant while preserving traceability. A passing outcome means that a permitted processing operation has a valid, timely authority record; withdrawals and restrictions are enforced for the relevant purpose; expiration is evaluated against a documented policy and lawful exceptions; and any completed disposal is supported by target-specific verification. Queued, approved, executed, redacted and erased are distinct states.
Requirements
- Confirm the installed plugin version, source/deployment digest, WordPress and PHP versions, database migrations, privacy settings, background scheduler state and exact affected workflow. Do not infer the running version from the GitHub repository.
- Use administrator-authorized staging with wholly synthetic records for mutations and fault injection. Perform only documented read-only reconciliation against live data; use aggregate results and suppress small cells before sharing.
- Understand the capabilities involved. Use the WordPress Privacy and Retention Center for authorized operations; the provided helper requires
sc_intake_view_privacy_centerand an explicit WP-CLI user. - Capture a private, access-controlled evidence packet: action ID, inquiry pseudonym, relevant policy key/version, event chronology, status transitions, error codes, hold scope, object-version references, and relevant build identifiers. Do not publish email addresses, inquiry narratives, attachment names or legal-hold reasons.
- Take a verified backup before any state-changing recovery, migration, retry, approval, deletion or restoration. This article intentionally provides no database UPDATE/DELETE scripts.
Symptoms
| Symptom | First evidence to inspect | Likely boundary |
|---|---|---|
| A contact remains active after withdrawal | Latest event by type and timestamp; current privacy state | Consent chronology or downstream processing gate |
| Accepted inquiry has no notice event | Notice-version anchor and matching privacy_notice event |
Post-create consent-ledger insert |
| Expired records never disappear | Queue scan, active policy, candidate eligibility, action state | Queue-only scheduling versus execution |
| Approved action cannot execute | Hold scope; approval setting; target dependency | Legal hold, status gate, missing attachment deletion |
| Record deleted despite apparent hold | Hold placement/release time relative to execution | Historical hold enforcement or misread current state |
| Two policies seem to apply | Policy key, version, status, status scope and anchor | Version/scope configuration |
| Execution says complete, but file still exists | Storage result, absence check and deletion tombstone | Partial physical/database delete |
| New policy is not reflected in queued item | Queued snapshot version versus active policy at execution | Stale queue or missing execution-time policy check |
| Privacy request marked complete but access/export is unsafe | Identity status, exception/waiver, dependency list | Identity verification and lifecycle reconciliation |
| Consent history or aggregate report conflicts | Cohort definition, versions, scope, event ordering | Query false positive, stale cache, omitted records |
| Low-privilege actor can read private records | Authenticated capability and cache layer | Private-read authorization or disclosure |
| Retention task is repeatedly retried | Failure code, action_version, side effects, dedupe key | Partial execution and unsafe replay |
Cause
Classify before changing anything. Notice/consent failures include absent or mismatched consent events, wrong purposes and chronological errors. Policy failures include incorrect start dates, status scopes, superseded versions and premature eligibility. Lifecycle failures include unrun queue scans, blocked actions, failed attachments, incomplete redaction or missing audit evidence. Permission and confidentiality failures include unauthorized reads, improper disclosure or unchecked downstream delivery. A current status alone rarely proves which class applies.
Study design and definitions
Specify an observation window (UTC), target population, inclusion/exclusion criteria and unit of analysis before computing failure rates. Separate the following: inquiry (private record), consent event (a typed acknowledgment/permission/withdrawal), privacy request (request and identity state), policy version (rule and retention clock), legal hold (documented preservation exception), retention action (stateful queued/approved/executed task), and storage artifact (file or dependent copy). Consent-event evidence does not, by itself, establish that consent is the correct legal basis. Record the distinction between an engineering observation, an inferred cause, and a legal or scientific determination.
Source-reviewed implementation map
| Implementation | Observed source contract | Validation limit |
|---|---|---|
SC_EI_Privacy_Repository::record_consent() |
Persists typed consent events with version, action, basis, source and time; withdrawal restricts the inquiry | A UI acknowledgment or main row is not proof its separate event was saved |
SC_EI_Retention_Policy_Repository |
Stores versioned policies; replaces active version by archiving the predecessor | An action referencing an old version requires historical interpretation |
SC_EI_Retention::cleanup() |
The legacy cron hook queues retention candidates | Cron completion does not mean physical deletion |
SC_EI_Retention_Engine::execute_action() |
Checks state and active holds, dispatches by target type, records result and verification time | The stored time is application evidence, not proof of every external copy being erased |
SC_EI_Privacy_Repository::active_hold() |
Looks for holds including inquiry/attachment scope | Current active holds do not establish past hold state |
SC_EI_Privacy_Repository::approve_action() |
Honors distinct-approver configuration if enabled | A second operator is not universally required by the reviewed code |
SC_EI_Privacy WordPress exporter/eraser |
Integrates with WordPress privacy processes | The eraser bridge queues controlled actions; do not infer immediate completion |
SC_EI_Audit_Log::record() |
Stores typed private audit entries | Audit write return values should be independently reconciled |
Troubleshooting
- Identify the affected object and its precise last known correct state. Decide whether the event concerns consent, processing, queueing, approval, execution, private export or physical deletion.
- Freeze unauthorized or destructive actions if the outcome is uncertain. Use a public-write pause where appropriate, but remember that not all background and administrative processes are the same as public intake.
- Capture the last effective consent event for the relevant consent type, its source and version. Distinguish a new renewal from an older withdrawal.
- Identify active and historical policy versions, retention anchor field, status scope, due time and queued snapshot. Compare to the source record as of the event being investigated.
- Check hold scope and event chronology before labeling an action a violation. A hold placed after execution does not retroactively prohibit an earlier action.
- For a pending action, inspect
queued,approved,blocked_hold,blocked_dependency,executing,failedorexecutedstate and the corresponding error code. - For an executed action, verify both the target-specific side effect and any database tombstone; inspect dependent files, linked communications and governed external systems separately.
- Capture sanitized before/after evidence and rerun only the minimum synthetic regression necessary to confirm recovery. Do not automatically replay operations with uncertain side effects.
Diagnose consent-event gaps
A public form can persist the main inquiry before a separate consent-ledger callback is executed. The reviewed callback does not propagate all consent-write failures to the caller. Accordingly, a successful submission is not proof that a matching privacy_notice event exists. Use notice-anchored records as an initial reconciliation cohort; not all records with a notice version necessarily came through the public form.
Read-only consent reconciliation query
The following MySQL example counts inquiry rows with a stored notice version and timestamp and checks whether they have a matching privacy_notice/granted/public_form event. It intentionally uses a synthetic example month and should be limited to a private operator environment. Change wp_ to the real WordPress table prefix. Missing matches are investigation leads, not proof that a sender failed to consent.
SELECT COUNT(*) AS notice_anchors,
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.source='public_form'
AND c.consent_version=i.consent_version
) THEN 1 ELSE 0 END) AS potential_ledger_gaps
FROM wp_sc_ei_inquiries i
WHERE i.created_at >= '2026-11-01 00:00:00'
AND i.created_at < '2026-12-01 00:00:00'
AND i.consent_version <> '' AND i.consent_at IS NOT NULL;
If an event is missing, preserve the source notice, timestamp, and original submission evidence. Do not manufacture a retrospective “granted” event. Repair event-write reliability through the supported application workflow, then retest with synthetic input and record whether the affected historic case needs manual privacy review.
Resolve withdrawal and renewal chronology
Read consent events in chronological order by consent_type with an explicit tie-breaker such as event ID. The effective event for communication may differ from the one for calendar_invitation; a blanket “consented” flag is insufficient. A documented withdrawal can move the inquiry into restricted state. Do not interpret this as erasure or as a declaration that every type of processing is forbidden under every legal basis.
- Reconstruct the latest effective action: granted, renewed, withdrawn, or unknown. Retain the event source, time, notice version and subject-to-purpose mapping.
- If the latest event is withdrawal, test whether prohibited outbound processing is blocked while valid preservation/hold processing remains controlled.
- If later renewal is asserted, verify evidence of the new event and a separately authorized privacy-state transition; the old withdrawal should remain in history.
- If an event is out of order or lacks a reliable timestamp, classify the case as unresolved until the original evidence can support the chronology.
Retention policies and due-date calculations
The policy engine uses documented anchors such as created_at, updated_at, closed_at, or an attachment-specific retention_until (depending on target type). Candidate selection uses policy status scope and eligibility, and may fall back to other record timestamps when a preferred anchor is absent. These details must be captured before comparing “days retained.”
Illustrative scientific model: due_at = anchor_utc + retention_days × 86,400 seconds for fixed-day policies. This formula is only a test model; the actual application may store an explicit due timestamp or use different field-specific rules. Use timezone-aware UTC datetime comparisons and test leap days, clock changes, missing anchors and policy revisions. An elapsed day count is not equivalent to legal eligibility.
from datetime import datetime, timedelta, timezone
def illustrative_due_at(anchor_iso: str, retention_days: int) -> str:
if retention_days < 1:
raise ValueError('retention_days must be positive')
anchor = datetime.fromisoformat(anchor_iso.replace('Z','+00:00'))
if anchor.tzinfo is None:
raise ValueError('anchor must have a time zone')
return (anchor.astimezone(timezone.utc)
+ timedelta(days=retention_days)).isoformat()
assert illustrative_due_at('2026-01-01T00:00:00Z',30) == '2026-01-31T00:00:00+00:00'
Version and scope conflicts
A newly created policy version archives the old active version. This preserves historical interpretation, but existing queued actions may still reference an old key/version and due time. The execution code verifies status and legal holds; it does not obviously recalculate every prior candidate against the currently active policy or current due date before dispatch. Re-evaluating historic actions under a new policy is a governance decision, not a simple database overwrite.
- Compare action policy key/version, snapshot and due date against the version in force when queued; separately compare with the policy applicable at execution.
- Check that target type and status scope have not changed and that a source status transition did not invalidate eligibility.
- Treat “old version” as a review warning, not automatic evidence of a wrongful execution. A later policy version is not necessarily retroactive.
- If the action is unsafe to execute, use the authorized cancellation/requeue workflow, preserve the original action and audit, and obtain a new decision under the applicable policy.
Scheduled queue scans are not deletion
The legacy scheduled hook sc_ei_cleanup_expired_attachments is retained for compatibility. Its queue-only pathway scans candidates and places planned actions into the retention ledger; it does not directly remove files or erase inquiry content. A scheduler report claiming “cleanup completed” can therefore mean only that an eligibility queue was processed.
# WordPress host, read-only; use your actual WordPress root.
WP_PATH='/absolute/path/to/wordpress'
wp --path="$WP_PATH" plugin get sustainable-catalyst-engagement-intake --field=version
wp --path="$WP_PATH" cron event list --fields=hook,next_run_relative --format=table | grep sc_ei_cleanup_expired_attachments || true
# A scheduled event is not evidence that execution or erasure occurred.
Compare candidate_count with queued, previously existing, blocked and failed counts, recognizing that scheduled windows, limits and dedupe can affect the definitions. An unexpectedly small count can reflect a candidate cap rather than absence of expired records.
Legal-hold enforcement
The reviewed system supports inquiry-scoped and attachment-scoped holds. They are evaluated at queueing, approval and execution. A hold blocks deletion where applicable, but the fact that a hold is active now does not prove it existed at the time of an earlier execution. Query placed/released timestamps and verify target scope.
| Scenario | Expected handling | Evidence |
|---|---|---|
| Hold before queueing | Action marked or remains blocked | Hold ID/scope, action state, source decision |
| Hold after queueing | Approval/execution must recheck and block | Chronology, action status, error code |
| Hold after approval but before execution | Executor must block | Hold timestamp precedes execution attempt |
| Hold placed after successful execution | Historical event requires review, not retroactive failure | Execution time earlier than hold time |
| Attachment-specific hold on another attachment | Check exact target; avoid global false violation | Attachment ID and scope match |
Approval rules and sole-operator governance
The option require_retention_approval controls whether the execution method only permits approved actions or also permits queued actions. A separate require_distinct_retention_approver setting can reject an approval by the same actor who proposed it. Neither rule should be presumed enabled on a particular installation. A single-operator deployment must accurately document its configured approval model and owner-verified evidence; do not label it “independently reviewed” if that did not occur. Preserve an attributable decision trail even when the same authorized operator conducts review and execution.
Investigate failed or stuck executions
A retention action may remain failed or executing after an exception, database error or failed physical operation. Inspect the action ID, version, original snapshot, last failure code and all prior side effects. Re-running an action without that reconciliation can cause duplicate transitions or conceal a partially completed deletion.
-- Aggregate-only first pass; no UPDATE/DELETE.
SELECT status, COUNT(*) AS records
FROM wp_sc_ei_retention_actions
GROUP BY status ORDER BY status;
SELECT COUNT(*) AS prematurely_executed
FROM wp_sc_ei_retention_actions
WHERE status='executed' AND due_at IS NOT NULL
AND executed_at IS NOT NULL AND executed_at < due_at;
SELECT COUNT(*) AS missing_execution_evidence
FROM wp_sc_ei_retention_actions
WHERE status='executed' AND verified_at IS NULL;
A completed status and non-null verified_at reflect application-recorded evidence. They do not certify that external backups, email providers, caches or downstream replicas have completed their retention procedures.
Attachment erasure and tombstones
For a private attachment, the executor attempts to remove the protected file, checks for its absence, then records a database tombstone. If file removal works but the tombstone fails, it returns a partial-state error. Conversely, a missing database record does not prove physical absence. Source review also shows that correctness depends on protected path resolution; test a deliberately unresolved storage path in staging rather than assuming a boolean alone proves physical absence.
- Confirm the target is the intended private attachment and its relationship to the inquiry.
- Inspect the approved action and effective hold at the moment of execution.
- Check that protected storage resolved the expected path and the original file is absent; do not print real paths publicly.
- Confirm tombstone and attachment metadata agree, and check that no quarantine/release action re-exposed the file.
- Classify external backups and replicas separately. Do not call an operation globally erased without evidence from each in-scope store.
Inquiry and communication redaction
Inquiry redaction requires active private attachments to be removed first. Communications, reviews, consent evidence and privacy-request text may be redacted transactionally through the engine. The resultant record can retain a nonpersonal audit tombstone. Verify the intended data fields and relationships using an authorized staging snapshot; a SQL transaction on one database does not reach external notifications, analytics snapshots, integrations or separately retained backup media.
Privacy requests and identity
Privacy requests are not equivalent to consent events. A requester may seek access, correction, withdrawal, erasure, restriction, portability or another action. An access/export action requires proper identity verification or a documented policy-supported waiver before private disclosure. An erasure request may be denied, partially completed, delayed by a hold or blocked by a dependent attachment. Report the exact final state, not a generalized “handled.”
Protected reporting and least privilege
Keep private case fields in the operator-controlled system. A public support article must not contain actual sender names, emails, uploaded filenames, legal-hold narratives, message bodies, internal paths, credentials or privacy export contents. Evidence shared publicly should be synthetic; aggregate metrics may still reveal identities when a population is very small. Test low-privilege and anonymous access to private records separately from public submission routes. Unauthorized 2xx reads are security incidents, not normal workflow errors.
Run read-only WordPress reconciliation
The included read_only_reconciliation.php is an administrator-only, aggregate-first helper intended to run outside the webroot. It requires an explicit authorized WP-CLI account with sc_intake_view_privacy_center and does not change records. It detects likely notice gaps, executed actions lacking recorded verification, current hold conflicts requiring review, premature execution and stuck actions. Output includes counts only; suppress small counts before external sharing.
# Private authorized environment only; adjust your own paths/user.
WP_PATH='/absolute/path/to/wordpress'
wp --path="$WP_PATH" --user='<admin-login>' eval-file '/absolute/private/path/read_only_reconciliation.php'
# Do NOT publish this script in the webroot or treat its aggregate counts
# as a legal determination or a physical file-integrity test.
The hold/action overlap query intentionally limits itself to approved or executing actions so it does not incorrectly label an action executed before a later hold. A retrospective investigation must reconstruct holds that were active at the earlier time, including those subsequently released.
Reproduce with the offline synthetic checker
The package contains a foundational consent/retention evidence checker and a dedicated troubleshooting classifier. Both accept explicit synthetic JSON; their inputs are illustrative diagnostic packets, not actual deployed REST schemas or production database exports. The checker tests consent chronology, approval evidence, hold-at-execution status, request identity evidence, physical deletion claims, scheduler semantics, and private disclosure.
cd consent_retention_troubleshooting
python3 -m unittest discover -s tests -p 'test_*.py' -v
python3 retention_triage.py fixtures/valid_incident.json
python3 retention_triage.py fixtures/invalid_incident.json || test "$?" -eq 2
python3 foundation/consent_retention_checker.py foundation/fixtures/valid.json
The suite records synthetic findings; a failing test is not evidence that the deployed site has the same defect. A report showing W_POLICY_RECHECK means policy eligibility needs temporal review; it does not automatically establish a violation.
Controlled staging failure injection
- Set up fresh synthetic cases and retain the pre-test WordPress snapshot. Record plugin source digest, DB version, event times and effective privacy settings.
- Submit a normal inquiry and confirm that both the notice event and expected audit records are present before using it as a control case.
- Inject a consent-ledger write failure: the outcome must be flagged for reconciliation even if a main inquiry was created. Restore normal persistence before subsequent tests.
- Queue a retention action under one policy version, update the policy, and test whether the action is appropriately reconsidered before execution.
- Place an inquiry or attachment legal hold before queueing; then repeat with a hold placed after approval but before execution. Confirm that the hold blocks all relevant operations.
- Test a hold placed after
- Inject private file deletion success followed by tombstone-write failure. Verify partial-state classification and that recovery does not blindly re-delete.
- Test an inquiry with remaining active attachments, a missing identity verification for export, and a withdrawn consent with a blocked outbound workflow.
- Restore the staging snapshot, verify no synthetic private information leaked into public caches or logs, and record unresolved exceptions.
Quantitative validation and uncertainty
Predeclare denominators and outcomes. For n_applicable eligible retention actions, define successful evidence-complete execution rate as n_verified / n_applicable; for n_withdrawn applicable restriction cases, define downstream violation rate as n_prohibited_operations / n_withdrawn; for n_due eligible records, define queue capture as n_correctly_queued / n_due. Treat blocked holds and legitimately excepted cases as separate categories rather than automatic misses.
For a binomial rate with zero failures in n independent trials, the approximate upper 95% failure probability is 3/n. For example, 0/30 observed failures gives an upper bound near 10%, not proof of zero risk. Non-independent cases, repeated retries and policy-dependent selection break simplistic inference. Report numerator, denominator, observation time window, selection method, exclusion criteria, and uncertainty; do not claim observed causal effectiveness from successful unit tests.
Resolution
| Observed failure | Safe next step | Required proof |
|---|---|---|
| Notice ledger gap | Preserve original evidence and fix event-write reliability; never fabricate consent | New synthetic submission produces matching notice event; historic gap remains recorded |
| Withdrawal not honored | Restrict relevant processing through authorized workflow; check downstream queues | Prohibited synthetic delivery blocked; event chronology reconciled |
| Stale policy action | Compare queued and current policies, cancel/requeue if justified | Correct policy/version/due and preserved prior action |
| Active hold conflict | Stop approval or execution; review hold scope and chronology | Action blocked while hold effective |
| Unapproved execution | Restore approval gating consistent with documented setting | Unsupported action rejected and audit recorded |
| Partial private-file erasure | Use protected storage reconciliation and repair tombstone through supported path | Physical absence plus consistent metadata; no public exposure |
| Stuck or failed action | Reconcile all side effects before any retry or restore | Single intended final state with auditable recovery |
| Unauthorized disclosure | Disable leaking read or cache pathway and investigate privately | Anonymous/low-privilege reads denied; authorized reads still functional |
| Incomplete privacy request | Reconcile identity, holds and related dependencies | Correct request state with documented disposition |
Verification
- Version: record installed plugin version and source digest; do not set “last verified version” from source review alone.
- Consent: notice and purpose-specific events reconcile by version and time; synthetic withdrawal and renewal behave as expected.
- Eligibility: test each policy anchor, status scope, due date and relevant historic version; early execution fails.
- Holds: all in-force holds block applicable operations, including those introduced after queueing and approval; later holds do not cause false retrospective failures.
- Approval: execution respects the installed approval settings and retains attributable operator evidence.
- Persistence: failed actions record error codes; repeated operation does not conceal partial effects or invent completion.
- Erasure: physical file absence, tombstone, inquiry/communication redaction and relevant external retention evidence are independently inspected.
- Privacy: unauthorized actors cannot retrieve private data, and public incident evidence contains no identifying case content.
- Recovery: before/after state, operator decision, tests, rollback evidence, residual risks and next review date are documented.
- Scientific judgment: sampled cases, rates, uncertainty, confounders and remaining unverified behavior are explicitly reported.
Reporting boundary
The acceptance threshold “records can be reviewed and expired according to approved policy” means policy-correct dispositions and traceable evidence, not automatic deletion or universal legal compliance. A restricted record, a hold-preserved record and a verified redacted record may each be correct under different documented circumstances. Publishing a guide or passing an offline test does not certify the live software or a specific privacy decision. Keep full incident evidence private and share only sanitized, non-identifying summaries.
Technical references
- Consent and privacy repository
- Retention engine
- Versioned policy repository
- Retention scheduling and queue-only compatibility layer
- Privacy taxonomy and settings
- Privacy Center operator actions
- WordPress privacy exporter and erasure bridge
- Database schema
- Audit log
- Private inquiry persistence
- Privacy and Retention Center runbook
- Source contract tests
Evidence scope: Source reviewed at commit 3f246974276a5e582d09f8c48d21628b82626bc7. Standalone diagnostic scripts and test fixtures are illustrative, not supported plugin endpoints. There has been no production data access, approved retention execution, or live software certification as part of this article.
