-
-
Notifications
You must be signed in to change notification settings - Fork 477
Fix change reviews in repositories without HEAD #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -238,27 +238,25 @@ test("a concurrent review rejects a different root after initialization", async | |
| } | ||
| }); | ||
|
|
||
| test("an unborn repository becomes reviewable after its first commit", async (t) => { | ||
| test("an unborn repository is reviewable without creating a HEAD commit", async (t) => { | ||
| const root = await unbornRepository(t); | ||
| await writeFile(join(root, "existing.txt"), "present at open\n"); | ||
| const manager = createReviewCheckpointManager(); | ||
|
|
||
| await manager.initializeWorkspace({ workspaceId: "ws_unborn", root }); | ||
| await assert.rejects( | ||
| () => manager.reviewChanges({ workspaceId: "ws_unborn", root }), | ||
| /repository has no HEAD commit/, | ||
| ); | ||
| const availability = await manager.initializeWorkspace({ workspaceId: "ws_unborn", root }); | ||
| assert.deepEqual(availability, { available: true }); | ||
| await assert.rejects(() => git(root, ["rev-parse", "--verify", "HEAD^{commit}"])); | ||
|
|
||
| await writeFile(join(root, "README.md"), "first commit\n"); | ||
| await git(root, ["add", "README.md"]); | ||
| await git(root, ["commit", "-m", "Initial commit"]); | ||
| await writeFile(join(root, "created-after-open.txt"), "new file\n"); | ||
|
|
||
| const afterFirstCommit = await manager.reviewChanges({ | ||
| const review = await manager.reviewChanges({ | ||
| workspaceId: "ws_unborn", | ||
| root, | ||
| markReviewed: false, | ||
| }); | ||
| assert.equal(afterFirstCommit.summary.files, 0); | ||
| assert.equal(afterFirstCommit.patch, ""); | ||
| assert.deepEqual(review.files.map((file) => file.path), ["created-after-open.txt"]); | ||
| assert.equal(review.files[0]?.type, "new"); | ||
| assert.match(review.patch, /new file/); | ||
|
Comment on lines
251
to
+259
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The regression test performs only one unmarked review while the repository is unborn. Add coverage that creates the first user commit and then reviews or advances the checkpoint again, so regressions in the new parentless checkpoint lifecycle are detected. Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| }); | ||
|
|
||
| async function committedRepository(t: TestContext): Promise<string> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
Repository: Waishnav/devspace
Length of output: 8845
🏁 Script executed:
Repository: Waishnav/devspace
Length of output: 50373
🏁 Script executed:
Repository: Waishnav/devspace
Length of output: 5344
Distinguish an unborn repository from other
HEAD^{commit}failures.getGitEligibilitycatches every failure from theHEAD^{commit}check.initializeWorkspaceStatethen usesread-tree --emptyand creates checkpoint refs without a parent. A brokenHEADor inaccessible object database can therefore create a synthetic baseline instead of preserving the Git error.🤖 Prompt for AI Agents