| 1 | How | How does a dashboard GET get the right rows? | JWT → SET ROLE → sequelize.query on req.dbTransaction → Postgres policies. |
| 2 | How | How does SET ROLE last for many queries? | One open transaction until FinishTransaction commit on HTTP finish. |
| 3 | How | How does the bot not run as table owner? | FastAPI returns SQL; Nest executeRawSelectQuery uses the RLS txn. |
| 4 | How | How is the token attached? | localStorage token → Axios Bearer (or fetch Authorization on chatbot.ts). |
| 5 | How | How does refresh work? | POST /auth/refresh-token with refresh JWT; new Bearer pair; 15 min timer. |
| 6 | How | How does fail-closed work? | SET ROLE rls_no_access when mapping is missing. |
| 7 | How | How are allowedTables built? | Policy allowedModules → ModuleRegistry.tables on USER path. |
| 8 | How | How does chart metadata get to the UI? | Pydantic fields on FastAPI JSON, forwarded by executeChatQuery, ElementRenderer. |
| 9 | How | How does WITH pass the SELECT gate? | Extractor wraps SELECT * FROM (cte) q. |
| 10 | How | How do Tally files land? | Zip multer memory → S3 tally-uploads/ → gateway POST. |
| 11 | How | How does the txn close? | res.on('finish') commit; rollback if commit throws. |
| 12 | How | How are routes hidden? | FeatureAccess hasFeatureAccess(route) + ProtectedRoute. |
| 13 | How | How is schema cached? | fieldsCache Map 5 min TTL + etag. |
| 14 | How | How is org injected into raw SQL? | Regex tables, if organizationId column, splice WHERE or AND. |
| 15 | How | How does prod differ from qa? | main vs qa branch; :latest vs :qa; prod waits on Arjun-ylogx. |
| 16 | How | How does ECS know the app is alive? | curl localhost:5000/health every 30s, Terminus pings Postgres. |
| 17 | How | How are secrets kept out of debug HTTP logs? | sanitizeBody redacts password/token/secret/apiKey/authorization. |
| 18 | How | How does signup become a login? | OTP email → activate hashes password → signin issues JWTs. |
| 19 | How | How does chat CRUD bypass the warehouse role? | New txn + RESET ROLE in executeWithoutRLS. |
| 20 | How | How is a report saved? | POST /reports JSON blob, createdBy userId, soft delete flag. |
| 21 | What | What is Nest’s job vs FastAPI’s? | Nest: identity + execute. FastAPI: NL → SQL JSON. |
| 22 | What | What is on req.user after JWT? | userId, role, email, client_id, organizationId. |
| 23 | What | What app.* keys get set? | is_SUPER_ADMIN, is_admin, current_user_id, user_role, organizationId, admin_hierarchy_filter (ADMIN). |
| 24 | What | What are the nine types? | overview, sales, receivables, payables, stock, collections, profitLoss, balanceSheet, cashflow. |
| 25 | What | What join enum values? | INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN. |
| 26 | What | What is SQLQueryAndDetails? | Pydantic model: eventQuery, chatMessage, axes, chartType, dataPeriod, … |
| 27 | What | What tables can LangChain see? | The 11 include_tables in extractor.py. |
| 28 | What | What is the default chatbot URL? | https://chatbot.projas.in/chatbot |
| 29 | What | What cache is in Nest? | In-memory Map for dataset fields, not Redis. |
| 30 | What | What does the cookie markdown claim? | HTTP-only cookies; this snapshot’s middleware is Bearer. |
| 31 | What | What does Terminus ping? | Indicator name postgresDB. |
| 32 | What | What is pool max? | 20. |
| 33 | What | What CPU/memory is the task? | 1024 / 3072 Fargate recipe. |
| 34 | What | What JWT times are in the task env? | 1h access, 7d refresh — env values, not an SLA percent. |
| 35 | What | What hashes passwords? | bcrypt in AuthService. |
| 36 | What | What does GUEST hit? | Unauthorized on query/dashboard/report create paths. |
| 37 | What | What does the interceptor print? | Method, URL, user email, IP, status, duration ms. |
| 38 | What | What is synchronize? | true in sequelize.module.ts. |
| 39 | What | What is in report.data? | Saved canvas JSON (pages, elements, size). |
| 40 | What | What library drags columns? | react-dnd + HTML5Backend. |
| 41 | Where | Where is Bearer verified? | src/middleware/jwt.middleware.ts |
| 42 | Where | Where is SET ROLE? | src/middleware/rls.middleware.ts |
| 43 | Where | Where is bot SQL executed? | QueryDBService.executeRawSelectQuery |
| 44 | Where | Where is SQL generated? | convbi-ai/extractor.py + prompts.py |
| 45 | Where | Where is Redis in this Nest tree? | It is not in package.json. Resume bot path still names Redis. |
| 46 | Where | Where are 9 types declared? | frontend PREDEFINED_DASHBOARDS in dashboard/App.tsx |
| 47 | Where | Where is Chart.js on the canvas? | reportBuilder/ElementRenderer.tsx |
| 48 | Where | Where is cookie-parser? | Not in this package.json. Markdown only. |
| 49 | Where | Where is the prod workflow? | convbi-backend/.github/workflows/convbi-prod.yml |
| 50 | Where | Where is FinishTransaction registered? | main.ts app.use(FinishTransactionMiddleware) |
| 51 | Where | Where is CORS *? | convbi-ai/main.py CORSMiddleware |
| 52 | Where | Where is joinCondition interpolated? | executeQuery in queryDB.service.ts |
| 53 | Where | Where is the SELECT prefix? | executeRawSelectQuery start |
| 54 | Where | Where is executeWithoutRLS? | chat.service.ts private method |
| 55 | Where | Where is fieldsCache? | QueryDBService fields |
| 56 | Where | Where is hasFeatureAccess? | FeatureAccessContext.tsx |
| 57 | Where | Where is the S3 key prefix? | fileUpload.service.ts tally-uploads/ |
| 58 | Where | Where is simple health? | GET /health/simple HealthController |
| 59 | Where | Where is gpt-4.1? | SQLQueryAndDetailsExtractor.get_llm_chain_object |
| 60 | Where | Where is @google/generative-ai? | frontend package.json; not the Nest chat-query path |
| 61 | Logic | Why first db_role_name only? | Postgres one SET ROLE. Extra roles still feed allowedTables. |
| 62 | Logic | Why RESET ROLE for SUPER_ADMIN? | Drop a prior restricted role; set is_SUPER_ADMIN configs. |
| 63 | Logic | Why SYSTEM scope for ADMIN? | Org-level warehouse role comes from SYSTEM roles assigned to that admin. |
| 64 | Logic | Why pg_policies outside the txn? | Restricted SET ROLE may not read the catalog. Discovery only. |
| 65 | Logic | Why FastAPI must not execute user SQL? | It has no caller SET ROLE. Nest does. |
| 66 | Logic | Why temperature 0? | Deterministic SQL/chart JSON. Not a tenant control. |
| 67 | Logic | Why features and RLS? | Routes vs rows. Hide chatbot ≠ filter sales. |
| 68 | Logic | Why no LLM on dashboard GET? | sub-210 ms family; tiles are aggregations not prose. |
| 69 | Logic | Why a new txn for chat CRUD? | Warehouse role often cannot DML chat tables. Reset on a side txn. |
| 70 | Logic | Why rls_no_access instead of RESET? | RESET was the ADMIN leak. Fail closed. |
| 71 | Algo | RLS resolution | BEGIN → branch SUPER_ADMIN / ADMIN SYSTEM / USER roles / else no_access → set_config → next(). |
| 72 | Algo | executeChatQuery | fetch FastAPI → parse eventQuery → executeRawSelectQuery → combine JSON without returning eventQuery. |
| 73 | Algo | executeRawSelectQuery | SELECT prefix → FROM/JOIN regex → hasTableAccess loop → org WHERE inject → query on txn. |
| 74 | Algo | executeQuery | access both tables → SELECT quoted cols → JOIN keyword + ON condition → date/org WHERE → LIMIT → txn. |
| 75 | Algo | Slicer WHERE | buildWhereClauseFromFilters operators with bound :pN replacements. |
| 76 | Algo | Signup → session | domain check → PENDING/inactive + OTP → activate bcrypt → signin two JWTs → localStorage. |
| 77 | Algo | Token refresh | timer 15m or focus + needsRefresh → POST refresh → write tokens → reschedule. Single-flight refreshPromise. |
| 78 | Algo | Tally | validate zip → upload current (and optional previous) → fill zip_files URIs → gateway create. |
| 79 | Algo | Schema validator | parse CREATE TABLE from get_table_info → diff config columns → optional rewrite config.py. |
| 80 | Algo | Dashboard filters | parse comma months/years → EXTRACT MONTH/YEAR IN lists on date columns → many aggregations one GET. |