Skip to content

Add quota controls and harden review processing - #166

Open
devarshishimpi wants to merge 1 commit into
mainfrom
dev
Open

devarshishimpi wants to merge 1 commit into
mainfrom
dev

Conversation

@devarshishimpi

Copy link
Copy Markdown
Owner

Description

Adds configurable subrequest limits for Cloudflare Workers and Node.js, plus default KV-backed quotas for review and retry actions. Improves GitHub review posting by salvaging valid inline comments when GitHub rejects some comments and preserving dropped findings in the review summary. Also improves Node.js database-client reuse and shutdown, separates unit and integration test commands, and updates contributing guidance for merging directly into main.

No new dependencies are required.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Dashboard Verification
  • Manual GitHub Webhook Verification

Checklist:

  • I have starred Codra on GitHub
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • I have signed the CLA

Comment on lines +23 to +24
const body = comment.body
.replace(/\|/g, "\\|")

@codra-app-personal codra-app-personal Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codra Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7f43833b8

ℹ️ About Codra in GitHub

Your team has set up Codra to review pull requests in this repo. Reviews are triggered when you:

  • Open a pull request for review
  • Mark a draft as ready

If Codra has suggestions, it will comment; otherwise it will react with 👍.

Comment thread packages/db/src/client.ts
return dbStorage.run(createDbClient(env), fn);
export function runWithDb<T>(env: DbEnv, fn: () => T, client?: DbClient): T {
const resolvedClient =
client ?? (env.workerMode === false ? getDb(env) : createDbClient(env));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Uncached database client created per runWithDb call in worker mode

When env.workerMode is not false and no client is explicitly passed to runWithDb, createDbClient(env) is invoked directly. Unlike getDb, this newly created client is neither cached nor registered for cleanup, resulting in a persistent database connection pool leak on every invocation.

Suggested change
client ?? (env.workerMode === false ? getDb(env) : createDbClient(env));
client ?? getDb(env);

}
await this.queue.send(nextParams, {
delaySeconds: result.delaySeconds,
delaySeconds: 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Job delaySeconds overridden with zero

The change hardcodes delaySeconds to 0 instead of using result.delaySeconds. This discards any backoff or scheduled delay requested by the orchestrator result, which may cause aggressive retry loops or immediate execution when a delay was expected.

Suggested change
delaySeconds: 0,
delaySeconds: result.delaySeconds,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants