Skip to content

Formalize replace-label compliance model and fixture-backed conformance tests#44981

Open
pelikhan with Copilot wants to merge 14 commits into
mainfrom
copilot/formal-spec-replace-label-compliance
Open

Formalize replace-label compliance model and fixture-backed conformance tests#44981
pelikhan with Copilot wants to merge 14 commits into
mainfrom
copilot/formal-spec-replace-label-compliance

Conversation

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

This PR codifies the replace-label compliance fixtures as executable formal predicates and aligns the spec-facing compliance README with the generated Go test suite. It closes gaps between RL fixture semantics and in-repo conformance coverage by making the predicate/test mapping explicit.

  • Formal fixture execution for RL-001/002/003

    • Added fixture-backed runners in pkg/workflow/replace_label_formal_test.go for:
      • rl-001-glob-semantics.yaml
      • rl-002-allowlist-enforcement.yaml
      • rl-003-blocklist-ordering.yaml
    • Added fixture parsing guards (malformed YAML, empty scenarios).
  • Predicate-level conformance coverage (P1–P15 + edges)

    • Added/expanded focused formal tests for:
      • required fields and length bounds (label_to_remove, label_to_add, repo)
      • count gate exclusivity (count < max, default max=5 behavior checks)
      • label-set arithmetic (remove/add semantics, dedup, missing-remove behavior)
      • staged semantics, blocklist symmetry, required-label/title-prefix gates
      • alias resolution (item_number / issue_number / pr_number / pull_number)
      • cross-repo restriction and exact-glob edge behavior
      • hard-error predicate modeling for REST failure outcomes.
  • Spec-compliance documentation alignment

    • Updated specs/replace-label-compliance/README.md with:
      • formal model section
      • behavioral coverage map (predicate → test function)
      • generated test suite reference for in-process Go conformance.
func TestFormalGlobSemantics(t *testing.T) {
	runReplaceLabelFixture(t, "rl-001-glob-semantics.yaml")
}

Copilot AI and others added 5 commits July 11, 2026 16:09
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review July 11, 2026 16:32
Copilot AI review requested due to automatic review settings July 11, 2026 16:32
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update README for replace-label compliance specification Formalize replace-label compliance model and fixture-backed conformance tests Jul 11, 2026
Copilot AI requested a review from pelikhan July 11, 2026 16:35

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 formal compliance coverage and documentation for replace-label behavior.

Changes:

  • Loads YAML compliance fixtures into Go tests.
  • Adds predicate and edge-case tests.
  • Documents the formal model and test mapping.
Show a summary per file
File Description
pkg/workflow/replace_label_formal_test.go Adds fixture loading and formal tests.
specs/replace-label-compliance/README.md Documents predicates and coverage mapping.

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

Comment thread pkg/workflow/replace_label_formal_test.go Outdated
Comment thread pkg/workflow/replace_label_formal_test.go
Comment thread pkg/workflow/replace_label_formal_test.go Outdated
Comment thread pkg/workflow/replace_label_formal_test.go Outdated
Comment thread pkg/workflow/replace_label_formal_test.go Outdated
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks when done.

Unresolved review feedback to address:

Generated by 👨‍🍳 PR Sous Chef · 22.6 AIC · ⌖ 7.57 AIC · ⊞ 4.2K ·
Comment /souschef to run again

Copilot AI and others added 2 commits July 11, 2026 17:22
…view feedback

- formalMatchAnyPattern: replace path.Match with production-faithful regex
  (escapes brackets to literals, * spans any char) matching matchesSimpleGlob
- rl-001 fixture: update char-class scenario to expect deny, reflecting that
  production implementation escapes brackets rather than treating them as
  character classes
