Skip to content

[COVAL-5823] Model the remaining dropped request fields - #126

Merged
callumreid merged 2 commits into
mainfrom
callum/cli-remaining-request-fields
Sep 4, 2026
Merged

[COVAL-5823] Model the remaining dropped request fields#126
callumreid merged 2 commits into
mainfrom
callum/cli-remaining-request-fields

Conversation

@callumreid

Copy link
Copy Markdown
Contributor

Depends on #122 for the audit exceptions; the code here stands alone. Shares the explicit_option move with #124 and #125 (identical content, so the later ones drop that hunk).

Last of the four modelling PRs. With #123, #124, and #125 it closes all 74 real request-field gaps the audit reports.

Agents

UpdateAgentRequest gains attributes, customer_agent_id, language, tags, workflows. CreateAgentRequest already modeled all five, so until now a field could be set when the agent was created and never changed again.

AgentUpdatePatch.database_field_updates() is model_dump(exclude_unset=True), and normalize_cleared_json_fields / normalize_cleared_list_fields map an explicit null to {} / []. Null is therefore how a caller clears one of these, so language, attributes, workflows, and tags take explicit_option. customer_agent_id does not: the API documents it non-nullable and rejects null.

Known, deliberately out of scope: the six fields the struct already declared (metadata, metric_ids, test_set_ids, phone_number, endpoint, prompt) have exactly the same clearing problem and are still plain Option<T>. Fixing them here would widen this PR past the audit's reported gaps, so they are COVAL-5829.

Test sets and run templates

Both gain tags on create and update. Both follow the "None means don't update; [] clears" contract, so plain Option.

Uploaded conversations

submit gains tags (repeatable --tag). patch gains metadata, the additive customer-metadata path — the API rejects a key that already has a value.

The API patches audio and metadata separately, deliberately, so a rejected metadata key can never leave audio half-attached, and it accepts exactly one target per call. patch now enforces that locally with a message naming the flags instead of relaying a 400.

Deliberately not modeled

agent_id, persona_id, test_set_id on the run-template requests. The published spec documents them and marks them required on create, but StrictCreateRunTemplateRequest / StrictUpdateRunTemplateRequest forbid extra fields and the served model takes the plural arrays the CLI already sends. Modeling the documented names would break every call. That drift is COVAL-5825, on the API/docs side.

Verification

Nine new tests, including the explicit-null clear, the "unset stays omitted" counterpart, and both conversation-patch guard rails.

cargo fmt --check && cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets --all-features

Running the #122 audit against this tree moves modeled request fields from 280/360 to 291/360 and reports exactly these 11 entries as stale exceptions, with no new extras.

Minor version bump to 0.8.0.

On merge order

Cut from main. After #122 merges, rebase and delete the 11 [[known_field_gap]] entries for agents, test-sets, run-templates (tags only — keep the three singular-id entries), and uploaded conversations. Then regenerate api-coverage-report.md and re-apply the version bump.

test_update_check_notifies_when_outdated fails under parallel cargo test here exactly as on clean main. Pre-existing, COVAL-5826.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 82e974de-4d59-4824-8c7d-d502d69aa971

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@callumreid
callumreid marked this pull request as ready for review September 3, 2026 22:38

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

Closes the request-field gaps left after the metric, persona, review, and report
work.

UpdateAgentRequest gains attributes, customer_agent_id, language, tags, and
workflows. CreateAgentRequest already modeled all five, so until now a field
could be set when the agent was created and never changed again.

The agent merge patch writes only supplied columns and normalizes an explicit
null to an empty value, so null is how a caller clears one of these. language,
attributes, workflows, and tags therefore take explicit_option;
customer_agent_id does not, because the API documents it as non-nullable and
rejects null. The six fields the struct already declared have the same clearing
problem and are left for COVAL-5829 rather than widening this change.

Test sets and run templates gain tags. Uploaded conversations gain tags on
submit and metadata on patch. The API patches conversation audio and metadata
separately so a rejected metadata key cannot leave audio half-attached, and
accepts exactly one target per call, so the command enforces that locally rather
than relaying a 400.

Deliberately unmodeled: agent_id, persona_id, and test_set_id on the run-template
requests. The published spec documents them, but the served model takes the
plural arrays the CLI already sends and forbids extra fields, so modeling the
documented names would break every call. Spec drift is COVAL-5825.
@callumreid
callumreid force-pushed the callum/cli-remaining-request-fields branch from 239fd62 to 9430c33 Compare September 4, 2026 17:09
@callumreid
callumreid merged commit bc39536 into main Sep 4, 2026
7 checks passed
@callumreid
callumreid deleted the callum/cli-remaining-request-fields branch September 4, 2026 17:46
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