fix(ci): unblock runtime publish and secret scan #1479

Merged
core-devops merged 1 commits from ci-fix-main-runtime-secret-scan into main 2026-05-18 06:17:01 +00:00
Owner

Summary

Unblocks the molecule-core/main post-merge CI failures observed during the 2026-05-18 05:12Z hourly CI/security triage.

  • Split fake GitHub-token test fixtures across string concatenation so the repo secret-scan workflow no longer flags its own test additions while ScanBytes still sees the full representative shapes.
  • Add a2a_tools_identity to scripts/build_runtime_package.py:TOP_LEVEL_MODULES, matching the new workspace/a2a_tools_identity.py file and unblocking the runtime wheel compatibility gate.
  • Make publish-runtime-autobump choose the next patch from both PyPI latest and existing runtime-v<major>.<minor>.* tags, so pre-existing runtime tags do not wedge the post-merge tagger when PyPI upload lagged behind tag creation.

Evidence

Fresh failing main evidence:

  • molecule-core/main@5324e69049fd: combined commit status failure.
  • Secret scan run 68848/job 0 flagged workspace-server/internal/secrets/patterns_test.go for ghp_[A-Za-z0-9]{36,}.
  • Runtime compatibility run 68847/job 1 failed with TOP_LEVEL_MODULES drifted ... ['a2a_tools_identity'].
  • Publish autobump run 68845/job 1 failed because PyPI latest was 0.1.1000 while runtime-v0.1.1001 already existed.

Local verification on this branch:

  • go test ./internal/secrets from workspace-server/
  • python3 -m unittest scripts/test_build_runtime_package.py -v
  • python3 scripts/build_runtime_package.py --version '0.0.0.dev0+pin-compat' --out <tmp>
  • python3 .gitea/scripts/lint-workflow-yaml.py --workflow-dir .gitea/workflows
  • python3 -m pytest .gitea/scripts/tests/test_prod_auto_deploy.py -q
  • local reproduction of the runtime version chooser: PyPI 0.1.1000 + latest runtime-v0.1.1003 -> 0.1.1004, with no existing-tag collision
  • local secret-scan pattern check over this PR diff: no credential-shaped additions

SOP Checklist

Comprehensive testing performed

  • Covered the three root failures from main: secret-scan fixture false positive, runtime packaging module drift, and runtime autobump tag/PyPI drift.
  • Local checks run: go test ./internal/secrets from workspace-server/, python3 -m unittest scripts/test_build_runtime_package.py -v, python3 scripts/build_runtime_package.py --version '0.0.0.dev0+pin-compat' --out <tmp>, workflow YAML lint, prod-auto-deploy tests, local secret-scan diff reproduction, and local runtime version chooser reproduction.

Local-postgres E2E run

  • N/A for the code changes in this PR: no database schema, migrations, handlers, or runtime data path changed. The earlier PR E2E failures are runner/staging-path failures (docker pull alpine: Failed to initialize: protocol not available, A2A DNS/proxy timeout), not introduced by these three CI/tooling-only edits.

Staging-smoke verified or pending

  • Pending post-merge: the PR fixes post-merge main CI/runtime publication gates. Current staging synthetic E2E failure is tracked as a separate staging delegation timeout (Delegation A2A POST failed rc=28) and should not be papered over by this PR.

Root-cause not symptom

  • Root causes: fake token fixtures were present as contiguous strings in diff additions, runtime package module allowlist did not include the new workspace/a2a_tools_identity.py, and runtime autobump only considered PyPI latest instead of also considering existing repo tags when prior tag creation outran PyPI upload.

Five-Axis review walked

  • Correctness: preserves the tested fixture values at runtime via string concatenation, adds the missing runtime module to the packaging allowlist, and computes the next runtime version from both PyPI and same-major/minor repo tags.
  • Readability: keeps the existing patterns and comments, with the workflow step name updated to state the expanded source of truth.
  • Architecture: leaves source-of-truth in molecule-core; no new service or manual state.
  • Security: does not expose matched secret values; avoids adding credential-shaped literals to new diffs.
  • Performance: no runtime hot path impact; changes are tests/build workflow only.

No backwards-compat shim / dead code added

  • No backwards-compat shim or dead code added. The changes are direct CI/tooling fixes and one runtime packaging allowlist entry for a real source file.

Memory/saved-feedback consulted

  • Applied SOP guidance to fetch fresh run logs before changing code, avoid chat-only TODOs, leave audit trails in Gitea, avoid destructive cleanup/force-push/main push, and use source-owned checks rather than manual state.
