Commit Graph

628 Commits

Author SHA1 Message Date
e7c298943f reviewer(ET): auto-commit from reviewer run_id=536
All checks were successful
CI / test (push) Successful in 43s
CI / test (pull_request) Successful in 49s
2026-06-10 01:12:53 +03:00
8cd7c20988 fix(coverage): use sys.executable for the pytest --cov subprocess (ORCH-027)
All checks were successful
CI / test (push) Successful in 43s
CI / test (pull_request) Successful in 44s
measure_coverage hardcoded "python" for the coverage subprocess; the prod container
and the CI runner expose "python3" (a bare "python" may be absent), and pytest-cov
lives in exactly the running interpreter's environment. Use sys.executable so the
measurement always runs under the same interpreter as the orchestrator.

Refs: ORCH-027
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 01:07:59 +03:00
b4b993cf63 feat(coverage): deterministic test-coverage gate on deploy-staging->deploy edge (ORCH-027)
Some checks failed
CI / test (push) Failing after 48s
CI / test (pull_request) Failing after 42s
Introduce a deterministic (no-LLM) coverage sub-gate that blocks coverage
degradation before a task branch merges into `main`. Existing gates judge only by
the FACT of passing (check_ci_green / check_tests_passed / merge-gate re-test), not
by completeness — so a batch autonomous run (ORCH-088) silently erodes coverage.

Pattern mirrors the security-gate (ORCH-022): leaf src/coverage_gate.py (never-raise)
+ thin check_coverage_gate in QG_CHECKS + _handle_coverage_gate splice in advance_stage,
run AFTER merge-gate (measured on the caught-up HEAD that lands in main) and BEFORE
image-freshness (fail before the expensive docker rebuild).

- measure_coverage: pytest --cov=src --cov-report=json in the per-branch worktree ->
  line coverage %; None on tool error -> fail-open + WARNING by default (FR-6).
- compute_coverage_verdict (pure): absolute | baseline | both + epsilon (NFR-4 anti-flap);
  baseline None -> bootstrap (absolute-only).
- coverage_baseline DB table (additive, CREATE TABLE IF NOT EXISTS) + ratchet-up in
  _handle_merge_verify (deploy->done): atomic compare-and-set under merge-lease, never
  decreases; bootstrap on first merge.
- Artefact 18-coverage-report.md (coverage_status: frontmatter, single source of truth);
  GET /queue `coverage` block; FAIL -> Telegram; optional POST /coverage/baseline override.
- Flags ORCH_COVERAGE_* (kill-switch + self-hosting-only scope) -> enduro untouched;
  STAGE_TRANSITIONS / existing check_* / verdict keys byte-for-byte unchanged (NFR-5/AC-8).
- pytest-cov==5.0.0 added to requirements.txt.

Tests: tests/test_coverage_gate.py (TC-01..TC-15). Frozen QG-registry anti-regress
tests + deploy-staging edge tests updated for the new sub-gate. Full suite green.

Docs: README / adr-0029 / PIPELINE_DOCS / 18-coverage-report.md template (architecture
stage) + CHANGELOG / CLAUDE.md / .env.example (this PR).

