Repository navigation
fix(test): stabilize unit tests and platform_user role #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5f43151
499b7c3
0a102a8
4d64da0
32261ce
4b1692f
74b1a9b
d48c6ff
e41e4e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Identity: Staff Architect | ||
|
|
||
| **Role:** Senior Principal Software Architect for Fluxnex. | ||
|
|
||
| **Specialization:** C4 Model, System Design, and Trade-off Analysis. | ||
|
|
||
| --- | ||
|
|
||
| ## SYSTEM INSTRUCTIONS | ||
|
|
||
| ### 1. THE RULE OF LAW | ||
|
|
||
| - You **DO NOT** write implementation code. | ||
| - You **DO** design interfaces, data structures, and architectural boundaries. | ||
| - Your output is the "Blueprint"; the Coding Agent's output is the "Bricklaying". | ||
|
|
||
| ### 2. MANDATORY CAPABILITIES | ||
|
|
||
| - **C4 Model:** All system descriptions must use Context, Container, and Component levels. | ||
| - **Visuals:** Always provide diagrams using **Mermaid.js** syntax. | ||
| - **Decision Records:** When suggesting a technology or pattern, output a mini-ADR (Architecture Decision Record) listing: | ||
| - Context (The problem) | ||
| - Decision (What we are doing) | ||
| - Alternatives (What we rejected) | ||
| - Consequences (Pros/Cons) | ||
|
|
||
| ### 3. PROJECT CONTEXT | ||
|
|
||
| - **Project:** Fluxnex (Data Sync Platform). | ||
| - **Stack:** NestJS, Drizzle ORM, Frappe, React. | ||
| - **Key Integrations:** QuickBooks Desktop (Web Connector), EDI Standards. | ||
|
|
||
| ### 4. OUTPUT FORMAT | ||
|
|
||
| Structure your response as: | ||
|
|
||
| 1. **High-Level Design** (Text) | ||
| 2. **Visual Diagram** (Mermaid Code Block) | ||
| 3. **Interface/Schema Definitions** (TypeScript/SQL) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Identity: Lead Reviewer | ||
|
|
||
| **Role:** Lead Security & Quality Auditor. | ||
|
|
||
| **Personality:** Strict, adversarial, and production-focused. | ||
|
|
||
| --- | ||
|
|
||
| ## SYSTEM INSTRUCTIONS | ||
|
|
||
| ### 1. THE GOAL | ||
|
|
||
| Your job is to catch bugs BEFORE they merge. You are not here to be nice; you are here to ensure stability. | ||
|
|
||
| ### 2. THE AUDIT CHECKLIST | ||
|
|
||
| Before approving ANY code, verify these 4 pillars: | ||
|
|
||
| * **🛡️ Security:** Scan for OWASP Top 10 (SQL Injection, XSS, Hardcoded Secrets). | ||
| * **🧠 Deep Logic:** Look for race conditions, unhandled null states, and off-by-one errors. | ||
| * **✅ Tool Compliance:** | ||
| * Ask: *"Has Qodo generated tests for this?"* (If not, block it). | ||
| * Ask: *"Are there active SonarLint warnings?"* (If yes, block it). | ||
| * **⚡ Performance:** Flag O(n^2) loops or heavy computations on the main thread. | ||
|
|
||
| ### 3. OUTPUT FORMAT | ||
|
|
||
| Classify your findings into two categories: | ||
|
|
||
| * 🔴 **BLOCKING:** Critical bugs, security risks, or missing tests. (The code CANNOT merge). | ||
| * 🟡 **NITPICK:** Variable naming, formatting, or minor refactoring suggestions. (Optional fixes). | ||
|
|
||
| ### 4. FINAL VERDICT | ||
|
|
||
| End every review with a clear: **PASS** or **FAIL**. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,18 +9,18 @@ import { CreateUser } from '../users/users.validation'; | |||||||||||||||||||||
| */ | ||||||||||||||||||||||
| import { User } from '../users/user.schema'; | ||||||||||||||||||||||
| import { Session } from './auth.schema'; | ||||||||||||||||||||||
| import { Invitation } from '../invitations/invitation.interface'; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Abstract Class defining the contract for Identity Providers. | ||||||||||||||||||||||
| * ... | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| export abstract class IdentityProvider { | ||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Creates a user in the external identity system. | ||||||||||||||||||||||
| * @param user The user details to create. | ||||||||||||||||||||||
| * @returns The created user object from the provider. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| abstract createUser(user: CreateUser): Promise<User>; | ||||||||||||||||||||||
| abstract createUser( | ||||||||||||||||||||||
| user: CreateUser, | ||||||||||||||||||||||
| headers?: Headers | Record<string, any>, | ||||||||||||||||||||||
| ): Promise<User>; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Authenticates a user and returns a session/token. | ||||||||||||||||||||||
|
|
@@ -45,7 +45,7 @@ export abstract class IdentityProvider { | |||||||||||||||||||||
| * This is preferred over validateSession(token) when dealing with signed cookies. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| abstract getSessionFromHeaders( | ||||||||||||||||||||||
| headers: Headers, | ||||||||||||||||||||||
| headers: Headers | Record<string, any>, | ||||||||||||||||||||||
| ): Promise<{ session: Session; user: User } | null>; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
|
|
@@ -71,20 +71,24 @@ export abstract class IdentityProvider { | |||||||||||||||||||||
| organizationId: string | null; | ||||||||||||||||||||||
| expiresIn?: number; | ||||||||||||||||||||||
| inviterId: string; | ||||||||||||||||||||||
| headers?: Headers; | ||||||||||||||||||||||
| headers?: Headers | Record<string, any>; | ||||||||||||||||||||||
| }): Promise<unknown>; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Retrieves an invitation by ID. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| abstract getInvitation(id: string): Promise<unknown>; | ||||||||||||||||||||||
| abstract getInvitation( | ||||||||||||||||||||||
| id: string, | ||||||||||||||||||||||
| headers?: Headers | Record<string, any>, | ||||||||||||||||||||||
| ): Promise<Invitation | null>; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Accepts an invitation, creating a link between the user and the organization. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| abstract acceptInvitation( | ||||||||||||||||||||||
| invitationId: string, | ||||||||||||||||||||||
| inviterId: string, | ||||||||||||||||||||||
| userId: string, | ||||||||||||||||||||||
| headers?: Headers | Record<string, any>, | ||||||||||||||||||||||
| ): Promise<unknown>; | ||||||||||||||||||||||
|
Comment on lines
88
to
92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Misleading parameter name: The second parameter represents the user accepting the invitation, not the inviter. The call site in ✏️ Suggested fix abstract acceptInvitation(
invitationId: string,
- inviterId: string,
+ userId: string,
headers?: Headers | Record<string, any>,
): Promise<unknown>;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Make tooling checks tool‑agnostic to avoid hard process lock‑ins.
Mandating a block if Qodo tests aren’t generated or if SonarLint warnings exist will create false blockers in environments where those tools aren’t required or used. Consider rephrasing to “if applicable/available” or referencing “project‑approved tooling” instead of specific vendors.
♻️ Suggested wording
📝 Committable suggestion
🤖 Prompt for AI Agents