Skip to content

Add fixture-driven formal conformance tests for intent attribution compliance - #49594

Merged
pelikhan merged 2 commits into
mainfrom
copilot/formal-spec-intent-attribution-compliance
Aug 1, 2026
Merged

Add fixture-driven formal conformance tests for intent attribution compliance#49594
pelikhan merged 2 commits into
mainfrom
copilot/formal-spec-intent-attribution-compliance

Conversation

CopilotAI commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

This adds the missing formal fixture-level conformance coverage for specs/intent-attribution-compliance/README.md. The new suite binds the three normative YAML fixtures to the real pkg/intent.Resolver and pkg/intent.PolicyCompiler, covering attribution precedence, ambiguous-root handling, and fail-closed governance.

  • Formal fixture suite

    • Adds pkg/intent/compliance_fixtures_formal_test.go
    • Loads:
      • explicit-intent-wins.yaml
      • ambiguous-root-closing-issues.yaml
      • unlinked-pr-fail-closed.yaml
    • Exercises the actual resolver/compiler implementations rather than stubs
  • Behavior covered

    • explicit intent wins over linked issues and labels
    • multiple closing issues resolve to status=ambiguous, source=closing_issue
    • no intent sources resolves to status=unlinked, source=none
    • ambiguous and unlinked attributions compile to the safest policy tuple
    • mapped explicit intent is not forced into fail-closed policy
    • repeated resolution/compilation is deterministic
    • each fixture resolves to exactly one attribution source
    • edge cases:
      • closing-issue order does not affect ambiguous results
      • empty label slice remains unlinked
      • explicit intent still overrides a single closing issue
  • Spec README formalization

    • Expands specs/intent-attribution-compliance/README.md with:
      • formal guard model
      • predicate/invariant definitions (F1F7)
      • behavioral coverage map
      • generated test suite reference
      • direct usage for the fixture-backed tests
fixture:=loadIntentComplianceFixture(t, "ambiguous-root-closing-issues.yaml")
rec:=matchingResolver().ResolvePullRequest(buildFixturePullRequest(fixture))
policy:=fixturePolicyCompiler(t).Compile(rec, intent.RepositoryContext{})
// ambiguous fixture => fail-closed policyassert.Equal(t, "ambiguous", string(rec.Status))
assert.Equal(t, "closing_issue", string(rec.Source))
assert.Equal(t, "propose_only", policy.Autonomy)
assert.Equal(t, "none", policy.WriteScope)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title [WIP] Add formal model and test suite for intent attribution complianceAdd fixture-driven formal conformance tests for intent attribution complianceAug 1, 2026
CopilotAI requested a review from pelikhanAugust 1, 2026 16:09
@github-actions

Copy link
Copy Markdown
Contributor

Looks good! 🎯 This PR adds the missing fixture-driven formal conformance tests for intent attribution compliance, exactly as specified in issue #49593. The implementation:

✅ Binds real implementations — exercises actual pkg/intent.Resolver and pkg/intent.PolicyCompiler against three normative YAML fixtures
✅ Comprehensive coverage — tests explicit-intent precedence, ambiguous-root handling, fail-closed governance, and edge cases
✅ Spec formalization — expands the spec README with formal guard model, predicate/invariant definitions, and behavioral coverage map
✅ Well-documented — clear code sample and bulleted behavior coverage in the PR body
✅ Focused & clean — two files, 402 lines of test and spec additions, zero deletions

This is ready for review. The fixture-driven approach mirrors the specification's intent and will provide strong conformance guarantees for the intent attribution system.

Generated by ✅ Contribution Check · auto · 48.4 AIC · ⌖ 16.6 AIC · ⊞ 8.7K ·

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: test
  • Risk: low
  • Priority: low
  • Score: 30/100 (Impact15/Urgency5/Quality10)
  • Recommended action:batch_review

Draft; adds formal fixture conformance tests only, no production code changes.

Generated by 🔧 PR Triage Agent · auto · 73.4 AIC · ⌖ 10.1 AIC · ⊞ 8K ·

@pelikhan
pelikhan marked this pull request as ready for review August 1, 2026 19:30
CopilotAI review requested due to automatic review settings August 1, 2026 19:30
@pelikhan
pelikhan merged commit 97d204d into mainAug 1, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/formal-spec-intent-attribution-compliance branch August 1, 2026 19:30

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds fixture-driven conformance tests for intent attribution and fail-closed policy behavior.

Changes:

  • Adds formal resolver/compiler tests using three YAML fixtures.
  • Documents formal invariants and their test coverage.
Show a summary per file
FileDescription
pkg/intent/compliance_fixtures_formal_test.goAdds fixture adapters, assertions, and conformance tests.
specs/intent-attribution-compliance/README.mdDefines the formal model, invariants, coverage map, and usage.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment on lines +77 to +78
F5_MappedStatusPermitsRelaxedPolicy(a) ≜
Resolve(a).status = mapped ⇒ Compile(Resolve(a)) ≠ safest_policy
Comment on lines +80 to +81
F6_PolicyDeterminism(a) ≜
Resolve(a) = Resolve(a) ∧ Compile(Resolve(a)) = Compile(Resolve(a))
Comment on lines +231 to +235
pr.ExplicitIntent = &intent.IntentRecord{
Status: intent.AttributionMapped,
Source: intent.AttributionSource(fixture.Input.Artifact.ExplicitIntent.Source),
Rule: "fixture_explicit_intent",
}
Comment on lines +264 to +265
Autonomy: fixture.Expected.Policy.Autonomy,
WriteScope: fixture.Expected.Policy.WriteScope,
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.3

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[formal-spec] intent-attribution-compliance/README.md — Formal model & test suite — 2026-08-01

3 participants

@pelikhan