Commit Graph

14 Commits

Author SHA1 Message Date
Maciej Lisiewski
0502253fd4 test(ci): section_keys refuses a key line one column short 2026-11-13 17:27:29 +01:00
Maciej Lisiewski
2f49f19032 test(ci): pin importer optionalDependencies, the ? precondition of the fold, and short quoted keys
Each test kills a mutant that previously survived: _DEP_FIELDS without
optionalDependencies, a fold of any '  : ' line, and _KEY splitting a plain
quoted 'key: x': line (real pnpm 12.15.0 writes one for a short file: path
containing ': ').

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 16:55:57 +01:00
Kevin Rajan
40d379ca38 fix(ci): preserve quoted colon-space in long pnpm mapping keys
After c2h5oh's explicit-key fold in #155077, section_keys still split
quoted file: keys at the first embedded ': '. This truncates the
package name/version in semantic lockfile reports for a legal POSIX
file path containing ': ' and long enough to trigger js-yaml's pair.

Reuse the quote-aware _ENTRY parser at the keys-only call site and
pin the real 1024-character threshold without changing pnpm defaults.

Follow-up to c2h5oh's #155077 and BearHuddleston's #150296 review.

(cherry picked from commit 0d8141d97fb09e3439b76b89f6da090134e049df)
2026-11-13 16:54:52 +01:00
Maciej Lisiewski
3abb6fa2ab test(ci): cover peer suffixes, dev/optional deps and one-sided moves in lockfile diff
Kills surviving mutants in _reference, the snapshot consumer key, the
dependency fields, the '- item' list branch and hidden()'s two sides.

