Add multi-remote fork topology and non-candidate ref test fixtures to ears-manager self-host suite
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 53/100
Research direction
Start with ears-manager/internal/cli/selfhost_test.go and the approvedRepositoryConfig and evaluateCandidate paths in ears-manager/internal/cli/state.go. Read the existing self-host fixtures and identify how they create repositories, refs, and remotes; then add cases for malformed non-candidate refs, fork and upstream remotes, and a checked-out local main branch. Run the named Go test command from the issue; done means all three regressions are covered and pass.
Written by the indexing model from the issue text.
Description
What happened
During the implementation of Issue #255 on PR #289 (https://github.com/redhat-et/ProtoBot/pull/289), the fix agent implemented approvedRepositoryConfig in ears-manager/internal/cli/state.go to anchor default-branch repository configuration to trusted Git refs. In Review Run 4 (workflow run 38657564178), the Review Agent advised failing closed on DecodeFields errors in evaluateCandidate (finding A23). The fix agent implemented this in commit 4bdd2dc, and all existing unit tests in selfhost_test.go passed.
However, in formal code reviews (https://github.com/redhat-et/ProtoBot/pull/289#pullrequestreview-3339396348, https://github.com/redhat-et/ProtoBot/pull/289#pullrequestreview-3343603387), maintainer John Strunk identified three blocking defects:
- B2 (Unrelated refs break check): Any clone with
fetch-depth: 0containing an unrelated feature orwipbranch with invalid YAML crashedears-manager checkwith exit 6git.read_failedbecauseapprovedRepositoryConfigdecoded all refs before filtering by candidate branch name. - B3 (Fork config self-approval): In a standard multi-remote fork clone (
originpointing to an untrusted fork with its ownmain,upstreampointing to canonicalredhat-et/ProtoBot),evaluateCandidateaccepted a candidate remote if its URL matchedcanonical_remoteread from that same candidate'sproject.yaml. Because candidates were sorted alphabetically by remote name,originwas evaluated beforeupstream, allowing a fork'smainbranch to self-declare canonical and supply the baseline. - B4 (Checked-out main cannot resolve): In a local clone with
mainchecked out and no remote-tracking refs,approvedRepositoryConfigskippedrefs/heads/<HEAD>, causingcheckto fail withproject.default_branch_unresolved.
PR #289 was closed unmerged after 9 iterations failed to resolve these edge cases without breaking existing tests.
What could go better
The root cause of these three defects escaping autonomous review and automated testing was a gap in ears-manager's test fixtures. selfhost_test.go only exercised isolated repositories with a single local branch or a single remote, and all test repositories contained strictly well-formed YAML. When the Review Agent advised failing closed on decode errors, the agent had no fixture to reveal that blanket fail-closed behavior would break repositories with non-candidate branches.
Had the test suite included multi-remote fixtures, non-candidate refs with invalid YAML, and local-only checkouts of main, the Code Agent and Fix Agent would have caught these regressions immediately during local go test runs prior to submission.
Proposed change
In ears-manager/internal/cli/selfhost_test.go, add dedicated regression and topology tests:
TestSelfHostingUnrelatedRefMalformedConfigIgnored: Create a test repository with a valid default branch and an unrelated non-candidate branch (e.g.,refs/heads/wip-corrupted) containing malformed YAML in.protobot/project.yaml. Verify thatears-manager checkignores the malformed non-candidate ref and successfully validates againstmainwithout returninggit.read_failed.TestSelfHostingForkCloneUpstreamCanonicalPriority: Configure a multi-remote fixture with remoteoriginpointing to a fork whosemainbranch declares its own fork URL ascanonical_remote, and remoteupstreampointing to canonicalredhat-et/ProtoBot. Verify thatapprovedRepositoryConfigresolves the baseline fromupstreamand rejects or ignoresorigin's self-declaration.TestSelfHostingCheckOnCheckedOutDefaultBranchSucceeds: Check outmaindirectly in a clean local repository without configured remote-tracking refs and verify thatears-manager checkresolvesmainas the default branch without throwingproject.default_branch_unresolved.- Update
ears-manager/internal/cli/state.goto filter candidate ref names prior to decoding Git blobs, and ensure candidate remote evaluation anchors to verified upstream remotes.
Validation criteria
- Running
go test ./ears-manager/internal/cli -v -run 'TestSelfHosting(UnrelatedRef|ForkClone|CheckOnCheckedOut)'fails when executed against PR #289's head commit (5c45cea4695d1f7d94130e10098bfeed660b9475), catching findings B2, B3, and B4. - Running the same test suite against an updated implementation that filters candidate refs before decoding and prioritizes canonical remotes passes cleanly.
Generated by retro agent from https://github.com/redhat-et/ProtoBot/pull/289
- Dominant language
- Go
- Stars
- 6
- Forks
- 8
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 84
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from redhat-et/ProtoBot
-
bug infra ready-for-triage triaged
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
redhat-et/ProtoBot#301 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
component:ears-manager enhancement feature ready-for-triage triaged
Difficulty 5/5 Over a week Newbie friendliness 35/100
redhat-et/ProtoBot#306 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Enforce change-set base freshness and project.yaml metadata hand-edit checks in review-pr skillPossibly taken @fullsend-ai-coder claimed this 4 days ago. Opencomponent:specification-toolkit documentation ready-for-triage ready-to-code
Difficulty 3/5 1-2 days Newbie friendliness 35/100
redhat-et/ProtoBot#294 · 3 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
Enable issue-driven Fullsend Code/Fix runs to create ears-manager-compliant PRsPossibly taken @JohnStrunk claimed this 5 days ago. Opencomponent:ears-manager enhancement feature infra triaged
redhat-et/ProtoBot#292 · 10 comments · 2 reactions · 1 assignee ·
Maintainers usually reply within 1 day
-
enhancement feature infra ready-for-triage triaged
Difficulty 3/5 1-2 days Newbie friendliness 55/100
redhat-et/ProtoBot#288 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
All issues in redhat-et/ProtoBot
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
aws/amazon-ecs-agent#5177 ·
Maintainers usually reply within 2 days
-
release-followup
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/rocketmq-dashboard#7292 ·
Maintainers usually reply within 3 days
-
[Bug]: Deleting an MCP proxy leaves its API keys in the gateway's memory and in the policy engineOpenAspect/API Aspect/Other Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
wso2/api-platform#3852 ·
Maintainers usually reply within 1 day