Repository navigation
feat(events): unverified + denied verification stages for crowdsourced listings - #624
Merged
Merged
Conversation
…urced listings Events can now exist without a manager in two pre-adoption stages: 'unverified' (imported or user-submitted, published and badged client-side) and 'denied' (community-rejected via registrant votes, unpublished). Assigning a manager and saving adopts the event into the normal verification cycle; grooming edits without a manager change nothing (verifyOnSave skips). - manager is now conditionally required: every ladder stage implies one; unverified/denied/finished may be unmanaged (the stale sweep finishes run-out events that were never adopted) - new columns: confidenceScore (indexed Wilson lower bound for feed ranking) and systemMeta (namespaced JSON for system-managed metadata, starting with communityFeedback vote tallies); submitter relationship -> users - ExpireEvents gains two stage-independent sweeps: finish elapsed unverified/denied events (they carry nextCheckAt: null and are invisible to the due sweep), and trash finished events 6+ months past schedule end - Atlas sidebar surfaces managerless unverified/denied events from the manager's owned-region subtree so they can be found and adopted - admin: verification notice banners + off-ladder stage tracker steps for both new stages; quality checks run on published unverified events and report a dedicated 'denied' skip reason; events capped at 7 images Part 1 of the unverified-events plan (submissions collection and registrant voting follow in separate PRs). Co-Authored-By: Claude Fable 5 <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-624 environment in sahajcloud
|
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-624
August 12, 2026 02:41
Destroyed
This was referenced Aug 12, 2026
…At watermark The two standalone sweeps added for the pre-adoption stages both led with `schedule.lastDate < now`, which matches every event that ever ended - permanently, and with no composite index on verification_stage. That degrades as the table grows, which country-batch imports will do quickly. nextCheckAt doesn't have that shape: it's a watermark, so only genuinely actionable rows ever sit in the past. Expressing the remaining transitions there returns the job to a single, permanently cheap due-query. - new resolveNextCheckAt() is the one place each stage's watermark is defined: schedule end for unverified/denied, min(stage deadline, schedule end) for the ladder, schedule end + 6 months for finished. Every writer routes through it (verify op, verifyOnSave, the job, the importer, the new hook) - stageMachine becomes a discriminated union (remind | trash | await-schedule) inside an exhaustive Record<VerificationStage, StageRule>, so a new stage can't be added without deciding what the job does with it. No FSM library: the state is one enum column transitioned by a nightly batch, and the graph projections we rely on (daysUntilUnpublish, the admin timeline) aren't something a library would cover - finished stops being a null-watermark dead end and becomes a dwell state with a retention deadline; finishesOnRunOut: false keeps a due finished event from re-finishing itself and deferring retention forever - new syncUnmanagedCheckAt hook arms the watermark on write for pre-adoption events (deliberately ignoring skipVerifyHook - it's derived data, and both paths that create unverified events set that flag) - a managed event whose schedule runs out is now finished the day after its last occurrence rather than up to a cadence later; the admin timeline gained a matching case so a capped watermark isn't mislabelled as a reminder date - scripts/backfill-finished-retention.ts arms pre-existing finished rows (dry-run clean against dev: 68 rows, 0 failures) Co-Authored-By: Claude Fable 5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-624
August 12, 2026 19:07
Destroyed
… watermark module Three review follow-ups on the watermark refactor, all structural: - verifyOnSave + syncUnmanagedCheckAt collapse into syncVerificationOnSave. They were two branches of one question (what should this save do to the verification fields?), mutually exclusive by construction, and each carried its own copy of the schedule merge. The skipVerifyHook asymmetry between them — the verify branch honours it, the derived-watermark branch must not — is now a documented ordering inside one function rather than an invariant split across two files. - StageRule/finishesOnRunOut is gone; MACHINE is Record<VerificationStage, StageAction>. The flag encoded a tautology — finishing is a transition *into* `finished`, so it cannot apply to an event already there — which reads better as a guard at the one call site than as a field repeated across eight rows. The invariant it protected is covered end-to-end by the retention case in the int spec. - The watermark rule moves out of periods.ts into its own watermark.ts. periods.ts is cadence helpers; the watermark rule is the load-bearing contract behind the job's single query, and had turned its host into a grab bag. Also fixes a pre-existing flake in the listing-progress tests (1 of 4 runs): remindOnce took the first email sent to the manager address that every event in the spec shares, so a second reminder landing in the same job run could be asserted against by mistake. It now selects by event title — three consecutive clean runs after the change. src/lib/eventVerification stays in lib, deliberately: ten distinct owners import from it (the Events and Registrations collections, the job, three admin components, seeds, app routes, two lib folders), so co-locating it under Events would force cross-owner imports into a collection's internals — the arrangement .claude/rules/project-structure.md rule 4 prohibits. Co-Authored-By: Claude Fable 5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-624
August 13, 2026 02:18
Destroyed
Admin-panel layout only — no schema change (tabs and collapsibles carry no `name`, so `migrate:create` generates nothing). - confidenceScore: was hidden, now a labelled read-only field in the Verification tab, shown only while `unverified` — the one stage where votes are still being collected, so anywhere else the number is a stale artefact - publicUrlFields now always wraps its fields in a collapsed 'Public Links' collapsible (Events, Regions, Pages), and takes hasAppUrl to omit appUrl entirely rather than emit a field that can only read null. Events opts out and moves the group into its Details tab - legacyMigrationFields collapsible starts collapsed - new collapsed 'System' collapsible gathers every machine-managed value that was previously hidden outright — nextCheckAt, registrationsFull, qualityOpenCount, qualityCheckVersion, systemMeta — so they're inspectable without a database query - systemMeta is admin-only in the UI (adminOnlyCondition) and carries access.update: () => false. Visibility and writability are decided separately on purpose: Payload deletes an access-denied key from the incoming patch rather than nulling the column, and system writers pass overrideAccess, so hiding the field can never let a manager's save wipe it. Pinned by two tests Co-Authored-By: Claude Fable 5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-624
August 13, 2026 18:24
Destroyed
…icter contact rules Consolidation. stages.ts and stageMachine.ts each held part of the lifecycle, and some facts twice — an `unpublish` boolean on the transition AND a PUBLISHED_STAGES list, an UNMANAGED_STAGES list AND an 'await-schedule' action. Both files are now one exhaustive Record<VerificationStage, StageConfig> in lib/eventVerification/stages.ts, declaring published/managed/onDue once per stage; PUBLISHED_STAGES, UNMANAGED_STAGES, STAGE_DURATION_DAYS, LADDER and whether a transition unpublishes are all derived from it. stageMachine.ts is deleted (it had also outgrown the job folder — the collection, admin components, sidebar and importer all read it). Consolidating surfaced a real collision the tests caught: modelling `finished` as managed: false made isUnmanagedStage() true for it, so the watermark took the pre-adoption branch and skipped the retention window entirely. Those were two different questions wearing one name — isUnmanagedStage (may have no manager: unverified, denied, finished) is now distinct from isPreAdoptionStage (no clock but the schedule: unverified, denied). nextCheckAt stays nullable — null is the watermark's 'never', and inventing deadlines to avoid it would reintroduce exactly the churn the watermark removes. What was loose is now tight: `finished` falls back to retention-from- now when there's no schedule end (the importer maps a dump status straight to the stage, so dormant and open-ended rows could reach it with a null watermark and never be trashed), leaving exactly one nullable case — a pre-adoption stage with nothing scheduled. Pinned as an invariant over every stage. Also: the importer wasn't threading its injected clock into the watermark. Contact rules. A website no longer satisfies an inactive event's contact requirement — it's metadata, not a route to a person (1 of 16 inactive events in the dev DB relies on it and will need a real contact on next save). contactEmail gains a bounded validator composed with `email` from payload/shared (an email field takes no maxLength, and a custom validate replaces the built-in format check); contactPhone likewise via `text`. contactName now appears for a phone OR an email. Reverted: appUrl is emitted on Events again and the hasAppUrl opt-out is gone. Moved: submitter into the System collapsible. Co-Authored-By: Claude Fable 5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-624
August 13, 2026 20:38
Destroyed
… drop dead weight Off-ladder is gone. The tracker had its own parallel vocabulary — OFF_LADDER, OffLadderStage, JOURNEY, STEP_ORDER — restating what STAGES already knew, and 'off ladder' only ever meant 'this stage isn't in my hardcoded list'. It now draws the journey the event is on: unverified -> denied -> verified for a pre-adoption listing (with copy saying what adoption actually takes), verified -> reminders -> expired once managed, finished as its own terminal. All six steps use the full STEP_COPY structure; the only thing this file still knows that the config doesn't is that three reminder stages collapse into one step. systemMeta is now a reusable field factory (src/fields/systemMetaField.ts) carrying a JSON Schema. That IS the built-in read helper: Payload generates the exact type into payload-types (so systemMeta?.communityFeedback?.denials is checked at compile time) and validates on write, so a malformed tally can't be stored. readCommunityFeedback is deleted — a defensive runtime parser could only report that bad data had already landed. collectIds walked pages of a table it was concurrently mutating; it's one pagination:false query, which is safe precisely because the watermark keeps the due set bounded by the day's work rather than the table. buildAtlasSidebarData is back to its original parallel shape. Pre-adoption events come out of the subtree query that already runs for the region counts — two extra fields in its select — instead of an OR branch that forced the region reads to complete first. Also: confidenceScore is visible for denied as well as unverified (on a denied event the score is the reason it came down), and backfillFinishedRetention is removed along with its script. Co-Authored-By: Claude Fable 5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-624
August 13, 2026 21:03
Destroyed
10 tasks
Closed
14 tasks
This was referenced Sep 21, 2026
24 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part 1 of the crowdsourced-listings plan: Events can now exist without a manager in two new pre-adoption verification stages, so bulk-imported and (soon) user-submitted events have somewhere to live until a manager adopts them.
unverified— imported or accepted from a public submission; published so it appears on the map (badged client-side by the Atlas frontend), open to registrant confirm/deny voting (PR 3).denied— community-rejected via the vote threshold; unpublished (_status: draft), voting closed.verifiedthrough the existing verify-on-save path. Grooming edits without a manager deliberately change nothing.Changes
manageris conditionally required: every ladder stage implies one;unverified/denied/finishedmay be unmanaged (finishedbecause the stale sweep below finishes run-out events that were never adopted, and a terminal stage sends no reminders).confidenceScore(indexed Wilson lower bound — feeds will rank unverified listings by it),systemMeta(namespaced system-managed JSON, starting withcommunityFeedbackvote tallies),submitter(→users, record-keeping only) +submittedEventsjoin on Users.unverified/deniedeventsfinished(they carrynextCheckAt: nulland are invisible to the due sweep), and trashfinishedevents whose schedule ended 6+ months ago (retention measured from schedule end).unverified/deniedevents in the manager's owned-region subtree now appear in the event list (the adoption surface); they bucket into Needs verification / Unpublished respectively.EventVerificationNoticebanners for both stages (with vote counts fromsystemMeta.communityFeedback), off-ladder steps in the stage tracker, adeniedquality-check skip reason; quality checks run on published unverified events; events capped at 7 images.ALTER TYPE ... ADD VALUE×2 + new columns (validated with migration-validator; only the rollback path rebuilds the enum).Tests
Follow-ups (separate PRs per the agreed plan):
event-submissionscollection + write-guard plugin + screening job; registrant confirm/deny voting + post-event follow-up emails.🤖 Generated with Claude Code