Skip to content

[COVAL-5822] Model the dropped review-project and report request fields - #125

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

[COVAL-5822] Model the dropped review-project and report request fields#125
callumreid merged 2 commits into
mainfrom
callum/cli-review-report-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 (identical content, so the second one to land drops that hunk).

Why

Nine review-project fields and five report fields were published and served but absent from the CLI's request structs, so input_json::finish dropped them and the call returned 200 having ignored them.

Review projects

Create gains project_rules, blind_labeling_shown_metric_ids, enforced_collaboration. Update gains those plus add_linked_simulation_ids, remove_linked_simulation_ids, metric_addition_completion_action.

The two membership deltas are the ones that actually cost something. Without them the CLI could only replace linked_simulation_ids wholesale, so adding one simulation to a project meant re-sending the entire set — and racing anyone else editing it. The API rejects a delta combined with the replacement, so --add-simulation-ids / --remove-simulation-ids are conflicts_with = "simulation_ids" and fail locally with a clear message.

Every review-project field is applied under an is not None guard in update_core.py, so none of them need null-versus-omitted handling.

Reports

Create gains simulation_output_ids, source_human_review_project_id. Update gains those plus view_config.

The report PATCH is different from the review-project one: api/v1/reports/update/service.py applies simulation_output_ids and source_human_review_project_id through model_fields_set, so an explicit null unpins the report. Both take explicit_option (Option<Option<T>>) so a deliberate unpin is not silently downgraded to "leave it alone".

view_config is a nested partial-update object (ReportViewConfigurationPatch) with extra="forbid" and its own validators, and it explicitly cannot be null. Modeling it as a typed Rust struct would duplicate validation the API already owns, so it stays a plain optional JSON value behind --view-config, like the existing --target-condition.

Verification

Nine new tests, including the explicit-null unpin, the "unset stays omitted" counterpart, and the delta/replacement conflict.

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 294/360 and reports exactly these 14 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 14 [[known_field_gap]] entries for POST/PATCH /review-projects and POST/PATCH /reports, 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: 41360ed7-57d6-4412-bd17-137013d9db27

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.

Review projects lost project_rules, blind_labeling_shown_metric_ids, and
enforced_collaboration on create, and additionally add_linked_simulation_ids,
remove_linked_simulation_ids, and metric_addition_completion_action on update.
The two membership deltas are the ones that cost something: without them the CLI
could only replace linked_simulation_ids wholesale, so there was no way to add or
remove one simulation without re-sending the whole set. The API rejects a delta
combined with the replacement, so the flags conflict with --simulation-ids.

Reports lost simulation_output_ids and source_human_review_project_id on create,
and additionally view_config on update.

The report PATCH applies simulation_output_ids and source_human_review_project_id
through model_fields_set, so an explicit null unpins the report; both take
explicit_option to keep that distinct from an omission. view_config is a nested
partial-update object the API validates and never accepts as null, so it stays a
plain optional JSON value behind --view-config.

Every review-project field is applied under an `is not None` guard, so none of
them need the null-versus-omitted treatment.

explicit_option moves from test_case.rs to common.rs. COVAL-5821 makes the same
move; the content is identical, so whichever lands second drops the hunk.
@callumreid
callumreid force-pushed the callum/cli-review-report-request-fields branch from c68e717 to ac3e4a1 Compare September 4, 2026 17:00
@callumreid
callumreid merged commit b957b8f into main Sep 4, 2026
7 checks passed
@callumreid
callumreid deleted the callum/cli-review-report-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