Worked Examples
Validate scientifically article versioning — Product Support and Feedback Platform
Validate support article versioning through controlled tests of generated-content fingerprints, human revisions, import identity, editorial metadata, and publication status. This scientific validation guide provides reproducible experiments, read-only WordPress diagnostics, and measurable evidence criteria for detecting unauthorized overwrites while preserving recoverable article history.
Application: Product Support and Feedback Platform
Component: Integrated Knowledge Base, Support Content Operations, and Editorial Governance
Guide type: Scientific validation / reproducible procedure
Source reviewed: Git commit 29a2bbfec41bdae059d31eff1aac1b6bfea9e129
Verification status: Source reviewed; offline diagnostic tests executed; staging and production verification pending
Estimated reading time: 19 minutes
Article versioning must protect a contributor’s substantive revisions while retaining the correct article identity, publication decision, provenance, and recoverable history. This guide defines a falsifiable procedure for examining how bundled documentation imports and manual WordPress editing interact. It distinguishes body preservation, editorial continuity, and public-state control; they are not interchangeable guarantees.
Goal
Determine whether repeated automated imports preserve manually edited Support Article content without silently overwriting it, whether legitimate updates to untouched generated content are accepted, and whether related metadata, publication status, and revision history remain defensible. The primary criterion is no unauthorized replacement of a manually edited article body. Secondary criteria concern provenance, discoverability, reproducibility, and the ability to reconstruct what was visible at a particular point in time.
Requirements
- Use a dedicated staging WordPress installation, isolated fixtures, and approved test accounts. Never use real support-case material, requester details, credentials, or production-only notes.
- Pin the installed plugin commit and version, WordPress version, PHP version, content corpus revision, and import settings. Record whether the importer is the bundled integrated Knowledge Base importer or the separate Content Operations importer.
- Confirm a successful database backup and restoration procedure before writing synthetic staging records; preserve existing post revisions, metadata, taxonomy terms, and URLs.
- Include an author, an independent reviewer, a publishing operator, and an unauthorized observer in the study design where role-based effects are tested.
- Collect immutable, access-restricted before/after evidence: article ID, status, slug, revision IDs and timestamps, title/body fingerprints, source key, generated hash, override flag, and relevant governance fields.
Symptoms
Versioning failures may appear as an edited paragraph reverting after a plugin upgrade, a draft unexpectedly going live, an article’s summary or verified-version label changing despite preserved body text, a second record appearing with a similar slug, a previously published guide disappearing, or approval metadata no longer matching the actual version. A lack of visible change does not prove the revision chain is complete; check storage and public output separately.
1. Study design and falsifiable hypotheses
Define the study unit as one existing WordPress sc_support_article record observed before and after an importer operation. Distinguish units by source: first-party bundled corpus, manually created article, Content Operations import, or other integration. The comparison is between intended behavior and measured after-state under a controlled intervention, not between arbitrary historical pages.
| Hypothesis | Required observation | Disconfirming counterexample |
|---|---|---|
| H1: protected edit | When stored generated fingerprint exists and current title/body differs, those four editorial fields remain byte-identical after bundled reimport. | Article title, slug, excerpt, or body changes without explicit approval. |
| H2: unedited update | When stored and current fingerprints match, a changed source article updates the generated article predictably. | Importer incorrectly classifies an untouched generated article as overridden. |
| H3: missing baseline safety | An existing article with no generated fingerprint is never silently overwritten without a verified origin. | Existing manual text is overwritten because no old fingerprint exists. |
| H4: identity and history | Canonical article ID and relevant revision evidence survive the operation. | Duplicate record, unmatched slug collision, or missing revision needed for reconstruction. |
| H5: governed publication | Post status and approval/verification evidence change only under an authorized policy. | A draft becomes public or approval metadata is reset by the importer without review. |
Interpretation: H1 and H2 describe paths in the reviewed source. H3 and H5 express stronger safety requirements and may fail against the reviewed implementation. Tests must report failures rather than weakening acceptance criteria to match existing code.
2. Source-verified implementation boundaries
The integrated importer belongs to SCFS_Integrated_Knowledge_Base, reads content/knowledge-base/articles.json, and uses stable content keys in _scfs_integrated_kb_key and legacy _sckb_content_key. It falls back to a matching article slug when neither key resolves. Each matching record may be updated using wp_update_post(); new records use wp_insert_post().
For an existing match, the source compares the current article fingerprint with _scfs_integrated_kb_hash, falling back to _sckb_generated_hash. A mismatch is classified as a manual override only if both fingerprints are nonempty. If classified as overridden, the importer leaves title, slug, excerpt, and body out of the update payload. It still sets post_status=publish and menu_order, refreshes metadata, and reassigns taxonomy terms.
The importer also sets metadata including _scfs_integrated_manual_override, _scfs_editorial_state, _scfs_editorial_approval_note, _scfs_last_verified_version, and _scfs_verified_at. The reviewed source contains a fixed verified-date value in this import path; it must not be treated as evidence that a current human verification occurred. Changes in these fields must be reported even when body protection works.
3. Reconstruct the content fingerprint
The bundled importer computes a SHA-256 digest over the UTF-8 string formed by the article title, one newline, and rendered HTML body, after substituting sample download URLs and replacing the initial draft-status notice. The stored digest represents the generated baseline, not an authenticated editorial approval or a cryptographic signature.
from hashlib import sha256
def generated_hash(title: str, html_body: str) -> str:
return sha256((title + "\n" + html_body).encode("utf-8")).hexdigest()
baseline = generated_hash("Synthetic setup", "<p>Generated v1</p>")
current = generated_hash("Synthetic setup", "<p>Human edit</p>")
assert baseline != current
Compare the hash using the exact stored WordPress title and body bytes. HTML entity changes, whitespace normalization, slash escaping, and serialization may affect byte-level comparisons; those differences should be documented rather than silently normalized away. The editorial approval hash in SCFS_Editorial_Governance::content_hash() covers title, content, and excerpt encoded as JSON; it is not interchangeable with the generated baseline hash.
4. Recognize distinct import mechanisms
| Path | Reviewed behavior | Validation concern |
|---|---|---|
| Bundled Knowledge Base import | Finds by source key, legacy key, or slug; updates generated content when no manual override is detected. | Missing baseline hash; fallback collisions; unconditional publish state; refreshed metadata. |
| Support Content Operations import | Creates records from validated imported sources, applies duplicate policy, and supports draft or pending status. | Duplicate detection, permissions, import batch history, rollback of created records. |
| WordPress editor | Stores an ordinary revision-enabled sc_support_article. |
Revision retention, status transitions, field-level update fidelity, role access. |
| Editorial Governance | Stores review states, assignments, notes, and content hashes. | Approval evidence can diverge from the published article; direct article publication is not uniformly gated. |
Do not apply an acceptance test written for the draft-by-default Content Operations importer to the first-party bundled importer, which explicitly requests published records. Record the specific function, version, and configuration of each trial.
5. Experimental conditions and controls
Pre-register a scenario matrix before executing the import. At minimum, compare: (A) new bundled article; (B) unchanged generated article with a new source revision; (C) manually modified body with valid stored baseline; (D) manually modified title with valid baseline; (E) manually modified body with missing baseline; (F) legacy baseline-key migration; (G) content-key collision; (H) slug-only collision; (I) manually edited excerpt; (J) preexisting draft; (K) metadata/taxonomy alterations; and (L) a double run of identical source content.
For every scenario, freeze the precondition and expected result before observing output. Use fresh synthetic fixtures and isolated test identifiers. Run each test at least twice to detect persistence, idempotency, and asynchronous status changes; repeat under different editors and site configurations only when those variables are explicitly controlled.
6. Procedure
- Identify the source artifact by the bundled
content_key, WordPress article ID, and installed plugin commit. Confirm whether the record already exists and whether its slug is unique. - Record the article’s title/body SHA-256 hash, excerpt, slug, status, revision count, assigned terms, generated-baseline hash, override marker, verification metadata, editorial state, and publication date.
- Snapshot the database and WordPress options used by the importer. Confirm rollback evidence in a staging-only restore trial.
- Change exactly one variable per experiment: body, title, excerpt, missing hash, source revision, post status, matching key, or taxonomy assignment.
- Execute the approved importer in staging only, with write auditing and a single operator. Do not use a production Admin import command for this exercise.
- Compare after-state with pre-registered field-level expectations, not only the importer’s success count.
- Retrieve the revision chain and anonymous public response where relevant; compare stored data with published output and archival evidence.
- Execute a repeated import with the same source and verify that no unexpected additional body changes, duplicates, or status transitions occur.
- Record whether observations support or reject each hypothesis, and attach the exact environment, exception logs, and source revision.
7. Read-only WordPress inventory
Use WP-CLI with the correct WordPress path and sufficient administrative read permission. The following commands do not write article records. The companion read_only_article_version_audit.php calculates aggregate risk indicators and prints no article text or contact information.
WP_PATH="/path/to/wordpress" # Set after verifying the deployment path.
wp --path="$WP_PATH" plugin list --fields=name,status,version
wp --path="$WP_PATH" post list --post_type=sc_support_article \
--post_status=any --fields=ID,post_status,post_modified_gmt --format=csv
# Read-only, reviewed PHP helper from the developer package:
wp --path="$WP_PATH" eval-file read_only_article_version_audit.php
Because wp eval-file executes PHP, inspect the helper, limit execution to a trusted operator, and do not enable it as a public endpoint. Its results are screening signals requiring case-specific review; an absent stored generated hash does not by itself prove content was overwritten.
8. Positive-control experiment: intact generated baseline
Start from a generated article whose stored baseline equals its current title/body fingerprint. Change only the bundled source content and run the importer. The reviewed code should update title, slug, excerpt, and body using the new source values and write a new generated hash. Confirm the same article ID remains in place and the WordPress revision history can reconstruct the earlier public text. A successful update does not establish approval or scientific verification.
9. Protected-edit experiment: human changes
Start from a generated article with a valid original stored baseline. Modify the body or title in WordPress and preserve the original generated hash. Reimport. The reviewed code should set the override flag and preserve title, slug, excerpt, and body. Compare their exact pre/post values; separately record any metadata, status, order, or taxonomy changes.
A separate edge case is an edit only to the excerpt or slug. Neither field is included in the generated title/body fingerprint, so changing just that field does not trigger the reviewed manual-override branch; the importer can replace the manually edited excerpt or slug with bundled values. Test these two fields independently rather than treating them as protected whenever any human edit occurs.
The preserved content condition can pass while the overall governance criterion fails. For example, a previously private article can be republished because the import payload requests publish regardless of the override flag. This requires a distinct publication-state assessment.
10. Negative controls: missing baseline and key collisions
Construct a manually edited article with neither the current nor legacy generated fingerprint, but with a matching bundled content key. The reviewed condition cannot identify a manual override without a nonempty prior fingerprint and can replace the article body. This is a source-supported safety gap to reproduce in staging, not a claim that any particular production article has been lost.
Create an unrelated article whose slug collides with a bundled article and which lacks both source keys. The importer may choose it through its fallback identity lookup. An acceptance policy should require a verified source identity before modifying a preexisting human-authored record; slug similarity alone is insufficient proof.
11. Revision history and reconstruction
WordPress registers Support Articles with the revisions feature, but registration alone does not prove that every migration created a usable revision. Inspect actual revision objects, timestamps, content fingerprints, authors, and restored snapshots. Approval notes and generated hashes are not a substitute for WordPress revision evidence.
Measure reconstruction completeness as the number of sampled changes with a verifiable before and after content state divided by the total sampled changes requiring reconstruction. If revisions were pruned, record that limitation and use authorized backups or source commits to fill the chain without inventing missing events.
12. Metadata and taxonomy side effects
Even when manual content survives, update_article_meta() refreshes the summary, audience, prerequisites, supported/last-verified version, source reference, source version, editorial state, approval note, verified date, and override marker. assign_article_terms() also updates product, version, component, article type, and collection relationships. Validate each against an approved mapping; record any divergence as a separate finding.
Never equate an imported _scfs_verified_at value with new human verification unless an authorized reviewer actually revalidated that version. Likewise, do not interpret _scfs_editorial_state=published as a complete, independent approval record.
13. Canonical identity and duplicate prevention
Define identity precedence for the study as current content key, legacy content key, then slug fallback. Check that one source key resolves to exactly one canonical WordPress post, existing manually authored articles are not claimed through a slug collision, and repeated runs do not generate multiple live URLs. Validate canonical tags, redirects, and taxonomy listings separately because a stable post ID does not guarantee unchanged public navigation.
14. Public access and publication-state tests
Observe the public state after each import as an anonymous user, not from an administrator browser. Test article permalinks, Knowledge Base collections, public search, sitemap entries, and REST article endpoints. A draft intended for editorial review should not become public merely because the content was imported. Document that the reviewed bundled importer unconditionally chooses post_status=publish for existing matched records; treat any unexpected visibility change as a publication governance finding.
15. Editorial approval and scientific verification are separate
SCFS_Editorial_Governance manages review states and approval evidence; SCFS_Support_Article_Integrity grades document readiness; SCFS_Support_Content_Governance records verification. Each provides a different type of evidence. The reviewed Editorial Governance publication filter returns early for sc_support_article, permitting native WordPress publishing independent of that general gate. Do not assert that the editor’s Publish action requires prior separate approval without an additional policy and staging proof.
16. Diagnostic fixture model
The supplied Python validator accepts JSON with source_records, before, after, and observations. It checks precondition integrity, source identity, manual-edit preservation, expected generated updates, publication-state drift, provenance, duplicate identities, and revision evidence. The model intentionally reports governance risks separately from source-behavior deviations.
python3 article_versioning_checker.py fixtures/valid.json
python3 article_versioning_checker.py fixtures/invalid.json
python3 -m unittest -v test_article_versioning_checker.py
All fixture IDs, titles, hashes, dates, and events are synthetic. A diagnostic script running over fixtures is not an integration test of WordPress hooks, revisions, or site access control.
17. Quantitative outcomes and uncertainty
Predefine the main proportion as unapproved_body_overwrites / manually_edited_trials. Report the number of eligible trials, failed or incomplete trials, skipped observations, and all exclusions. Secondary rates include unexpected publication changes, missing revision evidence, identity collisions, and metadata/approval drift. Never count a no-op test as evidence of protected manual edits.
from math import sqrt
def wilson_interval(failures, trials, z=1.96):
if trials == 0:
return None
p = failures / trials
denom = 1 + z*z/trials
mid = (p + z*z/(2*trials)) / denom
half = z*sqrt(p*(1-p)/trials + z*z/(4*trials*trials)) / denom
return (max(0, mid-half), min(1, mid+half))
assert wilson_interval(0, 30)[1] > 0.11
For example, zero failures in 30 independent representative trials still has an approximate 95% Wilson upper bound of 11.35% on the underlying failure rate. This is an uncertainty illustration, not an observed failure rate for Sustainable Catalyst. Correlated trials, selection bias, repeated tests on the same article, or nonrepresentative imports weaken statistical generalization.
18. Study design: paired comparisons and confounders
Use paired before/after observations for each article. Stratify by import mechanism, existing revision count, baseline presence, manual-edit status, and publication status. Hold constant the plugin commit, corpus artifact, URL rules, and editor role for a controlled series. Potential confounders include post-save hooks from other plugins, cache invalidation, manual moderation, cron-triggered jobs, WordPress escaping, and changes to version taxonomy data.
When comparisons span versions, maintain a change-control table showing which importer behavior changed and whether revised acceptance criteria were approved in advance. Observational similarity cannot establish causal protection; validate the counterfactual using an isolated edit followed by the target import action.
19. Privacy and restricted evidence
Export only article IDs, redacted metadata keys, hashes, state transitions, test labels, and counts into public reports. Keep editorial notes, unpublished text, reviewer identities, nonpublic URLs, and actual revision bodies in access-controlled evidence storage. Do not include production article content in public issues or paste sensitive draft text into an external bug report.
20. Cause
Failures can arise from an absent generated-baseline hash, incorrect fallback identity, differences in importer mechanisms, generated metadata refresh after a protected body, a status change independent of editorial approval, post-save filters, or revision-retention settings. Distinguish a verified source-level failure path from a demonstrated runtime incident, and distinguish both from content-editor disagreement.
21. Troubleshooting
| Observation | Inspect | Do not assume |
|---|---|---|
| Edited text reverted | Prior generated hash, current title/body hash, source key, importer execution record, revisions. | A revision implies the lost text was recoverable. |
| Text intact, metadata changed | update_article_meta(), source version, summary, taxonomy assignments, approval fields. |
Preserved body means full record immutability. |
| Draft became public | Importer post-status payload, native WordPress publish permissions, article ID. | Editorial state alone prevents publication. |
| Article unexpectedly renamed | Content key, legacy key, slug fallback, baseline presence. | Slug matching is an authoritative source identity. |
| Duplicate article appeared | Per-import identifier resolution, duplicate policy, canonical URLs, post types. | Two matching titles are the same canonical record. |
| Revision absent | WordPress revision settings, migration hooks, backup retention, plugin conflicts. | Post type registration guarantees every revision is stored. |
22. Resolution
For a suspected overwrite, first freeze additional import jobs and preserve database and file snapshots. Reconstruct the article from the latest authorized WordPress revision, source commit, or verified backup; compare affected fields before any restoration. Repair source keys and missing baseline information only after provenance is established. Where an importer could overwrite unknown human content, use a quarantine or review-required state and add a fail-closed rule before resuming production writes.
Never resolve a divergence by manually setting _scfs_editorial_state=approved, forging a content hash, or rewriting historical revision records. Where the text survives but metadata or publication state changed, reconcile those fields through normal authorized editorial operations and document their independent decisions.
23. Verification
Accept a proposed fix only when: (1) manually edited title/body survive a matching-key reimport; (2) missing-baseline and slug-collision cases are quarantined instead of overwritten; (3) untouched generated content can advance to a new source revision; (4) repeated imports preserve identity and do not create unintended duplicates; (5) status changes meet approved publication policy; (6) revision chain and review evidence remain reconstructible; (7) protected metadata and taxonomy changes are explicitly accounted for; and (8) anonymous readers see only authorized published versions.
These are target acceptance requirements. The reviewed plugin does not meet all of them by construction, particularly missing-baseline protection and unconditional import publication. A staging failure must be reported rather than labeled as a successful validation.
24. Evidence package and reproducibility
Archive the commit SHA, plugin release, WordPress/PHP versions, anonymized fixture hashes, exact source corpus revision, pre/post state CSV, test script SHA-256 checksums, test execution logs, WP-CLI read-only inventory, WordPress revision chain, and independent reviewer signoff. Preserve the protocol even when a release does not meet acceptance criteria. Document excluded cases and whether a test proves byte preservation, visibility, metadata integrity, or only the operation of a synthetic checker.
25. Reporting boundary
A reproducible technical test supports a narrow statement about the tested workflow; it does not prove that the documentation is scientifically correct, unbiased, current, or approved for publication. Report uncertainty, conflicts of interest, source limitations, and any policy exceptions. Only a qualified human reviewer may attest to substantive scientific accuracy, supported product versions, or approval of new public guidance.
26. Technical references
- Integrated Knowledge Base importer (pinned source) —
find_article_id,update_article_meta,import_documentation. - Support Content Operations importer — duplicate handling, record creation and import batches.
- Editorial Governance source — editorial state, approval evidence and publication gate.
- Bundled importer regression fixture — existing repository test reference; not equivalent to site-wide acceptance.
- Integrated Knowledge Base documentation.
- WordPress: wp_get_post_revisions(); wp_update_post(); register_post_type().
- RFC 6234 — SHA-256 algorithm; checksums are integrity evidence, not independent approval signatures.
