Repository source: docs/plans/qdb_moderated_submissions/qdb_moderated_submissions_step4_implementation_summary.md
QDB moderated submissions Step 4 implementation summary
Debug mode: enabled
Effort study: railspike-effort / v3/qdb_moderated_submissions; host ledger. Standing P2 enrollment; extended estimates enabled.
Cycle estimate: 0.65
Branch feat/qdb-moderated-submissions from 6bfe1243; planning commit 3b34a30.
Step 4 entry
Step 3 approved 2026-11-17. Whole-cycle projection 0.65 reaffirmed after the planning commit. Stage originals 0.15/0.12/0.08/0.12/0.08/0.06 copied from Step 3, non-additive. Claude single exposed rater; R1 hashes not re-verified.
Stage 1 - Pending rule in shared listings
Original estimate: 0.15
Retrospective: 0.15
Changes:
New flag
FORUM_QDB_QUEUE_ENABLED(site-mutable, off).New
src/ForumRewrite/Qdb/QdbModeration.php: the queue state, its SQL conditions (listedSqlSuffix,queueSql) andstate()for one quote.ScoreVisibility::listedSqlappends the moderation condition, so every public listing that already hides flagged posts also hides pending and rejected quotes. On other sites, or with the queue off, the condition is empty.Applicationregisters the repository withQdbModeration::useRepository, besideSignatureCheckCache::useBeside.New
src/ForumRewrite/Security/FeatureFlagSwitchOn.php: the first operator-signed switch-on of a flag.AttributionCutoffnow uses it instead of its own copy of the loop.
Verification:
./v3 test --smoke QdbModerationTest QdbPageTest ScoreVisibilityTest PublicOfflineSnapshotBuilderTest QdbWelcomeSelectionTest QdbExperienceRoutingTest ReadModelProvenanceTest FeatureFlagChangePageTest FeatureFlagEvaluatorTest: 475 passed. Full suite not run.New
QdbModerationTest: archive, anonymous, visitor, operator, news, approved (both key notations), self-approved, rejected, old rejected, approved-then-rejected and non-quote rows; inactive queue; empty operator list; unsigned switch-on.FeatureFlagEvaluatorTest::testRegistryListsCurrentPublicFlagsupdated for the new flag.Timing on 20,000 quotes with 60,000 tag rows: Latest 47 ms off, 52 ms on. A first version with correlated lookups took 222 ms; the tagged sets are now built once per query.
Notes:
Deviation from Step 3: no
QDB_QUEUE_STARTED_ATprivate setting. The start time is the first operator-signed switch-on record of the flag, asAttributionCutoffalready does. It lives in Git and no one but an operator can set or move it. Without a signed switch-on, nothing waits. New understanding, not changed scope.Deviation from Step 3: the rule sits in
ScoreVisibility::listedSqlrather than separately inQdbPage, Random and news. That one fragment reachesThreadRepository::fetchThreads(board, RSS, Random, news),QdbPage,QdbWelcomeSelection,ThreadKeysetPage,AuthoredContentRepositoryand the offline snapshot.Readers that bypass the rule, by design:
ThreadRepository::byId,Application::fetchThread,QdbQuoteNumbers::resolve(permalinks) andStaticArtifactBuilder::fetchVisibleThreadIds(static permalink pages). Stage 3 marks pending permalinks; Stage 5 rechecks static builds.Operator approval reads
viewer_tagsfrom active operators.approvedandrejectedare not yet writable tags; Stage 4 adds them as signed, operator-only tags. Until then nobody can write them.The signed switch-on path is covered only for the unsigned case; no test fixture signs feature-flag changes today. The qdb.us replay in Stage 6 covers the signed path.
Estimate details: original scope as planned; no revision. Retrospective matches: the main extra was the performance fix.
— Claude · 2026-11-17 UTC · Model: Claude Opus 5.5
Stage 2 - Public queue page
Original estimate: 0.12
Retrospective: 0.10
Changes:
QdbPage::pagegains aqueuesection: newest first, the score rule alone plusQdbModeration::queueSql.ScoreVisibility::scoreSqlsplit out oflistedSql, so the Queue page can keep flagged quotes hidden while listing pending ones.QdbExperienceroutes/queue,/queue/Nand/?queue;BoardPageControllerrenders them through the existing board template, quote card and empty state, titled "Queue".QdbPresentation::navigationshows Queue between Random and Add Quote, only while the queue runs.theme-nav-icons.css: an hourglass in the pixel-art and smooth-line sets.Applicationlists/queueand/queue/Nwith the other qdb routes.
Verification:
./v3 test QdbModerationTest QdbExperienceRoutingTest NavIconSetsTest QdbPageTest: 17 passed. Full suite not run.New
QdbModerationTest::testQueuePageListsOnlyWaitingQuotesandQdbExperienceRoutingTest::testQueueRoutesExistOnlyWhileTheQueueRuns. With the queue off,/queuepaths return 404 and/?queuestays the welcome page, as any unknown flag did before.Icons rendered with headless Chrome in Word97, Chicago, Midnight, Gloss, Gloss Dark and Engagify; each shows the hourglass beside Random and Add Quote.
Notes:
QdbModeration::current()now recomputes when the site profile changes, so tests that switchFORUM_SITE_IDin one process see the right state.The Queue page is not prebuilt by
StaticArtifactBuilder; it is served live, which keeps it current between rebuilds.
Estimate details: original scope as planned; no revision. Retrospective slightly lower: the board template and empty state fitted without changes.
— Claude · 2026-11-17 UTC · Model: Claude Opus 5.5
Stage 3 - Pending notices
Original estimate: 0.08
Retrospective: 0.06
Changes:
The thread page shows one line above a pending quote: "Pending approval · Queue", linking to
/queue.A rejected quote's thread page and number address return 404.
/api/create_quoteaddsmoderation=pendingormoderation=approved, matching the route's existingkey=valuelines.docs/reference/agent_api.mddocuments the new line.
Verification:
./v3 test --smoke WriteApiSmokeTest::testQdbQueueHoldsANewQuoteOffListingsButOnItsPermalink QdbModerationTest QdbExperienceRoutingTest ApiRouteCatalogTest: 459 passed. Full suite not run.The new end-to-end test creates an anonymous quote through
/api/create_quotewith the queue on. The quote is absent from/latest, present on/queueand its permalink with the marker, and listed again with the queue off.
Notes:
Deviation from Step 3: the Add page keeps its existing redirect to the new quote's permalink. The permalink's marker is the confirmation, so the Add flow needs no extra copy.
Deviation from Step 3: a rejected quote returns 404 to everyone, operators included, so the page stays the same for every viewer. Operators still reach the record through the source browser and Git.
Fixed:
useRepositorycleared a test override when a secondApplicationwas built.
Estimate details: original scope; no revision. Retrospective lower because the Add flow needed no change.
— Claude · 2026-11-17 UTC · Model: Claude Opus 5.5
Stage 4 - Approve and reject from the queue
Original estimate: 0.12
Retrospective: 0.14
Changes:
LocalWriteService::applyThreadTagacceptsapprovedandrejectedon qdb only throughassertQdbModerationTag. The tag must target a quote and carry a verified signature from an active operator. Unsigned tags, other keys and non-quote threads are refused.Queue cards render Approve and Reject buttons inside the quote card header. They use the existing
apply-thread-tagaction inthread_reactions.js, so signing, the Outbox and error feedback are unchanged.New
templates/partials/qdb_moderation_access.php: an inline script before the cards compares this browser's key fingerprint with the operator list and setsdata-qdb-moderatorbefore paint. Server HTML is the same for every viewer.QdbModeration::operatorFingerprintssupplies that list;BoardPageControllerpasses it only on the Queue page.
Verification:
./v3 test --smoke WriteApiSmokeTest::testQdbQueueApprovalAndRejectionAreSignedOperatorDecisions WriteApiSmokeTest::testQdbQueueHoldsANewQuoteOffListingsButOnItsPermalink WriteApiSmokeTest::testSignedThreadReactionPreservesBytesAndRejectsTampering QdbModerationTest TagScoreTest QuoteCardDisplayNumberTest: 487 passed. Full suite not run.New write test with GPG keys: unsigned operator tag, signed visitor tag and a non-quote target are refused. A signed operator approval lists the quote on Latest; a signed rejection removes it from the queue and returns 404 at its address.
Local acceptance in headless Chrome over the DevTools protocol, against a qdb instance whose queue was switched on through
prepareFeatureFlagChangeand an operator's GPG signature:/api/create_quoteansweredmoderation=pendingfor two anonymous quotes.Signed out, the moderation buttons were hidden; with the operator's key in browser storage they showed.
Approve signed in the browser and showed "✓ Approved"; Reject removed the other quote.
After reload the queue was empty; Latest showed the approved quote and not the rejected one.
This run also covers the signed switch-on path that Stage 1 could test only unsigned.
Notes:
Deviation from Step 3: a decided card stays in place, showing the applied label, until the page reloads. This reuses the vote buttons' behavior instead of adding card-removal code.
The queue footer still shows the queue's own count ("2 quotes"); Stage 5 replaces it.
Estimate details: original scope; no revision. Retrospective slightly higher for the browser acceptance harness.
— Claude · 2026-11-17 UTC · Model: Claude Opus 5.5
Stage 5 - Counts and published copies
Original estimate: 0.08
Retrospective: 0.10
Changes:
With the queue on, the qdb footer reads "N quotes approved; M pending", and "M pending" links to the Queue page. With it off, the footer is unchanged.
QdbPage::countcounts Latest or the queue without loading rows;QdbPage::pageandcountshare onebasequery.RecentPostRepositoryapplies the moderation rule beside its own score rule, so/recent/, the gallery and Inbox leave pending quotes out.The offline snapshot uses the shared rule already.
FrontControllerand./v3 offline publishnow register the repository, andQdbModerationfalls back to the configuredFORUM_REPOSITORY_ROOTfor other command-line builders. The fallback never creates the local repository.theme-qdb.css: footer links take the footer's ink color.
Verification:
./v3 test --smoke WriteApiSmokeTest::testQdbQueueHoldsANewQuoteOffListingsButOnItsPermalink WriteApiSmokeTest::testQdbQueueApprovalAndRejectionAreSignedOperatorDecisions QdbModerationTest QdbPageTest PublicOfflineSnapshotBuilderTest QdbWelcomeSelectionTest QdbExperienceRoutingTest LocalAppSmokeTest RecentPostTest: all passed. Full suite not run.New
QdbModerationTest::testOfflineSnapshotLeavesOutPendingAndRejectedQuotes. The end-to-end queue test now checks the footer on Latest and Queue and checks that/recent/leaves the pending quote out../v3 build-staticagainst the local acceptance instance (one approved, one rejected, one pending quote):latest.html,top.html,index.html,recent.htmland the offline snapshot leave out the pending and rejected quotes. The footer reads "1 quote approved; 1 pending". Screenshot checked in the qdb theme.
Notes:
The instance page's "Recent included items" still lists the pending quote's record, as Activity does. Both describe repository contents, and the queue is public.
llms.txt lists no threads, so it needed no change.
Estimate details: original scope; no revision. Retrospective higher:
/recent/had its own copy of the score rule, which the Stage 1 inventory missed.
— Claude · 2026-11-17 UTC · Model: Claude Opus 5.5
Stage 6 - Documentation and live-site check
Original estimate: 0.06
Retrospective: 0.06
Changes:
New concept entry Quote queue.
New runbook
docs/runbooks/qdb_quote_queue.md: how to turn the queue on, the live-site check and recovery.The classic URLs and theme fidelity checklists now note that Queue and the pending count exist.
Verification:
git diff --checkpassed. Relative links in the concept entry and runbook resolve.Final smoke run with every touched test class:
./v3 test --smoke QdbModerationTest QdbPageTest QdbWelcomeSelectionTest QdbExperienceRoutingTest QdbBoardPolicyTest QuoteCardDisplayNumberTest NavIconSetsTest ScoreVisibilityTest RecentPostTest PublicOfflineSnapshotBuilderTest FeatureFlagEvaluatorTest FeatureFlagChangePageTest TagScoreTest BoardSearchTestplus fourWriteApiSmokeTestqdb and reaction methods: 524 passed. Full suite not run.Pending: the qdb.us check in the runbook (Step 2 known environment). Local acceptance in Stage 4 does not satisfy it.
Notes:
Production needs only a deploy and the signed flag change; there is no read-model schema change or migration.
Estimate details: original scope; no revision.
— Claude · 2026-11-17 UTC · Model: Claude Opus 5.5
Cycle closeout
Completion contract:
Normal entry: passed locally for Add,
/api/create_quoteand the Queue page.End-to-end outcome (submit, queue, approve, listed): passed in local headless Chrome with real operator signing.
Recovery: a refused approval keeps the quote pending and shows the server's error through the existing reaction feedback (write tests); turning the flag off lists every quote (tests). Passed.
Deployment and qdb.us replay: pending maintainer deploy.
Release: the flag ships off. Passed.
Final diff review: 33 files against the planning commit. One listing rule reaches every listing; no duplicated queue logic.
AttributionCutoffnow sharesFeatureFlagSwitchOn. Nothing outside the approved scope.Commits: planning
3b34a30; stagesea9d7d3,bc7ea31,5399a1c,2aa1d23,f7ebe47, and this Stage 6 commit; seven commits for six stages plus planning.Deviations from Step 3, all new understanding within scope: start time from the signed switch-on instead of a private setting; the rule in
ScoreVisibility; no Add-page copy; rejected quotes 404 for everyone; decided cards stay until reload.
Study closeout
Retrospective cycle assessment: 0.65, matching the 0.65 projection. Scope v2 delivered as planned with six stages. One correction inside the cycle (
/recent/had its own score rule); no new requests.Stage retrospectives 0.15/0.10/0.06/0.14/0.10/0.06 against originals 0.15/0.12/0.08/0.12/0.08/0.06; independent annotations, not summed.
Active work time was not measured. Maintainer comfortable-fit judgment: pending. Study acceptance: pending.
— Claude · 2026-11-17 UTC · Model: Claude Opus 5.5