## Summary Unblocks the `molecule-core/main` post-merge CI failures observed during the 2026-05-18 05:12Z hourly CI/security triage. - Split fake GitHub-token test fixtures across string concatenation so the repo secret-scan workflow no longer flags its own test additions while `ScanBytes` still sees the full representative shapes. - Add `a2a_tools_identity` to `scripts/build_runtime_package.py:TOP_LEVEL_MODULES`, matching the new `workspace/a2a_tools_identity.py` file and unblocking the runtime wheel compatibility gate. - Make `publish-runtime-autobump` choose the next patch from both PyPI latest and existing `runtime-v<major>.<minor>.*` tags, so pre-existing runtime tags do not wedge the post-merge tagger when PyPI upload lagged behind tag creation. ## Evidence Fresh failing main evidence: - `molecule-core/main@5324e69049fd`: combined commit status `failure`. - Secret scan run 68848/job 0 flagged `workspace-server/internal/secrets/patterns_test.go` for `ghp_[A-Za-z0-9]{36,}`. - Runtime compatibility run 68847/job 1 failed with `TOP_LEVEL_MODULES drifted ... ['a2a_tools_identity']`. - Publish autobump run 68845/job 1 failed because PyPI latest was `0.1.1000` while `runtime-v0.1.1001` already existed. Local verification on this branch: - `go test ./internal/secrets` from `workspace-server/` - `python3 -m unittest scripts/test_build_runtime_package.py -v` - `python3 scripts/build_runtime_package.py --version '0.0.0.dev0+pin-compat' --out <tmp>` - `python3 .gitea/scripts/lint-workflow-yaml.py --workflow-dir .gitea/workflows` - `python3 -m pytest .gitea/scripts/tests/test_prod_auto_deploy.py -q` - local reproduction of the runtime version chooser: PyPI `0.1.1000` + latest `runtime-v0.1.1003` -> `0.1.1004`, with no existing-tag collision - local secret-scan pattern check over this PR diff: no credential-shaped additions ## SOP Checklist **Comprehensive testing performed** - Covered the three root failures from main: secret-scan fixture false positive, runtime packaging module drift, and runtime autobump tag/PyPI drift. - Local checks run: `go test ./internal/secrets` from `workspace-server/`, `python3 -m unittest scripts/test_build_runtime_package.py -v`, `python3 scripts/build_runtime_package.py --version '0.0.0.dev0+pin-compat' --out <tmp>`, workflow YAML lint, prod-auto-deploy tests, local secret-scan diff reproduction, and local runtime version chooser reproduction. **Local-postgres E2E run** - N/A for the code changes in this PR: no database schema, migrations, handlers, or runtime data path changed. The earlier PR E2E failures are runner/staging-path failures (`docker pull alpine: Failed to initialize: protocol not available`, A2A DNS/proxy timeout), not introduced by these three CI/tooling-only edits. **Staging-smoke verified or pending** - Pending post-merge: the PR fixes post-merge main CI/runtime publication gates. Current staging synthetic E2E failure is tracked as a separate staging delegation timeout (`Delegation A2A POST failed rc=28`) and should not be papered over by this PR. **Root-cause not symptom** - Root causes: fake token fixtures were present as contiguous strings in diff additions, runtime package module allowlist did not include the new `workspace/a2a_tools_identity.py`, and runtime autobump only considered PyPI latest instead of also considering existing repo tags when prior tag creation outran PyPI upload. **Five-Axis review walked** - Correctness: preserves the tested fixture values at runtime via string concatenation, adds the missing runtime module to the packaging allowlist, and computes the next runtime version from both PyPI and same-major/minor repo tags. - Readability: keeps the existing patterns and comments, with the workflow step name updated to state the expanded source of truth. - Architecture: leaves source-of-truth in `molecule-core`; no new service or manual state. - Security: does not expose matched secret values; avoids adding credential-shaped literals to new diffs. - Performance: no runtime hot path impact; changes are tests/build workflow only. **No backwards-compat shim / dead code added** - No backwards-compat shim or dead code added. The changes are direct CI/tooling fixes and one runtime packaging allowlist entry for a real source file. **Memory/saved-feedback consulted** - Applied SOP guidance to fetch fresh run logs before changing code, avoid chat-only TODOs, leave audit trails in Gitea, avoid destructive cleanup/force-push/main push, and use source-owned checks rather than manual state.
hongming added 1 commit 2026-05-18 05:21:12 +00:00
fix(ci): unblock runtime publish and secret scan
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
CI / Detect changes (pull_request) Successful in 10s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 8s
E2E API Smoke Test / detect-changes (pull_request) Successful in 26s
E2E Chat / detect-changes (pull_request) Successful in 14s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 13s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 12s
Harness Replays / detect-changes (pull_request) Successful in 11s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 11s
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Successful in 41s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 32s
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Successful in 1m23s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 11s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 9s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Successful in 34s
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Successful in 1m45s
security-review / approved (pull_request) Failing after 5s
qa-review / approved (pull_request) Failing after 11s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m29s
CI / Platform (Go) (pull_request) Successful in 6m5s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 6s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Failing after 28s
Harness Replays / Harness Replays (pull_request) Successful in 4s
CI / Python Lint & Test (pull_request) Successful in 7m11s
CI / Canvas (Next.js) (pull_request) Successful in 7m18s
CI / all-required (pull_request) Successful in 7m25s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2m3s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Chat / E2E Chat (pull_request) Failing after 5m20s
sop-checklist / na-declarations (pull_request) N/A: (none)
gate-check-v3 / gate-check (pull_request) Successful in 12s
sop-checklist / all-items-acked (pull_request) Successful in 13s
sop-tier-check / tier-check (pull_request) Successful in 8s
audit-force-merge / audit (pull_request) Successful in 7s
cadae43c7e
infra-sre reviewed 2026-05-18 05:28:50 +00:00
infra-sre left a comment
Member

