Skip to content

feat(enterprise): compile issue scoring requests - #532

Merged
seonghobae merged 13 commits into
mainfrom
feat/enterprise-issue-scoring-request
Aug 4, 2026
Merged

feat(enterprise): compile issue scoring requests#532
seonghobae merged 13 commits into
mainfrom
feat/enterprise-issue-scoring-request

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

Advances issue #404 with the smallest incremental slice on top of the accepted enterprise evidence contracts merged in #529.

  • compiles AtomicIssueRecord into the existing shared criterion-level ScoringRequest boundary;
  • preserves exact issue, source revision, evidence span, counterevidence, assertion-kind, stakeholder-perspective, intervention, assessment, rubric, task-revision, criterion, and engine-policy provenance;
  • returns shared EvidenceReference values for issue and stakeholder spans without creating a parallel observation/result schema;
  • rejects cross-issue replay, unbound perspective evidence, duplicate evidence multiplication, reserved provenance overrides, and sensitive raw-text metadata;
  • adds deterministic input-order invariance and shared-contract delegation coverage.

This slice performs no sentiment, likelihood, calibration, ranking, utility, value-of-information, causal-effect, or queue-routing arithmetic. Existing ScoringEngine, ScoreObservation, and ScoringResult remain authoritative.

Refs #404

Validation target

  • 100% statement and branch coverage for the added request module
  • complete public docstrings
  • authoritative changelog parity
  • exact-head CI, security, SAST, packaging, Rust, GPU parity, and final review before merge

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d3d073b-170c-41d2-842a-f334eadd8444

📥 Commits

Reviewing files that changed from the base of the PR and between d78e885 and eccb0ce.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • docs/changelog.d/enterprise-issue-scoring-request.md
  • docs/enterprise_issue_evidence_contracts.md
  • python/fast_mlsirm/scoring/enterprise_issue/__init__.py
  • python/fast_mlsirm/scoring/enterprise_issue/request.py
  • tests/test_scoring_enterprise_issue_request.py

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

@jules Validate and harden the exact current draft head. Run Ruff formatting/lint, focused tests for tests/test_scoring_enterprise_issue_request.py, 100% statement and branch coverage for python/fast_mlsirm/scoring/enterprise_issue/request.py, public docstring checks, typing/import checks, and python scripts/render_changelog_fragments.py --update CHANGELOG.md. Fix all objective failures directly on this branch. Preserve the accepted #529 contracts and the existing shared ScoringRequest/EvidenceReference/ScoreObservation/ScoringResult boundaries. Do not add sentiment, likelihood, calibration, ranking, utility, causal-effect, or queue-routing arithmetic. Report exact commands and results.

Copy link
Copy Markdown
Contributor Author

@jules One concrete test-helper bug to include in the hardening pass: _request(object()) currently constructs default perspectives/interventions before the compiler can reject the non-AtomicIssueRecord, causing attribute access instead of invalid_atomic_issue. Make those defaults conditional on an accepted issue (or pass empty defaults for invalid test inputs) so the public fail-closed path is exercised. Keep the production API unchanged.

Copy link
Copy Markdown
Contributor Author

@jules Exact-head CI completed with only two objective failures: (1) tests/test_changelog_fragment_contract.py::test_repository_changelog_is_rendered_from_current_fragments; run python scripts/render_changelog_fragments.py --update CHANGELOG.md. (2) tests/test_scoring_enterprise_issue_request.py::test_issue_type_is_validated_before_attribute_access; fix the _request test helper so invalid issue objects use empty default perspectives/interventions and reach the production invalid_atomic_issue validation. The remaining 2,725 tests passed; SAST, all Security Scan jobs, package/release acceptance, GPU smoke, fuzz, and Rust passed. Apply both focused fixes directly, run Ruff and the focused test/100% branch coverage target, and commit to this branch.

Copy link
Copy Markdown
Contributor Author

