Skip to content

Update repository.py#26

Merged
susrisha merged 2 commits into
developfrom
feature-task-3953
Jul 3, 2026
Merged

Update repository.py#26
susrisha merged 2 commits into
developfrom
feature-task-3953

Conversation

@susrisha

@susrisha susrisha commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Adds the pending columns when a TDEI user is provisioned. This is taken directly from the existing code of CGIMap
Task reference : Task 3953: Figure out a way to add users from TDEI system

This pull request updates the user provisioning logic in the _provision_users_from_tdei function to ensure that all required fields are set when inserting new users into the users table. The SQL statement for user creation has been expanded to include additional columns and default values, improving data consistency and aligning with the expected schema.

User provisioning improvements:

  • Expanded the INSERT INTO users SQL statement in repository.py to include additional fields such as auth_provider, status, pass_crypt, data_public, email_valid, terms_seen, creation_time, terms_agreed, and tou_agreed, all set to appropriate default values for users provisioned from TDEI.

Updated _provision_users_from_tdei so newly provisioned TDEI users are inserted into users with the full required schema fields, not just auth_uid, email, and display_name. The insert now includes defaults for fields like auth_provider, status, pass_crypt, data_public, email_valid, terms_seen, terms_agreed, tou_agreed, and timestamps, improving consistency with the table schema.

Adds the pending columns when a TDEI user is provisioned. This is taken directly from the existing code of CGIMap
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@susrisha, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 95c1d9c1-a500-41f0-aec0-9e6f896531a5

📥 Commits

Reviewing files that changed from the base of the PR and between 6f04fcb and 3e1f692.

📒 Files selected for processing (1)
  • api/src/tasking/projects/repository.py
📝 Walkthrough

Walkthrough

The auto-provisioning insert for TDEI-sourced user accounts in TaskingProjectRepository._provision_users_from_tdei now sets additional columns (auth_provider, status, pass_crypt, data_public, email_valid, terms_seen, terms_agreed, tou_agreed, timestamps) beyond auth_uid, email, and display_name. An unused alternate SQL block was also added.

Changes

User Provisioning Insert Update

Layer / File(s) Summary
Expanded users INSERT statement
api/src/tasking/projects/repository.py
The executed INSERT for auto-provisioned users now sets additional TDEI-related fields (auth_provider, status, pass_crypt, data_public, email_valid, terms_seen/agreed, tou_agreed, UTC timestamps) alongside auth_uid, email, display_name, keeping ON CONFLICT (auth_uid) DO NOTHING; an additional unused RETURNING id SQL string is also added.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit hops through fields of code,
New columns sprout along the road,
Timestamps ticking, status set,
One SQL block still unused yet,
Hop hop hooray, the users grow! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is accurate but too generic to describe the main provisioning change in repository.py. Rename it to mention the user provisioning or INSERT changes, e.g. 'Expand TDEI user provisioning fields in repository.py'.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@susrisha susrisha requested a review from MashB July 3, 2026 05:31
MashB
MashB previously approved these changes Jul 3, 2026

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
api/src/tasking/projects/repository.py (1)

273-302: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the dead SQL string block.

Lines 273‑302 are a bare triple-quoted string expression that is never assigned or executed. It duplicates the real INSERT below with $1/$2/$3 placeholders and even contains a stray closing paren after RETURNING id (line 301). It adds no behavior and will mislead future readers into thinking RETURNING id is in play. Please drop it.

♻️ Proposed removal
-        '''
-        INSERT INTO users (
-                 email,
-                 display_name,
-                 auth_uid,
-                 auth_provider,
-                 status,
-                 pass_crypt,
-                 data_public,
-                 email_valid,
-                 terms_seen,
-                 creation_time,
-                 terms_agreed,
-                 tou_agreed)
-          VALUES (
-                 $1,
-                 $2,
-                 $3,
-                 'TDEI',
-                 'active',
-                 'none',
-                 true,
-                 true,
-                 true,
-                 (now() at time zone 'utc'),
-                 (now() at time zone 'utc'),
-                 (now() at time zone 'utc'))
-          RETURNING id
-    )
-        '''
-
         resolved: set[str] = set()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/src/tasking/projects/repository.py` around lines 273 - 302, Remove the
dead triple-quoted SQL string block in repository.py; it is a standalone string
literal that is never used and duplicates the actual INSERT logic. Delete the
unused block near the users insert code so the remaining implementation is the
real SQL path in the relevant repository method and avoids confusion with the
stray RETURNING id text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@api/src/tasking/projects/repository.py`:
- Around line 273-302: Remove the dead triple-quoted SQL string block in
repository.py; it is a standalone string literal that is never used and
duplicates the actual INSERT logic. Delete the unused block near the users
insert code so the remaining implementation is the real SQL path in the relevant
repository method and avoids confusion with the stray RETURNING id text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c95dae31-cb97-453c-8fda-3e0a4643094d

📥 Commits

Reviewing files that changed from the base of the PR and between 5a6de5d and 6f04fcb.

📒 Files selected for processing (1)
  • api/src/tasking/projects/repository.py

linting fixes
@susrisha susrisha merged commit 4eefbdf into develop Jul 3, 2026
3 checks passed
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.

3 participants