Skip to content

Expand lifecycle tests for identity, validation, and merge behavior - #78940

Merged
pelikhan merged 4 commits into
mainfrom
copilot/testify-expert-improve-test-quality
Nov 18, 2026
Merged

pelikhan merged 4 commits into
mainfrom
copilot/testify-expert-improve-test-quality

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Lifecycle tests lacked coverage for IsHuman and several Delivered, Observe, and Merge validation paths. The fallback tests also changed time in both cases, leaving HumanVerified unisolated.

  • Add coverage: Test human identification, invalid delivery URLs and run IDs, observation errors, delivery-evidence conflicts, invalid incoming records, and UTC-equivalent adoption times.
  • Clarify behavior checks: Table-drive identity-field changes and split fallback checks into a valid control and independent rejection cases.
_, err := Observe(fallback, Observation{
    State: "accepted", At: fallback.Delivery.At,
    ObservedAt: observedAt, AcceptanceKind: "fallback_delivery",
})
require.NoError(t, err)

gh-aw-bot and others added 3 commits November 18, 2026 05:29
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@gh-aw-bot gh-aw-bot changed the title [WIP] Improve test quality in lifecycle_test.go Expand lifecycle tests for identity, validation, and merge behavior Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Triage

  • Category: test
  • Risk: low
  • Total score: 41/100 (impact 12 + urgency 10 + quality 19)
  • Recommended action: auto_merge
  • CI: passing across build/test and impacted Go coverage.

This is a focused lifecycle test expansion that improves validation coverage without changing runtime behavior.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~5 AIC · ⌖ ~1 AIC · ⊞ 14.5K · ◷

@pelikhan
pelikhan marked this pull request as ready for review November 18, 2026 07:16
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 07:16
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #78940 · copilot · gpt56 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #78940 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Design Decision Gate: no ADR verified

Result: ADR enforcement applies (177 added lines under pkg/, threshold 100), but no architectural decision can be inferred from this PR, so no draft ADR was generated.

Evidence

  • Labels: no implementation label. Enforcement comes from the volume trigger only.
  • Diff: test code only. The single changed file is pkg/lifecycle/lifecycle_test.go. No production code changes.
  • ADR search: no ADR in the PR body or the branch. The linked issue [testify-expert] Improve Test Quality: pkg/lifecycle/lifecycle_test.go #78799 is a test-quality audit with no Context, Decision, Alternatives, or Consequences sections. No existing ADR in docs/adr/ covers pkg/lifecycle.
  • Conventions applied: the require vs assert and ErrorContains choices follow ADR 47252 (testify error-assertion conventions), so they do not introduce a new decision.

Next action (choose one)

  1. If this PR is meant to record a design decision, add an ADR at docs/adr/78940-<kebab-case-title>.md with Context, Decision, Alternatives Considered, and Consequences sections.
  2. If it is test-only and needs no ADR, a maintainer should confirm that test-only changes are out of scope for this gate.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-501ce51c-1365-4113-b78c-19280de07b1e","parents":[],"payload":{"id":"ldg-67d42931-e89f-4de4-8923-699a52073e22","operation":"append","value":{"finding_count":0,"head_sha":"6157f3b18582b10ae01ce5f3c4f033c0e58c64d7","outcome":"aligned"}},"sha":"sha256:61c4539107ba1e335a2c553f0c2c1c80fc07208c7e8ef60c9c653be2ba7060c3","timestamp":"2026-11-18T07:24:02.510Z","type":"ledger_append","version":1}
History

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.

🟢 Approval recommended

The review evidence describes focused lifecycle test coverage across validation, identity, merge conflicts, fallback behavior, and timezone comparisons without flagging outstanding concerns.

No open issues 🎉

What changed in this PR

Expands lifecycle test coverage for identity classification, delivery and observation validation, merge conflict handling, fallback adoption rules, and timezone-normalized comparisons.

Changes:

  • Adds table-driven tests for IsHuman, invalid delivery identities and URLs, and invalid observations.
  • Covers delivery-evidence conflicts, invalid incoming records, and UTC-equivalent timestamps during merge.
  • Refines identity-change and fallback tests to isolate individual behavior checks.
