Skip to content

chore(locks): regenerate hash locks to clear upstream PyPI drift - #500

Merged
haiyuan-eng-google merged 1 commit into
GoogleCloudPlatform:mainfrom
caohy1988:chore/regen-hash-locks-20260928
Sep 28, 2026
Merged

haiyuan-eng-google merged 1 commit into
GoogleCloudPlatform:mainfrom
caohy1988:chore/regen-hash-locks-20260928

Conversation

@caohy1988

@caohy1988 caohy1988 commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

What

Regenerates the three hash-locked files so the Hash-lock drift check goes green again:

  • deploy/otlp_receiver/pip-tools.lock
  • deploy/otlp_receiver/requirements.lock
  • producers/build-requirements.lock

Why

lock-drift in producers-ci.yml reruns regen-locks.sh against live PyPI and diffs against the checked-in locks. New upstream releases since the last refresh make it fail on every PR that touches producers/ (seen on #499). The drift is unrelated to any feature PR, so it is fixed here on main rather than folded into #499.

How

The content is the exact regen-locks.sh output from CI run 36452021746, job 109028872797 (2026-09-28 16:35 UTC), applied byte-for-byte from that job's git diff. No .in, pyproject.toml, Dockerfile, or script changes.

Notable bumps: pip-tools 7.6.0 to 7.6.1 (pip stays 26.1.2, so the pip<26.2 hold from #412 is still honored), build 1.6.1, hatchling 1.32.4, google-cloud-bigquery 3.45.2, grpcio 1.84.0, opentelemetry 1.45.0, protobuf 7.36.2, urllib3 2.8.0, cryptography 50.0.1. The autogenerated header comment now shows --no-index (a side effect of the newer click 8.5.0 in the generator env, per review); it is a comment only and does not affect install or resolution, which ran against PyPI.

Verification

CI on this PR reruns the regen and the receiver image self-test. Expect Hash-lock drift check green unless PyPI publishes again before the run (the check floats against live PyPI).

Follow-up (not in this PR)

Because the check regenerates against live PyPI, it will re-drift on the next upstream release. A durable fix (for example, running drift as a scheduled/lock-path-only job, or pinning resolution time) is a separate decision.

The Hash-lock drift check (producers-ci.yml lock-drift) regenerates all
three locks with regen-locks.sh against live PyPI and has been failing on
every PR touching producers/ since new upstream releases landed.

This commit is the exact regen-locks.sh output from CI run 36452021746
(job 109028872797, 2026-09-28 16:35 UTC), applied byte-for-byte from the
job's git diff. No .in / pyproject / script changes. pip stays at 26.1.2
(pip<26.2 hold from GoogleCloudPlatform#412 still respected); pip-tools 7.6.0 -> 7.6.1.

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Rejection criteria recorded before reading the diff:

  1. Reject if the patch changes anything outside the three specified locks, differs from the cited CI regeneration diff, or violates the pip<26.2 hold.
  2. Reject if a lock loses required hashes/dependencies or introduces an option/marker change that breaks hash-enforced installation.
  3. Reject if regeneration immediately re-drifts or the dependency updates cause the receiver/producers checks to fail.

Independent Astra review of de0d845e016b158255873f2f7657aff48ac190ac → c44001f8a31f47fd5f85f74c893fb820b838815b. No other reviewer's review, PR review/comment, vault note, or shared review artifact was read.

What I tried and verified:

  • Read the PR description, commit message, full diff, generator, Dockerfile, generator-guard tests, producers workflow/manifest, and image self-test. git diff --name-status contains exactly the three contracted files; git diff --check passes.
  • Independently ran gh run view 36452021746 -R GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK --job 109028872797 --log. Removed only the job/step/timestamp envelope and extracted the complete three-file patch. It is byte-for-byte equal to the specified base-to-head git diff: 63,943 bytes, SHA-256 2e478ee44e3e15fb9ef6f6a58fffe0b77151bfbd7afde4200511954431d6ed6e for both. Source job.
  • Parsed every logical requirement and independently used pip's requirements-file parser: generator 13, runtime 32, build 8 entries, all exact pins with SHA-256 hashes. No executable index/options, direct URLs, or platform-marker changes. The --no-index additions are comments at line 5 of each lock; pip ignores them. The unchanged hold in deploy/otlp_receiver/pip-tools.in:27 is honored by pip==26.1.2 at deploy/otlp_receiver/pip-tools.lock:58.
  • Compared package sets and versions against base: no packages removed and no major-version jumps. Runtime retains all 32 packages. protobuf was already 7.x and cryptography already 50.x. The only added package is hashed tomlkit==0.15.1, attributed to hatchling in both toolchain locks (deploy/otlp_receiver/pip-tools.lock:44, producers/build-requirements.lock:33). All direct core/receiver requirements in producers/pyproject.toml:41 and :56 accept the locked versions.
  • Ran PYTHONDONTWRITEBYTECODE=1 python3 -m pytest -c producers/pyproject.toml producers/tests/test_regen_locks_guards.py producers/tests/test_release_workflow_contract.py -p no:cacheprovider --tb=short -q: 17 passed. These include executed guard, rollback/signal, and convergence-failure tests.
  • Inspected Producers CI run 36464719073, whose recorded head is the reviewed SHA. All five Python 3.10–3.14 producers jobs report 547 passed, 4 skipped. Although the workflow installs floating [dev,receiver] dependencies (.github/workflows/producers-ci.yml:88), I compared its install logs to the runtime lock: all 32 runtime versions match in every matrix job.
  • Inspected the receiver image job: both Dockerfile hash-enforced installs ran successfully, all 32 runtime versions match, factories/version checks passed, bad-token HTTP returned 401, and authenticated protobuf export returned 200 with 1 published record and 0 dead letters. The locked build/backend and wheel build also passed in the producers build job.
  • Tried to falsify immediate stability using the head's drift-check log: it converged in one generator phase, regenerated both downstream locks, and passed the three-file git diff --exit-code at 2026-09-28 18:23 UTC, after the cited 16:35 UTC output.

Findings:

  • P0: None.
  • P1: None.
  • P2: None introduced by this patch; no corrective change requested.

Limits and residual risk: I could not locally rerun regen-locks.sh or the Docker self-test: docker info fails because this Mac's client API is 1.40 while the daemon requires at least 1.44. Docker execution evidence above comes from the actual head's CI logs. Future PyPI releases or added distributions can still cause drift because the unchanged generator resolves live inputs; the successful current run disproves immediate re-drift, not future drift. The PR already identifies that separate follow-up, so expanding this three-lock patch is unnecessary.

Final gh pr checks after foreground waiting: 20 passed, 4 skipped, no failures or pending checks (including the broader SDK test matrix and package build). Worktree remains clean; no branch changes, pushes, or merges.

VERDICT: APPROVE @ c44001f

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Blind review, Fable (Claude) · PR #500 @ c44001f8a31f47fd5f85f74c893fb820b838815b (base de0d845)

I reviewed this as an attempt to disprove it. I did not read any other review or comment on this PR before posting.

Rejection criteria (set before reading the diff)

  • RC1 (fidelity): the three locks at head differ from what deploy/otlp_receiver/regen-locks.sh produces today. That means the PR diff ≠ the diff printed by run 36452021746 / job 109028872797, or Hash-lock drift check is not green on this head.
  • RC2 (scope + hash integrity): any file outside the three locks changes. Or a pin lacks --hash. Or an uncommented option/index line (--no-index, --index-url, --find-links, …) would change pip install --require-hashes. Or pip-tools.lock pins pip>=26.2 (breaks the #412 hold). Or the hashes don't match the real PyPI artifacts.
  • RC3 (runtime safety): the upgraded deps break the receiver image or producers CI. Or a dropped transitive dep or a marker change breaks install/import on the Dockerfile's Python 3.12 / linux-amd64.

Result: none of the criteria is met. Evidence below.

What I tried

  1. Scope. git diff --stat de0d845..c44001f shows 3 files: pip-tools.lock (+26/−22), requirements.lock (+374/−288), build-requirements.lock (+17/−13). It is a single commit whose parent is de0d845. There are no .in, pyproject.toml, Dockerfile, script, or workflow edits.

  2. Re-extracted the CI diff myself.

    • Run 36452021746 is the pull_request run for #499. The job checked out 388572e, which is 8994f97 merged into de0d845: the same base as this PR. #499 touches none of the lock inputs.
    • I stripped the log prefixes from gh run view 36452021746 --job 109028872797 --log, leaving 859 diff lines. That text has the same SHA-256 (2e478ee4…) as git diff de0d845 c44001f -- <3 locks>.
    • Applying the CI patch to the base files in a scratch repo reproduces the exact head blobs acbd022 / f7b449f / 611cdc6 (full SHA-1 match). The byte-for-byte claim holds.
  3. Independent regen today. I replicated regen-locks.sh:49-100 faithfully:

    • same pinned python:3.12-slim@sha256:423ed6ab… digest, run as --platform linux/amd64 (Python 3.12.13);
    • same pip install --require-hashes / pip-compile commands and the same /src and /out paths;
    • a fresh container per phase, with inputs and outputs moved as tar streams instead of bind mounts.

    At 2026-09-28 18:33:55Z it converged and all three outputs were byte-identical to the head blobs. Separately, this PR's own lock-drift job (run 36464719073, job 109071796192, merge a7a5909) converged in phase 1 and passed git diff --exit-code at 18:23Z.

  4. Hash authenticity. For all 44 unique pins across the three locks, the lock's --hash set exactly equals the sha256 digests PyPI lists for that version. There are no subsets and no unknown hashes, nothing is yanked, and every file was uploaded on or before 2026-09-25. Pins shared between locks carry identical hashes in each file.

  5. Structural diff. I parsed the old and new locks.

    • No pin lacks hashes, no option lines are uncommented, and there are no markers.
    • requirements.lock has the same 32 packages, none added or removed. There are no major-version jumps: 21 minor/patch bumps.
    • The generator and build locks gain only tomlkit==0.15.1, because hatchling 1.32.4 now has Requires-Dist: tomlkit>=0.11.1.
    • The changed via comments match upstream metadata. google-api-core 2.39.0 now requires opentelemetry-api>=1.44.0. gunicorn 26.2.0 has no deps, and packaging remains via google-cloud-bigquery.
    • The hash-count shifts (charset-normalizer 93→172, google-crc32c 33→31) equal PyPI's artifact counts.
    • The CI image install built nothing from source: cffi, charset-normalizer, cryptography, google-crc32c, grpcio, and protobuf all came from x86_64 cp312/abi3 wheels.
  6. pip hold. pip==26.1.2 (deploy/otlp_receiver/pip-tools.lock:58) satisfies pip<26.2 (deploy/otlp_receiver/pip-tools.in:27).

  7. --no-index. It appears only in the # header line (line 5 of each lock). pip ignores comment lines, and regen-locks.sh:53 compares lock bodies with comments stripped. pip-compile forwards --no-index to pip only when the parsed value is truthy (piptools/scripts/compile.py:291), and the resolution demonstrably ran against PyPI. It is harmless for install and resolution. See P2-1 for its real cause.

  8. Runtime. All checks are green on c44001f: 20 pass, and the 4 zizmor jobs were skipped.

    • The receiver image self-test got 401 for a bad token and 200 with published: 1 and 0 dead-lettered.
    • Producers build installed build-requirements.lock with hashes and built the sdist and wheel with --no-isolation.
    • I also replicated both Dockerfile stages locally on linux/amd64 (Dockerfile:27-30, :36-41). Installing all 32 runtime pins with --require-hashes worked, and pip check reported "No broken requirements found". Both factories import, neither build nor hatchling is present, and an OTLP ExportLogsServiceRequest round-trips (protobuf upb backend).
  9. Tests. producers/tests/test_regen_locks_guards.py passed locally (13 passed). Note that Producers test (3.10–3.14) installs floating .[dev,receiver] (producers-ci.yml:88), not the lock. They corroborate rather than consume it: the 3.12 job resolved the same versions as the lock for the key bumped packages I checked (google-cloud-bigquery 3.45.2, pubsub 2.41.0, api-core 2.39.0, protobuf 7.36.2, grpcio 1.84.0, otel 1.45.0, gunicorn 26.2.0, urllib3 2.8.0, cryptography 50.0.1, crc32c 1.9.0) and got 547 passed, 4 skipped.

Findings

P0: none. P1: none.

P2-1: the PR body misattributes the --no-index header token, and the header is now misleading.

  • Cause: the click bump 8.4.2 → 8.5.0 (pip-tools.lock:11), not pip-tools 7.6.1.
  • How it happens: under click 8.5.0, a flag option without an explicit default gets .default == Sentinel.UNSET. pip-tools' get_compile_command then fails its option.default == value skip (piptools/utils.py:366). For a flag with no negative form, it emits the positive name (utils.py:387) even though the value is False.
  • Reproduced in a 2×2 matrix of py3.12 venvs:
    • with click 8.5.0, pip-tools 7.6.0 and 7.6.1 both write --no-index into the header;
    • with click 8.4.2, both write a clean header;
    • ctx.params['no_index'] == False in all four.
  • Impact: none on install or resolution. But anyone who re-runs the header command by hand passes a real --no-index, which fails without --find-links.
  • Fix: reword that sentence in the PR body.
  • Follow-up (script change, out of scope here): export CUSTOM_COMPILE_COMMAND=deploy/otlp_receiver/regen-locks.sh into the pip-compile containers. pip-tools honors it (piptools/writer.py:139), so headers stay stable across generator and click upgrades and header-only drift goes away.

P2-2: the stated reason for the pip<26.2 hold is now stale. This is a follow-up; this PR correctly keeps the hold.

  • pip-tools.in:21-26 says the newest pip-tools predates pip 26.2 and is equally affected.
  • The pip-tools 7.6.1 locked here ships a pip ≥ 26.2 shim: it passes allow_editables when PIP_VERSION_MAJOR_MINOR >= (26, 2) (piptools/_internal/_pip_api/command_methods.py:55). Its metadata still says only pip>=22.2, and CI already prints the pip 26.1.2 -> 26.2.1 notice.
  • Suggestion: in a separate PR, try lifting the hold and let the convergence loop prove pip 26.2.x + pip-tools 7.6.1 works. Failing that, at least update the comment.

P2-3: the check will re-drift on the next relevant upstream release. The PR's own Follow-up section acknowledges this, so it doesn't block. For scale: since the previous refresh (#412, 2026-08-10), 21 of the 32 runtime pins had moved.

  • Suggestion: the generator's locked pip (26.1.2) supports --uploaded-prior-to <datetime>. Passing --pip-args="--uploaded-prior-to=<timestamp committed in the repo>" to the three pip-compile calls (regen-locks.sh:61,93,97) would make the check deterministic: it would drift only when a refresh PR bumps the timestamp. First verify that pip-tools forwards the flag to its PackageFinder.
  • Alternative: run drift only when lock inputs change, plus a scheduled refresh job.

Not verified

  • I did not run the full selftest.sh (Pub/Sub emulator path) locally; for that I rely on the green CI run on c44001f.
  • docker build wasn't usable here (no buildx, and the legacy builder can't cross-build), so I replicated the image stage by stage with docker run.
  • I did not run the regen-locks.sh wrapper itself (bind mounts and transactional copyback) locally. The copyback is covered by the 13 guard tests.
  • I checked only linux/amd64. That is the only release platform: release-tracing.yml:215 runs a plain docker build on ubuntu-latest.

VERDICT: APPROVE @ c44001f

@haiyuan-eng-google
haiyuan-eng-google merged commit 98984ff into GoogleCloudPlatform:main Sep 28, 2026
24 checks passed
haiyuan-eng-google pushed a commit that referenced this pull request Sep 29, 2026
…st (#501)

* chore(release): 0.5.4 — compaction_windows view, smoke-test unpickling allowlist

Bump the version to 0.5.4 and cut the CHANGELOG for the ten PRs merged
since v0.5.3 (#490–#497, #499, #500). [Unreleased] is left empty; the
#494 entry moves into [0.5.4].

* docs(changelog): tighten 0.5.4 compatibility notes

List every incidental name #490/#496 removed and where each lives
now, fix the permission repair to `chmod go-w`, scope the log-dir
symlink rule to logs outside the state directory, and qualify the
tracing checks' platform fallbacks.

* chore(release): date 0.5.4 for 2026-09-29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants