fix(core): check RowsAffected errors in admin_schedules_health, org_import, llm_billing_mode #2107

Merged
devops-engineer merged 3 commits from fix/rows-affected-core into main 2026-06-01 23:28:30 +00:00
Member

Three handlers ignored errors from Result.RowsAffected():

  • admin_schedules_health.go ReapOrphans: repointedN / disabledN
  • org_import.go migrateRuntimeSchedulesFromRemovedPredecessor
  • llm_billing_mode.go SetWorkspaceLLMBillingMode (clear + set paths)

All now log/return the error instead of silently discarding it.

  • go build ./... clean
  • go test ./internal/handlers/... passes

Comprehensive testing performed

  • Unit tests in internal/handlers/ pass (go test).
  • Verified RowsAffected error paths with existing sqlmock suites.
  • No new external dependencies.

Local-postgres E2E run

  • N/A: pure handler-layer error-checking change; no schema or DB behavior change.

Staging-smoke verified or pending

  • Scheduled post-merge; change is defensive error-checking only.

Root-cause not symptom

Root cause: sql.Result.RowsAffected() errors were silently discarded with _, so a DB driver or connection failure during UPDATE/DELETE would be invisible. Fix: capture and propagate the error.

Five-Axis review walked

  • Correctness: error propagation matches existing handler patterns.
  • Readability: minimal change, consistent naming.
  • Architecture: no structural change.
  • Security: no new attack surface.
  • Performance: no hot-path impact.

No backwards-compat shim / dead code added

Yes — no shim or dead code.

Memory/saved-feedback consulted

N/A: routine defensive fix following existing patterns.

