Skip to content

Add formal conformance suite for AWF config source contract and DriftRecord invariants - #48503

Closed
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/formal-spec-awf-config-sources-spec
Closed

Add formal conformance suite for AWF config source contract and DriftRecord invariants#48503
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/formal-spec-awf-config-sources-spec

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This issue formalizes the AWF config source-of-truth contract in specs/awf-config-sources-spec.md and requires executable coverage for CR-01 through CR-06a plus DriftRecord schema constraints. This PR adds a dedicated formal test suite that encodes those predicates as deterministic checks.

  • Formal coverage for CR-01..CR-06a

    • Added /pkg/awfconfig/awfconfig_formal_test.go with conformance tests for:
      • dual-source consultation (spec + schema)
      • drift trigger conditions (schema change, schedule, explicit request)
      • corrective PR requirements for actionable drift categories
      • SLA window computation in business days
      • escalation requirement and owner assignment
  • DriftRecord schema invariants

    • Added typed DriftRecord test model and predicate checks for:
      • required fields non-empty
      • category enum exhaustiveness (missing_in_ghaw|missing_in_schema|spec_mismatch)
      • property path dot-notation validity
      • serialized record rejecting additional properties
  • Safeguard and coverage predicates

    • Added explicit checks for degraded-mode behavior when canonical sources are unavailable.
    • Added schema-property coverage predicate asserting all schema properties are represented in gh-aw references.
type DriftRecord struct {
    PropertyPath    string `json:"property_path"`
    DriftCategory   string `json:"drift_category"`
    SuggestedAction string `json:"suggested_action"`
    DetectedAt      string `json:"detected_at"`
}

func TestDriftRecordNoExtraFields(t *testing.T) {
    extra := []byte(`{"property_path":"apiProxy.anthropicAutoCache","drift_category":"missing_in_ghaw","suggested_action":"Add coverage","detected_at":"2026-07-27T16:00:00Z","extra":true}`)
    assert.False(t, hasNoAdditionalProperties(extra))
}

Copilot AI and others added 2 commits July 28, 2026 03:25
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add formal model and test suite for AWF config sources specification Add formal conformance suite for AWF config source contract and DriftRecord invariants Jul 28, 2026
Copilot AI requested a review from pelikhan July 28, 2026 03:35
@pelikhan
pelikhan marked this pull request as ready for review July 28, 2026 03:38
Copilot AI review requested due to automatic review settings July 28, 2026 03:38
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

Copilot AI 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 a test-only AWF configuration conformance model covering drift records, SLA handling, escalation, safeguards, and schema coverage.

Changes:

  • Adds formal predicate tests under pkg/awfconfig.
  • Updates generated model-cost metadata for the Copilot smoke workflow.
Show a summary per file
File Description
pkg/awfconfig/awfconfig_formal_test.go Adds AWF contract models and conformance tests.
.github/workflows/smoke-copilot-auto.lock.yml Adds generated pricing metadata for the auto model.

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: 6
  • Review effort level: Medium

Comment on lines +32 to +35
func dualSourceConsultation(consultedSources []string) bool {
hasSpec := slices.Contains(consultedSources, "docs/awf-config-spec.md")
hasSchema := slices.Contains(consultedSources, "docs/awf-config.schema.json")
return hasSpec && hasSchema
Comment on lines +84 to +88
func requiresEscalationIssue(detectedAt, now time.Time) bool {
slaDeadline := addBusinessDays(detectedAt, 5)
escalationDeadline := slaDeadline.AddDate(0, 0, 1)
return now.After(escalationDeadline)
}
Comment on lines +23 to +25
type EscalationIssue struct {
Owner string
}
PropertyPath: "apiProxy.anthropicAutoCache",
DriftCategory: "missing_in_ghaw",
SuggestedAction: "Add coverage",
DetectedAt: "2026-07-27T16:00:00Z",
Comment on lines +232 to +234
schemaProperties := []string{"apiProxy.anthropicAutoCache", "container.dockerHostPathPrefix"}
completeRefs := []string{"apiProxy.anthropicAutoCache", "container.dockerHostPathPrefix"}
incompleteRefs := []string{"container.dockerHostPathPrefix"}
Comment on lines +27 to +30
type SafeguardResult struct {
DestructiveActionsSkipped bool
DegradedMode bool
}
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.

[formal-spec] awf-config-sources-spec.md — Formal model & test suite — 2026-07-27

3 participants