Compare commits

..

13 Commits

Author SHA1 Message Date
claude-ceo-assistant 4c54b59099 Merge pull request 'fix(ci)(interim): disable status-reaper + main-red-watchdog crons (machinery-down)' (#645) from infra/interim-disable-reaper-watchdog-crons into main
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 3s
Block internal-flavored paths / Block forbidden paths (push) Successful in 9s
CI / all-required (push) Successful in 1s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (push) Successful in 9s
Secret scan / Scan diff for credential-shaped strings (push) Successful in 9s
Handlers Postgres Integration / detect-changes (push) Successful in 17s
E2E Staging Canvas (Playwright) / detect-changes (push) Successful in 17s
E2E API Smoke Test / detect-changes (push) Successful in 18s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 13s
CI / Detect changes (push) Successful in 19s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (push) Successful in 3s
CI / Platform (Go) (push) Successful in 2s
CI / Canvas (Next.js) (push) Successful in 2s
CI / Shellcheck (E2E scripts) (push) Successful in 2s
Handlers Postgres Integration / Handlers Postgres Integration (push) Successful in 2s
CI / Python Lint & Test (push) Successful in 2s
CI / Canvas Deploy Reminder (push) Has been skipped
Sweep stale e2e-* orgs (staging) / Sweep e2e orgs (push) Successful in 2s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 3s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 5s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 9s
qa-review / approved (pull_request) Failing after 12s
CI / Detect changes (pull_request) Successful in 14s
security-review / approved (pull_request) Failing after 12s
sop-tier-check / tier-check (pull_request) Successful in 14s
E2E API Smoke Test / detect-changes (pull_request) Successful in 15s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 15s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 17s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 17s
gate-check-v3 / gate-check (pull_request) Successful in 16s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 4s
CI / Platform (Go) (pull_request) Successful in 5s
CI / Python Lint & Test (pull_request) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 6s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 5s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 7s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 6s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 7s
CI / all-required (pull_request) Successful in 2s
Staging SaaS smoke (every 30 min) / Staging SaaS smoke (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
gate-check-v3 / gate-check (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Continuous synthetic E2E (staging) / Synthetic E2E against staging (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
2026-05-12 02:45:52 +00:00
claude-ceo-assistant 6ee9ecdf0d fix(ci)(interim): disable status-reaper + main-red-watchdog crons
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 8s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 10s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 11s
qa-review / approved (pull_request) Failing after 12s
security-review / approved (pull_request) Failing after 10s
CI / Detect changes (pull_request) Successful in 17s
E2E API Smoke Test / detect-changes (pull_request) Successful in 19s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 19s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 20s
sop-tier-check / tier-check (pull_request) Successful in 11s
gate-check-v3 / gate-check (pull_request) Successful in 16s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 19s
CI / Platform (Go) (pull_request) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 5s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 4s
CI / Python Lint & Test (pull_request) Successful in 5s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 6s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 5s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 5s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 4s
CI / all-required (pull_request) Successful in 2s
audit-force-merge / audit (pull_request) Successful in 10s
RFC#420 Option-C machinery has been down ~2.5h:
- status-reaper rev2 (PR#633, merged 01:48Z): 0 'Compensated by status-reaper'
  status on the last 14 main commits. Schedule reds stranded on stale
  commits despite the rev2 sweep-last-10 design.
- main-red-watchdog: 'Failing after 10m56s' with timeout-minutes:5 — runner
  saturation queue-lag pushed it past its own timeout. No [main-red] issues
  filed during the outage despite 5 reds on HEAD e7965a0f at the high
  watermark.

Both workflows were themselves contributing to the red pileup on main +
queuing the ubuntu-latest pool. Cheap-and-safe interim: comment out the
schedule: blocks. workflow_dispatch: stays so they can be triggered
manually for debugging.

Re-enable after:
1. rev3 lands (likely scan_workflows() should LOG-and-skip rather than
   sys.exit on a malformed workflow; list_recent_commit_shas() should
   degrade gracefully)
2. Dedicated status-ops runner-label (route status-reaper + watchdog +
   ci-required-drift to it so they don't queue behind CI-merge-churn)

Per hongming-pc2 02:31Z directive: 'pick one: rev3+raise-timeout OR
temporarily disable the crons'. Choosing disable for safety while rev3
investigation proceeds.

Reviewed-by: hongming-pc2 (pre-APPROVE on sight 02:31Z)
Author: claude-ceo-assistant (orchestrator emergency; operator-host
unreachable 02:01-02:38Z blocked SSH-bridge to core-devops persona)

Cross-links: task #90 (rev2), task #75 (main-red sweep), RFC#420 Option-C
2026-05-11 19:39:43 -07:00
core-devops c9166faac2 Merge pull request 'feat(ci): wire review-check.sh regression tests into CI (closes #540)' (#620) from ci/review-check-tests-wire into main
Block internal-flavored paths / Block forbidden paths (push) Successful in 12s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (push) Successful in 15s
review-check-tests / review-check.sh regression tests (push) Successful in 18s
Secret scan / Scan diff for credential-shaped strings (push) Successful in 15s
CI / Detect changes (push) Successful in 43s
E2E API Smoke Test / detect-changes (push) Successful in 43s
E2E Staging Canvas (Playwright) / detect-changes (push) Successful in 44s
CI / Platform (Go) (push) Successful in 8s
CI / Canvas (Next.js) (push) Successful in 7s
CI / Shellcheck (E2E scripts) (push) Successful in 6s
CI / Python Lint & Test (push) Successful in 6s
Handlers Postgres Integration / detect-changes (push) Successful in 45s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 43s
CI / Canvas Deploy Reminder (push) Has been skipped
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 9s
CI / all-required (push) Successful in 5s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (push) Successful in 9s
Handlers Postgres Integration / Handlers Postgres Integration (push) Successful in 9s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 9s
Sweep stale e2e-* orgs (staging) / Sweep e2e orgs (push) Successful in 2s
status-reaper / reap (push) Successful in 1m3s
Continuous synthetic E2E (staging) / Synthetic E2E against staging (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Sweep stale Cloudflare Tunnels / Sweep CF tunnels (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Sweep stale AWS Secrets Manager secrets / Sweep AWS Secrets Manager (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Staging SaaS smoke (every 30 min) / Staging SaaS smoke (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
2026-05-12 02:27:39 +00:00
core-lead 2ca0433a35 Merge branch 'main' into ci/review-check-tests-wire
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 4s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 5s
CI / Detect changes (pull_request) Successful in 8s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 9s
review-check-tests / review-check.sh regression tests (pull_request) Successful in 9s
qa-review / approved (pull_request) Failing after 10s
security-review / approved (pull_request) Failing after 10s
E2E API Smoke Test / detect-changes (pull_request) Successful in 13s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 13s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 14s
gate-check-v3 / gate-check (pull_request) Successful in 14s
CI / Platform (Go) (pull_request) Successful in 5s
sop-tier-check / tier-check (pull_request) Successful in 12s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 15s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 4s
CI / Canvas (Next.js) (pull_request) Successful in 4s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CI / Python Lint & Test (pull_request) Successful in 3s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 3s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
CI / all-required (pull_request) Successful in 1s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2s
audit-force-merge / audit (pull_request) Successful in 16s
2026-05-12 01:55:16 +00:00
claude-ceo-assistant e7965a0f0c Merge pull request 'feat(ci): status-reaper rev2 sweeps last 10 main commits (closes stranded-status gap)' (#633) from infra/status-reaper-rev2-sweep-recent-commits into main
Block internal-flavored paths / Block forbidden paths (push) Successful in 6s
Secret scan / Scan diff for credential-shaped strings (push) Successful in 6s
CI / Detect changes (push) Successful in 11s
E2E API Smoke Test / detect-changes (push) Successful in 12s
E2E Staging Canvas (Playwright) / detect-changes (push) Successful in 11s
Handlers Postgres Integration / detect-changes (push) Successful in 11s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 12s
CI / Shellcheck (E2E scripts) (push) Successful in 2s
CI / Platform (Go) (push) Successful in 2s
CI / Canvas (Next.js) (push) Successful in 2s
CI / Python Lint & Test (push) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (push) Successful in 3s
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 3s
CI / Canvas Deploy Reminder (push) Has been skipped
Handlers Postgres Integration / Handlers Postgres Integration (push) Successful in 3s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 3s
CI / all-required (push) Successful in 1s
Sweep stale e2e-* orgs (staging) / Sweep e2e orgs (push) Successful in 7s
status-reaper / reap (push) Successful in 1m43s
Staging SaaS smoke (every 30 min) / Staging SaaS smoke (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
gate-check-v3 / gate-check (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Sweep stale Cloudflare DNS records / Sweep CF orphans (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
main-red-watchdog / watchdog (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
ci-required-drift / drift (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Continuous synthetic E2E (staging) / Synthetic E2E against staging (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
2026-05-12 01:47:57 +00:00
claude-ceo-assistant f6f477d6b3 Merge branch 'main' into infra/status-reaper-rev2-sweep-recent-commits
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 7s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 15s
qa-review / approved (pull_request) Failing after 17s
security-review / approved (pull_request) Failing after 17s
sop-tier-check / tier-check (pull_request) Successful in 18s
CI / Detect changes (pull_request) Successful in 21s
gate-check-v3 / gate-check (pull_request) Successful in 21s
E2E API Smoke Test / detect-changes (pull_request) Successful in 22s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 23s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 23s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 24s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Platform (Go) (pull_request) Successful in 3s
CI / Canvas (Next.js) (pull_request) Successful in 3s
CI / Python Lint & Test (pull_request) Successful in 3s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 3s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 4s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 3s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 4s
CI / all-required (pull_request) Successful in 1s
audit-force-merge / audit (pull_request) Successful in 7s
2026-05-12 01:47:16 +00:00
app-fe 83b4e4a88a Merge pull request 'test(tabs): export + unit-test getSkills + extractSkills (28 cases)' (#629) from test/skill-helpers-coverage into main
CI / Canvas Deploy Reminder (push) Blocked by required conditions
CI / all-required (push) Blocked by required conditions
Block internal-flavored paths / Block forbidden paths (push) Successful in 6s
Harness Replays / detect-changes (push) Successful in 8s
Secret scan / Scan diff for credential-shaped strings (push) Successful in 8s
publish-workspace-server-image / build-and-push (push) Failing after 9s
CI / Detect changes (push) Successful in 14s
E2E API Smoke Test / detect-changes (push) Successful in 15s
Harness Replays / Harness Replays (push) Successful in 4s
Handlers Postgres Integration / detect-changes (push) Successful in 16s
E2E Staging Canvas (Playwright) / detect-changes (push) Successful in 16s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 15s
CI / Shellcheck (E2E scripts) (push) Successful in 4s
CI / Platform (Go) (push) Successful in 4s
CI / Python Lint & Test (push) Successful in 4s
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 5s
Handlers Postgres Integration / Handlers Postgres Integration (push) Successful in 5s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 4s
publish-canvas-image / Build & push canvas image (push) Failing after 34s
CI / Canvas (Next.js) (push) Has been cancelled
E2E Staging Canvas (Playwright) / Canvas tabs E2E (push) Has been cancelled
2026-05-12 01:45:57 +00:00
core-devops 98323734ea feat(ci): status-reaper rev2 sweeps last 10 main commits (closes stranded-status gap)
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 10s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 15s
qa-review / approved (pull_request) Failing after 14s
CI / Detect changes (pull_request) Successful in 24s
security-review / approved (pull_request) Failing after 12s
sop-tier-check / tier-check (pull_request) Successful in 12s
E2E API Smoke Test / detect-changes (pull_request) Successful in 26s
gate-check-v3 / gate-check (pull_request) Successful in 22s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 26s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 27s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 26s
CI / Platform (Go) (pull_request) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 4s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 5s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 7s
CI / Python Lint & Test (pull_request) Successful in 7s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 6s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 6s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 7s
CI / all-required (pull_request) Successful in 3s
rev1 (PR #618, merged 4db64bcb) only inspected the CURRENT main HEAD per
tick. Schedule workflows post `failure` to whatever SHA was HEAD when the
run COMPLETED, which by the next */5 tick is usually a stale commit
because main has already moved forward via merges. Result: rev1 was
running successfully but with `compensated:0` on every tick across ~6
cycles (orchestrator + hongming-pc2 Phase 1+2 evidence 23:46Z / 23:59Z /
00:02Z); reds stranded on stale commits.

rev2 sweeps the last 10 main commits per tick:

- New `list_recent_commit_shas(branch, limit)` wraps
  GET /repos/{o}/{r}/commits?sha={branch}&limit={limit}. Vendor-truth
  probe 2026-05-11 confirms Gitea 1.22.6 returns a JSON list of commit
  objects with `sha` keys (per `feedback_smoke_test_vendor_truth_not_
  shape_match`).
- New `reap_branch()` orchestrates the sweep:
  - For each SHA: GET combined status with PER-SHA ERROR ISOLATION
    (refinement #7) — ApiError on one stale SHA logs `::warning::` and
    continues to the next. Different from the single-HEAD pre-rev2 path
    where fail-loud was correct; the sweep is best-effort across
    historical commits.
  - When `combined.state == "success"`: skip the per-context loop
    entirely (refinement #2, cost optimization, common case).
  - Otherwise delegate to the existing per-SHA `reap()` worker (logic
    UNCHANGED — `_has_push_trigger` / `parse_push_context` /
    `scan_workflows` not touched per refinement #6).
- Aggregated counters preserve all rev1 fields PLUS:
  - `scanned_shas`: how many SHAs we actually iterated (always 10
    in normal operation; less if commits API returns fewer)
  - `compensated_per_sha`: {<full_sha>: [<context>, ...]} for the
    SHAs that actually got at least one compensation
- `reap()` now also returns `compensated_contexts` so `reap_branch()`
  can build `compensated_per_sha` without re-deriving it from the POST
  stream. Backwards-compatible — all existing test assertions check
  specific counter keys, none enforce a closed dict shape.
- `main()` switches from `get_head_sha` + `get_combined_status` + `reap`
  to a single `reap_branch()` call. Adds `--limit` CLI flag for
  ops-driven sweep-width tuning (default 10).

Design choices (refinements 1-4):
- N=10: covers the burst-merge window between */5 ticks; older reds
  falling off acceptable (the schedule run that posted them has long
  since been overwritten by a real push trigger).
- Skip combined=success early: most commits in the window will be green;
  short-circuit before the per-context loop saves work.
- No de-dup needed (refinement #4): each workflow run posts to exactly
  one SHA, so two different SHAs in the sweep cannot have the same
  (context) pair eligible for compensation.

Test suite: 37 + 3 = 40/40 cases pass.
- New: test_reap_sweeps_n_shas_smoke (mock 3 SHAs, verify each GET'd)
- New: test_reap_skips_combined_success_shas (verify the
  combined=success short-circuit; only the 1 failure SHA is iterated)
- New: test_reap_continues_on_per_sha_apierror (per-SHA error isolation
  contract — ApiError on SHA[0] logged + skipped + SHA[1] processes)
- All 37 existing rev1 tests pass unchanged (per-SHA worker logic + the
  helpers it consumes are untouched).

Live dry-run smoke against git.moleculesai.app:
  scanned 41 workflows; push-triggered=18, class-O candidates=23
  summary: {"branch":"main","compensated":0,"compensated_per_sha":{},
           "dry_run":true,"limit":10,"preserved_non_failure":196,
           ...,"scanned_shas":10}

Cross-link:
- internal#327 (sibling publish-runtime-bot)
- task #90 (orchestrator brief), task #46 (hongming-pc2 brief)
- PR #618 (parent rev1, merge 4db64bcb)
- `reference_post_suspension_pipeline`
- `feedback_no_shared_persona_token_use` (commit author = core-devops, not hongming-pc2)
- `feedback_strict_root_only_after_class_a` (root cause, not symptom)
- `feedback_brief_hypothesis_vs_evidence` (evidence: compensated:0 across 6 cycles)

Removal path: drop this workflow when Gitea >= 1.24 ships with a real
fix for the hardcoded-suffix bug. Audit issue (filed alongside rev1)
tracks the deletion as a follow-up sweep.
2026-05-11 18:41:39 -07:00
app-fe 1f2089a6a9 chore: retimestamp to retrigger CI
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 15s
Harness Replays / detect-changes (pull_request) Successful in 18s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 16s
CI / Detect changes (pull_request) Successful in 41s
E2E API Smoke Test / detect-changes (pull_request) Successful in 42s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 38s
gate-check-v3 / gate-check (pull_request) Successful in 29s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 49s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 41s
Harness Replays / Harness Replays (pull_request) Successful in 8s
qa-review / approved (pull_request) Failing after 17s
security-review / approved (pull_request) Failing after 20s
CI / Platform (Go) (pull_request) Successful in 10s
sop-tier-check / tier-check (pull_request) Successful in 21s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 7s
CI / Python Lint & Test (pull_request) Successful in 9s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 9s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 11s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 7s
CI / Canvas (Next.js) (pull_request) Successful in 7m20s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CI / all-required (pull_request) Successful in 1s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 7m25s
audit-force-merge / audit (pull_request) Successful in 6s
2026-05-12 01:34:45 +00:00
app-fe 4d2636f31a test(tabs): export and unit-test getSkills + extractSkills pure helpers (28 cases)
getSkills (DetailsTab): null/undefined/empty inputs, id+name priority,
description truthy-guard edge cases, id-name precedence, falsy coercion.

extractSkills (SkillsTab): same inputs plus tags/examples coercion,
"undefined" id vs "Unnamed skill" name distinction, mixed valid/invalid.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 01:34:45 +00:00
app-fe 451cec1a75 Merge pull request 'test(ui): add KeyValueField + RevealToggle + ValidationHint coverage (29 cases)' (#616) from test/ui-primitive-coverage into main
Block internal-flavored paths / Block forbidden paths (push) Successful in 3s
Harness Replays / detect-changes (push) Successful in 8s
CI / Detect changes (push) Successful in 11s
Secret scan / Scan diff for credential-shaped strings (push) Successful in 9s
E2E API Smoke Test / detect-changes (push) Successful in 17s
Handlers Postgres Integration / detect-changes (push) Successful in 21s
E2E Staging Canvas (Playwright) / detect-changes (push) Successful in 22s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 22s
Harness Replays / Harness Replays (push) Successful in 7s
publish-workspace-server-image / build-and-push (push) Failing after 28s
CI / Platform (Go) (push) Successful in 7s
CI / Shellcheck (E2E scripts) (push) Successful in 7s
CI / Python Lint & Test (push) Successful in 7s
Handlers Postgres Integration / Handlers Postgres Integration (push) Successful in 6s
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 7s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 5s
publish-canvas-image / Build & push canvas image (push) Failing after 44s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (push) Successful in 7m25s
CI / Canvas (Next.js) (push) Successful in 8m49s
CI / Canvas Deploy Reminder (push) Successful in 3s
CI / all-required (push) Successful in 3s
Sweep stale e2e-* orgs (staging) / Sweep e2e orgs (push) Successful in 3s
status-reaper / reap (push) Successful in 53s
Sweep stale Cloudflare Tunnels / Sweep CF tunnels (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Continuous synthetic E2E (staging) / Synthetic E2E against staging (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
2026-05-12 01:33:40 +00:00
core-devops c74c0a0283 fix(ci): add jq install to review-check-tests workflow + fix /tmp/jq hardcode
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 14s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 14s
CI / Detect changes (pull_request) Successful in 25s
review-check-tests / review-check.sh regression tests (pull_request) Successful in 15s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 32s
E2E API Smoke Test / detect-changes (pull_request) Successful in 34s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 34s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 17s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 30s
qa-review / approved (pull_request) Failing after 17s
security-review / approved (pull_request) Failing after 16s
sop-tier-check / tier-check (pull_request) Successful in 18s
gate-check-v3 / gate-check (pull_request) Successful in 27s
CI / Platform (Go) (pull_request) Successful in 7s
CI / Canvas (Next.js) (pull_request) Successful in 7s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 5s
CI / Python Lint & Test (pull_request) Successful in 6s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 6s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 9s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 6s
CI / all-required (pull_request) Successful in 3s
Two fixes found during first CI run:

1. Workflow missing jq installation step — T12 jq-filter test needs jq
   which is not in the Gitea Actions ubuntu-latest runner image.
   Add the same install dance as sop-tier-check.yml (apt-get first,
   GitHub binary download fallback, infra#241 belt-and-suspenders).

2. test_review_check.sh hardcodes /tmp/jq in T12. In CI jq gets
   installed to /usr/bin/jq via apt-get. Fix: use `command -v jq` to
   resolve from PATH first, fall back to /tmp/jq for local dev.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 01:24:24 +00:00
core-devops a2a1e644ab feat(ci): wire review-check.sh regression tests into CI (closes #540)
New workflow .gitea/workflows/review-check-tests.yml triggers on
every PR + push that touches review-check.sh or its test fixtures.
Runs the existing 22-scenario regression suite (test_review_check.sh)
which covers all issue #540 acceptance criteria.

CONTRIBUTING.md updated with:
- review-check-tests row in the CI job table
- Local testing section with the smoke command

Note: tests are bash-based (not bats) per existing test_review_check.sh
design. Converting to bats would be refactoring rather than closing the gap.
Bats dependency was never added to the runner-base image.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 01:24:24 +00:00
11 changed files with 687 additions and 34 deletions
+179 -20
View File
@@ -19,18 +19,34 @@ What this script does, per `.gitea/workflows/status-reaper.yml` invocation:
downstream — Gitea uses ` / ` as the workflow/job separator).
Classify each by whether `on:` contains a `push:` trigger.
2. GET combined status for HEAD of WATCH_BRANCH.
2. List the last N (=10) commits on WATCH_BRANCH via
GET /repos/{o}/{r}/commits?sha={branch}&limit={N}. rev2 sweeps
N commits per tick instead of HEAD only — schedule workflows
post `failure` to whatever SHA was HEAD when they COMPLETED, so
by the next */5 tick main has often moved forward and the red
gets stranded on a stale commit (Phase 1+2 evidence: rev1 saw
`compensated:0` every tick across ~6 cycles).
3. For each per-context status entry where:
state == "failure" AND context.endswith(" (push)")
Parse context as `<workflow_name> / <job_name> (push)`. Look up
workflow_name in the trigger map:
- missing → log ::notice:: and skip (conservative).
- has_push_trigger=True → preserve (would mask real signal).
- has_push_trigger=False → POST a compensating
`state=success` status to /statuses/{sha} with the same
context (Gitea de-dups by context) and a description that
documents the workaround + this script's path.
3. For EACH SHA in the list:
- GET combined commit status. Per-SHA error isolation
(refinement #7): if this call raises ApiError or any 5xx,
LOG `::warning::` + continue to the next SHA. Different from
the single-HEAD pre-rev2 path where fail-loud was correct;
the sweep is best-effort across historical commits, so one
transient blip on a stale SHA must not strand reds on the
OTHER stale SHAs.
- If combined.state == "success": skip — cost optimization
(refinement #2), common case (most commits are green).
- Otherwise iterate per-context entries. For each entry where:
state == "failure" AND context.endswith(" (push)")
Parse context as `<workflow_name> / <job_name> (push)`.
Look up workflow_name in the trigger map:
- missing → log ::notice:: and skip (conservative).
- has_push_trigger=True → preserve (real defect signal).
- has_push_trigger=False → POST a compensating
`state=success` status to /statuses/{sha} with the same
context (Gitea de-dups by context) and a description
documenting the workaround + this script's path.
4. Exit 0. Re-running is idempotent — Gitea's commit-status table
stores the LATEST state-per-context, so the success POST sticks
@@ -401,21 +417,29 @@ def reap(
sha: str,
*,
dry_run: bool = False,
) -> dict[str, int]:
) -> dict[str, Any]:
"""Walk `combined.statuses[]` and compensate where appropriate.
Per-SHA worker. The multi-SHA orchestrator (`reap_branch`) calls
this once per stale main commit each tick.
Returns counters for observability:
{compensated, preserved_real_push, preserved_unknown,
preserved_non_failure, preserved_non_push_suffix,
preserved_unparseable}
preserved_unparseable,
compensated_contexts: [<context>, ...]}
`compensated_contexts` is rev2-added so `reap_branch` can build
`compensated_per_sha` without re-deriving it from the POST stream.
"""
counters = {
counters: dict[str, Any] = {
"compensated": 0,
"preserved_real_push": 0,
"preserved_unknown": 0,
"preserved_non_failure": 0,
"preserved_non_push_suffix": 0,
"preserved_unparseable": 0,
"compensated_contexts": [],
}
statuses = combined.get("statuses") or []
@@ -464,10 +488,136 @@ def reap(
sha, context, s.get("target_url"), dry_run=dry_run
)
counters["compensated"] += 1
counters["compensated_contexts"].append(context)
return counters
# --------------------------------------------------------------------------
# rev2: multi-SHA sweep over the last N commits on WATCH_BRANCH
# --------------------------------------------------------------------------
# How many main commits to sweep per tick. Sized to cover a burst-merge
# window where multiple PRs land in the 5-min interval between reaper
# ticks. Older reds falling off the window is acceptable — they were
# already stale enough that the schedule-run that posted them has long
# since been overwritten by a real push trigger. See `reference_post_
# suspension_pipeline` for the merge-cadence baseline.
DEFAULT_SWEEP_LIMIT = 10
def list_recent_commit_shas(branch: str, limit: int) -> list[str]:
"""List the most recent `limit` commit SHAs on `branch`, newest
first.
Wraps GET /repos/{o}/{r}/commits?sha={branch}&limit={limit}. Gitea
1.22.6 returns a JSON list of commit objects each with a `sha` key
(verified via vendor-truth probe 2026-05-11 against
git.moleculesai.app — `feedback_smoke_test_vendor_truth_not_shape_match`).
Raises ApiError on non-2xx OR on unexpected response shape. This is
a HARD halt — without the commit list the sweep can't proceed. (The
per-SHA error isolation downstream is a different concern: tolerating
a transient 5xx on ONE commit's status is best-effort; losing the
commit list itself means we don't even know which commits to try.)
"""
_, body = api(
"GET",
f"/repos/{OWNER}/{NAME}/commits",
query={"sha": branch, "limit": str(limit)},
)
if not isinstance(body, list):
raise ApiError(
f"commits listing for {branch} not a JSON array "
f"(got {type(body).__name__})"
)
shas: list[str] = []
for entry in body:
if not isinstance(entry, dict):
continue
sha = entry.get("sha")
if isinstance(sha, str) and len(sha) >= 7:
shas.append(sha)
if not shas:
raise ApiError(
f"commits listing for {branch} returned no usable SHAs"
)
return shas
def reap_branch(
workflow_trigger_map: dict[str, bool],
branch: str,
*,
limit: int = DEFAULT_SWEEP_LIMIT,
dry_run: bool = False,
) -> dict[str, Any]:
"""Sweep the last `limit` commits on `branch`, applying `reap()`
to each (with per-SHA error isolation).
Returns aggregated counters PLUS rev2 observability fields:
- scanned_shas: how many SHAs we actually iterated
- compensated_per_sha: {<sha_full>: [<context>, ...]} — only
SHAs that actually got at least one compensation are included
"""
shas = list_recent_commit_shas(branch, limit)
aggregate: dict[str, Any] = {
"scanned_shas": 0,
"compensated": 0,
"preserved_real_push": 0,
"preserved_unknown": 0,
"preserved_non_failure": 0,
"preserved_non_push_suffix": 0,
"preserved_unparseable": 0,
"compensated_per_sha": {},
}
for sha in shas:
aggregate["scanned_shas"] += 1
# Per-SHA error isolation (refinement #7). One transient blip
# on a historical commit must NOT abort the whole tick — the
# OTHER stale SHAs may still hold strandable reds.
try:
combined = get_combined_status(sha)
except ApiError as e:
print(
f"::warning::get_combined_status({sha[:10]}) failed; "
f"skipping this SHA: {e}"
)
continue
# Cost optimization (refinement #2): the common case is a green
# commit. Skip the per-context loop entirely when combined is
# already success — saves a tight loop over ~20 statuses per SHA
# on green commits, the dominant majority.
if combined.get("state") == "success":
continue
per_sha = reap(
workflow_trigger_map, combined, sha, dry_run=dry_run
)
# Aggregate scalar counters.
for key in (
"compensated",
"preserved_real_push",
"preserved_unknown",
"preserved_non_failure",
"preserved_non_push_suffix",
"preserved_unparseable",
):
aggregate[key] += per_sha[key]
# Record per-SHA compensated contexts (only when non-empty —
# keep the summary readable when most SHAs are no-ops).
contexts = per_sha.get("compensated_contexts") or []
if contexts:
aggregate["compensated_per_sha"][sha] = list(contexts)
return aggregate
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
@@ -475,6 +625,15 @@ def main() -> int:
action="store_true",
help="Skip the compensating POST; print what would be done.",
)
parser.add_argument(
"--limit",
type=int,
default=DEFAULT_SWEEP_LIMIT,
help=(
"How many recent commits on WATCH_BRANCH to sweep per tick "
f"(default: {DEFAULT_SWEEP_LIMIT})."
),
)
args = parser.parse_args()
_require_runtime_env()
@@ -486,11 +645,11 @@ def main() -> int:
f"class-O candidates={sum(1 for v in workflow_trigger_map.values() if not v)}"
)
sha = get_head_sha(WATCH_BRANCH)
combined = get_combined_status(sha)
counters = reap(
workflow_trigger_map, combined, sha, dry_run=args.dry_run
counters = reap_branch(
workflow_trigger_map,
WATCH_BRANCH,
limit=args.limit,
dry_run=args.dry_run,
)
# Observability: print one JSON line summarising the tick. Loki
@@ -499,9 +658,9 @@ def main() -> int:
"status-reaper summary: "
+ json.dumps(
{
"sha": sha,
"branch": WATCH_BRANCH,
"dry_run": args.dry_run,
"limit": args.limit,
**counters,
},
sort_keys=True,
+2 -1
View File
@@ -317,7 +317,8 @@ JQ_FILTER='.[]
T12_INPUT='[{"state":"APPROVED","dismissed":false,"user":{"login":"core-devops"}},{"state":"CHANGES_REQUESTED","dismissed":false,"user":{"login":"bob"}},{"state":"APPROVED","dismissed":false,"user":{"login":"alice"}},{"state":"APPROVED","dismissed":true,"user":{"login":"carol"}}]'
T12_CANDIDATES=$(echo "$T12_INPUT" | /tmp/jq -r "$JQ_FILTER" 2>/dev/null | sort -u)
JQ_CMD=$(command -v jq 2>/dev/null || echo /tmp/jq)
T12_CANDIDATES=$(echo "$T12_INPUT" | "$JQ_CMD" -r "$JQ_FILTER" 2>/dev/null | sort -u)
assert_contains "T12 jq: core-devops (non-author APPROVED) in candidates" "core-devops" "$T12_CANDIDATES"
assert_eq "T12 jq: alice (author) NOT in candidates" "" "$(echo "$T12_CANDIDATES" | grep '^alice$' || true)"
assert_eq "T12 jq: carol (dismissed) NOT in candidates" "" "$(echo "$T12_CANDIDATES" | grep '^carol$' || true)"
+7 -4
View File
@@ -37,10 +37,13 @@ name: main-red-watchdog
# "unknown on type" when `workflow_dispatch.inputs.X` is present. Revisit
# when Gitea ≥ 1.23 is fleet-wide.
on:
schedule:
# Hourly at :05 — task spec calls for "off-zero" (`5 * * * *`),
# offset from :17 (ci-required-drift) and :00 (peak cron load).
- cron: '5 * * * *'
# SCHEDULE DISABLED 2026-05-12 — interim per RFC#420 Option-C machinery-down emergency
# Watchdog timing out behind runner saturation; rev3+dedicated-runner-label in flight
# Re-enable after rev3 lands + runner saturation root resolved
# schedule:
# # Hourly at :05 — task spec calls for "off-zero" (`5 * * * *`),
# # offset from :17 (ci-required-drift) and :00 (peak cron load).
# - cron: '5 * * * *'
workflow_dispatch:
# Read commit status + branch ref + issues; write issues (open/PATCH/close).
+70
View File
@@ -0,0 +1,70 @@
name: review-check-tests
# Runs review-check.sh regression tests on every PR + push that touches
# the evaluator script or its test fixtures.
#
# Follows RFC#324 follow-up (issue #540):
# .gitea/scripts/review-check.sh is load-bearing for PR merge gates.
# It has ZERO production CI coverage. This workflow closes that gap.
#
# Design choices:
# - Bash test harness (not bats). The existing test_review_check.sh
# uses a custom assert_eq/assert_contains framework that is already
# working and covers all 13 acceptance criteria (issue #540 §Acceptance).
# Converting to bats would be refactoring, not closing the gap.
# - No bats dependency: the runner-base image needs no extra tooling.
# - continue-on-error: false — these tests must pass; a failure means
# the review-gate evaluator is broken and must not be merged.
on:
push:
branches: [main, staging]
paths:
- '.gitea/scripts/review-check.sh'
- '.gitea/scripts/tests/test_review_check.sh'
- '.gitea/scripts/tests/_review_check_fixture.py'
- '.gitea/workflows/review-check-tests.yml'
pull_request:
branches: [main, staging]
paths:
- '.gitea/scripts/review-check.sh'
- '.gitea/scripts/tests/test_review_check.sh'
- '.gitea/scripts/tests/_review_check_fixture.py'
- '.gitea/workflows/review-check-tests.yml'
workflow_dispatch:
env:
GITHUB_SERVER_URL: https://git.moleculesai.app
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: review-check.sh regression tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install jq
# Required for T12 jq-filter test case. Gitea Actions runners (ubuntu-latest
# label) do not bundle jq. Install via apt-get first (reliable for Ubuntu
# runners with internet access to package mirrors). Falls back to GitHub
# binary download. GitHub releases may be blocked on some runner networks
# (infra#241 follow-up).
continue-on-error: true
run: |
if apt-get update -qq && apt-get install -y -qq jq; then
echo "::notice::jq installed via apt-get: $(jq --version)"
elif timeout 120 curl -sSL \
"https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-amd64" \
-o /usr/local/bin/jq && chmod +x /usr/local/bin/jq; then
echo "::notice::jq binary downloaded: $(/usr/local/bin/jq --version)"
else
echo "::warning::jq install failed — apt-get and GitHub download both failed."
fi
jq --version 2>/dev/null || echo "::notice::jq not yet available — continuing"
- name: Run review-check.sh regression suite
run: bash .gitea/scripts/tests/test_review_check.sh
+10 -7
View File
@@ -53,13 +53,16 @@ name: status-reaper
# `inputs:` block here. Gitea 1.22.6 rejects the whole workflow as
# "unknown on type" when `workflow_dispatch.inputs.X` is present.
on:
schedule:
# Every 5 minutes. Off-zero alignment with sibling cron workflows:
# ci-required-drift (`:17`), main-red-watchdog (`:05`),
# railway-pin-audit (`:23`). 5-min cadence gives a tight enough
# close on schedule-triggered false-reds that main-red-watchdog
# (hourly :05) almost never files an issue on the false case.
- cron: '*/5 * * * *'
# SCHEDULE DISABLED 2026-05-12 — interim per RFC#420 Option-C machinery-down emergency
# Reaper rev2 not compensating + watchdog timeout-cascade; rev3 in flight
# Re-enable after rev3 lands + runner saturation root resolved
# schedule:
# # Every 5 minutes. Off-zero alignment with sibling cron workflows:
# # ci-required-drift (`:17`), main-red-watchdog (`:05`),
# # railway-pin-audit (`:23`). 5-min cadence gives a tight enough
# # close on schedule-triggered false-reds that main-red-watchdog
# # (hourly :05) almost never files an issue on the false case.
# - cron: '*/5 * * * *'
workflow_dispatch:
# Compensating-status POST needs write on repo statuses; no other
+10
View File
@@ -156,6 +156,16 @@ and run CI manually.
| python-lint | pytest with coverage |
| e2e-api | Full API test suite (62 tests) |
| shellcheck | Shell script linting |
| review-check-tests | `review-check.sh` evaluator regression suite (13 scenarios) |
| ops-scripts | Python unittest suite for `scripts/*.py` |
## Local Testing
### review-check.sh
```bash
bash .gitea/scripts/tests/test_review_check.sh
```
Runs the full regression suite against a fixture HTTP server. No network access required.
## Code Style
+1 -1
View File
@@ -402,7 +402,7 @@ function Row({ label, value, mono }: { label: string; value: string; mono?: bool
);
}
function getSkills(card: Record<string, unknown> | null): { id: string; description?: string }[] {
export function getSkills(card: Record<string, unknown> | null): { id: string; description?: string }[] {
if (!card) return [];
const skills = card.skills;
if (!Array.isArray(skills)) return [];
+1 -1
View File
@@ -647,7 +647,7 @@ export function SkillsTab({ workspaceId, data }: Props) {
);
}
function extractSkills(agentCard: Record<string, unknown> | null): SkillEntry[] {
export function extractSkills(agentCard: Record<string, unknown> | null): SkillEntry[] {
if (!agentCard) return [];
const rawSkills = agentCard.skills;
if (!Array.isArray(rawSkills)) return [];
@@ -0,0 +1,140 @@
// @vitest-environment jsdom
/**
* Unit tests for extractSkills — pure helper from SkillsTab.
*
* Covers: null card, non-array skills, empty skills, full skill entries
* (id, name, description, tags, examples), id-only fallback, name-only
* fallback, string coercion, array coercion for tags/examples,
* filtering entries with no id after coercion, empty string id (filtered).
*/
import { describe, it, expect } from "vitest";
import { extractSkills } from "../SkillsTab";
describe("extractSkills", () => {
it("returns [] for null card", () => {
expect(extractSkills(null)).toEqual([]);
});
it("returns [] when card.skills is not an array", () => {
expect(extractSkills({ skills: undefined })).toEqual([]);
expect(extractSkills({ skills: "not-an-array" })).toEqual([]);
expect(extractSkills({ skills: { id: "x" } })).toEqual([]);
});
it("returns [] for empty skills array", () => {
expect(extractSkills({ skills: [] })).toEqual([]);
});
it("maps a fully-populated skill entry", () => {
const card = {
skills: [
{
id: "code_search",
name: "Code Search",
description: "Semantic code search",
tags: ["search", "code"],
examples: ["Find unused exports", "Search by AST pattern"],
},
],
};
expect(extractSkills(card)).toEqual([
{
id: "code_search",
name: "Code Search",
description: "Semantic code search",
tags: ["search", "code"],
examples: ["Find unused exports", "Search by AST pattern"],
},
]);
});
it("uses name as id when id is absent", () => {
const card = { skills: [{ name: "web_scraper" }] };
expect(extractSkills(card)).toEqual([
{ id: "web_scraper", name: "web_scraper", description: "", tags: [], examples: [] },
]);
});
it("uses id as name when name is absent", () => {
const card = { skills: [{ id: "legacy_skill" }] };
expect(extractSkills(card)).toEqual([
{ id: "legacy_skill", name: "legacy_skill", description: "", tags: [], examples: [] },
]);
});
it("filters out entries with neither id nor name", () => {
// id: String(undefined || undefined || "") → "" → filtered (id.length = 0)
const card = { skills: [{ description: "orphan entry" }] };
expect(extractSkills(card)).toEqual([]);
});
it("filters out entries with no id after string coercion", () => {
// id resolves to "" after String(undefined || null || {})
const card = { skills: [{ id: null, name: null }] };
expect(extractSkills(card)).toEqual([]);
});
it("filters out entries with empty-string id", () => {
const card = { skills: [{ id: "", name: "" }] };
expect(extractSkills(card)).toEqual([]);
});
it("coerces numeric tags to strings", () => {
const card = { skills: [{ id: "x", tags: [1, "two", 3] }] };
expect(extractSkills(card)).toEqual([
{ id: "x", name: "x", description: "", tags: ["1", "two", "3"], examples: [] },
]);
});
it("coerces non-array tags to empty array", () => {
const card = { skills: [{ id: "x", tags: "not-an-array" }] };
expect(extractSkills(card)).toEqual([
{ id: "x", name: "x", description: "", tags: [], examples: [] },
]);
});
it("coerces non-array examples to empty array", () => {
const card = { skills: [{ id: "x", examples: 42 }] };
expect(extractSkills(card)).toEqual([
{ id: "x", name: "x", description: "", tags: [], examples: [] },
]);
});
// NOTE: extractSkills uses `String(skill.description || "")` — falsy values
// (0, null, false) fall through to "", NOT to their string form.
it("returns '' for falsy description values (0, null, false)", () => {
const card = { skills: [{ id: "x", description: 0 }] };
expect(extractSkills(card)).toEqual([
{ id: "x", name: "x", description: "", tags: [], examples: [] },
]);
});
it("handles mixed valid/invalid entries", () => {
const card = {
skills: [
{ id: "valid_one", name: "One" },
{ name: "named_only" },
{ description: "orphan" }, // filtered — id becomes ""
{ id: "valid_two", examples: ["a", "b"] },
],
};
expect(extractSkills(card)).toEqual([
{ id: "valid_one", name: "One", description: "", tags: [], examples: [] },
{ id: "named_only", name: "named_only", description: "", tags: [], examples: [] },
{ id: "valid_two", name: "valid_two", description: "", tags: [], examples: ["a", "b"] },
]);
});
it("handles a realistic agent card with multiple skills", () => {
const card = {
skills: [
{ id: "web_search", name: "Web Search", description: "Search the web", tags: ["search"], examples: ["Latest news"] },
{ id: "file_read", name: "Read Files", description: "Read from disk", tags: ["io"], examples: [] },
],
};
const result = extractSkills(card);
expect(result).toHaveLength(2);
expect(result[0].id).toBe("web_search");
expect(result[1].tags).toEqual(["io"]);
});
});
@@ -0,0 +1,95 @@
// @vitest-environment jsdom
/**
* Unit tests for getSkills — pure helper from DetailsTab.
*
* Covers: null card, non-array skills, empty skills, id-only entries,
* name-only entries (id derives from name), entries with description,
* entries with neither id nor name (filtered out), mixed entries.
*/
import { describe, it, expect } from "vitest";
import { getSkills } from "../DetailsTab";
describe("getSkills", () => {
it("returns [] for null card", () => {
expect(getSkills(null)).toEqual([]);
});
it("returns [] when card.skills is not an array", () => {
expect(getSkills({ skills: undefined })).toEqual([]);
expect(getSkills({ skills: "not-an-array" })).toEqual([]);
expect(getSkills({ skills: { id: "x" } })).toEqual([]);
});
it("returns [] for empty skills array", () => {
expect(getSkills({ skills: [] })).toEqual([]);
});
it("maps skill with id and description", () => {
const card = { skills: [{ id: "code_search", description: "Find code patterns" }] };
expect(getSkills(card)).toEqual([{ id: "code_search", description: "Find code patterns" }]);
});
it("maps skill with id only (description absent)", () => {
const card = { skills: [{ id: "code_search" }] };
expect(getSkills(card)).toEqual([{ id: "code_search", description: undefined }]);
});
it("derives id from name when id is absent", () => {
const card = { skills: [{ name: "web_scraper" }] };
expect(getSkills(card)).toEqual([{ id: "web_scraper" }]);
});
it("maps description when present", () => {
const card = { skills: [{ id: "file_write", description: "Writes files to disk" }] };
expect(getSkills(card)).toEqual([{ id: "file_write", description: "Writes files to disk" }]);
});
it("returns description as undefined when skill has no description", () => {
const card = { skills: [{ id: "noop_skill" }] };
const result = getSkills(card);
// The map always includes description; it's undefined when absent
expect(result).toEqual([{ id: "noop_skill", description: undefined }]);
});
it("filters out skills with neither id nor name", () => {
// id: String(undefined || undefined || "") → "" → filtered
const card = { skills: [{ description: "loner" }] };
expect(getSkills(card)).toEqual([]);
});
it("handles mixed valid/invalid entries", () => {
const card = {
skills: [
{ id: "valid_one" },
{ name: "named_skill" },
{ description: "orphaned" }, // filtered
{ id: "valid_two", description: "Has both" },
],
};
expect(getSkills(card)).toEqual([
{ id: "valid_one", description: undefined },
{ id: "named_skill", description: undefined },
{ id: "valid_two", description: "Has both" },
]);
});
it("handles string coercion for numeric ids/names", () => {
const card = { skills: [{ id: 42, name: "numeric_id" }] };
expect(getSkills(card)).toEqual([{ id: "42" }]);
});
it("uses id over name when both are present", () => {
const card = { skills: [{ id: "priority_id", name: "fallback_name" }] };
expect(getSkills(card)).toEqual([{ id: "priority_id", description: undefined }]);
});
it("omits description when it is falsy (0 is falsy in JS)", () => {
// The implementation uses `s.description ?` — 0 is falsy, so it's treated
// as absent and undefined is returned. Non-zero numbers coerce fine.
const cardZero = { skills: [{ id: "x", description: 0 }] };
expect(getSkills(cardZero)).toEqual([{ id: "x", description: undefined }]);
const cardNum = { skills: [{ id: "x", description: 42 }] };
expect(getSkills(cardNum)).toEqual([{ id: "x", description: "42" }]);
});
});
+172
View File
@@ -601,3 +601,175 @@ def test_scan_workflows_missing_dir_returns_empty(sr_module, tmp_path, capsys):
assert out == {}
captured = capsys.readouterr()
assert "::warning::workflows dir not found" in captured.out
# --------------------------------------------------------------------------
# rev2: multi-SHA sweep — `reap_branch()` walks last N main commits
# --------------------------------------------------------------------------
# Phase 1+2 evidence (orchestrator + hongming-pc2): rev1 sees `compensated:0`
# every tick because the schedule workflow posts `failure` to whatever SHA
# was HEAD when it COMPLETED. By the next */5 tick, main has often moved
# forward, so the single-HEAD reaper misses the stranded red. rev2 sweeps
# the last 10 commits each tick. See `reference_post_suspension_pipeline`
# and parent rev1 PR #618 for context.
SHA_A = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
SHA_B = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
SHA_C = "cccccccccccccccccccccccccccccccccccccccc"
def test_reap_sweeps_n_shas_smoke(sr_module, monkeypatch):
"""rev2 contract: sweep last 10 (or N) main commits, GET combined
status for EACH. Smoke: with 3 stub SHAs, each is GET'd exactly once.
"""
gets: list[str] = []
posts: list[tuple[str, dict]] = []
def fake_api(method, path, *, body=None, query=None, expect_json=True):
if method == "GET" and path.endswith("/commits"):
# commits listing — return 3 fake commit objects
return (200, [{"sha": SHA_A}, {"sha": SHA_B}, {"sha": SHA_C}])
if method == "GET" and "/commits/" in path and path.endswith("/status"):
sha = path.split("/commits/")[1].split("/status")[0]
gets.append(sha)
# All combined=success → cost-optimization short-circuit
return (200, {"state": "success", "statuses": []})
if method == "POST":
posts.append((path, body))
return (201, {})
raise AssertionError(f"unexpected api call: {method} {path}")
monkeypatch.setattr(sr_module, "api", fake_api)
workflow_map = {"x": False}
counters = sr_module.reap_branch(
workflow_map, "main", limit=10, dry_run=False
)
# Each of the 3 SHAs returned by /commits should be GET'd once.
assert gets == [SHA_A, SHA_B, SHA_C]
# No POST (everything was combined=success).
assert posts == []
# Counters reflect what we saw.
assert counters["scanned_shas"] == 3
assert counters["compensated"] == 0
assert counters["compensated_per_sha"] == {}
def test_reap_skips_combined_success_shas(sr_module, monkeypatch):
"""rev2 cost-optimization (refinement #2): when combined==success for
a SHA, do NOT iterate per-context statuses; move on to next SHA.
Mock 2 SHAs with combined=success + 1 with combined=failure → only
the failure-SHA's statuses get the per-context loop applied.
"""
per_context_iterated_for: list[str] = []
posts: list[tuple[str, dict]] = []
failure_statuses = [
{
"context": "drift / drift (push)",
"state": "failure",
"target_url": "https://example.test/run/42",
}
]
def fake_api(method, path, *, body=None, query=None, expect_json=True):
if method == "GET" and path.endswith("/commits"):
return (200, [{"sha": SHA_A}, {"sha": SHA_B}, {"sha": SHA_C}])
if method == "GET" and "/commits/" in path and path.endswith("/status"):
sha = path.split("/commits/")[1].split("/status")[0]
if sha == SHA_B:
# Mark this SHA as the failure one — return per-context
# statuses that would compensate if iterated.
return (200, {"state": "failure", "statuses": failure_statuses})
# Others are combined=success — must short-circuit.
return (200, {"state": "success", "statuses": failure_statuses})
if method == "POST":
# If a POST hits a non-failure SHA, the short-circuit failed.
posts.append((path, body))
return (201, {})
raise AssertionError(f"unexpected api call: {method} {path}")
monkeypatch.setattr(sr_module, "api", fake_api)
# Workflow trigger map: `drift` is schedule-only (compensable).
workflow_map = {"drift": False}
counters = sr_module.reap_branch(
workflow_map, "main", limit=10, dry_run=False
)
# Only SHA_B (the combined=failure one) should be compensated.
assert counters["compensated"] == 1
assert counters["scanned_shas"] == 3
assert SHA_B in counters["compensated_per_sha"]
assert counters["compensated_per_sha"][SHA_B] == ["drift / drift (push)"]
# SHA_A and SHA_C must NOT appear in compensated_per_sha — their
# per-context loop was skipped via the combined=success short-circuit.
assert SHA_A not in counters["compensated_per_sha"]
assert SHA_C not in counters["compensated_per_sha"]
# Exactly one POST: the compensation on SHA_B.
assert len(posts) == 1
assert posts[0][0] == f"/repos/owner/repo/statuses/{SHA_B}"
def test_reap_continues_on_per_sha_apierror(sr_module, monkeypatch, capsys):
"""rev2 refinement #7 (MOST CRITICAL): a transient ApiError or HTTP-5xx
on get_combined_status(SHA_X) must NOT fail the whole tick. Log + skip
SHA_X, continue with SHA_Y.
Different from the single-HEAD path (where fail-loud is correct): the
sweep is best-effort across historical commits, so one transient blip
on a stale SHA should not strand reds on the OTHER stale SHAs.
"""
posts: list[tuple[str, dict]] = []
def fake_api(method, path, *, body=None, query=None, expect_json=True):
if method == "GET" and path.endswith("/commits"):
return (200, [{"sha": SHA_A}, {"sha": SHA_B}])
if method == "GET" and "/commits/" in path and path.endswith("/status"):
sha = path.split("/commits/")[1].split("/status")[0]
if sha == SHA_A:
raise sr_module.ApiError(
f"GET /repos/owner/repo/commits/{SHA_A}/status "
f"-> HTTP 502: bad gateway"
)
# SHA_B returns normally with a failure to compensate.
return (
200,
{
"state": "failure",
"statuses": [
{
"context": "drift / drift (push)",
"state": "failure",
}
],
},
)
if method == "POST":
posts.append((path, body))
return (201, {})
raise AssertionError(f"unexpected api call: {method} {path}")
monkeypatch.setattr(sr_module, "api", fake_api)
workflow_map = {"drift": False}
# Must NOT raise — per-SHA error isolation contract.
counters = sr_module.reap_branch(
workflow_map, "main", limit=10, dry_run=False
)
# SHA_A was logged + skipped. SHA_B processed normally.
assert counters["scanned_shas"] == 2
assert counters["compensated"] == 1
assert SHA_B in counters["compensated_per_sha"]
assert SHA_A not in counters["compensated_per_sha"]
# Compensation POST landed on SHA_B only.
assert len(posts) == 1
assert posts[0][0] == f"/repos/owner/repo/statuses/{SHA_B}"
# The ApiError must be logged so a human auditing tick output can see
# WHICH SHA blipped and WHY.
captured = capsys.readouterr()
assert "::warning::" in captured.out or "::notice::" in captured.out
assert SHA_A[:10] in captured.out