Conversation
…e units, limits and filenames
…e and fan-out wiring helpers
… insertAuditRow everywhere, like helpers in db, path-over-body helpers
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.
What changed
A repo-wide consolidation and naming pass, behavior-neutral. Duplicated helpers now have one home (cursors, hashing, bounded concurrency, sleep, time units, page limits, timeouts, the capped body reader, Postgres error codes, queue names, LIKE escaping, path-over-body merging, the chat/DM message core and the room fan-out wiring), the PR 11 delegate modules are gone, files and factories follow one naming convention, repository contracts live in
<name>-repository.tsbeside their implementations, and the 22 in-memory repositories that only tests use moved fromsrctotest/helpers. Nothing a user sees should change.Before you start
organization-rules.tsandhost-team-rules.ts).Verify
Nothing new to verify: every step below is a regression check.
Regression
Signing in and out — [Web] [Mobile]
Photo reports — [Web] [Mobile]
Chat and direct messages — [Web] [Mobile]
Hosting — [Web] [Mobile]
Your data and your account — [Web]
Admin — [Admin]
Findings addressed
Campaign PR 12 (repo-wide abstraction and naming): the GLOBAL DUP families from HELPERS.md and the ledger (isUuid, sha256, limit clamps, parseBool, sleep, bounded concurrency, time units, trailing slashes, attachment filenames, the SMTP timeout default, one cursor system, timeout races, the capped body reader, the chat/DM message core, fan-out wiring, the threads nudge, the analytics panel mapper, queue names, Postgres error codes, personViewOf, the PR 11 delegates, writeAudit, like helpers, mergeParams/mergeQuery, fragment aliases), the naming items (-repo vs -repository,
.types.tsvs-types.ts, db/schema file names, the worker jobs module,make*vsbuild*, one place for repository interfaces, the PR 9 part files) and the in-memory repository move.Metrics (api and media-worker
src, #100's head -> this PR): source lines 123,080 -> 114,522 (about 8,600 of it the test doubles leavingsrc); functions 8,191 -> 7,267; functions over 100 lines 124 -> 123.Decisions for the reviewer
*-repository.drizzle.tsfamily (the files are raw postgres.js, not Drizzle). Renaming it touches 344 files on a repo many people push to, and themakeDrizzle*factory names would still say Drizzle; CLAUDE.md already documents the misnomer.@civfix/api/*key the worker uses keeps working (only some targets moved); new ones:queue-names,time,concurrency,env-parsers,timeout,capped-body, and three type-only contract subpaths.dm-repository.memory.tsandconversation-hides-repository.memory.tsstay insrcbecause the no-database fake mode builds them.makeMessage*Repositorywithout theDrizzleprefix (the optional prefix pass was skipped);admin/mail-repository.tsstill holds a few runtime helpers next to its contract, as it did before this PR; sixbuild*functions read from the database while assembling a value, so the convention is recorded as "build*assembles a value and never returns a wired object" rather than "pure".writeAudit(the transcripts pin it); threesrcexports now used only by test helpers; a few test-side leftovers (?./!on the now-required worker methods, a hand copy of the mute binder in one test).User-visible copy changes
None.
Tests changed
Only to follow moved paths or renamed symbols; no assertion changed.
test/helpers(87 files), the queue names, the error codes, the renamed modules and contracts, and the removed delegates.makeServer,makeContainer,makeAuthServices,makeWorker,makeJobs,makeSeams,insertAuditRow,parseKeysetCursor(two precision tests pass theirrequireUuidflag in the options object),makeDrizzle*Repositoryfactories,InMemoryMediaWorkerRepository.dm-pg.test.tscalls the user-search repository directly now that the social-repository wrapper is gone (same arguments, same assertion).makeSeamsinstead ofbuildSeams.Verification
pnpm lint, prettier check,check:sqlclean; api unit suite by explicit path 428 files, 7282 passed, 3 skipped; media-worker unit 300 passed, 2 failed (the known arm64 ffprobe helper issue fixed in Backend test safety net: SQL transcripts, CSRF pairing, authz and characterization tests #92).osloorargon2, and the sandboxed image lane still imports nothing from the api beyond the inlined timeout module.Staging checks
https://api.civfix.dev/readyzanswers ready (no migration in this PR).Not covered
🤖 Generated with Claude Code