Glossary
Glossary
Relevant source files
The following files were used as context for generating this wiki page:
- .devin/rules/code-guardrails.md
- .devin/rules/data-model-conventions.md
- .devin/rules/dev-server.md
- .devin/rules/workflow.md
- AGENTS.md
- docs/gitflow.md
- emailsender/src/db/schema-snapshot.ts
- emailsender/src/domain/entities/entity-decorators.ts
- emailsender/src/nats/types.ts
- emailsender/src/providers/brevo.ts
This page provides definitions for codebase-specific terminology, architectural patterns, and domain concepts used within the Primebrick v3 Microservices repository. It serves as a reference for onboarding engineers to understand the specific vocabulary used in code and documentation.
Architectural & Process Terms
Tic-Toc Planning
A mandatory workflow cycle for AI agents (and recommended for humans) to ensure architectural alignment before code is modified. It consists of an Analysis Phase, the creation of an ai-plans/ markdown file, and a MANDATORY BLOCKER where the agent halts until the user provides the "PROCEED" keyword.
- Implementation: Defined in the governance rules at .devin/rules/workflow.md:4-17.
- Data Flow:
- Analysis (No code changes).
- Plan generation in
primebrick-workspace/ai-plans/. - User Review.
- Execution.
Snake_case Enforcement
A "Golden Rule" across the repository requiring that all database columns, TypeScript interfaces, and JSON payloads (Request/Response) use snake_case. This eliminates the need for field renaming (DTO transformation) between layers.
- Implementation: Governed by .devin/rules/data-model-conventions.md:12-16.
- Exceptions: Only permitted at External API adapter boundaries (e.g., emailsender/src/providers/brevo.ts:1-11) where the third-party service dictates the naming convention.
GitFlow
The branching model used for version control. It strictly separates develop (integration), main (production), feature/ (new work), release/ (version preparation), and hotfix/ (production patches).
- Implementation: Detailed in docs/gitflow.md:1-21.
- Key Rule: Manual versioning in
package.jsonis required as there is no automated sync script docs/gitflow.md:46-51.
Data Layer Concepts
Entity Metadata (Decorators)
A system using TypeScript decorators to map classes to database tables without a heavy ORM. It uses a WeakMap named META to store configuration about tables, keys, and columns.
- Key Decorators:
@Entity(): Maps a class to a table name emailsender/src/domain/entities/entity-decorators.ts:158-164.@Key(): Defines the Primary Key emailsender/src/domain/entities/entity-decorators.ts:19.@Column(): Overrides default SQL mappings emailsender/src/domain/entities/entity-decorators.ts:189-191.
- Source: emailsender/src/domain/entities/entity-decorators.ts:9-108.
Schema Snapshot
A JSON representation of the "intended" database state (derived from @Entity metadata) or the "actual" state (introspected from PostgreSQL). The system compares these snapshots to generate migration patches.
- Key Function:
compareSnapshots(entitySnap, dbSnap)emailsender/src/db/schema-snapshot.ts:62-161. - Heuristics: Includes
findLikelyRenamesto suggestALTER TABLE ... RENAME COLUMNinstead of drop/create emailsender/src/db/schema-snapshot.ts:7-11.
Diagram: Data Model to Code Entity Mapping
This diagram illustrates how the Entity decorator metadata is processed into a SchemaSnapshot for comparison.
Code
Sources: emailsender/src/domain/entities/entity-decorators.ts:99-152, emailsender/src/db/schema-snapshot.ts:17-18.
Email Domain Concepts
Brevo Provider
The primary external service for dispatching emails. The integration is handled by the BrevoClient which maps internal requests to the Brevo API format.
- Implementation: emailsender/src/providers/brevo.ts:23-60.
- Status Mapping: The
mapStatusfunction converts Brevo-specific event strings (e.g., "hardbounce") into internal system statuses (e.g., "bounced") emailsender/src/providers/brevo.ts:62-79.
Messaging Contracts (NATS)
The definitions for inter-service communication via NATS JetStream.
- SendEmailRequest: The payload required to trigger an email dispatch, including
templateCodeandvariablesemailsender/src/nats/types.ts:1-12. - SendEmailResponse: The acknowledgement containing the
providerMessageIdor an error string emailsender/src/nats/types.ts:14-20.
Diagram: Email Dispatch Request Flow Mapping the NATS message interface to the Brevo Provider execution.
Code
Sources: emailsender/src/nats/types.ts:1-20, emailsender/src/providers/brevo.ts:32-60.
Infrastructure Terms
Dev Server Management
Specific rules for managing Node.js processes on Windows development machines to prevent port conflicts.
- Tooling: Uses
netstat -anoandGet-CimInstance Win32_Processto identify existing PIDs before starting new services .devin/rules/dev-server.md:23-27. - Policy: Agents must never kill a PID holding a port without explicit instruction .devin/rules/dev-server.md:44-46.
Code Guardrails
Constraints placed on AI agents to prevent infinite loops or architectural drift.
- Max Retry: 2 attempts to fix linting/compilation errors before entering a BLOCKED state .devin/rules/code-guardrails.md:7-10.
- Scope Locking: Prohibition against altering function signatures or shared state unless specified in an approved plan .devin/rules/code-guardrails.md:13-14.
Sources:
- docs/gitflow.md:1-108
- .devin/rules/workflow.md:1-17
- .devin/rules/data-model-conventions.md:1-47
- .devin/rules/dev-server.md:1-49
- AGENTS.md:1-31
- .devin/rules/code-guardrails.md:1-15
- emailsender/src/db/schema-snapshot.ts:1-161
- emailsender/src/domain/entities/entity-decorators.ts:1-191
- emailsender/src/nats/types.ts:1-28
- emailsender/src/providers/brevo.ts:1-81