Follow-up to #150296 (review nits).

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 16:54:51 +01:00
Maciej Lisiewski
a407a95938 fix(ci): read pnpm's explicit ? key / : value pairs in the lockfile reader
js-yaml (pnpm's lockfile emitter) writes a mapping key longer than 1024
characters as an explicit pair, which a long peer suffix on a snapshot key
or a long file: path reaches. _section_lines refused the '? ' line, failing
the lockfile-diff step on a lock pnpm wrote itself; fold the pair back
into the usual key: lines.

Follow-up to #150296 (review nits).

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 16:54:51 +01:00
Maciej Lisiewski
6740235436 fix(ci): end a pnpm lock section at any top-level key
pnpm round-trips root keys it does not define (Bit's bit: block) and
sorts them between packages and snapshots, so the fixed key list made
such locks unreadable. Comments, conflict markers and tabs still raise.
2026-11-06 22:11:51 +01:00
Maciej Lisiewski
a357a562be fix(ci): report pnpm aliases, new edges and projects as one row
- An npm: alias (my-ms: ms@2.1.3, string-width-cjs: string-width@4.2.3)
  was checked against its alias name, which is not a packages key, so a
  move between locked versions was dropped. Check the real package.
- An edge added to or removed from a package on both sides (a
  packageExtensions dependency) was not compared. Report it.
- Diff the direct dependencies only of projects present on both sides;
  a project that appears or disappears is one "project <path>" row, not
  a row per dependency (a rename went from 240 rows to 2).
- An entry of an unexpected shape raises ValueError rather than
  AttributeError, KeyError or TypeError.
2026-11-06 22:11:51 +01:00
Maciej Lisiewski
9d4df4b7b3 fix(ci): end a pnpm lock section only at a known top-level key
section() and section_keys() stopped at any column-0 line, so a stray
comment, a merge-conflict marker or a tab-indented field inside importers
truncated the section and the diff reported every later project as
removed. Only a pnpm lockfile top-level key or the end of the file now
ends a section; any other unindented line raises.
2026-11-06 22:11:51 +01:00
Maciej Lisiewski
542626ed76 fix(ci): report pnpm dependencies moving between locked versions
The lockfile diff reduced pnpm-lock.yaml to its packages keys, so a
project or package repinned to a version already in the lock (hermes-ink
semver 7.8.5 -> 7.7.4) reported no change. Also diff each importer's
direct dependencies and the snapshot dependency edges, shown only when
the package rows cannot explain the move, so a bump stays one row.
2026-11-06 22:11:51 +01:00
Maciej Lisiewski
7062229090 chore(js): switch the workspaces from npm to pnpm
pnpm 12.15.0 (native executable) installs every JS workspace from one
pnpm-lock.yaml, imported from package-lock.json with the same resolved
versions. website/, the WhatsApp bridge and the photon sidecar stay separate
npm projects.

Configuration moves from .npmrc and the root manifest into
pnpm-workspace.yaml: the 14-day minimumReleaseAge and its excludes,
overrides, allowBuilds (the old allowScripts set, with strictDepBuilds
failing any unlisted build script), engineStrict, sideEffectsCache: false
(in-place rebuilds must not write into the store) and
verifyDepsBeforeRun: false (a `pnpm run` never installs).

The pnpm version is pinned in pm/lock.json and in root devEngines.
pmOnFail: ignore keeps that pin out of pnpm-lock.yaml: a leading pin
document makes osv-scanner read zero packages. scripts/build/node-deps.mjs
enforces the exact version instead, and every lock reader refuses a
multi-document lock. A root preinstall refuses `npm install`; devEngines
onFail is warn so npx (MCP servers, the tsc linter) keeps working inside
the checkout.

User-machine installs run --frozen-lockfile --trust-lockfile (release age is
checked when locking, in CI, not per user). node-deps removes npm-era
node_modules trees before the first pnpm install. Nix builds the store with
fetchPnpmDeps and a hash file that CI checks.
2026-11-06 04:08:24 +01:00
teknium1
aedc6ccc3a test: purge low-value tests, lane py05 (339 removed)
Change-detectors, tautologies, source-reading tests, redundant duplicates,
mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane
ledger (category + reason for every removal).
2026-09-23 03:15:26 -07:00
Teknium
6b81590c55 test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions
Systematic prune per AGENTS.md test policy, one pass over every major
test tree (gateway, hermes_cli, tools, agent, run_agent, plugins, cli,
cron, tui_gateway, honcho/openviking, root-level):

- DELETE: source-reading tests (read_text/getsource on prod files),
  change-detector tests (exact catalog counts, model-name snapshots,
  config version literals), mock-echo tests (assert a mock returns what
  it was told), assertion-free/trivial tests, near-duplicate
  parametrizations (boundaries + one representative kept), async/sync
  twin duplicates, cosmetic within-file variations.
- KEEP (mandatory): security/redaction/approval guards, message-role
  alternation invariants, prompt-caching/deterministic-call-id
  invariants, issue-number regression tests (deduped), E2E tests.
- 6 test files deleted outright (script-style/no-assert or fully
  redundant); conftest.py, fakes/, fixtures/ untouched.
- tests/acp/conftest.py added: autouse fixture stubs the live
  models.dev/GitHub/Copilot/Anthropic inventory fetches that ACP server
  tests performed on every session create — test_server.py 147s → 3.4s,
  and the tests are now genuinely hermetic.
- Sleep-based slowness shrunk where safe (codex_ttfb_watchdog,
  compression_concurrent_fork, etc.); no wall-clock assertion tightened.

Verification: full hermetic suite via scripts/run_tests.sh —
2439 files, 31,130 tests passed, 0 failed, 0 flaky retries, 315s wall
(baseline: 583s wall, 13,564s subprocess CPU).
2026-07-29 13:10:23 -07:00
ethernet
b9f82ed39f ci: live-updating PR review comment with structured job statuses
Replace the static comment-pending + comment-results two-job pattern
with a live-updating comment system that polls the GitHub Actions API
every 15s, re-assembles the review comment from whatever results are
available, and upserts it via the <!-- hermes-ci-review-bot --> marker.
The comment updates in real time as each job finishes — no waiting for
the full pipeline.

Every CI job that wants to appear in the review comment emits a
review_status output — a JSON array of objects, each with a source
and a results array:

    [
      {
        "source": "review-label-gate",
        "results": [
          {"kind": "action_required", "title": "...", "summary": "...",
           "how_to_fix": "..."},
          {"kind": "info", "title": "...", "summary": "..."}
        ]
      },
      {
        "source": "ci timing",
        "results": [
          {"kind": "warning", "title": "CI timings", "summary": "...",
           "detail": "...", "link": "..."}
        ]
      }
    ]

One job can emit multiple results of different kinds. The source field
is used to exclude the corresponding job from the synthesized error
list (case-insensitive, hyphen-normalized matching against GitHub
Actions job display names).

| job                        | source                   | kind (on failure)         | section              |
|----------------------------|--------------------------|---------------------------|----------------------|
| review-labels              | review label gate        | action_required / info    | Action required      |
| lockfile-diff              | lockfile-diff            | action_required           | Action required      |
| ci-timings                 | ci timing                | warning / info            | Warnings             |
| supply-chain scan          | supply chain             | error / (none)            | Job failures         |
| supply-chain dep-bounds    | supply chain             | action_required / (none)  | Action required      |
| osv-scanner                | osv scan                 | warning / (none)          | Warnings             |
| uv-lockfile-check          | uv.lock check            | action_required / (none)  | Action required      |
| history-check              | unrelated histories      | action_required           | Action required      |
| contributor-check          | contributor attribution  | action_required           | Action required      |

Jobs that find nothing emit [] (empty array) — no noise info items.

A single comment-live job polls the GitHub Actions API every 15s,
classifies jobs into (completed, pending), assembles the comment, and
upserts it. Merges review_status outputs from all needs jobs via
toJSON(needs.*.outputs.review_status), and downloads the ci-timings
artifact when it becomes available. Shows commit SHA + message below
the header.

The assembler has ZERO job-specific knowledge. It just:
1. collect_from_statuses() — flattens all nested status objects into ReviewItems
2. collect_failed_jobs() — synthesizes errors for failed jobs with no declared status
3. _attach_job_urls() — fills in per-job log links for ALL items
4. render_comment() — groups by severity, renders with group headers

Each item shows links inline next to the title: View report (job-emitted
URL) and View job (auto-attached logs link). Each info item is its own
collapsible <details> block.

    # ૮ >ﻌ< ა ci review

    running on abc1234 — commit message first line

    ## ❌ Job failures
    ### {title} · [View job](url)
    {summary}

    ## ⚠️ Action required
    ### {title} · [View job](url)
    {summary}
    **How to fix:**
    {how_to_fix}

    ## ⚠️ Warnings
    ### {title} · [View report](url) · [View job](url)
    {summary}
    {detail}

    <details><summary>{title}</summary>
    {content}
    </details>

    Still running 3 jobs: ci-timings, docker

- test_assemble_review_comment.py (48 tests): collect_from_statuses,
  collect_failed_jobs with exclude_sources, _attach_job_urls,
  render_comment (group headers, inline links, commit info, per-item
  details, pending footer), assemble integration
- test_live_comment.py (16 tests): classify_jobs pure function
- test_timings_report.py (10 tests): generate_review_status nested format
- test_lockfile_diff.py (6 tests)
- test_classify_changes.py (32 tests, pre-existing)
2026-07-20 16:48:25 -04:00
ethernet
f8ddf4fd86 feat(ci): semantic package-lock.json diff as an upserted PR comment (#65206)
git diff on a lockfile is unreadable: npm reorders entries, rewrites
integrity hashes, and moves packages between nesting levels, so a
one-line package.json bump produces a thousand-line textual diff.

scripts/ci/lockfile_diff.py instead parses the `packages` map out of
both versions of every tracked package-lock.json (via `git show`),
reduces each to {install path: version}, and set-diffs the maps —
reorder/hash churn vanishes, leaving only actual version movement
(added / removed / updated, with nested dedup copies tracked
separately).

The lockfile-diff workflow posts the result as a Markdown table in a
PR comment gated behind a hidden marker: subsequent pushes PATCH the
existing comment instead of stacking new ones, and a push that reverts
all lockfile changes updates the comment to say so. Advisory only —
never fails on findings; fork PRs (read-only token) degrade to a
warning.

Wired through the ci.yml orchestrator with a new npm_lock lane in
classify_changes.py (fails open on .github/ changes per the existing
contract).
2026-07-16 03:18:15 +00:00