Skip to content
open.blog documentation
open.blog

ADR 0112: Third Perspective shapes map mechanically onto B5's targets and provenance and RD12's policy when they merge

Context#

Third Perspectives reuse B5's passage targets and feedback provenance and RD12's participation kinds and moderation state machine, but neither branch is on main. This contract has to compile on main now and become a mechanical change, with no format change, once both merge.

Decision#

openblog_core::third_perspective carries minimal shapes with the same ids and JSON. At merge, each is replaced as follows; stored records and submissions keep their JSON, parsed value for parsed value (object key order aside, which JSON does not define).

Here (main)After B5 / RD12 mergeMapping
KIND_ID, KIND_LABELparticipation::ParticipationKind::ThirdPerspectiveKIND_ID == ThirdPerspective.id(), KIND_LABEL == label(); keep the constants as those calls. A test asserts both.
PerspectiveTargetpassage_target::PassageTargetWork = PassageSelector::Work with no section; Section { section, digest } = PassageSelector::Section { digest } with section. Make it a checked wrapper: TryFrom<PassageTarget> refusing PassageSelector::Quote with targetNotAllowed; from_value becomes PassageTarget::from_value plus that check. TARGET_VERSION = PASSAGE_TARGET_VERSION. The JSON is already B5's, field for field; key order may differ, because B5 embeds the target as a serde_json value with alphabetical keys.
TargetStatuspassage_target::ResolutionPassageDocument::of_post(..).resolve(&target, Some(&copy.provenance.revision)): Current(location) and Reanchored(location) → TargetStatus::Current { section: location.section }; Stale(stale) → TargetStatus::Stale { section_present: stale.section_present }. Add impl From<&Resolution> for TargetStatus.
ReaderAttributionfeedback_provenance::ReaderAttributionSame fields and JSON; replace with a re-export. Name rules are the same (B5's MAX_READER_NAME_CHARS, whitespace collapsed, no control or bidirectional characters).
Channelfeedback_provenance::FeedbackChannelSame ids (hosted, manual); re-export.
Provenance, is_work_path, is_passage_revisionfeedback_provenance::FeedbackProvenance, B5's is_work_path, passage_target::is_passage_revisionThe provenance object is B5's record, the same JSON key order aside (a test pins its keys and compares parsed values). Store FeedbackProvenance with the target checked as above; FeedbackProvenance::public is not used, because ApprovedResponse is this kind's projection.
ModerationStatemoderation::ModerationStateSame six variants and ids; re-export.
ModerationFactsmoderation::ItemFacts plus the stored approved_consentstate, revision, approved_revision and content_retained are ItemFacts fields of the same names; approved_consent is stored with the approval (below). Add a constructor from &ItemFacts and the consent number.
shown: boolparticipation::effective_mode(config, post, ParticipationKind::ThirdPerspective)shown = mode.shows_approved(). approved_response then implies RD12's moderation::is_public(item, mode), and adds the consent, work and name rules.
ApprovalRequest::moderatormoderation::AuditEvent::actor_id from the ActorThe inbox resolves the actor through RD12, calls ModerationPolicy::decide with Approve, and before applying it calls check_approval with the actor id; both results go in one write.
ConsentOutcome::Withdrawmoderation::ModerationAction::Withdraw by Actor::SubmitterHosted copies only. Apply in the same write as the consent record.
ConsentOutcome::RemoveAndPurgemoderation::ModerationAction::Remove by a site Admin, then purge of the textManual copies only: RD12 accepts a withdrawal or clarification only from Actor::Submitter, and only a receipt makes a reader one. Apply the Remove and the purge in the same write as the consent record.
SubmittedCopy::clarifymoderation::ModerationAction::ClarifyHosted copies only (a manual copy is refused with clarificationUnavailable). Same write; RD12's superseded_revision is the replaced text, which is not kept as a publishable revision.
ConsentChoices::clarificationmoderation::Submission::clarification_consentRecord 1 sets it at admission; the stored clarification_consent then follows the consent in effect, so a reader who later declines can no longer be asked.
Stagemoderation::ModerationState and ItemFacts::content_retainedUnchanged: a pure view over RD12's facts.

Storage, a one-way door this task does not open. No table, column or migration changes here. The conservative mapping for #221 is one openblog_feedback row per copy (B5's ADR 0080, whose kind and status columns check only the id's shape): kind = third-perspective; work, revision, target, body, seen_at, received_at, channel, reader_name and publish_name from the provenance as received; details = {"category"?, "intake", "consents"} (the contract keeps details within that 16 KiB bound: details_bytes is checked when a consent change is recorded and when a record is read, and a worst case of 80 four-byte-character names and a 4000-character body is a tested round trip; the 50-record count alone does not guarantee it, because names repeat); status from RD12. The approval's revision and consent number, and RD12's version and revision counters, need the additive columns RD12 and #226 introduce. Until then nothing is stored, and the static site is unchanged. (ADR 0113 opens this door for #221 with exactly this mapping, adding revisedAt to details and one nullable approved_consent column.)

As applied#

With B5 and RD12 on main, the table above is applied:

  • KIND_ID and KIND_LABEL are gone; third_perspective::KIND is ParticipationKind::ThirdPerspective, and its id() and label() are the id and label. ApprovedResponse::kind is that kind, serialized as its id.
  • PerspectiveTarget wraps a PassageTarget: TryFrom<PassageTarget> refuses a quotation with targetNotAllowed, From<PerspectiveTarget> for PassageTarget gives it back, and from_value refuses a quote kind before B5 reads its fields, so the error codes stay as they were.
  • TargetStatus is From<&Resolution>.
  • ReaderAttribution, Channel (B5's FeedbackChannel), Provenance (B5's FeedbackProvenance), is_work_path, is_passage_revision and the version and length constants are re-exports. A stored copy's provenance is B5's record, checked by B5 and then by the target restriction.
  • ModerationState is RD12's. ModerationFacts keeps the stored approved_consent and adds RD12's clarification_asked, and ModerationFacts::from_item(&ItemFacts, approved_consent) builds it. approved_response and featured take the kind's ParticipationMode (effective_mode(..)) and show only while mode.shows_approved(), never while a clarification request asked about the current text, so a response is always one RD12's is_public allows.
  • A hosted copy's Intake::Hosted digest is the digest of RD12's reader receipt (ADR 0107): the reader withdraws, clarifies and changes consent through that receipt, and a revocation on a hosted copy is RD12's receipt withdrawal (openblog_erase_feedback with a withdrawal), which purges the text at once. A manual copy has no receipt: revoking it is a site Admin's Remove and a purge, and it cannot be clarified.

Considered options#

  • Merge B5 and RD12 into this branch first. Rejected: neither is on main, and this contract must stand alone.
  • Different ids or JSON now, converted at merge. Rejected: any stored or in-flight record would need migrating; identical ids and JSON make the merge a type substitution.

Consequences#

  • The merge replaces type definitions with re-exports and adds the two From conversions; the state fixtures and tests keep passing unchanged, because they pin ids and JSON, not the type paths.
  • If RD12's revision changes a state id or the kind's target shape, this table is the place to update.

View this page's source