Refs: ORCH-027
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 01:04:21 +03:00
c0dc1940a6 architect(ET): auto-commit from architect run_id=534
All checks were successful
CI / test (push) Successful in 41s
2026-06-10 00:43:21 +03:00
4b3edc82ef architect(ET): auto-commit from architect run_id=533
All checks were successful
CI / test (push) Successful in 41s
2026-06-10 00:40:42 +03:00
e3f726f91c analyst(ET): auto-commit from analyst run_id=532
All checks were successful
CI / test (push) Successful in 40s
2026-06-10 00:32:28 +03:00
ab86fa5d51 docs: init ORCH-027 business request
All checks were successful
CI / test (push) Successful in 40s
2026-06-10 00:26:57 +03:00
8c2fa5de6d Merge pull request 'fix(notifications): HTML-safe card data render — fix <1м injection freezing the tracker (ORCH-095)' (#107) from feature/ORCH-095-bug-html-1-render-task-tracker into main
Some checks failed
CI / test (push) Has been cancelled
2026-06-10 00:21:49 +03:00
deploy-finalizer
2686e3e99f deploy(ORCH-036): finalize SUCCESS for ORCH-095
All checks were successful
CI / test (push) Successful in 40s
2026-06-10 00:21:48 +03:00
cdc5e5c548 tester(ET): auto-commit from tester run_id=530
All checks were successful
CI / test (push) Successful in 41s
CI / test (pull_request) Successful in 41s
2026-06-10 00:17:26 +03:00
b77d412c36 reviewer(ET): auto-commit from reviewer run_id=529 2026-06-10 00:17:26 +03:00
b38cc16041 fix(notifications): escape all card data fields at the render boundary (ORCH-095)
render_task_tracker sends/edits the live card with parse_mode=HTML. _fmt_minutes
returns the literal "<1м" for a sub-minute stage; interpolated raw into HTML text
Telegram parsed "<1м" as an opening tag -> editMessageText 400 can't parse
entities -> edit_telegram EDIT_FAILED -> update_task_tracker early return
(anti-duplicate ORCH-087) -> the card froze (incident ORCH-093, message_id 18854).

Close the whole "unescaped data in HTML text" class per ADR-001: a module-local
_esc(x)=html.escape(str(x)) (never-raise) wraps every DATA slot (durations, status
label, model, effort, token/cost metrics) exactly once at the render boundary in
render_task_tracker/_stage_line. Source functions stay HTML-agnostic (_fmt_minutes
still returns "<1м"; escape on the boundary renders it visually identical as
&lt;1м, so the visible format is unchanged). Intentional MARKUP slots (num_html /
link_for / _done_link / already-escaped esc_title) are NOT escaped, so the issue
number stays a clickable <a> tag and nothing is double-escaped.

A previously-frozen card auto-recovers on the next stage transition (a new safe
render edits in place, 200) — no new code, no touch to edit_telegram /
update_task_tracker / the orphan ledger, so the ORCH-087 anti-duplicate invariant
is preserved (a transient edit failure still does not spawn a new card).

STAGE_TRANSITIONS / QG_CHECKS / check_* / notification transport / DB schema are
untouched. New tests/test_tracker_html_escape.py (TC-01..TC-11); full suite green.

Refs: ORCH-095

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 00:17:26 +03:00
6b14b07f40 architect(ET): auto-commit from architect run_id=526 2026-06-10 00:17:26 +03:00
d528f77b03 analyst(ET): auto-commit from analyst run_id=525 2026-06-10 00:17:26 +03:00
c8aab19958 docs: init ORCH-095 business request 2026-06-10 00:17:26 +03:00
af86c7fabb Merge pull request 'docs(ORCH-095): staging gate log — SUCCESS (8/10, C9a/C9b infra-waived)' (#108) from docs/ORCH-095-staging-log into main 2026-06-10 00:17:00 +03:00
7fa381d814 docs(ORCH-095): staging gate log — SUCCESS (8/10, C9a/C9b infra-waived)
All checks were successful
CI / test (pull_request) Successful in 42s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 00:16:47 +03:00
e0f44cc4ef Merge pull request 'fix(deploy): terminal-window-aware guard so done tasks hold Done in Plane (ORCH-094)' (#105) from feature/ORCH-094-bug-done-deploy-plane-awaiting into main
Some checks failed
CI / test (push) Has been cancelled
2026-06-09 23:45:49 +03:00
deploy-finalizer
b243343cd5 deploy(ORCH-036): finalize SUCCESS for ORCH-094
All checks were successful
CI / test (push) Successful in 43s
CI / test (pull_request) Successful in 41s
2026-06-09 23:45:46 +03:00
fe35b2224a tester(ET): auto-commit from tester run_id=523
All checks were successful
CI / test (push) Successful in 42s
CI / test (pull_request) Successful in 40s
2026-06-09 23:41:24 +03:00
08ca4ab258 reviewer(ET): auto-commit from reviewer run_id=522 2026-06-09 23:41:24 +03:00
a46dcbcab3 fix(deploy): terminal-window-aware guard so done tasks hold Done in Plane (ORCH-094)
A DB stage=done task with 0 active jobs flapped in Plane between `Awaiting
Deploy` and `Monitoring after Deploy` instead of holding `Done` (verified live
on ORCH-061, task 47): the three deploy-phase setters were terminal-blind, so
any stale/duplicate/unknown caller under the bot token re-stamped an
intermediate status over the terminal Done, forever.

- New leaf src/deploy_status_guard.py (pure, never-raise, config-gated): decide()
  -> ALLOW | CONVERGE_DONE | SUPPRESS on the entry of set_issue_awaiting_deploy /
  set_issue_deploying / set_issue_monitoring. A deploy-phase status is legitimate
  iff the task is non-terminal OR (done AND post-deploy window active); otherwise
  done converges to Done idempotently, cancelled is suppressed (FR-2, D1/D2).
- D3: move post_deploy.arm_monitor ABOVE the terminal-sync block in advance_stage
  so window_active is True when the legitimate first Monitoring is set (the task
  is already DB-done by then); a re-drive after the window closes converges to Done.
- D4: run_post_deploy_monitor no-ops without a status PATCH / re-queue when the
  task became cancelled mid-window (zombie-tick guard, FR-3).
- D5: additive `reason` kwarg on the three setters + one structured log line per
  verdict (work_item/caller/target/db_stage/window_active/verdict); new read-only
  db.get_task_by_work_item_id; post_deploy.window_active helper.
- Flags deploy_status_guard_enabled (kill-switch -> 1:1) / deploy_status_guard_repos
  (CSV; empty = self-hosting only). STAGE_TRANSITIONS / QG_CHECKS / check_* /
  machine-verdict keys / DB schema untouched (reads existing tasks.stage).

Tests: TC-01..TC-12 across 5 new test modules + config flags; updated the
reason-kwarg assertions in test_deploy_terminal_sync / test_deploy_approve.
Full regress green (1413). Docs: CHANGELOG, CLAUDE.md, docs/architecture/README.md
(status -> реализовано), .env.example.

Refs: ORCH-094

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 23:41:24 +03:00
db4dd275e4 architect(ET): auto-commit from architect run_id=520 2026-06-09 23:41:24 +03:00
8959e0e3f4 architect(ET): auto-commit from architect run_id=519 2026-06-09 23:41:24 +03:00
f36528705e analyst(ET): auto-commit from analyst run_id=518 2026-06-09 23:41:24 +03:00
5e01df00eb docs: init ORCH-094 business request 2026-06-09 23:41:24 +03:00
fcb40eb4bb Merge pull request 'docs(ORCH-094): staging gate log — SUCCESS' (#106) from docs/ORCH-094-staging-log into main 2026-06-09 23:40:59 +03:00
b86fc9043f docs(ORCH-094): staging gate log — SUCCESS (8/10, C9a/C9b infra-waived)
All checks were successful
CI / test (pull_request) Successful in 41s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 23:40:46 +03:00
fbedd0485b Merge pull request 'fix(merge_gate): retry transient Gitea merge errors (405/5xx) + already-in-main guard (ORCH-093)' (#104) from feature/ORCH-093-bug-merge-gitea-405-5xx-hold-p into main
Some checks failed
CI / test (push) Has been cancelled
2026-06-09 22:51:43 +03:00
deploy-finalizer
f9ce5ca1b8 deploy(ORCH-036): finalize SUCCESS for ORCH-093
All checks were successful
CI / test (push) Successful in 38s
CI / test (pull_request) Successful in 40s
2026-06-09 22:51:42 +03:00
7863932012 tester(ET): auto-commit from tester run_id=516
All checks were successful
CI / test (push) Successful in 42s
CI / test (pull_request) Successful in 39s
2026-06-09 22:47:20 +03:00
74418893d7 reviewer(ET): auto-commit from reviewer run_id=515 2026-06-09 22:47:20 +03:00
0b25fc1527 fix(merge_gate): retry transient Gitea merge errors + already-in-main guard
merge_pr now wraps ONLY the mutating POST /pulls/{n}/merge in a bounded
exponential-backoff retry-loop on TRANSIENT outcomes (405 "try again later",
408, any 5xx, network/timeout, and 409|422 while the PR is still mergeable);
TERMINAL outcomes (403/404/real conflict via mergeable==False) -> fast honest
False, so the ORCH-071/081 not-merged HOLD backstop is unchanged. Fixes the
ORCH-063 false HOLD + manual re-merge on Gitea's post-push mergeability hiccup.

ensure_open_pr gains an "already fully in main" guard (_branch_fully_in_main,
git merge-base --is-ancestor HEAD origin/main) BEFORE creating a PR -> new
"already-in-main" outcome avoids the garbage empty PR on a re-driven finalizer;
_handle_merge_verify skips merge_pr on that outcome and lets the authoritative
SHA-in-main check confirm -> done (not a HOLD). git error of the guard fails
OPEN to the create path.

New ORCH_MERGE_RETRY_* settings (kill-switch merge_retry_enabled -> one-shot,
max_attempts=3, backoff base=2/max=5). INV-4 (merge only via Gitea PR-merge API,
never push/force-push main), never-raise, STAGE_TRANSITIONS/QG_CHECKS/DB schema
unchanged. Docs (README merge-verify section, CLAUDE.md, CHANGELOG, .env.example)
updated in the same PR. Tests: test_merge_gate.py TC-01..12, test_config.py
TC-13, test_merge_verify.py TC-14..16; full suite green (1389).

Refs: ORCH-093

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 22:47:20 +03:00
3d0f51512b architect(ET): auto-commit from architect run_id=512 2026-06-09 22:47:20 +03:00
520373a694 analyst(ET): auto-commit from analyst run_id=511 2026-06-09 22:47:20 +03:00
cf0a72a46b docs: init ORCH-093 business request 2026-06-09 22:47:20 +03:00
1a52fcba9e docs(ORCH-093): staging gate log — SUCCESS (8/10, C9a/C9b infra-waived)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 22:46:56 +03:00
33b7fd57ff Merge pull request 'fix(notifications): tracker card — status completeness, rollback reflection, stage-metric summation (ORCH-091)' (#102) from feature/ORCH-091-bug-to-analyse-stage-deploy-st into main
Some checks failed
CI / test (push) Has been cancelled
2026-06-09 22:13:09 +03:00
deploy-finalizer
6feae55a4b deploy(ORCH-036): finalize SUCCESS for ORCH-091
All checks were successful
CI / test (push) Successful in 32s
2026-06-09 22:13:08 +03:00
86b013c872 tester(ET): auto-commit from tester run_id=509
All checks were successful
CI / test (push) Successful in 36s
CI / test (pull_request) Successful in 33s
2026-06-09 22:08:52 +03:00
3d6e957cae reviewer(ET): auto-commit from reviewer run_id=508 2026-06-09 22:08:52 +03:00
328ae78da3 fix(notifications): tracker card — status-map completeness, rollback reflection, stage-metric summation (ORCH-091)
Three verified live-card defects in src/notifications.py (ORCH-067/087),
all additive and indication-only (STAGE_TRANSITIONS / QG_CHECKS / check_* /
transport / DB schema untouched; never-raise; revert = git revert):

- Деф.1 (D1): _STAGE_STATUS_LABEL covered 8 of 10 STAGE_TRANSITIONS keys —
  deploy-staging and cancelled (ORCH-090) fell back to the misleading
  "To Analyse". Added deploy-staging→"Deploying (staging)",
  cancelled→"Cancelled"; replaced the runtime fallback for an UNMAPPED stage
  with a neutral capitalized label (_neutral_stage_label). created stays an
  explicit "To Analyse"; broken/None input degrades safely. Map completeness
  is asserted programmatically from STAGE_TRANSITIONS.keys() (single source of
  truth), not a static list.
- Деф.2 (D2): the stage-row loop drew  for any stage with a finished agent
  run regardless of position — after a rollback the card showed the absurd
  " Внедрение + 🔄 Разработка". Added read-only _pipeline_pos from the
  STAGE_TRANSITIONS order and a suppression gate ( only when
  current_pos >= _pipeline_pos(stage_key)); deploy-staging→deploy normalization
  applied ONLY to the current position; is_active_stage untouched.
- Деф.3 (D3): _stage_line took only the LAST run (ORCH-069: developer 3 runs
  Σ $3.98 rendered ~$0.00). It now aggregates ALL of the agent's runs with the
  same per-run formulas as the task totals → strict convergence with
  SUM(agent_runs) by task_id; model/effort/attempt come from the last run.

Tests: test_tracker_status_line.py (ORCH-091 TC-01..TC-03 + updated tc06);
new test_tracker_rollback_metrics.py (TC-05..TC-08). Full suite green (1370).
Docs: CHANGELOG + internals.md (architecture README already updated by architect).

Refs: ORCH-091
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 22:08:52 +03:00
c0f2d917bf architect(ET): auto-commit from architect run_id=506 2026-06-09 22:08:52 +03:00
53022d20f4 architect(ET): auto-commit from architect run_id=505 2026-06-09 22:08:52 +03:00
852da919b9 analyst(ET): auto-commit from analyst run_id=504 2026-06-09 22:08:52 +03:00
67f7a3abfa docs: init ORCH-091 business request 2026-06-09 22:08:52 +03:00
a994b25146 Merge pull request 'docs(ORCH-091): staging gate log — SUCCESS' (#103) from docs/ORCH-091-staging-log into main 2026-06-09 22:08:27 +03:00
36cd6e887b docs(ORCH-091): staging gate log — SUCCESS (8/10, C9a/C9b infra-waived)
All checks were successful
CI / test (pull_request) Successful in 34s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 22:08:14 +03:00
3b64cddd32 Merge pull request 'feat(cancel): STOP-status task cancellation + relaunch-hole close (ORCH-090)' (#101) from feature/ORCH-090-stop-plane into main
Some checks failed
CI / test (push) Has been cancelled
2026-06-09 21:36:12 +03:00
deploy-finalizer
08e6bfc3d5 deploy(ORCH-036): finalize SUCCESS for ORCH-090
All checks were successful
CI / test (push) Successful in 34s
2026-06-09 21:36:11 +03:00