@jules The invalid-issue helper fix is now present at exact head 254a57a437d1d810d6c763229ec7ce39da840f30. One objective CI failure remains expected until the managed changelog block is regenerated. Run exactly python scripts/render_changelog_fragments.py --update CHANGELOG.md, verify python scripts/render_changelog_fragments.py --check CHANGELOG.md and pytest -q tests/test_changelog_fragment_contract.py, then commit only the rendered CHANGELOG.md update to this branch. Do not alter the accepted contracts or statistical claims.

Copy link
Copy Markdown
Contributor Author

@jules Exact head 845fcbfc2673ef2d14db0162ba2b009b248cc28a adds a further authoritative fragment bullet after the prior render, so CHANGELOG.md is stale again. Re-run python scripts/render_changelog_fragments.py --update CHANGELOG.md, verify the renderer check and focused changelog contract test, and commit only the regenerated CHANGELOG.md. Preserve the current contract/code surface.

@seonghobae
seonghobae marked this pull request as ready for review August 4, 2026 22:14

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Review the exact current head eccb0ce47ce3f0b8a571abadcaeddca75c472d1b. The test-helper fail-closed path and authoritative changelog parity are now fixed. Report only findings applicable to this head, with particular attention to provenance binding, duplicate evidence prevention, shared scoring-contract delegation, sensitive metadata handling, and conservative interpretation boundaries.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

expected='eccb0ce47ce3f0b8a571abadcaeddca75c472d1b'
actual="$(git rev-parse HEAD)"
printf 'HEAD=%s\nEXPECTED=%s\n' "$actual" "$expected"
git status --short
printf '\n--- changed files against PR base ---\n'
git diff --name-status "$(git merge-base HEAD origin/main)" HEAD || true
printf '\n--- commit summary ---\n'
git show --no-ext-diff --format=fuller --stat --summary HEAD
printf '\n--- relevant file locations ---\n'
fd -a 'request\.py|test_scoring_enterprise_issue_request\.py|scoring.*\.py' . | sed -n '1,160p'
printf '\n--- request module outline ---\n'
ast-grep outline python/fast_mlsirm/scoring/enterprise_issue/request.py --items all --view expanded || true
printf '\n--- focused test module outline ---\n'
ast-grep outline tests/test_scoring_enterprise_issue_request.py --items all --view expanded || true
printf '\n--- relevant diff ---\n'
git diff --no-ext-diff "$(git merge-base HEAD origin/main)" HEAD -- \
  python/fast_mlsirm/scoring/enterprise_issue/request.py \
  tests/test_scoring_enterprise_issue_request.py \
  | sed -n '1,260p'

Length of output: 18138


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- request compiler, remaining implementation ---'
sed -n '220,340p' python/fast_mlsirm/scoring/enterprise_issue/request.py

printf '%s\n' '--- enterprise contract model outline ---'
ast-grep outline python/fast_mlsirm/scoring/enterprise_issue/contracts.py --items all --view expanded
printf '%s\n' '--- enterprise contract source: records and evidence methods ---'
rg -n -A28 -B8 \
  '^(class (AtomicIssueRecord|StakeholderPerspective|CandidateIntervention|EvidenceSpan|CounterevidenceRecord|EnterpriseSourceRecord)\b|def evidence_references\b|def to_evidence_reference\b|MAX_ENTERPRISE_)' \
  python/fast_mlsirm/scoring/enterprise_issue/contracts.py

printf '%s\n' '--- shared request authorization boundary ---'
ast-grep outline python/fast_mlsirm/scoring/authorization.py --items all --view expanded
rg -n -A100 -B8 '^def build_scoring_request\b' python/fast_mlsirm/scoring/authorization.py

printf '%s\n' '--- metadata safety and shared execution request definition ---'
rg -n -A100 -B8 '^(def (freeze_metadata|bounded_values)\b|class ScoringRequest\b|class EvidenceReference\b)' \
  python/fast_mlsirm/scoring/_contract_safety.py \
  python/fast_mlsirm/scoring/execution.py \
  python/fast_mlsirm/scoring/_validation.py