Three handlers ignored errors from `Result.RowsAffected()`: - `admin_schedules_health.go` `ReapOrphans`: repointedN / disabledN - `org_import.go` `migrateRuntimeSchedulesFromRemovedPredecessor` - `llm_billing_mode.go` `SetWorkspaceLLMBillingMode` (clear + set paths) All now log/return the error instead of silently discarding it. - `go build ./...` clean - `go test ./internal/handlers/...` passes ## Comprehensive testing performed - Unit tests in `internal/handlers/` pass (go test). - Verified RowsAffected error paths with existing sqlmock suites. - No new external dependencies. ## Local-postgres E2E run - N/A: pure handler-layer error-checking change; no schema or DB behavior change. ## Staging-smoke verified or pending - Scheduled post-merge; change is defensive error-checking only. ## Root-cause not symptom Root cause: `sql.Result.RowsAffected()` errors were silently discarded with `_`, so a DB driver or connection failure during UPDATE/DELETE would be invisible. Fix: capture and propagate the error. ## Five-Axis review walked - Correctness: error propagation matches existing handler patterns. - Readability: minimal change, consistent naming. - Architecture: no structural change. - Security: no new attack surface. - Performance: no hot-path impact. ## No backwards-compat shim / dead code added Yes — no shim or dead code. ## Memory/saved-feedback consulted N/A: routine defensive fix following existing patterns.
core-be added 1 commit 2026-06-01 19:05:30 +00:00
fix(core): check RowsAffected errors in admin_schedules_health, org_import, llm_billing_mode
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
E2E API Smoke Test / detect-changes (pull_request) Failing after 0s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Has been skipped
E2E Chat / detect-changes (pull_request) Failing after 0s
E2E Chat / E2E Chat (pull_request) Has been skipped
CI / Python Lint & Test (pull_request) Successful in 3s
Harness Replays / detect-changes (pull_request) Failing after 1s
Handlers Postgres Integration / detect-changes (pull_request) Failing after 1s
Harness Replays / Harness Replays (pull_request) Has been skipped
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Has been skipped
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 3s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 9s
CI / Detect changes (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 7s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 4s
sop-checklist / review-refire (pull_request_target) Has been skipped
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 10s
security-review / approved (pull_request_target) Failing after 6s
gate-check-v3 / gate-check (pull_request_target) Successful in 8s
sop-tier-check / tier-check (pull_request_target) Successful in 5s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 1s
CI / Canvas (Next.js) (pull_request) Successful in 7s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 15s
qa-review / approved (pull_request_target) Failing after 11s
sop-checklist / all-items-acked (pull_request_target) Successful in 10s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 6s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 57s
CI / Platform (Go) (pull_request) Successful in 3m50s
CI / all-required (pull_request) Successful in 2s
ee39ccbf2f
Three handlers ignored errors from Result.RowsAffected():

- admin_schedules_health.go: ReapOrphans repointedN / disabledN
- org_import.go: migrateRuntimeSchedulesFromRemovedPredecessor
- llm_billing_mode.go: SetWorkspaceLLMBillingMode (clear + set paths)

All now log/return the error instead of silently discarding it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
core-be requested review from core-qa 2026-06-01 19:05:45 +00:00
core-be requested review from core-security 2026-06-01 19:05:47 +00:00
core-be added 1 commit 2026-06-01 19:16:43 +00:00
fix(core): add missing rows.Err() checks in llm_billing_mode and audit
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
E2E API Smoke Test / detect-changes (pull_request) Failing after 1s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Has been skipped
CI / Python Lint & Test (pull_request) Successful in 4s
E2E Chat / detect-changes (pull_request) Failing after 1s
E2E Chat / E2E Chat (pull_request) Has been skipped
Harness Replays / detect-changes (pull_request) Failing after 2s
Harness Replays / Harness Replays (pull_request) Has been skipped
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 12s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 5s
CI / Detect changes (pull_request) Successful in 16s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 9s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 16s
sop-checklist / review-refire (pull_request_target) Has been skipped
Handlers Postgres Integration / detect-changes (pull_request) Successful in 20s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
gate-check-v3 / gate-check (pull_request_target) Successful in 11s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 22s
security-review / approved (pull_request_target) Failing after 10s
sop-checklist / all-items-acked (pull_request_target) Successful in 9s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 0s
qa-review / approved (pull_request_target) Failing after 15s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 7s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 16s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 1s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
sop-tier-check / tier-check (pull_request_target) Successful in 6s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 56s
CI / Platform (Go) (pull_request) Successful in 3m56s
CI / all-required (pull_request) Successful in 2s
df6014a34b
readWorkspaceDeriveInputs (llm_billing_mode.go) and scanAuditRows (audit.go)
both iterated rows.Next() without checking rows.Err() after the loop.
Add the check so iteration errors are not silently swallowed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
core-be added 1 commit 2026-06-01 20:20:08 +00:00
fix(core): use %w instead of %v for error wrapping in fmt.Errorf
sop-tier-check / tier-check (pull_request_review) Successful in 5s
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 4s
Harness Replays / detect-changes (pull_request) Successful in 4s
CI / Detect changes (pull_request) Successful in 6s
CI / Python Lint & Test (pull_request) Successful in 5s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 6s
E2E Chat / detect-changes (pull_request) Successful in 7s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 3s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 4s
E2E API Smoke Test / detect-changes (pull_request) Successful in 9s
sop-checklist / review-refire (pull_request_target) Has been skipped
Handlers Postgres Integration / detect-changes (pull_request) Successful in 9s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 3s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4
sop-checklist / na-declarations (pull_request) N/A: (none)
qa-review / approved (pull_request_target) Successful in 4s
gate-check-v3 / gate-check (pull_request_target) Successful in 4s
security-review / approved (pull_request_target) Successful in 4s
sop-checklist / all-items-acked (pull_request_target) Successful in 4s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 12s
CI / Canvas (Next.js) (pull_request) Successful in 2s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 1s
Harness Replays / Harness Replays (pull_request) Successful in 4s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Chat / E2E Chat (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 2s
sop-tier-check / tier-check (pull_request_target) Successful in 11s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m12s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1m9s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2m32s
CI / Platform (Go) (pull_request) Successful in 6m9s
CI / all-required (pull_request) Successful in 2s
audit-force-merge / audit (pull_request_target) Successful in 5s
ef650644cd
Two handlers used %v for error values in fmt.Errorf, preventing
callers from using errors.Is/As. Switch to %w.

- ssrf.go: DNS resolution error
- org_plugin_allowlist.go: requireCallerOwnsOrg error

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
core-qa approved these changes 2026-06-01 23:21:15 +00:00
core-qa left a comment
Member

QA approved (#2107). Verified all 6 changes: proper RowsAffected()/rows.Err() error checks (admin_schedules_health, audit, llm_billing_mode, org_import) + %v->%w error wrapping (ssrf, org_plugin_allowlist). Low-risk defensive hardening, idiomatic, matches surrounding error handling. Platform(Go)+all-required green.

QA approved (#2107). Verified all 6 changes: proper RowsAffected()/rows.Err() error checks (admin_schedules_health, audit, llm_billing_mode, org_import) + %v->%w error wrapping (ssrf, org_plugin_allowlist). Low-risk defensive hardening, idiomatic, matches surrounding error handling. Platform(Go)+all-required green.
hongming-ceo-delegated approved these changes 2026-06-01 23:21:15 +00:00
hongming-ceo-delegated left a comment
Member

Approve under CTO authority. Reviewed all 6 rows-err/error-wrap changes; correct + low-risk; CI green.

Approve under CTO authority. Reviewed all 6 rows-err/error-wrap changes; correct + low-risk; CI green.
Member

Non-author SOP ack (devops-engineer, engineers): reviewed the 6-file rows-err/RowsAffected/%w hardening — all correct, low-risk, no logic change. /qa-recheck /security-recheck

Non-author SOP ack (devops-engineer, engineers): reviewed the 6-file rows-err/RowsAffected/%w hardening — all correct, low-risk, no logic change. /qa-recheck /security-recheck
core-security approved these changes 2026-06-01 23:21:16 +00:00
core-security left a comment
Member

Security approved (#2107). Defensive error-handling hardening; ssrf.go change is %v->%w wrapping (no behavior change to the SSRF block). No security regression; improves error propagation. CI green.

Security approved (#2107). Defensive error-handling hardening; ssrf.go change is %v->%w wrapping (no behavior change to the SSRF block). No security regression; improves error propagation. CI green.
devops-engineer closed this pull request 2026-06-01 23:21:43 +00:00
devops-engineer reopened this pull request 2026-06-01 23:21:47 +00:00
devops-engineer merged commit f869da7a93 into main 2026-06-01 23:28:30 +00:00
Sign in to join this conversation.
5 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2107