File Description
pkg/​lifecycle/​lifecycle_test.go Adds lifecycle validation, identity, fallback, merge, and timezone test coverage while improving assertion structure.

Review effort: Lite (adaptive)

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-18T07:20:00Z
review_event: COMMENT
top_themes:
  - target URL identity-change coverage
files_reviewed:
  - pkg/lifecycle/lifecycle_test.go
comment_count: 1
History

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

Found one low-severity test coverage gap: the identity test clears the baseline target URL, so it does not verify that changing one valid URL to another changes the lifecycle ID. No runtime defects were identified in this test-only PR.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again

require.NoError(t, err)
require.NotEqual(t, first.ID, next.ID)
identity := first.Identity
identity.TargetURL = ""

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.

This baseline clears TargetURL, so the later target-URL case only checks adding a URL to an otherwise URL-less identity, not that changing one valid target URL changes the identity. That leaves regressions where target URLs are ignored or normalized indistinguishably from one another undetected.

💡 Strengthen the identity test

Keep the valid target URL in the baseline and mutate it to a different valid URL (or add a separate add-versus-change case), then retain the ID inequality assertion.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-b3a19c20-5c10-484a-8079-63d9b0330173","parents":[],"payload":{"id":"ldg-255e8783-a319-432e-9d31-2551612c4842","operation":"append","value":{"finding_count":1,"head_sha":"6157f3b18582b10ae01ce5f3c4f033c0e58c64d7","outcome":"findings"}},"sha":"sha256:93bf7de2abd70f860247f668e1ad90ee07f3a0aaae61af676c893920b1d7100e","timestamp":"2026-11-18T07:25:09.454Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /tdd and a mutation check (/diagnosing-bugs style) to the test changes. Observations only; one narrow coverage gap, no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Target URL distinctness: only empty vs. set is covered; two different non-empty URLs are not compared.
  • Testify style: assert.Error in the table loop may trip require-error. Lint could not run here, so this is unverified.

Positive Highlights

  • ✅ Four temporary mutations in lifecycle.go (identity hash, publisher handling, UTC normalisation, delivery-time conflict) were each caught by the new tests.
  • ✅ go test -count=1 ./pkg/lifecycle/ passes; gofmt and go vet are clean.
  • ✅ Table-driven subtests with descriptive names read as a clear specification.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

{"host", func(i *Identity) { i.Host = "github.example" }},
{"workflow", func(i *Identity) { i.Workflow = "other-worker" }},
{"type", func(i *Identity) { i.Type = "add_comment" }},
{"target URL", func(i *Identity) { i.TargetURL = "https://github.com/org/target/issues/8" }},

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.

[/tdd] The target URL case only checks empty vs. set. Two different non-empty URLs are never compared, so a mutation that maps every non-empty TargetURL to one value still passes the suite (verified).

💡 Suggested test

Add a second base identity with a non-empty TargetURL and assert that two different URLs yield different IDs, e.g. https://github.com/org/target/issues/7 vs .../issues/8.

@copilot please address this.

identity := record.Identity
tt.change(&identity)
_, err := Delivered(identity, record.Delivery.At, record.Delivery.ObservedAt, record.Delivery.Source)
assert.Error(t, err)

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.

[/tdd] assert.Error is used for an error check in the table loop. testifylint's require-error rule (enabled via enable-all) will likely flag this, so require.Error is the expected form. Lint could not run in this environment, so this is unverified.

@copilot please address this.

@github-actions

Copy link
Copy Markdown
Contributor

Category: test | Risk: low | Score 41/100 (impact 15 + urgency 12 + quality 14) | Action: auto_merge | Reason: valuable lifecycle coverage increase with low regression risk and passing CI.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~6 AIC · ⌖ ~1 AIC · ⊞ 13K · ◷

@pelikhan
pelikhan merged commit 0a304b3 into main Nov 18, 2026
133 checks passed
@pelikhan
pelikhan deleted the copilot/testify-expert-improve-test-quality branch November 18, 2026 21:51
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.

[testify-expert] Improve Test Quality: pkg/lifecycle/lifecycle_test.go

4 participants