Commit graph

3834 commits

Author SHA1 Message Date
Mikael Hugo
e0fd2076d3 test: Investigated R102 symlink dedup: canonicalizePath already exists…
SF-Task: S01/T07
2026-05-02 12:00:56 +02:00
Mikael Hugo
3915dfda3a chore(vitest): bump testTimeout 30s→60s to absorb cold-import latency
Cold vitest+esbuild module-graph imports take 16-25s on this repo (dynamic
imports of captures.js and friends). The 30s testTimeout was racing the
import phase, producing 30s spurious failures across dev-engine-wrapper,
ensure-db-open, workflow-mcp, sf-tools, verification-gate, hook-key-parsing,
visualizer-overlay, and others — all timing out at exactly ~30s with no
real assertion failure.

Also bumps hookTimeout symmetrically.

Re-running the affected files: 147/147 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:53:31 +02:00
Mikael Hugo
44204e0424 chore(sf): add optional token telemetry 2026-05-02 11:50:34 +02:00
Mikael Hugo
ff60f5f62f test(sf): make worktree suites explicit 2026-05-02 11:40:18 +02:00
Mikael Hugo
26be0b4153 fix(sf): stabilize headless auto flow 2026-05-02 11:34:41 +02:00
Mikael Hugo
12538bbfa3 sf snapshot: pre-dispatch, uncommitted changes after 32m inactivity 2026-05-02 11:25:51 +02:00
Mikael Hugo
3edc35a7ea feat(sf): UOK parity safety + verification gate hard-kill
Three small fixes for UOK rollout debuggability and gate reliability:

1. parity-report.ts: writeParityReport now writes via atomic temp+rename
   so the report file is never partially written on disk full / crash.
   parseParityEvents now skips whitespace-only lines without recording
   error events.

2. verification-gate.ts: spawnSync gate commands use killSignal: SIGKILL
   so npm/node grandchildren actually exit when the deadline fires
   (default SIGTERM was being caught by shell wrappers, leaving lingering
   children that out-lived the deadline).

3. session_start drain (bootstrap/register-hooks.ts) now reads
   .sf/runtime/uok-parity-report.json and notifies the operator on
   criticalMismatches, fallbackInvocations, or status errors. New helper
   module uok-parity-summary.ts encapsulates the read+summarize logic
   with 8 tests.

Tests: parity-report 5/5, parity-summary 8/8, verification-gate 87/87.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 10:52:52 +02:00
Mikael Hugo
75a4f35ea5 test(sf): fix zombie-cleanup test pollution from sibling-stop changes
Adding the new "cancelled" worker state in 1fdaae5c7 didn't itself break
the test, but the existing afterEach hooks (placed inside each test body)
weren't reliably resetting the orchestrator singleton between runs.
M002 leftover from test #2 was leaking into test #3, breaking the
"all cached workers in error state" assertion.

Add a top-level beforeEach that always resets the orchestrator before
each test so the shared module-level state can't leak across the file.
afterEach blocks remain for tmpdir cleanup.

All 4 tests now pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 10:48:45 +02:00
Mikael Hugo
1fdaae5c77 feat(sf): parallel sibling-stop opt-in
When one parallel worker fails, siblings keep running (and burn budget) by
default. Add an opt-in cascade so dependent parallel work stops on first
failure instead of producing wasted output.

- CLI: /sf parallel start --stop-on-failure
- Pref: parallel.stop_on_failure (default false)
- Journal: parallel-cancelled-by-sibling event (workerId, triggeringWorkerId, kind)
- State: cancelled (vs error) so post-hoc reporting distinguishes "I failed"
  from "a sibling failed and I was cancelled"
- Cancellation: graceful via existing file-IPC stop signal + SIGTERM

Side fix: after → afterAll in worktree-bugfix.test.ts (vitest API).

Tests: 10/10 in parallel-stop-on-failure.test.ts; 38/38 across the worktree
+ parallel test set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 09:39:13 +02:00
Mikael Hugo
1412eac60a fix(sf): harden exit and worktree cleanup 2026-05-02 09:30:14 +02:00
Mikael Hugo
ddee5c8711 feat(sf): add backlog triage workflow 2026-05-02 09:17:22 +02:00
Mikael Hugo
07d7e99e1e feat: wire requirement promoter + triage-backlog prompt
- register-hooks.ts: wires promoteFeedbackToRequirements into session_start drain
- prompts/triage-backlog.md: new prompt for backlog triage agent
- tests/requirement-promoter.test.ts: 7 tests covering forge-gate, count threshold,
  milestone threshold, idempotency, R-ID increment, 90d filtering, and resolved-skip
