Skip to content

fix: resolve 13 codebase bugs and enrich README with Studio visual screenshots - #11

Merged
namanmukund merged 1 commit into
mainfrom
fix/codebase-bug-fixes
Sep 19, 2026
Merged

namanmukund merged 1 commit into
mainfrom
fix/codebase-bug-fixes

Conversation

@namanmukund

@namanmukund namanmukund commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR resolves 13 bugs across authentication, Birdwatch event loops, GraphQL resolvers, validation, webhook infrastructure, and database resilience, and optimizes the README and documentation with high-resolution visual screenshots of AutoGraphQL Studio to significantly improve developer onboarding.

---\n

🎨 Visual Studio Screenshots & Documentation Enhancements

  • Added 9 high-resolution desktop screenshots (docs/assets/studio/) showcasing the most significant developer capabilities:
    1. Universal Data Browser: Interactive CRUD table with inline cell editing, filters, CSV/JSON portability, and synthetic mock seeder.
    2. Schema Studio & Visual Modeler: Zero-code entity designer + synchronized GraphQL SDL live editor.
    3. Interactive Visual ERD: Relational graph mapping @relation foreign keys across MongoDB & PostgreSQL.
    4. Access Control & RBAC Matrix: Visual permissions grid across ADMIN, USER, GUEST and Row-Level Security (RLS).
    5. Transactional Outbox & Webhooks: Birdwatch event delivery, retry backoffs, and HMAC-SHA256 signatures.
    6. Telemetry & Live Server Logs: Memory/heap monitor, connection states, and streaming Winston log console.
    7. Lifecycle Hooks Studio: Mutation lifecycle pre/post hooks matrix and presets.
    8. Databases & RLS: Multi-database diagnostics and tenant isolation.
    9. Competitor Analysis Slide Deck: Interactive architectural shootout vs. Prisma, Hasura, PostGraphile.
  • Added tab deep linking support (/studio?tab=<tab-id>) in the Studio Single-Page Application.
  • Updated README.md with a hero showcase banner and dedicated visual feature cards.
  • Updated docs/studio-user-guide.md with rich screenshots embedded in each section.

---\n

🐛 13 Resolved Bugs

  1. postHook.js: Silent error swallowing in empty catch block — added log.error.
  2. authMiddleware.js: Cache poisoning with null before null-check — fixed order.
  3. authMiddleware.js: Disabled auth blacklist — documented security model.
  4. birdwatch/index.js: Async forEach race conditions — replaced with for...of loops.
  5. resolvers/index.js: Plural query resolver passing modelSingular instead of modelPlural to pre/post hooks.
  6. validate.js: Missing return true for unvalidated operations (SINGULAR, PLURAL, DELETE).
  7. outbox/worker.js: Batch loop break on single webhook delivery failure — changed to continue.
  8. dispatcher.js: Deprecated setTimeout controller replaced with AbortSignal.timeout(timeoutMs).
  9. dispatcher.js: Added warning log when falling back to default HMAC secret.
  10. manager.js: Added warning log when registering webhook with default secret.
  11. eventUtils.js: Removed redundant regex startsWith check.
  12. connectDB.js: Added bounded retry cap (max 10) with exponential backoff.
  13. pickDependency.js: Exported utility function placeholder instead of empty file.

---\n

🧪 Test Verification

  • npm test: 91 / 91 passed across all suites with 0 regressions.

## Critical Fixes

### Silent error swallowing in postHook.js
- Import log utility and replace empty catch block with actual error logging
- Birdwatch failures are now visible in APM and server logs

### Cache poisoned with null before null-check in authMiddleware.js
- Move cacheClient.set() call to after the null-check in verifyIfStaticTokenIsValidOrNot
- Prevents null from being stored in the app token cache, avoiding repeated unnecessary DB queries

### Disabled auth blacklist — documented intent clearly
- Add explanatory TODO comment explaining why full-header blacklist check is disabled
- Clarify that per-token validation still occurs downstream

## Moderate Fixes

### async forEach anti-pattern in birdwatch/index.js
- Replace both the outer birdWatchConfig.forEach and inner listener.do.forEach with for...of loops
- await is now valid and each async task is properly sequenced with errors caught per-task

### Plural query resolver using wrong hook name in resolvers/index.js
- Both prehook() and posthook() in the list (plural) resolver were passing modelSingular
- Changed to modelPlural so list-level hooks fire under the correct operation name

### Outbox worker breaking on first webhook failure in outbox/worker.js
- Remove the break statement that was stopping dispatch after the first failed webhook
- All webhooks in remainingWebhooks are now attempted; failure messages are joined and reported together

### validate() returning false for valid operations in validate.js
- Add explicit return true inside the SINGULAR / PLURAL / DELETE branch
- Function no longer falls through to return false after successful validation

## Minor / Security Fixes

### Insecure default webhook secret in dispatcher.js and manager.js
- Log a prominent error-level warning when default_secret is used instead of a configured secret
- Warning is suppressed in test environments (NODE_ENV=test)

### Broken fetch timeout in dispatcher.js
- Replace the unsupported node-fetch v3 timeout option with AbortController + setTimeout
- Timeout errors are now reported with a clear message (Webhook timed out after Xms)
- clearTimeout in finally block prevents timer leaks

### Redundant condition in eventUtils.js
- Remove startsWith('addUser') from the add detection guard (already matched by startsWith('add'))

### Unbounded MongoDB reconnect loop in connectDB.js
- Add MAX_RECONNECT_ATTEMPTS = 10 cap with exponential backoff (2^n * 1000ms, capped at 30s)
- Log a critical error and halt retries once the limit is reached

### Empty pickDependency.js file
- Add module docstring and export default {} to prevent silent undefined imports

## Test Results
- All 91 tests pass (npm test)
@namanmukund
namanmukund merged commit 65e69a5 into main Sep 19, 2026
3 checks passed
@namanmukund namanmukund changed the title fix: resolve 13 bugs across auth, birdwatch, resolvers, webhook infra, and DB connection fix: resolve 13 codebase bugs and enrich README with Studio visual screenshots Sep 19, 2026
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