Skip to content

feat(perl): consumer-side contract freeze — accept frozen fields + Test2::V1 (Campaign 31 step 2, #1379) - #1450

Merged
EffortlessSteven merged 1 commit into
mainfrom
perl-contract-freeze-consumer
Jun 26, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
perl-contract-freeze-consumer

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Companion to perl-lsp-swarm#3104 (producer-side contract freeze, merged). The producer now emits changed_observable/missing_discriminator on changes and observed_sink/expected_expression on oracles, plus the Test2::V1 framework wire name. This PR makes ripr's consumer accept them.

Live break fixed

TestFramework had no Test2::V1 variant. serde rejects unknown enum variants by default, so a real producer packet with "framework": "Test2::V1" would fail closed on deserialization. Added the variant + as_str + supports_strict_actionability.

New fields (Option<>, #[serde(default)] for backward compat)

  • ChangeFact.changed_observable, ChangeFact.missing_discriminator
  • OracleFact.observed_sink, OracleFact.expected_expression

#[serde(default)] keeps legacy packets (Test2::V0/Suite/Test::More fixtures) parsing unchanged. H2 classification semantics can now consume observed_sink for changed-sink alignment — the field that distinguishes owner-target identity from changed-sink observation (the false-exposed family; see docs/LEARNINGS.md).

Consumer-parity tests (3)

  • consumer_accepts_packet_with_frozen_contract_fields — reads all 4 new fields
  • consumer_accepts_test2_v1_framework_wire_name — V1 deserializes + queryable
  • consumer_still_parses_legacy_packets_without_frozen_fields — backward compat

55 perl tests pass (52 prior + 3 new); fmt clean.

Campaign 31 (#1379). Step 2 (freeze one interoperable schema) now complete on both repos. Unblocks H2 classification semantics + steps 3–9.

…st2::V1 (Campaign 31 step 2, #1379)

Companion to perl-lsp-swarm#3104 (producer-side contract freeze, merged).
The producer now emits changed_observable/missing_discriminator on changes
and observed_sink/expected_expression on oracles, plus the Test2::V1
framework wire name. This PR makes ripr's consumer ACCEPT them.

Live break fixed:
- TestFramework had no Test2::V1 variant. serde rejects unknown enum
  variants by default, so a real producer packet with
  "framework": "Test2::V1" would FAIL CLOSED on deserialization. Added the
  variant + as_str + supports_strict_actionability (V1 supports alpha
  actionability per the goal).

New fields (Option<>, #[serde(default)] for backward compat):
- ChangeFact.changed_observable, ChangeFact.missing_discriminator
- OracleFact.observed_sink, OracleFact.expected_expression
#[serde(default)] means legacy packets without the fields still parse
(Test2::V0/Suite/Test::More fixtures unchanged). H2 classification
semantics can now consume observed_sink for changed-sink alignment — the
field that distinguishes owner-target identity from changed-sink
observation (the false-exposed family, see docs/LEARNINGS.md).

3 consumer-parity tests:
- consumer_accepts_packet_with_frozen_contract_fields — reads all 4 new fields
- consumer_accepts_test2_v1_framework_wire_name — V1 deserializes + queryable
- consumer_still_parses_legacy_packets_without_frozen_fields — backward compat

55 perl tests pass (52 prior + 3 new); fmt clean.

Campaign 31 (#1379). Step 2 (freeze one interoperable schema) now complete
on both repos. Unblocks H2 classification semantics + steps 3-9.
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@EffortlessSteven, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 25 minutes and 57 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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 credits.

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6aa4dc57-e9a6-4164-97d1-7d7499845c65

📥 Commits

Reviewing files that changed from the base of the PR and between b5c64af and 2121526.

📒 Files selected for processing (2)
  • crates/ripr/src/analysis/language/perl/mod.rs
  • crates/ripr/src/analysis/language/perl/tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perl-contract-freeze-consumer

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.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ripr/src/analysis/language/perl/mod.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@EffortlessSteven
EffortlessSteven merged commit 6222805 into main Jun 26, 2026
20 of 22 checks passed
@EffortlessSteven
EffortlessSteven deleted the perl-contract-freeze-consumer branch June 26, 2026 21:36
EffortlessSteven added a commit that referenced this pull request Jun 27, 2026
…gnment (Campaign 31, #1379) (#1451)

* feat(perl): H2 classification — already-observed outcome via sink alignment (Campaign 31, #1379)

Delivers maintainer end-state outcome #2 ("already-observed evidence
explaining why no test is needed"), now unblocked by observed_sink from the
contract freeze (#1450/#3104).

Sink alignment (the discrimination-vs-coverage distinction made concrete):
a change classifies Exposed (already-observed) when a DirectOwnerCall
relation links a strong-exact oracle whose observed_sink aligns to the
change's changed_observable. Owner-target identity alone is NOT observation
(the recurring false-exposed family) — the oracle must observe the SPECIFIC
changed sink.

sink_aligned_observation() returns Some only when ALL hold:
- relation is DirectOwnerCall + Reachable (advisory relations never prove it)
- oracle is strong-exact targeting the changed owner
- oracle.observed_sink present + non-empty
- change.changed_observable present + non-empty
- observed_sink == changed_observable (exact), or normalized via `return <x>`
  aliasing. Token-substring coincidence (buffer vs buffered_stream) fails
  closed to WeaklyExposed. Any uncertainty returns None.

When Exposed (already-observed), the Finding:
- class = Exposed
- emits perl_already_discriminated: <test> observes changed sink `<sink>` via <shape>
- SUPPRESSES repair-gap fields (no perl_suggested_test_location, no canonical
  gap, no missing discriminator) — telling a maintainer to ADD a test when one
  already discriminates would be the cardinal sin
- recommended_next_step = "No test change needed..."

5 adversarial tests:
- h2_sink_aligned_oracle_classifies_exposed_and_suppresses_repair_gap
- h2_non_aligned_sink_stays_weakly_exposed (false-exposed guard)
- h2_advisory_relation_with_matching_sink_does_not_promote (relation-kind gate)
- h2_token_substring_coincidence_does_not_align (buffer vs buffered_stream)
- h2_return_prefix_aliasing_aligns (legitimate `return $x` normalization)

60 perl tests pass (55 prior + 5 new); fmt clean; clippy clean on H2 code.

Note: perl_gap_record_for currently accepts only WeaklyExposed, so an Exposed
finding does not yet produce a repair packet (correct — it needs no repair).
Wiring the projection's "observed" result path lands with the step-9
two-binary three-outcome proof. Public readiness stays off.

Campaign 31 (#1379). Prerequisite for step 9 (actionable/observed/limited).

* fix(perl): replace banned term 'proven' in H2 comments (static-language gate)

check-static-language bans 'proven' in all tracked prose (incl. comments) —
AGENTS.md: do not claim proven. Replaced 4 standalone 'proven' with
'established' in H2 classification comments. 'provenance' (different word)
is unaffected. Caught by the policy_checker_facade test in CI.

* fix(perl): remove .expect() in H2 evidence path (no-panic-family gate)

check-no-panic-family bans .expect()/.unwrap()/panic! in production code.
The H2 already-observed evidence path used .expect() on the
sink_aligned_evidence Option. Restructured to `if is_already_observed && let
Some(aligned)` — the invariant (Exposed implies Some) is now enforced by the
pattern, not by a panic. 60 tests still pass.

* fix(perl): replace banned term 'coverage' in H2 comments (static-language gate)

check-static-language bans the standalone word 'coverage' in tracked prose.
Three H2 comments used 'discrimination-vs-coverage' (the AGENTS.md concept
name) — replaced with 'discrimination distinction' to keep the meaning while
avoiding the banned token. 60 tests pass; fmt clean.
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