Skip to content

Add POST /git/push for leased branch publication - #250

Merged
nishu-builder merged 1 commit into
codex/publish-design-20260917-911f8baefrom
codex/publish-endpoint-20260917-911f8bae
Sep 18, 2026
Merged

nishu-builder merged 1 commit into
codex/publish-design-20260917-911f8baefrom
codex/publish-endpoint-20260917-911f8bae

Conversation

@nishu-builder

@nishu-builder nishu-builder commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Add POST /git/push {destination, commit, branch, expected}. Validate commit availability and fast-forward ancestry, then make one Git push with an explicit destination lease. Creates and fast-forwards are the only supported updates.

Return typed completion, rejection or uncertainty. Missing source/expected commits and non-fast-forward updates have distinct error codes; porcelain ref status distinguishes receiver rejection from an unconfirmed response. Serialize duplicate pushes to a branch across servers sharing the store.

The endpoint does not import, merge, scan source files or conversation ancestry, or perform follow-up lookups. The HTTPS fixture covers leased creation/advancement, concurrent requests, stale/racing leases, receive-hook rejection and credential redaction, lost replies, and exact-commit transfer.

Validation on EC2: Nix build passed. The salted suite passed 46/47 checks in 395s; its Clippy findings were fixed, and Clippy passed on all affected crates with --all-targets -- -D warnings. Formatting passed after those lint-only fixes. HTTPS import/push, shallow-locator/offline-cache, and focused unit checks also passed. The functional suite was not repeated for the lint-only changes.

@nishu-builder nishu-builder left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layer 3/8. The endpoint shape matches the design: required-but-nullable expected (with a unit test for the three cases), check-ref-format plus the leading-dash guard, G3 ancestry only when G3 exists, --force-with-lease=<ref>:<E> with the empty lease meaning create-only, push.followTags=false, and the observe-after-failure ladder. The fixture's racing lease, lost reply and 4-way concurrent push are the right tests, and the "no rev-list" assertion pins the "do not re-walk the closure" promise.

One finding I would fix before merging, inline at the post-failure branch: definite receiver-side rejections (read-only token, branch protection, archived repo) are reported as uncertain, and the design's "inspect before continuing" cannot resolve them because the branch is legitimately unchanged. --porcelain puts the ! [remote rejected] status on stdout, which is safe to parse with stderr still nulled.

Two nits inline: the fast-forward 422 also covers "E is not stored", and the shared marker check dropped the file/line listing the host path used to report.


Generated by Claude Code

Comment thread rust/crates/server/src/push.rs Outdated
Comment thread rust/crates/server/src/push.rs Outdated
Comment thread rust/crates/git-locator/src/publish.rs Outdated
@nishu-builder
nishu-builder force-pushed the codex/publish-endpoint-20260917-911f8bae branch from 305bfb2 to 2171f3d Compare September 18, 2026 00:03
@nishu-builder
nishu-builder force-pushed the codex/publish-endpoint-20260917-911f8bae branch from 2171f3d to 6d61208 Compare September 18, 2026 00:48
@nishu-builder
nishu-builder removed this pull request from stack #255 September 18, 2026 07:50
@nishu-builder
nishu-builder added this pull request to stack #257 September 18, 2026 07:51
@nishu-builder
nishu-builder force-pushed the codex/publish-endpoint-20260917-911f8bae branch from 6d61208 to 95352d7 Compare September 18, 2026 10:52
@nishu-builder
nishu-builder removed this pull request from stack #257 September 18, 2026 10:52
@nishu-builder
nishu-builder changed the base branch from codex/publish-git-compat-20260917-911f8bae to codex/publish-design-20260917-911f8bae September 18, 2026 10:52
@nishu-builder
nishu-builder added this pull request to stack #257 September 18, 2026 10:52
@nishu-builder
nishu-builder removed this pull request from stack #257 September 18, 2026 10:53
@nishu-builder
nishu-builder added this pull request to stack #261 September 18, 2026 10:53
@nishu-builder
nishu-builder force-pushed the codex/publish-endpoint-20260917-911f8bae branch from 95352d7 to 3d60957 Compare September 18, 2026 19:52
@nishu-builder
nishu-builder merged commit 525c9ab into main Sep 18, 2026
2 checks passed
@nishu-builder
nishu-builder deleted the codex/publish-endpoint-20260917-911f8bae branch September 18, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant