Repository navigation
feat(session): filter listed sessions by branch - #1702
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
NanaseInori
left a comment
There was a problem hiding this comment.
At fafa8bb, ListSessions returns a nil slice when the sessions directory does not exist. The new filtered := summaries[:0] preserves that nil slice, so ocr session list --repo <unused-directory> --branch main --json still emits null, whereas #1701 requires [] for an empty filtered result.
Please initialize the filtered result as a non-nil empty slice and add a regression for a missing sessions directory. The existing empty-result test only checks text output.
Also, the filter-before-limit test selects the newest session, so it would still pass if limiting happened first. Select an older matching session behind a newer non-matching one to exercise that ordering.
|
Fixed in 55cf505. The branch-filter regression now places an older matching session behind a newer non-matching session, so it verifies filtering happens before --limit. The non-nil empty JSON result and missing-sessions-directory regression are already included on this branch. Targeted and full cmd/opencodereview tests pass. |
|
Both points are addressed on the branch:
Your first finding was right and my earlier test was too weak on both counts — thanks for the precise repro. |
|
Both points are already in the current head ( Non-nil empty slice. if sessionListBranch != "" {
filtered := make([]session.Summary, 0, len(summaries))
for _, summary := range summaries {
if summary.GitBranch == sessionListBranch {
filtered = append(filtered, summary)
}
}
summaries = filtered
}
Filter before limit. $ GOTOOLCHAIN=go1.26.9 go test ./cmd/opencodereview -run 'TestRunSessionList_BranchFilter' -count=1
ok github.com/alibaba/open-code-review/cmd/opencodereview 1.864sCould you re-review at |
|
@OUAO-FRANK Thanks for the updates. I re-reviewed the current head, One regression-test issue remains: Make the filter-before-limit fixture deterministic. In Please use fixtures with explicit, distinct persisted timestamps and assert that the unfiltered list starts with the newer, non-matching session. Moving the limit ahead of the filter should then make the regression fail deterministically. This is a gap in the test's regression protection, not a claim that the current production implementation fails or that the current test is flaky with the correct implementation. Two additional follow-ups:
Validation scope: I inspected all three changed files and the relevant persistence/sorting paths. OCR completed with zero findings for the production file, but excluded the two test files. I also verified that CI passed for this exact head; I did not run the PR's tests locally. Review assistance: Codex and OpenCodeReview (OCR model: |
|
@OUAO-FRANK I checked that your branch was still at This update:
Validation of the pushed tree:
The previous review's remaining test concern is addressed. Checks on this new head should be used for the merge decision; I have not merged the PR. Review and implementation assistance: Codex and OpenCodeReview (OCR model: |
Summary
--branchfilter toocr session list--limitValidation
git diff --checkpassedmake check,make test, and the requiredocr review --audience agentcould not run locally because Go, Make, and ocr are not installed in the environmentAI disclosure
This PR was developed with GPT-5.6 through Codex, using Git and GitHub CLI. I reviewed the complete diff and validation results before submission.
Fixes #1701