infra-sre review

APPROVE — correct fixes for all three failure paths.

Fix 1: publish-runtime-autobump.yml — version bump collision

Old logic: next = MAJOR.MINOR.(PyPI_latest_patch + 1). Bug: if PyPI latest is behind the most-recently-published runtime tag (e.g. manual publish to PyPI), this computes a version that already exists → bump-and-tag fails on upload conflict.

Fix: compare PyPI latest against latest existing runtime-v{MAJOR}.{MINOR}.* git tag, take max(), then increment. Python script with parse() + max() handles the case cleanly. Correct.

Fix 2: build_runtime_package.py — missing module allowlist entry

a2a_tools_identity was absent from TOP_LEVEL_MODULES. This caused publish-runtime-autobump's wheel build to fail when the runtime bundle includes this module. Added in the right sorted position. Correct.

Fix 3: patterns_test.go — secret scan false positive on test fixtures

The ghp_EXAMPLE... pattern in test fixtures triggered the repo's own SECRET_PATTERNS drift lint on every push of these test files — creating a feedback loop where the test additions themselves look like leaked secrets.

Fix: split the prefix from the body ("ghp_" + "EXAMPLE...") so no single line contains the full 40-char credential shape. ScanBytes reads the concatenated value so the test still exercises the full pattern, but the committed source contains no 40-char credential-shaped string in one line. Correct pattern.

Non-blocking note: once this merges and the 6 push failures clear, the main-red-watchdog will auto-close issue #1478. The E2E Chat (push) failure is separate (internal#1480) and will need its own fix.

## infra-sre review **APPROVE** — correct fixes for all three failure paths. ### Fix 1: `publish-runtime-autobump.yml` — version bump collision Old logic: `next = MAJOR.MINOR.(PyPI_latest_patch + 1)`. Bug: if PyPI latest is behind the most-recently-published runtime tag (e.g. manual publish to PyPI), this computes a version that already exists → `bump-and-tag` fails on upload conflict. Fix: compare PyPI latest against latest existing `runtime-v{MAJOR}.{MINOR}.*` git tag, take `max()`, then increment. Python script with `parse()` + `max()` handles the case cleanly. Correct. ### Fix 2: `build_runtime_package.py` — missing module allowlist entry `a2a_tools_identity` was absent from `TOP_LEVEL_MODULES`. This caused `publish-runtime-autobump`'s wheel build to fail when the runtime bundle includes this module. Added in the right sorted position. Correct. ### Fix 3: `patterns_test.go` — secret scan false positive on test fixtures The `ghp_EXAMPLE...` pattern in test fixtures triggered the repo's own `SECRET_PATTERNS drift lint` on every push of these test files — creating a feedback loop where the test additions themselves look like leaked secrets. Fix: split the prefix from the body (`"ghp_" + "EXAMPLE..."`) so no single line contains the full 40-char credential shape. `ScanBytes` reads the concatenated value so the test still exercises the full pattern, but the committed source contains no 40-char credential-shaped string in one line. Correct pattern. **Non-blocking note**: once this merges and the 6 push failures clear, the `main-red-watchdog` will auto-close issue #1478. The `E2E Chat (push)` failure is separate (internal#1480) and will need its own fix.
infra-runtime-be approved these changes 2026-05-18 05:30:46 +00:00
infra-runtime-be left a comment
Member

Review — PR #1479 Approve

Changes (5 files)

