1
0
Fork 0

docs(contributions): document the journal-publish rule

This commit is contained in:
Jason Fraley 2026-10-13 14:37:53 -04:00
parent 7f65e0371b
commit 87dc4deadb

View file

@ -4,7 +4,8 @@
Crowdsourced contribution XP: users earn XP for helping build the app (wiki pages, mission
planning markers, surveys, manual awards). The XP feeds the existing virtual profile total
planning markers, surveys, journal entries, manual awards). The XP feeds the existing virtual
profile total
(`Profiles.progression.xp`), so it shows up in the sidebar `XPDisplay`, the profile page, and the
level ladder with no extra wiring.
@ -33,6 +34,7 @@ snapshotted onto each entry, so editing a value rebalances future earnings only.
| `wiki-page-edit` | 5 | instant | 30 XP/day cap; min 200-char normalized content delta |
| `mission-map-marker` | 2 | queued | first 10 per user per mission |
| `survey-completion` | 5 | instant | one per submission (idempotency) |
| `journal-publish` | 5 | instant | 25 XP/day cap; min 200-char body; one per entry |
| `manual` | grantor-set | instant | reason required, no self-grants below superuser |
## Service (`src/lib/contributions/`)
@ -64,6 +66,8 @@ update, event, and notification flows through these functions.
- **Wiki**: `createWikiPage` / `updateWikiPage` award on success (Documentation excluded; edits need
a substantive delta, deduped by content hash); `deleteWikiPage` revokes the page's entries.
- **Journals**: `createJournal` / `updateJournal` award `journal-publish` when an entry is published
with a body of at least 200 chars; `deleteJournal` revokes the entry's XP.
- **Surveys**: `formBuilderConfig.ts` `form-submissions` `afterChange` awards `survey-completion`.
- **Missions**: `classification.planningMapDelegates` + `afterChange` sweep + `beforeDelete` expire.
- **Moderation**: `src/app/(frontend)/contributions/actions.ts` (`grantManualContribution`,
@ -101,4 +105,4 @@ the ledger plus the public event log.
schema migration; the `contribution-entries` table and profile column do (migration
`20261009_201920_add_contribution_entries`).
- The Missions `afterChange` sweep must stay loop-safe: it writes entries/profiles, never missions.
- Tests: `tests/int/contributions.int.spec.ts`.
- Tests: `tests/int/contributions.int.spec.ts`, `tests/int/journal-contributions.int.spec.ts`.