Skip to content

fix(local-coding): count only new sync dates#1531

Open
eshaanag wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
eshaanag:fix/local-coding-session-cap
Open

fix(local-coding): count only new sync dates#1531
eshaanag wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
eshaanag:fix/local-coding-session-cap

Conversation

@eshaanag
Copy link
Copy Markdown
Contributor

Summary

  • Count only truly new incoming local-coding dates against MAX_SESSIONS_PER_USER.
  • Keep existing-date re-syncs allowed near the 365-session cap.
  • Add regression coverage for the near-limit upsert case.

Why

This fixes #1530 as part of GSSoC 2026. The sync route was adding the full incoming session count to the user's existing row count before enforcing the cap, but the database upserts by (user_id, date). That meant normal re-syncs of existing dates could be rejected even though they would not create new rows.

Testing

  • npm run test -- test/local-coding-sync.test.ts
  • npm run lint
  • npm run type-check
  • node scripts/check-deps.js
  • npm ci --dry-run
  • npx -p node@20 -c 'node -v && npm run build'

Note: the Node 20 build completed successfully. Next.js still prints the existing upstream package-lock.json parse warning from conflict markers, but this PR does not touch the lockfile.

Closes #1530

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@eshaanag is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:testing GSSoC type bonus: tests (+10 pts) labels May 29, 2026
@github-actions
Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@eshaanag eshaanag force-pushed the fix/local-coding-session-cap branch from 315fa9f to 86091d0 Compare May 29, 2026 17:18
@eshaanag
Copy link
Copy Markdown
Contributor Author

eshaanag commented May 29, 2026

Rebased this branch onto current main and pushed a follow-up after checking the failed Playwright report. The local-coding fix is still the core change, and the extra CI fixes cover the standalone E2E server missing static assets plus dashboard/public-profile auth edge cases that were breaking the smoke suite. Local validation is green: lint, type-check, the local-coding sync regression test, Node 20 production build, and the full Playwright suite.

@github-actions github-actions Bot added the type:devops GSSoC type bonus: devops (+15 pts) label May 29, 2026
@eshaanag eshaanag force-pushed the fix/local-coding-session-cap branch from 7cb68ee to c0bf384 Compare May 29, 2026 18:26
@eshaanag eshaanag force-pushed the fix/local-coding-session-cap branch from 15d45c4 to a0a019f Compare May 29, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:devops GSSoC type bonus: devops (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Local coding sync session cap counts upserts as new rows

1 participant