Skip to content

Flag implausible scout reports and exclude them from analysis - #86

Open
jackshim415 wants to merge 4 commits into
mainfrom
jackshim415/report-flagging
Open

jackshim415 wants to merge 4 commits into
mainfrom
jackshim415/report-flagging

Conversation

@jackshim415

@jackshim415 jackshim415 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Implausible scout reports can distort team averages, predictions, and exports. Add report reliability states with an UNVERIFIED default, automatically flag native and Dashboard uploads above 800 total points, and flag unverified reports whose scored-ball count exceeds their alliance's completed official score during match imports. Verified reports are protected from automatic flagging; user flags and bad reports are preserved.

Computed analysis includes only verified and unverified reports, including raw SQL, nested report queries, timelines, CSV exports, and match results. The scouting lead management list retains every reliability state and exposes that state so flagged reports can still be inspected and deleted. Cached match refreshes check late uploads, and newly flagged reports invalidate analysis cache registrations so stale results are recalculated.

Also repair the website preview build: use the repository root in the PR environment and install the existing pinned Magnolia commit as an archive, avoiding npm Git dependency preparation failures. Add coverage for excluded report autonomous paths to satisfy the existing 100% per-file coverage requirement.

Areas affected

  • Server
  • Dashboard
  • Collection
  • Website
  • Shared documentation, CI, or deployment

Shared database schema/migration and match import worker are also affected.

Contracts and data

  • No API, report-schema, authentication, deep-link, season-metric, or database contract changed
  • Every affected producer and consumer was updated together
  • Tenant and source-team visibility was reviewed
  • No credentials, production data, or private scouting notes are included

Adds ScoutReport.reliability and the ReportReliability enum. Existing reports become unverified. Upload payloads remain compatible, and source-team/tournament predicates remain in place.

Verification

  • packages/db: npm run db:validate, npm run build, and npm run db:deploy against a new disposable local database passed.
  • apps/server: npm run build, npm run typecheck, npm run typecheck:test, and npm test passed (1,064 unit tests).
  • apps/server: npm run test:integration -- test/analysisMetrics.integration.test.ts test/analysisCache.integration.test.ts passed with disposable PostgreSQL/Redis (113 tests).
  • apps/server: npm run lint passed with 80 existing warnings and no errors.
  • apps/worker: npm run typecheck and LOVAT_DB_TEST=1 bun test passed against the disposable database (57 tests).
  • ./scripts/check-structure.sh and git diff --check passed.

Coverage includes the 800-point boundary, climb points, exclusion of feeding quantities, fresh and cached imports, alliance-specific scores, verified-report immunity, flagged/bad outliers in real database analysis, and invalidated Redis cache registrations.

Additional verification after the CI fixes: unit-only coverage passes all 1,069 tests at 100% after the review fixes; the full Server unit/integration coverage suite passed all 1,242 tests at 100% before those fixes; Website Node 20.19.6 clean npm ci, npm run build, npm run check (0 errors, 13 warnings), and npm run lint (0 errors, 19 warnings) pass.

Deployment

Apply 20261018000000_add_report_reliability through the existing database migration owner before deploying the updated server and worker. Analysis cache keys move from v2 to v3; worker flagging invalidates registered analysis caches. The PR website environment now uses repository root /, Dockerfile apps/website/Dockerfile, and website/changelog watch paths. The Website preview deployed successfully and its /healthz returned ok. Production hosting settings and environment variables are unchanged. Migration was applied locally only to a disposable database; the API preview also deployed successfully through its existing migration flow.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T15:36:35.838263Z 8cd08a0 PR opened
🔒 Security Review ✅ Completed 2026-10-18T15:41:57.983389Z 8cd08a0 PR opened
ℹ️ About Codex in GitHub

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

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@railway-app

railway-app Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the lovat-pr-86 environment in lovat

Service Status Web Updated
website 😴 Sleeping (View Logs) Web Oct 18, 2026 at 4:00 pm UTC
api ✅ Success (View Logs) Web Oct 18, 2026 at 3:54 pm UTC
dashboard 😴 Sleeping (View Logs) Web Oct 18, 2026 at 3:42 pm UTC
learn 😴 Sleeping (View Logs) Web Oct 18, 2026 at 3:41 pm UTC

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8cd08a0172

ℹ️ About Codex in GitHub

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

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/server/src/handler/manager/scoutreports/addScoutReport.ts Outdated
Comment thread apps/server/src/handler/analysis/scoutingLead/scouterScoutReports.ts Outdated

This branch was successfully deployed

1 active deployment
lovat / lovat-pr-86 — 8887d534 Deployed Oct 18, 2026 by railway-app[bot]
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