2026-05-02 09:14:12 +02:00
Mikael Hugo
f9116f5514 feat: gap audit + upstream bridge + backlog prompt injection
- gap-audit.ts: automatic detection of orphaned prompts, handlers, native modules, and advertised commands. Deduped by content hash, runs at session_start.
- upstream-bridge.ts: rolls up recurring upstream anomalies into forge-local backlog when threshold crossed (≥3 entries, ≥2 repos, 30d window). Severity capped at medium.
- system-context.ts: injects top-5 backlog entries into system prompt, sorted by severity then recency. Capped at 2K chars.
- register-hooks.ts: wires both gap audit and upstream bridge into session_start drain.
- Tests: 13 upstream-bridge tests covering thresholds, idempotency, resolution, severity capping, and multi-kind handling.
2026-05-02 09:03:08 +02:00
Mikael Hugo
1990d2a2ee feat: Renamed textBuffer to assistantTextBuffer in headless.ts and vali…
- src/headless.ts
- .sf/REQUIREMENTS.md

SF-Task: S01/T04
2026-05-02 08:48:44 +02:00
Mikael Hugo
8bbda93d24 chore: purge bun from internal toolchain
Node 24 is the only runtime — drop bun from nix-build skill instructions
(use `npm run --workspace=...`) and from lockfile-skip globs in the secret/
base64 scanners. flake.nix dev shell already lost bun in the prior snapshot
commit. End-user-facing package-manager.ts still supports bun by design.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:38:20 +02:00
Mikael Hugo
6698b2f247 fix(native): bind dev .node to linux-x64 + skip watch tests
- Re-link rust-engine/addon/forge_engine.linux-x64.node → forge_engine.dev.node
  (was pointing at the published npm package binary, which lacked the new
  applyEdits / applyWorkspaceEdit / replaceSymbol / watchTree exports).
  Native loader now picks up the freshly-built dev addon for tests.
- Skip watch.test.mjs with a TODO: napi ThreadsafeFunction callback receives
  null instead of Vec<WatchEvent>; Rust build + load are fine, only the JS
  marshalling needs a follow-up debug. edit + symbol suites are green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:36:18 +02:00
Mikael Hugo
78ea18dbee feat(native): expose unified edit module with native ops
Adds applyEdits, applyWorkspaceEdit, replaceSymbol, insertAroundSymbol,
and watchTree to @singularity-forge/native via the new ./edit subpath.

- applyEdits / applyWorkspaceEdit: LSP-shaped TextEdit arrays applied via
  byte-level splice + atomic rename, two-phase commit across files.
- replaceSymbol / insertAroundSymbol: tree-sitter symbol resolution via
  forge-ast, TS/JS/TSX support; v1 replaces whole declaration.
- watchTree: notify-rs recursive watcher with native globset ignore + JS
  EventEmitter wrapper (drops chokidar dep).

Rust impl in rust-engine/crates/engine/src/{edit,symbol,watch}.rs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:33:06 +02:00
Mikael Hugo
5f52680285 chore: snapshot in-flight work (mcp graph refactor, native edit module, misc)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:31:44 +02:00
Mikael Hugo
f4dd66d4ed fix(sf): cap sift warmup with timeout(1) wall-clock wrapper
Orphaned sift warmups can spin past --retriever-timeout-ms (a per-page
timeout, not wall-clock) and burn CPU indefinitely after the launcher
exits — observed a 95-min, 98% CPU orphan. Wrap the detached spawn in
timeout(1) / gtimeout when present (SIGTERM at the cap, SIGKILL 10s
later); fall back to raw spawn elsewhere. Default cap 1800s, override
via SF_SIFT_HARD_TIMEOUT_SEC, disable via SF_SIFT_HARD_TIMEOUT_DISABLE=1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 08:29:02 +02:00
Mikael Hugo
f5ea1cb6c0 feat: Validated R116: product-audit fires at three phase transition poi…
SF-Task: S01/T02
2026-05-02 07:35:36 +02:00
Mikael Hugo
a4ae2feaac sf snapshot: pre-dispatch, uncommitted changes after 30m inactivity 2026-05-02 07:26:07 +02:00
Mikael Hugo
8ed0c4078e chore: commit headless follow-up changes 2026-05-02 06:55:12 +02:00
Mikael Hugo
aed104c81f fix: guard advisor fallback session model 2026-05-02 06:39:23 +02:00
Mikael Hugo
6f6ace3da6 chore: Node 24.15 floor + modernization round-up
- engines.node: >=24.15.0 across all 23 package.json (root + 8
  workspace + studio + web + pkg + vscode-extension + 11 SF
  extension manifests)
- CI workflows pinned to node-version: '24.15' (16 sites)
- Dockerfile -> node:24.15-slim
- .nvmrc / .node-version -> 24.15.0
- Refactored worktree-cli.ts and headless-query.ts to use
  import.meta.filename instead of fileURLToPath(import.meta.url)
