Repository navigation
Conversation
🦋 Changeset detectedLatest commit: ff1c57a The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
There was a problem hiding this comment.
Superseded by the review of
1e75c2f4.
This review, of ad092aa3
✅ Approved — No correctness, security, performance or release issues found in the local Git event publishing, and it is tested at both the Miniflare and Wrangler layers.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
The change only affects local Miniflare behaviour, and the changeset records it as a minor Miniflare release.
🔒 Security: ✅ LGTM
- Admin actions: The new
commitRangeandpushRefsactions go through the existing admin endpoint, which needs the backend secret. - Inputs: Inputs are checked: commit IDs must be 40-character hex,
requestIdmust be a UUID, and the limits are bounded integers. - Git commands: Git runs with argument arrays, not a shell, so there is no command or argument injection.
- Push records: These are keyed by repository path and generation, so one repository cannot read another's refs. The map has a size cap and each record is deleted once read.
📖 AGENTS.md: ✅ LGTM
The change follows the repository's guidance: the feature is built in Miniflare, with a thin Wrangler test on top.
📋 Code Quality: ✅ LGTM
- Push refs: The sidecar captures the refs before and after each push while it holds the repository lock, and
pushRefstakes the same lock. Concurrent pushes to one repository therefore each report only their own refs. - Rejected pushes: Events are published only when the refs actually changed, so a rejected push publishes nothing.
- Commit listing: The
git cat-file --batchparsing checks its bounds correctly. - Clone and fetch: Classification handles protocol v0, v1 and v2 and gzipped bodies. Errors are logged and never fail the Git response.
- Tests: The change is built in Miniflare and covered there by unit tests and real-Git tests, plus a Wrangler test.
⚡ Performance: ✅ LGTM
The extra Git work only runs when a subscription receives that event type from that repository. Commits are read in the background, so the push response is never delayed.
📝 Documentation: ✅ LGTM
The LOCAL_DEVELOPMENT.md update and the changeset match the new behaviour.
Reviewed commit: ad092aa3
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
| expect(() => | ||
| parseCatFileBatch(Buffer.from(`${"a".repeat(40)} commit 99\nshort\n`)) | ||
| ).toThrow("Truncated"); |
There was a problem hiding this comment.
I think this could be better placed in its own test 🤔
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
|
@petebacondarwin sorry I didn't see that you un-assigned me from the PR, I gave it a high level review but I'm happy for you to re-review it 🙂 (also I was about to suggest that someone from the artifacts team should also have a look ideally) |
ad092aa to
1e75c2f
Compare
There was a problem hiding this comment.
Superseded by the review of
086bcb18.
This review, of 1e75c2f4
✅ Approved — I found no correctness, security, performance or release issues in local publishing of push, clone and fetch events. The change has unit tests, real-Git tests in Miniflare and an end-to-end test in Wrangler.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
The change only affects local Miniflare behaviour. Its changeset records a minor Miniflare release, which follows the project's convention for new features.
🔒 Security: ✅ LGTM
- New actions:
commitRangeandpushRefsgo through the existing admin endpoint, which requires the backend secret. - Input checks: Commit IDs must be 40-character hex,
requestIdmust be a UUID, and the limits are bounded integers. - Git commands: Git runs with argument arrays, not a shell, so arguments cannot be injected.
- Push records: Records are keyed by request, repository path and generation, so one repository cannot read another's refs. The map is capped in size, and each record is deleted once read.
📖 AGENTS.md: ✅ LGTM
The change follows the repository's guidance: the feature is built in Miniflare and covered there, with a thin Wrangler test on top.
📋 Code Quality: ✅ LGTM
- Concurrent pushes: The refs before and after a push are recorded while the repository lock is held, and
pushRefstakes the same lock. Each of several concurrent pushes to one repository therefore reports only its own refs. - Rejected pushes:
syncAfterPushnow also runs for failed pushes, which releases the record of the push. Events go out only when refs actually changed, so a rejected push publishes nothing. cat-fileparsing: The bounds check inparseCatFileBatchis correct, and a truncated header throws an error.- Clone and fetch: Events are published only after a successful upload-pack response. A failure to publish is logged and never fails the Git response.
⚡ Performance: ✅ LGTM
- Extra Git work: It runs only when a subscription receives that event type from that repository.
- Commit reads: They are capped at 21 revisions per ref and run in the background, so they never delay the push response.
- Push records: The map of finished pushes is capped in size.
📝 Documentation: ✅ LGTM
The LOCAL_DEVELOPMENT.md update and the changeset match the new behaviour.
Reviewed commit: 1e75c2f4
1e75c2f to
086bcb1
Compare
|
Codeowners approval required for this PR:
Show detailed file reviewers |
There was a problem hiding this comment.
Superseded by the review of
a9e3704f.
This review, of 086bcb18
✅ Approved — I found no correctness, security, performance or release issues in local publishing of push, clone and fetch events. The change has unit tests, real-Git tests in Miniflare and an end-to-end test in Wrangler.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
The change only affects local Miniflare behaviour. Its changeset records a minor Miniflare release, which follows the project's convention for new features.
🔒 Security: ✅ LGTM
- New actions:
commitRangeandpushRefsgo through the existing admin endpoint, which requires the backend secret. - Input checks: Commit IDs must be 40-character hex,
requestIdmust be a UUID, and the limits are bounded integers. - Git commands: Git runs with argument arrays, not a shell, so arguments cannot be injected.
- Push records: Records are keyed by request, repository path and generation, so one repository cannot read another's refs. The map is capped in size, and each record is deleted once read.
📖 AGENTS.md: ✅ LGTM
The change follows the repository's guidance: the feature is built in Miniflare and covered there, with a thin Wrangler test on top.
📋 Code Quality: ✅ LGTM
- Concurrent pushes: The refs before and after a push are recorded while the repository lock is held, and
pushRefstakes the same lock. Each of several concurrent pushes to one repository therefore reports only its own refs. - Rejected pushes:
syncAfterPushnow also runs for failed pushes, which releases the record of the push. Events go out only when refs actually changed, so a rejected push publishes nothing. cat-fileparsing: The bounds check inparseCatFileBatchis correct, and a truncated header throws an error.- Clone and fetch: Events are published only after a successful upload-pack response. A failure to publish is logged and never fails the Git response.
⚡ Performance: ✅ LGTM
- Extra Git work: It runs only when a subscription receives that event type from that repository.
- Commit reads: They are capped at 21 revisions per ref and run in the background, so they never delay the push response.
- Push records: The map of finished pushes is capped in size.
📝 Documentation: ✅ LGTM
The LOCAL_DEVELOPMENT.md update and the changeset match the new behaviour.
Reviewed commit: 086bcb18 — same changes as 1e75c2f4, so this is that commit's review (no new review was run; line numbers are as of 1e75c2f4)
Local Artifacts accepted subscriptions to `cf.artifacts.repo.pushed`, `cf.artifacts.repo.cloned`, and `cf.artifacts.repo.fetched`, but never published them: events came only from binding operations, and Git traffic goes through the local Git backend instead. A Workflow subscribed to pushes therefore never started. The namespace now publishes them the way production does: - After a push, one `pushed` event per ref it changed. The Git backend records the refs before and after the push while it holds the repository's lock, so concurrent pushes to one repository each report only their own refs. Branch updates list up to 20 commits along the first-parent chain from `after` until `before`, newest first, with `totalCommitsCount` counting at most one past that so `commitsTruncated` is set. Messages are cut to 4096 UTF-8 bytes. Tags and deletions list no commits. Commits are read in the background, one ref at a time and in one Git process per ref, so they never delay the push response. - After a served upload-pack request, `cloned` when it names no objects the client already has and `fetched` when it does, including gzipped requests. Ref listing (`ls-refs`) publishes nothing. Git work for events only happens when a subscription receives that event type from that repository, so other repositories behave as before.
086bcb1 to
a9e3704
Compare
There was a problem hiding this comment.
Superseded by the review of
ff1c57a3.
This review, of a9e3704f
✅ Approved — I found no correctness, security, performance or release issues in local publishing of push, clone and fetch events. The change has unit tests, real-Git tests in Miniflare and an end-to-end test in Wrangler.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
The change only affects local Miniflare behaviour. Its changeset records a minor Miniflare release, which follows the project's convention for new features.
🔒 Security: ✅ LGTM
- New actions:
commitRangeandpushRefsgo through the existing admin endpoint, which requires the backend secret. - Input checks: Commit IDs must be 40-character hex,
requestIdmust be a UUID, and the limits are bounded integers. - Git commands: Git runs with argument arrays, not a shell, so arguments cannot be injected.
- Push records: Records are keyed by request, repository path and generation, so one repository cannot read another's refs. The map is capped in size, and each record is deleted once read.
📖 AGENTS.md: ✅ LGTM
The change follows the repository's guidance: the feature is built in Miniflare and covered there, with a thin Wrangler test on top.
📋 Code Quality: ✅ LGTM
- Concurrent pushes: The refs before and after a push are recorded while the repository lock is held, and
pushRefstakes the same lock. Each of several concurrent pushes to one repository therefore reports only its own refs. - Rejected pushes:
syncAfterPushnow also runs for failed pushes, which releases the record of the push. Events go out only when refs actually changed, so a rejected push publishes nothing. cat-fileparsing: The bounds check inparseCatFileBatchis correct, and a truncated header throws an error.- Clone and fetch: Events are published only after a successful upload-pack response. A failure to publish is logged and never fails the Git response.
⚡ Performance: ✅ LGTM
- Extra Git work: It runs only when a subscription receives that event type from that repository.
- Commit reads: They are capped at 21 revisions per ref and run in the background, so they never delay the push response.
- Push records: The map of finished pushes is capped in size.
📝 Documentation: ✅ LGTM
The LOCAL_DEVELOPMENT.md update and the changeset match the new behaviour.
Reviewed commit: a9e3704f — same changes as 1e75c2f4, so this is that commit's review (no new review was run; line numbers are as of 1e75c2f4)
`cf dev` runs local development through either the `cf-wrangler` delegate
or the Vite plugin, both with events declared as
`exports.workflow({ events })` in `cloudflare.config.ts`. Only the
`wrangler.jsonc` path had a Git event test.
Both paths now have a test that pushes to a filtered repository and to an
ignored one, clones, pushes again, and fetches, then checks that the
Workflow recorded exactly one push, one clone, and one fetch for the
subscribed repository. The `cf-wrangler` test parses its arguments as the
binary does and lives in its own file: loading the `cf-wrangler` modules
next to the `wrangler dev` tests stalls the latter's reload test.
`runFixtureGit` runs host Git with the same isolated, authenticated
environment as `pushGitFixture`, for the clone, commit, push, and fetch.
| const { type, source } = event.payload; | ||
| await this.env.EVENTS.put(type + ":" + source.repoName, JSON.stringify(event.payload)); |
There was a problem hiding this comment.
🔍 One push record masks missing events
RecordRepoEvent uses the same KV key for both pushes to demo. Both this test and the cf-wrangler test pass if either push fails to start a Workflow.
Was this helpful? React with 👍 or 👎 to provide feedback.
| const running = runCfWranglerDev({ | ||
| ...parseCfWranglerArgs(["--port=0", "--inspector-port=0"]), | ||
| showInteractiveDevSession: false, | ||
| onReady: (ip: string, port: number) => { | ||
| url = `http://${ip}:${port}`; | ||
| }, | ||
| }); | ||
| try { | ||
| await vi.waitUntil(() => url, { timeout: READY_TIMEOUT }); |
There was a problem hiding this comment.
| import { mockConsoleMethods } from "../helpers/mock-console"; | ||
| import type { StartDevOptions } from "../../dev"; | ||
|
|
||
| let stopDev: (() => Promise<void>) | undefined; |
There was a problem hiding this comment.
🔍 Module-wide dev teardown state
stopDev stores a single test’s teardown callback in mutable module state. That conflicts with the review rule against global variables.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
✅ Approved — I found no correctness, security, performance, documentation or release issues. The new cf dev tests for cf-wrangler and the Vite plugin follow how Miniflare classifies push, clone and fetch.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
The change only affects local Miniflare behaviour. Its minor changeset follows the project's convention for new features.
🔒 Security: ✅ LGTM
- Admin endpoint:
commitRangeandpushRefsstill go through it, and it checks the backend secret. - Input checks: commit IDs and
requestIdare validated, and the walk limits are bounded. - Git commands: Git runs with argument arrays, not a shell.
- Push records: each one is checked against the repository path and generation, deleted once read, and the map is capped in size.
📖 AGENTS.md: ✅ LGTM
The change follows the repository guidance for features that span several tools:
- The feature is built and tested in Miniflare.
- Wrangler,
cf-wranglerand the Vite plugin each add only thin tests on top.
📋 Code Quality: ✅ LGTM
runFixtureGit(packages/workers-utils/src/test-helpers/git.ts): it uses the same isolated Git environment aspushGitFixture, createscwdbefore running Git, and passes the token as an argument rather than through a shell.- New tests (
artifacts-local.spec.tsin the Vite plugin,cf-wrangler/artifacts-events.test.tsin Wrangler): the push, clone, push, fetch sequence lines up with how Miniflare classifies requests.- The push to the ignored repository is filtered out.
- The clone sends no
havelines, so it is reported ascloned. - The second push gives the later fetch something to negotiate, so that fetch sends
havelines and is reported asfetched. - The final assertion on exactly one push, one clone and one fetch therefore holds.
⚡ Performance: ✅ LGTM
The extra Git work runs only for subscribed repositories, and it runs in the background, so it does not delay the push response.
📝 Documentation: ✅ LGTM
The LOCAL_DEVELOPMENT.md update and the changeset match the new behaviour.
Reviewed commit: ff1c57a3
@dinasaur404 this implements the event we missed: locally,
cf.artifacts.repo.pushed(andcloned/fetched) now start your Workflow when yougit push, with the sametriggers.eventsconfig. Could you review?Local Artifacts accepted subscriptions to
cf.artifacts.repo.pushed,cf.artifacts.repo.cloned, andcf.artifacts.repo.fetched, but never published them. Events only came from binding operations (create, import, fork, delete, tokens), and Git traffic goes through the local Git backend instead, so a Workflow subscribed to pushes never started. #16246 shipped with this documented as a known gap; this closes it.Local namespaces now publish these events the way production does:
pushedevent per ref it changed. The Git backend records the refs before and after while it holds the repository's lock, so concurrent pushes to one repository each report only their own refs. Branch updates list up to 20 commits along the first-parent chain fromafterback tobefore, newest first.totalCommitsCountcounts at most one past that, socommitsTruncatedis set when commits were left out. Commit messages are cut to 4096 UTF-8 bytes. Tags and deletions list no commits. After a force push the list also includes older history, as in production, because the walk stops only atbefore. Commits are read in the background, one ref at a time with one Git process per ref, so they never delay the push response.clonedwhen it names no objects the client already has,fetchedwhen it does, including gzipped requests. Like production, a fetch that negotiates over several requests publishes once per request. Ref listing (ls-refs, e.g.git ls-remote) publishes nothing.This works the same under
cf dev, whether it delegates to Wrangler (cf-wrangler, with events declared throughexports.workflow({ events })incloudflare.config.ts) or to the Vite plugin, since both run this Miniflare Artifacts plugin.This extra Git work only happens when a subscription receives the event type from that repository, so repositories without subscribers behave as before.
Tests:
git-events.spec.tsdrives real host Git against a local namespace: payload shape for a new branch, a branch update, a tag and a tag deletion; truncation at 20 commits; repository filters; concurrent pushes to one repository; a rejected push followed by a force push; and clone (protocol v0 and v2), gzipped fetch, andls-remote.artifacts-local.test.tsrunswrangler devwith atriggers.eventssubscription tocf.artifacts.repo.pushedfiltered to one repository, pushes with Git, and checks that only that repository's push starts the Workflow, with the production payload.cf devpaths:cf-wrangler/artifacts-events.test.tsruns thecf-wranglerentrypoint, and the Vite plugin'sartifacts-local.spec.tsruns Vite, both withexports.workflow({ events })incloudflare.config.ts. Each pushes to a filtered and an ignored repository, clones, pushes again, and fetches, then checks that the Workflow recorded exactly one push, clone, and fetch for the subscribed repository.git cat-file --batchoutput.packages/miniflare/src/plugins/artifacts/LOCAL_DEVELOPMENT.md) is updated; the event shapes are the documented production ones.