Skip to content

docs: consolidate contributing guidelines and coding rules#3669

Open
TaprootFreak wants to merge 15 commits intodevelopfrom
docs/coding-rules-analysis
Open

docs: consolidate contributing guidelines and coding rules#3669
TaprootFreak wants to merge 15 commits intodevelopfrom
docs/coding-rules-analysis

Conversation

@TaprootFreak
Copy link
Copy Markdown
Collaborator

@TaprootFreak TaprootFreak commented May 2, 2026

Summary

  • Rewrites CONTRIBUTING.md into a single, comprehensive document covering all coding conventions, architecture patterns, and process rules
  • Derived from analysis of 3,609 review comments, 274 commits, and 129 review bodies across 2,300 PRs
  • Merges and replaces the previous CONTRIBUTING.md and removes the separate CODING_RULES.md

Contents

  • Build & test commands, Git workflow, PR process
  • Naming conventions, code style, import rules
  • Architecture (domain-driven structure, entity logic, module patterns)
  • TypeScript/NestJS patterns (DTOs, Swagger, cron jobs, await discipline)
  • Database/TypeORM (entity patterns, queries, JSON columns, migrations incl. constraint naming)
  • Error handling, logging, null safety
  • Performance (SQL filtering, N+1, caching, Promise.all)
  • API design, testing, anti-patterns reference table

Test plan

  • Review for accuracy against current codebase
  • Validate rules match team expectations

Add verbose logging to trace token balance values through the pipeline:
- BlockchainAdapter: log when balance changes between cache updates
- BlockchainAdapter: log assets missing from cache after update
- BalanceService: log when saves are skipped (updated > startDate)
- BalanceService: log when balance values actually change
- Only log uncached assets when an update was actually attempted
- Log balance changes for all chains, not just Ethereum
- Remove redundant chainId from log message
- Only log balance changes when cache was previously populated
- Add always-on BBTC (394) trace to capture Alchemy response value
  even when unchanged (covers the case where Alchemy returns stale data)
Comprehensive analysis of 3,609 review comments, 274 commits,
and 129 review bodies to extract coding conventions and patterns.
Raw JSONL analysis data kept locally only, not needed in repo.
- Remove analysis subtitle, make it a project standard
- Fix section numbering (2.2a -> 2.3, 6.4a -> 6.5)
- Add missing rules: imports, trailing commas, URL construction,
  error message format
- Clarify section comment style (// --- NAME --- //)
- Clarify @DfxCron vs @Cron usage
- Generalize infrastructure references
Single source of truth for all coding conventions and process rules.
Resolves contradictions (JSON column pattern, simple-json vs getter/setter),
fixes await-before-return nuance, adds build commands and migration workflow.
- Remove duplicate end-to-end thinking (already in PR Completeness)
- Restore constraint naming algorithm table for hand-written migrations
- Add explicit Avoid Eager Loading section
- Add Promise.all() parallelization pattern
@TaprootFreak TaprootFreak changed the title docs: add coding rules from David's PR review analysis docs: consolidate contributing guidelines and coding rules May 2, 2026
- Fix @DfxCron: has built-in locking + DisabledProcess, never combine
  with @lock manually
- Add UpdateResult<T> entity pattern (107 usages in codebase)
- Add DfxLogger (not standard NestJS Logger)
- Add CachedRepository<T> for reference data
- Add DtoMapper class pattern
- Clarify DTO inheritance is optional, not mandatory
- Fix UserData example: use actual getters (tradingLimit, isDfxUser,
  hasActiveUser) instead of non-existent complete()/isDataComplete()
- Fix UpdateResult example: use real setPriceInvalidStatus() instead
  of fabricated txReceived()
- Fix DtoMapper: use ClassName.entityToDto (not this.entityToDto)
- Fix mapper location: not always in dto/, remove hardcoded path
- Array Methods: use real BankMapper.toDto instead of non-existent
  this.entityToDto instance method
- .then() chains: use real PaymentLinkDtoMapper.toLinkDto and
  CountryDtoMapper.entitiesToDto from actual controllers
- DtoMapper section: use actual PaymentLinkDtoMapper methods
  (toLinkDto/toLinkDtoList) instead of fabricated entityToDto
- Entity example now matches actual Recall entity in codebase
- Fix BAD example in "Don't Load Separately" to use valid TypeORM 0.3
  findOne({ where: {} }) syntax so the lesson is clearly about the
  pattern, not the API
@TaprootFreak TaprootFreak marked this pull request as ready for review May 2, 2026 21:29
@TaprootFreak TaprootFreak requested a review from davidleomay as a code owner May 2, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant