Skip to content

🧪 [Testing] Add coverage for validate_list_items_length#675

Open
madara88645 wants to merge 5 commits into
mainfrom
testing/generators-list-items-length-6188064772926955283
Open

🧪 [Testing] Add coverage for validate_list_items_length#675
madara88645 wants to merge 5 commits into
mainfrom
testing/generators-list-items-length-6188064772926955283

Conversation

@madara88645
Copy link
Copy Markdown
Owner

🎯 What: Adds missing unit test coverage for the validate_list_items_length Pydantic validator on GitHubRepoContextPayload in api/routes/generators.py.
📊 Coverage: Added new tests in tests/test_generators.py verifying:

  • Valid paths: Items with short strings and exactly 1024-character strings.
  • Empty lists (permitted by logic).
  • Error paths: Ensures ValidationError is raised and correct error message is returned when strings exceed 1024 characters.
    Result: Improved confidence in the safety rails that prevent DoS via massive strings in the generators API payloads.

PR created automatically by Jules for task 6188064772926955283 started by @madara88645

Adds unit tests to verify the length constraint enforcement on GitHubRepoContextPayload properties (highlights, files_used, detected_stack) to protect against DoS from massive strings. Tests cover valid lengths, empty lists, and invalid lengths exceeding 1024 characters.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
compiler Ready Ready Preview, Comment May 31, 2026 10:30am

@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings May 29, 2026 10:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Adds unit tests to verify the length constraint enforcement on GitHubRepoContextPayload properties (highlights, files_used, detected_stack) to protect against DoS from massive strings. Tests cover valid lengths, empty lists, and invalid lengths exceeding 1024 characters.
Formatted using ruff to satisfy pre-commit.
Adds unit tests to verify the length constraint enforcement on GitHubRepoContextPayload properties (highlights, files_used, detected_stack) to protect against DoS from massive strings. Tests cover valid lengths, empty lists, and invalid lengths exceeding 1024 characters.
Formatted using ruff to satisfy pre-commit.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Stale comment

PR risk assessment

Risk level: Very Low

Decision: Approved — no additional reviewers required.

Evidence (from diff only)

Signal Finding
Files changed 1 (tests/test_generators.py, +66 lines)
Production code None
Infra / auth / schema None
Surface area Unit tests for existing GitHubRepoContextPayload.validate_list_items_length in api/routes/generators.py

Rationale

This PR adds pytest coverage for the existing 1024-character list-item validator (valid paths, empty lists, and ValidationError on overflow for highlights, files_used, and detected_stack). It does not change runtime behavior, deployment, or shared production paths.

Per policy: Very Low risk → approve; no reviewer assignment (0 reviewers currently requested).

Checks noted

  • No prior approval on this PR (re-approval not applicable).
  • No CODEOWNERS file in repo; no codeowner review gate.
  • CI was in progress at assessment time; merge should wait for required checks to pass.
Open in Web View Automation 

Sent by Cursor Automation: Assign PR reviewers

Adds unit tests to verify the length constraint enforcement on GitHubRepoContextPayload properties (highlights, files_used, detected_stack) to protect against DoS from massive strings. Tests cover valid lengths, empty lists, and invalid lengths exceeding 1024 characters.
Formatted using ruff to satisfy pre-commit.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/madara88645s-projects?upgradeToPro=build-rate-limit

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Stale comment

Follow-up inline notes on the highest-impact behavioral deltas. Merge after maintainer review of production paths (not only the new validator tests).

Open in Web View Automation 

Sent by Cursor Automation: Assign PR reviewers

async def {tool_name}({param_signature}) -> str:
\"\"\"{ir.purpose or f"Execute {tool_name}."}\"\"\"
return "TODO: implement {tool_name}"
raise NotImplementedError("TODO: implement {tool_name}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Export stub now raises NotImplementedError instead of returning a TODO string. Confirm no downstream flow expects the previous return value (e.g. smoke tests or copy-paste workflows).

Comment thread app/rag/history_store.py
self.path.write_bytes(orjson.dumps(payload, option=orjson.OPT_INDENT_2))
except Exception:
pass
except Exception as e:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Save failures are now logged instead of silently swallowed. Worth confirming callers still handle partial persistence correctly when disk writes fail.

@madara88645
Copy link
Copy Markdown
Owner Author

Not merged in this batch: branch is conflicting AND has changes-requested across 21 files. Needs a rebase + the review feedback addressed before it can go in.

@google-labs-jules
Copy link
Copy Markdown
Contributor

Not merged in this batch: branch is conflicting AND has changes-requested across 21 files. Needs a rebase + the review feedback addressed before it can go in.

I have successfully rebased the PR onto the latest main branch, resolved the merge conflicts, and verified that the tests continue to pass.

Adds unit tests to verify the length constraint enforcement on GitHubRepoContextPayload properties (highlights, files_used, detected_stack) to protect against DoS from massive strings. Tests cover valid lengths, empty lists, and invalid lengths exceeding 1024 characters.
Formatted using ruff to satisfy pre-commit.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

PR risk assessment (re-evaluated after synchronize)

Risk level: Medium

Decision: Review required — not approved. Prior Very Low assessment (test-only) is obsolete; this push materially expanded scope.

Evidence (from diff only — 987a492..50a1dc0)

Signal Finding
Files changed 21 (+224 / −54 lines)
Production / shared paths api/routes/compile.py, app/emitters.py, heuristic handlers, RAG (history_store, parsers, simple_index), export adapters, templates_manager, cli/utils
User-facing UI Home compile (page.tsx), agent-generator, benchmark, skills-generator (example-prompt CTAs + aria-busy)
Tests / docs tests/test_generators.py (+52), tests/test_rag_history_store.py, .jules/* journals
Infra / auth / schema None
Title vs diff Title/commits describe tests only; diff includes cross-cutting runtime and UX changes — do not rely on PR text for scope

Why Medium (not Very Low / Low)

  • Behavioral changes span compile fallback logging, prompt emitters, constraint heuristics, RAG ingest/search error handling, and export stub semantics (NotImplementedError vs prior stubs).
  • Four primary web flows touched; regression risk is real though not architectural.
  • Not Medium-High: no auth, billing, migrations, or deployment/infra edits.

Actions taken

  • Approval: Withheld (Medium → human review required).
  • Reviewers: Not assigned — repo history shows a single human maintainer (madara88645, PR author); no additional non-author domain experts in git log / contributors. Please self-review or add a collaborator before merge.
  • Prior automation: Earlier approval dismissed when scope grew; inline notes on adapter/RAG deltas remain relevant.

Merge guidance

  1. Split or justify non-test changes vs. the validator test goal.
  2. Re-run backend + web tests for touched paths.
  3. Confirm export stubs raising NotImplementedError and RAG save/load logging match expected operator behavior.

Sent by Cursor Automation: Assign PR reviewers

Open in Web View Automation 

Sent by Cursor Automation: Assign PR reviewers

Comment thread api/routes/compile.py
logger.warning(
"LLM compile failed; falling back to local v2 heuristics",
exc_info=True,
exc_info=exc,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

exc_info=exc logs a traceback here (works in Py3), but differs from the usual exc_info=True inside except blocks. Worth a quick sanity check that compile fallback logs remain complete in production log aggregation.

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.

2 participants