docs/CONTRIBUTING.md

Contributing

This guide is for contributors who change NeonFlux's code or documentation. It covers the checks a change must pass, generated files, the documentation style and the places a new feature or table must be registered

Prepare and check

Prepare the toolchain as the repository guide describes, then run the aggregate check from projects/ before a pull request is opened

sh
1pnpm run check

The check needs no credentials or network connection. pnpm run format fixes the formatting it reports

To run one test file, run its package's runner from that package's folder, such as projects/bot/

PackageCommand
Bot and backendnode ../scripts/heavy.mjs node --test tests/<file>.test.ts
Websitenode ../scripts/heavy.mjs pnpm exec tsx --test tests/<file>.test.ts

Add --test-name-pattern="<part of the name>" after --test to run one test of a file. bot/tests/main.test.ts starts the built bot from bot/dist/, so run pnpm run build in projects/bot/ first. The heavy-task gate queues machine-heavy commands so parallel runs do not overload the machine

Generated files

  • backend/convex/_generated/: Regenerate it after changing the backend schema or a function interface, with pnpm --filter @neonflux/backend run codegen --typecheck disable against a configured development deployment, as the backend guide describes. Adding a function to an existing module needs no codegen, while a new module does
  • web/src/routeTree.gen.ts: The website build regenerates it, so run pnpm --filter @neonflux/web run build after adding, renaming or removing a route
  • pnpm-lock.yaml: Change dependencies through pnpm and verify a frozen install, as the repository guide describes

Commit generated files together with the change that needs them

Documentation style

  • Describe only behavior that works today, and mark unbuilt work as planned
  • Use plain, concrete words and the names the code and the interface use
  • Use impersonal wording that never addresses the reader, except in a tagline
  • Use no em dashes, no semicolons in prose and no final period at the end of a paragraph, list item or table cell
  • Link to other guides with repository-relative links instead of copying their content
  • Never put tokens, keys, archives or member data in documentation, examples or tests. Use clearly synthetic values

Detector evals

pnpm run evals scores the deceptive link judge, the lookalike name check, the typo hints, which feed posts go out, anti-nuke and board visibility against the labeled cases in projects/evals/ and prints what each catches and wrongly flags, per family. The cases are synthesized from common phishing, impersonation and typing mistakes, not taken from real servers. evals/baseline.json lists the cases each detector fails today, and pnpm run check fails when a case outside that list starts to fail. After an improvement, node scripts/evals.mjs --update tightens the baseline

The board-visibility detector scores boardMayRepost, which decides whether a board may repost from a channel from its roles and permission overwrites. A wrong repost shows a private message, so a false repost costs more than a missed one

The anti-nuke and lockdown detectors read the same cases in evals/anti-nuke/, which label whether a careful moderator wants the account stopped and whether freezing the server is also needed. lockdown names that folder in its folder field, and baseline.json lists each detector on its own

To tune a detector, work only from train.json. A false positive costs more than a miss, since a flagged link is usually deleted, so never trade a new false positive for a catch. The holdout.json sets scored the last tuning round and now only guard against regressions, so a new round needs new held-out cases, written by someone other than the person tuning and scored once at the end

Public docs

The public docs live in projects/site/content/docs/<version>/. nightly/ is the version being written. Its pages are for server staff and people hosting NeonFlux, while docs/ stays for contributors and describes every detail

  • Add a page as a Markdown file with title and description in its frontmatter, and list it in that version's meta.json. The build fails when a page and the list disagree
  • Link another page by its file, such as ./tickets.md#commands. The build turns that into an address that works in every version, and pnpm run lint checks the file and heading exist
  • Mark anything not built with a line that starts > **Planned:**
  • A table of sentences or long commands becomes a list of entries when built, and a code block past 28 lines opens with a button, so neither needs special writing
  • After changing a Markdown step in astro.config.mjs or src/docs/, delete projects/site/.astro/ and build again, because Astro keeps pages it already rendered

To add a Stable version, copy nightly/ to a folder named for the version, such as v1.0.0/, and add { folder: "v1.0.0", channel: "stable" } to versions in projects/site/src/docs/versions.js. The newest Stable then takes /docs/, Nightly moves to /docs/nightly/ and older Stable versions stay at their own address, and the version menu appears

Adding a feature or a table

A new feature or backend table usually has to be registered in several places. Each line names what catches a missing entry, and a line without a check depends on review

RegistrationWhereWhat catches a missing entry
Per-server rows removed when a server's data is purgedPURGE_INDEXES in backend/convex/installationsPurge.tsThe typecheck, through its satisfies clause, and backend/tests/installations-purge.test.ts
Member data for access and erasure requestsAn entry in MEMBER_DATA in backend/convex/memberData.ts with a by_member_data index on the member field and serverId, or a stated exemption in MEMBER_DATA_EXEMPTbackend/tests/member-data.test.ts
Bot functionsBOT_FUNCTIONS in contracts/src/service.ts and the export in backend/convex/botService.tsbackend/tests/bot-service.test.ts
Bot request pathsbackendRoutes in bot/src/backend-routes.tsbot/tests/backend-http.test.ts
Request body limitsThe limit argument of botQuery and botMutation in backend/convex/botService.tsThe typecheck requires a limit, and no test checks its value
Retention of expiring rowsRETENTION_PASSES in backend/convex/retention.ts, or a stated exemption in RETENTION_EXEMPT in backend/tests/retention.test.tsbackend/tests/retention.test.ts, which treats a table as expiring when an index is named for expiry, cleanup or history or a field holds an expiry time, and fails when no pass reads it
Background workWORK_SOURCES in backend/convex/workDispatch.tsbackend/tests/work-dispatch.test.ts, whose tests check each worker kind and the dashboard passes
Help pages and reserved command namesThe command table in bot/src/help.tsbot/tests/help.test.ts
Setup and overview statesbackend/convex/setupCheck.ts and bot/src/setup-check.tsbackend/tests/setup-check.test.ts and bot/tests/setup-check.test.ts
Recovery inbox sourcesRecoverySource in contracts/src/setup.ts and backend/convex/recovery.tsbackend/tests/recovery.test.ts, which fails until its scenario shows every source, and the bot typecheck, through areas in bot/src/setup-check.ts
Backends in backend testsconvexBackend in backend/tests/convex-backend.tsbackend/tests/document-limits.test.ts, which refuses a test that imports convex-test directly. After each test the scan fails when a stored document is over 1 MiB or an array holds more than 8,192 values
Audit change summariesbackend/convex/auditLog.tsbackend/tests/audit-log.test.ts, which covers part of the summaries
Readable server exportFAMILIES in backend/convex/serverExport.tsbackend/tests/server-export.test.ts
Backup configuration familiesThe backup snapshot and restore in backend/convex/backup.tsbackend/tests/backup.test.ts
Feature navigationThe feature table in the repository guide, or a link from the guide for a file outside a featurepnpm run lint, through repository-guide.mjs
Public docsA page or section in site/content/docs/nightly/features/, as public docs describesReview only, since nothing checks that a new feature has a page
Public feature pagesAn entry in FE in site/src/features.js, with its art and example in site/src/scripts/home.jsReview only, since a feature need not have a page. site/tests/seo.test.mjs then checks its address, heading and docs link

Document the feature's usable behavior and limits in the bot guide, the backend guide or the dashboard guide