printf '%s\n' '--- focused request tests ---'
cat -n tests/test_scoring_enterprise_issue_request.py

printf '%s\n' '--- evidence-contract documentation diff at HEAD ---'
git diff --no-ext-diff "$(git merge-base HEAD origin/main)" HEAD -- docs/enterprise_issue_evidence_contracts.md

Length of output: 87227


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- evidence span validation and conversion ---'
sed -n '246,373p' python/fast_mlsirm/scoring/enterprise_issue/contracts.py

printf '%s\n' '--- atomic issue validation and reference collection ---'
sed -n '444,570p' python/fast_mlsirm/scoring/enterprise_issue/contracts.py

printf '%s\n' '--- perspective and intervention validation ---'
sed -n '571,736p' python/fast_mlsirm/scoring/enterprise_issue/contracts.py

printf '%s\n' '--- enterprise sensitive-metadata usage and definitions ---'
rg -n -i -A25 -B12 \
  '(sensitive_metadata|source_text|raw.*text|metadata.*sensitive|sensitive.*field)' \
  python/fast_mlsirm/scoring tests/test_scoring_enterprise_issue_contracts.py \
  tests/test_scoring_contract_sensitive_metadata.py

printf '%s\n' '--- package export diff ---'
git diff --no-ext-diff "$(git merge-base HEAD origin/main)" HEAD -- \
  python/fast_mlsirm/scoring/enterprise_issue/__init__.py \
  docs/changelog.d/enterprise-issue-scoring-request.md \
  CHANGELOG.md

printf '%s\n' '--- complete changed implementation diff ---'
git diff --no-ext-diff "$(git merge-base HEAD origin/main)" HEAD -- \
  python/fast_mlsirm/scoring/enterprise_issue \
  tests/test_scoring_enterprise_issue_request.py \
  | sed -n '1,520p'

printf '%s\n' '--- direct execution/result construction or score arithmetic in new request module ---'
rg -n -i \
  '(ScoringEngine|ScoreObservation|ScoringResult|score\s*\(|sentiment|likelihood|calibrat|rank|utility|value.of.information|causal|queue)' \
  python/fast_mlsirm/scoring/enterprise_issue/request.py \
  docs/enterprise_issue_evidence_contracts.md

Length of output: 74835


@seonghobae I reviewed exact head eccb0ce47ce3f0b8a571abadcaeddca75c472d1b.

I found no findings that apply to this head.

The compiler validates the AtomicIssueRecord before attribute access. It binds perspective and intervention records to the exact issue content revision. It also requires each perspective span to reference a source revision declared by the issue.

The compiler rejects duplicate compiled EvidenceReference values. It preserves counterevidence and stakeholder judgment roles as shared evidence roles.

The compiler delegates construction to the authoritative shared build_scoring_request() boundary. It fixes ObservationGranularity.CRITERION_LEVEL. It does not create a parallel request, observation, result, or engine boundary.

The metadata path rejects reserved enterprise provenance fields. The shared metadata safety layer rejects sensitive content fields recursively and case-insensitively. The compiler performs no scoring, calibration, ranking, utility, causal-effect, or queue-routing arithmetic.

I verified the source and focused tests statically. I did not execute tests or coverage because the review sandbox permits source inspection only.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@jules Perform a read-only final review of exact head eccb0ce47ce3f0b8a571abadcaeddca75c472d1b after CI settles. Check shared-contract/ABI preservation, deterministic provenance identity, duplicate and cross-revision rejection, metadata redaction, bounds/resource safety, public exports/docstrings, changelog parity, and interpretation claims. Specifically verify whether the imported MAX_ENTERPRISE_ISSUE_EVIDENCE in request.py represents a missing aggregate bound or is merely unused; do not invent a new limit. Modify the branch only for an objective defect, then report exact validation and a merge/no-merge verdict.

@seonghobae
seonghobae merged commit 39f4883 into main Aug 4, 2026
33 checks passed
@seonghobae
seonghobae deleted the feat/enterprise-issue-scoring-request branch August 4, 2026 22:23
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