Skip to content

Close the Greptile gaps from the prospecting PR - #38

Merged
yudelevi merged 2 commits into
developmentfrom
fix/prospecting-greptile-p2
Oct 1, 2026
Merged

yudelevi merged 2 commits into
developmentfrom
fix/prospecting-greptile-p2

Conversation

@yudelevi

@yudelevi yudelevi commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Two Greptile P2s left open on #37.

  • ProspectingMessageRequest with neither text nor any intake answer is rejected locally. The API already 422s it (its text_or_intake validator); the spec can't express the rule, so the generated model let it through.
  • scripts/check_contract.py kept only the first method per route, so answer_intake (same route as message) was never checked. It now checks answer_intake's arguments against the body fields they fill: intake keys, IntakeAnswer fields, and text.

RetriggerConfidence Score: 4/5

The PR appears safe to merge; the contract-check coverage gap is non-blocking.

Fix All in Claude CodeFindings

  1. P2 Missing key constraints go unchecked ▶
Fix with agent prompt
### Issue 1
scripts/check_contract.py:236-237
If the API schema removes `propertyNames.enum` from `intake`, `spec_keys` is empty and this check skips the key comparison. The SDK could then reject a question key the API accepts without the contract check reporting the drift. Treat a missing key constraint as a mismatch rather than a passing check.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR rejects prospecting messages with neither text nor intake answers and adds contract coverage for the answer_intake method on its shared route.

  • The new intake-key comparison can silently pass when the API schema omits its key enumeration.

Reviews (1) · Last reviewed commit: "Close the Greptile gaps from the prospec..."

Making ProspectingMessageRequest.text optional for intake answers
dropped the local guard against an empty message. The API still
rejects a body with neither text nor intake answers (422 from its
text_or_intake validator), but the spec cannot express that rule, so
the generated model let {} and {"intake": {}} through to a wasted
request. The base request class now applies the same rule, the way
it already mirrors the platform's geo shape rules.

answer_intake shares the messages route with message(), and the
contract check kept only the first method per route, so it never
looked at answer_intake. Its signature carries a hand-written intake
key Literal and IntakeAnswer values that nothing compared to the spec.
The check now keeps every decorated method and checks answer_intake's
arguments against the body fields they fill: intake keys both ways,
IntakeAnswer fields both ways, and that the text field still exists.
Comment thread scripts/check_contract.py Outdated
Comment on lines +236 to +237
spec_keys = set(variant.get("propertyNames", {}).get("enum", []))
if spec_keys and typing.get_origin(key_type) is Literal:

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 Missing key constraints go unchecked If the API schema removes propertyNames.enum from intake, spec_keys is empty and this check skips the key comparison. The SDK could then reject a question key the API accepts without the contract check reporting the drift. Treat a missing key constraint as a mismatch rather than a passing check.

Knowledge Base Used: Contract and release workflows

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/check_contract.py
Line: 236-237

Comment:
**Missing key constraints go unchecked** If the API schema removes `propertyNames.enum` from `intake`, `spec_keys` is empty and this check skips the key comparison. The SDK could then reject a question key the API accepts without the contract check reporting the drift. Treat a missing key constraint as a mismatch rather than a passing check.

**Knowledge Base Used:** [Contract and release workflows](https://app.greptile.com/discolike/-/custom-context/knowledge-base/discolike/discolike-python/-/docs/contract-and-release-workflows.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

@yudelevi yudelevi Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a follow-up commit: a Literal key type against a spec with no propertyNames enum is now reported ("spec accepts any key ... but the SDK restricts them"), with a test.

If the spec stops listing allowed intake keys, the SDK's Literal would
reject keys the API accepts while the key comparison silently skipped,
since it only ran when the spec had an enum.
@yudelevi
yudelevi merged commit c8d414f into development Oct 1, 2026
8 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.

1 participant