- replaceLabelExpected: add ErrorCode/*int and Reason/string fields decoded
  from fixture YAML
- formalEvaluateFixtureScenario: return error instead of bool so callers can
  distinguish blocked-pattern from allowlist denial
- runReplaceLabelFixture: switch on decision, fail on unknown values, assert
  error_code(-32003/-32002) ordering signal for deny scenarios
- formalResolveItemNumberAliases: stop at first present alias (even non-positive)
  matching production temporary_id.cjs precedence behaviour
- add formalRunReplaceLabel model + TestFormalStagedMode_NoWriteAPI to assert
  write API is not called in staged mode

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
… comment

- Add source citation (escapeRegexChars in glob_pattern_helpers.cjs) to the
  escaped character list in formalSimpleGlobToRegex
- Clarify formalResolveItemNumberAliases inline comment: first present alias
  returns 0 for non-positive without falling through

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks when done.

Unresolved review feedback to address:...

All five review threads addressed in commits 9a66ac5 and f0b3dac:

  1. Glob matcher aligned with productionformalMatchAnyPattern now uses formalSimpleGlobToRegex, a Go port of glob_pattern_helpers.cjs:simpleGlobToRegex (pathMode=false): brackets are escaped to literals, * expands to .*, matching is case-insensitive. The RL-001 char-class scenario updated to expect deny (production escapes brackets; the character-class scenario was a false green).

  2. Blocklist ordering signal decodedreplaceLabelExpected now includes ErrorCode *int and Reason string decoded from fixture YAML. formalEvaluateFixtureScenario returns an error instead of bool. The fixture runner asserts error_code -32003 → error contains "blocked pattern" and -32002 → error contains "allowed list", letting TestFormalBlocklistOrdering verify ordering rather than just the binary allow/deny.

  3. Unknown decision values fail the subtestrunReplaceLabelFixture now uses a switch on decision and calls t.Fatalf for any value that is not "allow" or "deny".

  4. Staged mode write-API assertion — Added formalRunReplaceLabel(staged bool, onWrite func()) model function and TestFormalStagedMode_NoWriteAPI which asserts the onWrite counter stays at zero when staged=true. If the staged-mode branch were removed, the counter would reach 1 and the test would fail.

  5. Alias resolution precedenceformalResolveItemNumberAliases now stops at the first present alias key even when the value is non-positive (returns 0 without falling through), matching temporary_id.cjs behaviour.

Copilot AI requested a review from gh-aw-bot July 11, 2026 17:25
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef
@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks when done.

Unresolved review feedback to address:

Run: https://github.com/github/gh-aw/actions/runs/29161645125

Generated by 👨‍🍳 PR Sous Chef · 6.92 AIC · ⌖ 7.23 AIC · ⊞ 4.2K ·
Comment /souschef to run again

…Mode

The direct struct construction in TestFormalStagedMode (lines 571-573) was
flagged in review as not exercising the handler. The new TestFormalStagedMode_NoWriteAPI
already asserts these properties via formalRunReplaceLabel, making the direct
construction redundant. Remove it so TestFormalStagedMode focuses on config
parsing and the write-API guard is tested by the dedicated test.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address any unresolved review feedback, make sure the branch is up to date with the base branch, and rerun checks.

Generated by 👨‍🍳 PR Sous Chef · 9.19 AIC · ⌖ 8.12 AIC · ⊞ 7.5K ·
Comment /souschef to run again

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address any unresolved review feedback, make sure the branch is up to date with the base branch, and rerun checks.

...

Branch is already up to date with main (merged in commit 40e8815). All 5 review threads remain resolved. CI run 29174674348 is currently in progress against HEAD. Nothing further is actionable for the agent.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef

@copilot please run the pr-finisher skill, address unresolved review comments, make sure the branch is up to date with the base branch, and rerun checks once complete.

Generated by 👨‍🍳 PR Sous Chef · 12.5 AIC · ⌖ 6.52 AIC · ⊞ 7.5K ·
Comment /souschef to run again

…eplace-label-compliance

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-sous-chef

@copilot please run the pr-finisher skill, address unresolved review comments, make sure the branch is up to date with the base branch, and rerun checks once complete....

Branch merged up to date with main (commit 87da5a4, includes firewall bump v0.27.30). All 5 review threads remain resolved. Local make fmt and make test-unit pass. CI will need a human re-trigger against the new HEAD.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category test
Risk 🟢 low
Score 47/100 (impact:20 + urgency:15 + quality:12)
Action ⚡ fast_track

Rationale: Non-draft, test-only additions formalizing replace-label compliance fixtures. Low risk, good description, no behavior changes. CI unknown — human review/approval likely quick.

Triage run §29183606049

Generated by 🔧 PR Triage Agent · 171.6 AIC · ⌖ 5.63 AIC · ⊞ 5.6K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef
@copilot please run the pr-finisher skill, confirm whether any unresolved review feedback remains, and if so address it and rerun checks once the branch is up to date. Run: https://github.com/github/gh-aw/actions/runs/29183870267

Generated by 👨‍🍳 PR Sous Chef · 9.89 AIC · ⌖ 6.64 AIC · ⊞ 6K ·
Comment /souschef to run again

…eplace-label-compliance

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-sous-chef
@copilot please run the pr-finisher skill, confirm whether any unresolved review feedback remains, and if so address it and rerun checks once the branch is up to date. Run: https://gi...

Branch merged up to date with main (commit 8210608, includes safe-output fixture files and DICTATION update). All 5 review threads remain resolved. Local make fmt, make lint, make test-unit, and make agent-report-progress all pass. CI needs a human re-trigger against the new HEAD before merge.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category test
Risk 🟢 Low
Score 65/100 (impact: 28, urgency: 20, quality: 17)
Action fast_track

CI fully green ✅. Formalizes replace-label compliance model with fixture-backed tests. +418/-21. Low risk, high quality — fast track.

Generated by 🔧 PR Triage Agent · 48.3 AIC · ⌖ 7.99 AIC · ⊞ 5.6K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review feedback if any, and rerun checks once the branch is up to date.

Generated by 👨‍🍳 PR Sous Chef · 14.1 AIC · ⌖ 8.64 AIC · ⊞ 7.5K ·
Comment /souschef to run again

…eplace-label-compliance

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address unresolved review feedback if any, and rerun checks once the branch is up to date.

...

Branch merged up to date with main (commit e1659c4, includes docs homepage updates). All 5 review threads remain resolved. Local make fmt, make test-unit, and make agent-report-progress all pass. CI needs a human re-trigger against the new HEAD before merge.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address any unresolved review feedback, and rerun checks once the branch is up to date.

Run: https://github.com/github/gh-aw/actions/runs/29196572530

Generated by 👨‍🍳 PR Sous Chef · 8.11 AIC · ⌖ 5.41 AIC · ⊞ 4.2K ·
Comment /souschef to run again

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address any unresolved review feedback, and rerun checks once the branch is up to date.

Run: https://github.com/github/gh-aw/actions/runs/29196572530...

Branch is already up to date with main (HEAD e1659c4). All 5 review threads remain resolved. No new review feedback to address. CI needs a human re-trigger before merge.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address any unresolved review feedback, and rerun checks once the branch is up to date.

Run: https://github.com/github/gh-aw/actions/runs/29200137487

Generated by 👨‍🍳 PR Sous Chef · 8.57 AIC · ⌖ 7.74 AIC · ⊞ 7.5K ·
Comment /souschef to run again

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address any unresolved review feedback, and rerun checks once the branch is up to date.

Run: https://github.com/github/gh-aw/actions/runs/29200137487...

Branch is already up to date with main (HEAD e1659c4). All 5 review threads remain resolved. No new review feedback to address. CI needs a human re-trigger before merge.

Sign up for free to 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] replace-label-compliance/README.md — Formal model & test suite — 2026-07-11

4 participants