.gitea/workflows/publish-runtime-autobump.yml — Fix version bumping logic to compare against both PyPI latest AND existing runtime tags, taking the max. Correct.

scripts/build_runtime_package.py — Adds a2a_tools_identity to TOP_LEVEL_MODULES. This module was added in identity tools (PR #1451) but wasn't wired into the build script, so it would be excluded from the published PyPI wheel. Right fix.

workspace-server/internal/secrets/patterns_test.go — Comprehensive test suite for the secrets Pattern package: compile check, duplicate names guard, known-patterns-presence pins, positive match fixtures (split across string concatenation to prevent secret-scan false positives), negative shapes, and a contract test asserting Match never round-trips the secret value. Well-structured.

canvas/src/components/__tests__/TestConnectionButton.test.tsx — Better error labeling for network exceptions; adds 404-specific test for internal#492. Clean improvement.

canvas/src/components/mobile/MobileChat.tsx — Reuses AgentCommsPanel + AttachmentPreview + downloadChatFile for mobile parity (#231/#232. Clean import additions + proper auth routing.

Note on E2E API Smoke Test failure

E2E API Smoke Test shows failure. None of the changed files touch the platform server or tests/e2e/test_api.sh. This appears to be an environment flake. Recommend re-running the job.

Queue hold

Applying merge-queue-hold — main queue is frozen until SOP_TIER_CHECK_TOKEN is provisioned.

## Review — PR #1479 ✅ Approve ### Changes (5 files) **`.gitea/workflows/publish-runtime-autobump.yml`** — Fix version bumping logic to compare against both PyPI latest AND existing runtime tags, taking the max. Correct. **`scripts/build_runtime_package.py`** — Adds `a2a_tools_identity` to `TOP_LEVEL_MODULES`. This module was added in identity tools (PR #1451) but wasn't wired into the build script, so it would be excluded from the published PyPI wheel. Right fix. **`workspace-server/internal/secrets/patterns_test.go`** — Comprehensive test suite for the secrets Pattern package: compile check, duplicate names guard, known-patterns-presence pins, positive match fixtures (split across string concatenation to prevent secret-scan false positives), negative shapes, and a contract test asserting `Match` never round-trips the secret value. Well-structured. **`canvas/src/components/__tests__/TestConnectionButton.test.tsx`** — Better error labeling for network exceptions; adds 404-specific test for internal#492. Clean improvement. **`canvas/src/components/mobile/MobileChat.tsx`** — Reuses `AgentCommsPanel` + `AttachmentPreview` + `downloadChatFile` for mobile parity (#231/#232. Clean import additions + proper auth routing. ### Note on E2E API Smoke Test failure `E2E API Smoke Test` shows failure. None of the changed files touch the platform server or `tests/e2e/test_api.sh`. This appears to be an environment flake. Recommend re-running the job. ### Queue hold Applying `merge-queue-hold` — main queue is frozen until `SOP_TIER_CHECK_TOKEN` is provisioned.
infra-runtime-be added the merge-queue-hold label 2026-05-18 05:30:55 +00:00
Member

[core-security-agent] APPROVED — OWASP Secrets-scan clean. (1) Secret fixture strings split by concatenation in patterns_test.go — prevents regex self-trip while keeping test coverage identical. Strings are EXAMPLE-patterns, not real credentials. (2) publish-runtime version-bump: reads existing git tags + PyPI latest, computes max+1 via Python — no external input. (3) build_runtime_package adds a2a_tools_identity (pre-approved in #1474). No new injection, auth, or SSRF surface.

[core-security-agent] APPROVED — OWASP Secrets-scan clean. (1) Secret fixture strings split by concatenation in patterns_test.go — prevents regex self-trip while keeping test coverage identical. Strings are EXAMPLE-patterns, not real credentials. (2) publish-runtime version-bump: reads existing git tags + PyPI latest, computes max+1 via Python — no external input. (3) build_runtime_package adds a2a_tools_identity (pre-approved in #1474). No new injection, auth, or SSRF surface.
Member

[core-qa-agent] APPROVED — CI workflow fix (publish-runtime version bump), adds a2a_tools_identity to build modules, splits long test strings to avoid secret-scan false positives. Go secrets tests PASS. e2e: N/A — CI/script-only.

[core-qa-agent] APPROVED — CI workflow fix (publish-runtime version bump), adds a2a_tools_identity to build modules, splits long test strings to avoid secret-scan false positives. Go secrets tests PASS. e2e: N/A — CI/script-only.
hongming added the tier:medium label 2026-05-18 06:15:06 +00:00
core-devops merged commit 7cff067b6e into main 2026-05-18 06:17:01 +00:00
Sign in to join this conversation.
No Reviewers
5 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1479