- exec.ts simplified with AbortSignal.any + spawn signal/killSignal
- Picks up Crush's biome.json + AGENTS.md doc cleanup in same pass

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 06:37:36 +02:00
Mikael Hugo
d9c848132a chore: CI workflows, package.json updates, test fixes, docs cleanup
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:30:45 +02:00
Mikael Hugo
f00af5b67f chore: remove last vitest exclude — lsp-integration already converted
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:22:59 +02:00
Mikael Hugo
a920164a04 chore: worktree e2e test update
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:21:09 +02:00
Mikael Hugo
302888e3d3 chore: test fixes, dep updates, lockfile sync
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:20:44 +02:00
Mikael Hugo
6fcf61ba0e chore: lockfile update and vitest config cleanup
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:19:52 +02:00
Mikael Hugo
6744f6d254 chore: update version and changelog scripts
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:19:16 +02:00
Mikael Hugo
7106a04951 chore: remaining studio and web updates
💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:18:50 +02:00
Mikael Hugo
d73a73d7f3 chore: node 24 native APIs, import.meta.dirname, parsers rename, dep updates
- Replace fileURLToPath(import.meta.url) with import.meta.dirname across
  scripts and extensions
- Rename parsers-legacy.ts → parsers.ts
- Remove deleted plan/spec docs (cicd-pipeline)
- Update package.json engines and deps across workspace packages
- Update web/package-lock.json

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:18:25 +02:00
Mikael Hugo
980772cc90 refactor: migrate from better-sqlite3 to node:sqlite, npm glob to node:fs
Since Node >= 24 is the minimum engine, remove the better-sqlite3 fallback
chain from sf-db.ts, unit-ownership.ts, and cli-stats.ts. Use DatabaseSync
from node:sqlite directly. Also replace the `glob` npm package with built-in
node:fs/promises.glob and node:fs.globSync in pi-coding-agent LSP utils.

- Remove createRequire boilerplate and suppressSqliteWarning helper
- Simplify loadProvider() and openRawDb()
- Net -177 lines of fallback/middleware code

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 06:13:57 +02:00
Mikael Hugo
040bdf4eb8 fix(sf): simplify parallel-merge, remove debug logs from state
- Simplify parallel-merge.ts error handling
- Remove console.log debug statements from state.ts deriveState

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 05:48:13 +02:00
Mikael Hugo
37f1028fe9 test: fix mcp-server imports, regex patterns, and add sqlite fallback in parallel-merge 2026-05-02 05:46:32 +02:00
Mikael Hugo
2be52e28a3 test: convert ci_monitor and linux-ready to vitest, add vectordrive to include 2026-05-02 05:45:40 +02:00
Mikael Hugo
449d0ca878 test: convert remaining standalone tests to vitest, remove debug logs, fix parser fallback 2026-05-02 05:43:32 +02:00
Mikael Hugo
ba5ecfc050 fix: stalled-tool-recovery test wrap in describe/it, minor cleanup
- Wrap bare test blocks in describe/it for vitest compatibility
- Clean up vitest.config.ts

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 05:41:39 +02:00
Mikael Hugo
b6358c1c14 test: commit current vitest fixes 2026-05-02 05:39:38 +02:00
Mikael Hugo
0e769dbf13 test: include vitest test import 2026-05-02 05:38:37 +02:00
Mikael Hugo
df03312fa5 test: stabilize vitest compatibility 2026-05-02 05:36:57 +02:00
Mikael Hugo
7dd59ad70d test: enable 7 more converted vitest tests and fix worktree-nested-git slice size 2026-05-02 05:35:42 +02:00
Mikael Hugo
9ad818d4a0 test: enable 7 converted vitest tests previously in exclude list 2026-05-02 05:32:32 +02:00
Mikael Hugo
0682fbc32a test: remove debug logs, fix loop.ts logging, and enable converted vitest tests 2026-05-02 05:13:14 +02:00
Mikael Hugo
3ddb8c84e0 chore: commit current worktree state 2026-05-02 05:11:03 +02:00
Mikael Hugo
e44237e526 test: final vitest API migration fixes across all packages and extensions 2026-05-02 04:49:34 +02:00
Mikael Hugo
5cf94c296e test: complete vitest mock API fixes for callCount and calls access 2026-05-02 04:47:41 +02:00
Mikael Hugo
1de5d5456a chore: complete vitest migration for remaining packages and API calls
- Convert remaining node:test → vitest imports in packages/* and studio/*
- Fix mock.callCount() → mock.callCount property access for vitest compat
- Fix mock.calls[N].arguments → mock.calls[N] for vitest compat
- Update tsconfig.extensions.json to exclude test files from tsc
- Harden migrate-to-vitest-all.mjs regex for single quotes and optional semicolons
2026-05-02 04:46:11 +02:00
Mikael Hugo
b62f7b20ec fix: convert node:test API calls to vitest equivalents
- t.after() → afterEach() with import injection
- t.before() → beforeEach() with import injection
- t.test() → test() (flatten subtests)
- t.skip() → return with skip comment
- Fix vitest.config.ts poolOptions deprecation for Vitest 4
- Run fix-vitest-api.mjs across 108 affected test files

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
2026-05-02 04:42:38 +02:00
Mikael Hugo
01d8f2fad6 fix(pi-ai): drop pre-5.3 codex models from generated registry
Remove gpt-5.1 and gpt-5.2 variants from openai-codex-responses.
Keep gpt-5.3+, gpt-5.4, and the newly-added gpt-5.5.
2026-05-02 04:41:06 +02:00