@ngockhoale/ukit 3.5.11 → 3.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/manifests/documentation.yaml +11 -0
- package/manifests/platform.full.yaml +39 -2
- package/package.json +1 -1
- package/template_project/.claude/agents/code-reviewer.md +1 -0
- package/template_project/.claude/agents/feature-implementer.md +1 -0
- package/template_project/.claude/hooks/completion-gate.sh +3 -3
- package/template_project/.claude/settings.json +2 -2
- package/template_project/.claude/skills/code-review/SKILL.md +14 -0
- package/template_project/.claude/skills/testing-quality/SKILL.md +31 -1
- package/template_project/.claude/skills/testing-quality/memory-safe-tests.md +133 -0
- package/template_project/.claude/ukit/index/test-batches-adapters.mjs +261 -0
- package/template_project/.claude/ukit/index/test-batches.mjs +829 -0
- package/template_project/.claude/ukit/runtime/stop-coordinator.mjs +4 -4
- package/template_project/.omp/agents/code-reviewer.md +1 -0
- package/template_project/.omp/agents/feature-implementer.md +1 -0
- package/template_project/docs/memory/testing.md +10 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Stalled-cursor releases are advisory, never completion evidence.
|
|
10
10
|
* Completion infrastructure failures block with redacted reasons (details only
|
|
11
11
|
* on stderr); watchdog failures are advisory and reported verbatim.
|
|
12
|
-
* UKIT_HOOK_DEADLINE_MS bounds execution (wrapper default
|
|
12
|
+
* UKIT_HOOK_DEADLINE_MS bounds execution (wrapper default 10000ms), including the ledger
|
|
13
13
|
* child. Deadline expiry synchronously emits a fail-closed block and reaps the
|
|
14
14
|
* child before exit0: empty stdout would incorrectly release the wrapper.
|
|
15
15
|
* Exported evaluators, merge, normalization and redaction seams are tested directly.
|
|
@@ -143,14 +143,14 @@ export const DEDUPE_WINDOW_MS = 2000;
|
|
|
143
143
|
|
|
144
144
|
// Budget slices inside the hook deadline: the ledger child gets the larger slice, each
|
|
145
145
|
// watchdog lock acquisition gets a short one. The ledger slice is 1500ms under a short
|
|
146
|
-
// deadline and grows with a longer one (the shipped wrapper arms
|
|
147
|
-
//
|
|
146
|
+
// deadline and grows with a longer one (the shipped wrapper arms 10000ms → 7000ms) capped at 8000ms:
|
|
147
|
+
// min(8000, max(min(3000, d-1500), d-3000)), leaving 1500-3000ms for the advisory lanes and the decision write. Field telemetry:
|
|
148
148
|
// on a loaded machine / external volume a healthy evaluation overran 1500ms and the
|
|
149
149
|
// stop was blocked as an "infrastructure failure".
|
|
150
150
|
export function resolveLedgerBudgetMs(deadlineMs) {
|
|
151
151
|
const deadline = Number(deadlineMs);
|
|
152
152
|
if (!Number.isFinite(deadline) || deadline <= 3000) return 1500;
|
|
153
|
-
return Math.min(3000, deadline - 1500);
|
|
153
|
+
return Math.min(8000, Math.max(Math.min(3000, deadline - 1500), deadline - 3000));
|
|
154
154
|
}
|
|
155
155
|
const LEDGER_BUDGET_MS = resolveLedgerBudgetMs(HOOK_DEADLINE_MS);
|
|
156
156
|
export const LOCK_BUDGET_MS = 600;
|
|
@@ -66,6 +66,7 @@ If any input is missing, return `CHANGES-REQUESTED` with reason "incomplete hand
|
|
|
66
66
|
4. **Safety / security / data loss** — Destructive actions, auth/permission, path handling, unsafe shell/DB/file ops.
|
|
67
67
|
5. **Performance / scale** — Accidental N+1, repeated I/O, large scans inside hot paths.
|
|
68
68
|
6. **Maintainability** — Duplicated logic, dead branches, misleading naming, drift between docs/tests/source.
|
|
69
|
+
6a. **Test hygiene (test diffs)** — Follow `.claude/skills/code-review/SKILL.md` § Test Diffs: app/server/client/DB fixtures without teardown, real-data reachability, per-test app registries, oversized new test files (count parametrize expansion), and tests skipped to save time/RAM. Run `node .claude/ukit/index/test-batches.mjs audit --changed`; an enforced ERROR on a new test file is `CHANGES-REQUESTED` unless the project records an exception.
|
|
69
70
|
7. **Solution fit** — For each added block, ask with evidence and cite the construct + why (never the prose length):
|
|
70
71
|
- Does new code duplicate an existing helper with the same semantics? A same-semantics duplicate is `CHANGES-REQUESTED` — reuse the existing helper.
|
|
71
72
|
- Would the standard library or a native platform API satisfy every stated requirement? If yes, the custom implementation is avoidable.
|
|
@@ -42,6 +42,7 @@ and even then, report it, don't ask about it.
|
|
|
42
42
|
### 2. Plan Approach (< 1 minute)
|
|
43
43
|
|
|
44
44
|
- List files to create/modify (max diff).
|
|
45
|
+
- **Tests you add:** plan the layout first (feature, category, expected case count incl. parametrize, target files, fixture teardown) and follow `.claude/skills/testing-quality/SKILL.md` § Writing Memory-Safe Tests — small focused files, every app/client/DB fixture torn down, test paths isolated before app import. Full-suite verification uses `node .claude/ukit/index/test-batches.mjs run`.
|
|
45
46
|
- **Handoff mode only:** if no Test Plan exists in the task file and task is not `trivial`, write one inline before implementing (happy + ≥2 edge cases of different kinds; regression test if fixing a bug). In daily mode, skip this step.
|
|
46
47
|
- **Choose the smallest solution that fully meets the stated requirements and project conventions.** When more than one option qualifies, prefer, in order: (1) reuse an existing codebase helper with the same semantics; (2) standard library, native platform API, or an already-installed dependency; (3) custom code or a new dependency (last resort). Never drop validation, security, accessibility, error handling, compatibility, or required tests to reduce code. A bugfix fixes the root cause and the affected callers. If the small option is insufficient, build the full option — never ship a weaker version and ask. No speculative abstraction for imagined needs.
|
|
47
48
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Testing patterns (UKit default)
|
|
2
|
+
|
|
3
|
+
Seeded once by UKit; this file is yours — edit, extend or delete entries. Full rules: `.claude/skills/testing-quality/memory-safe-tests.md`.
|
|
4
|
+
|
|
5
|
+
- Pattern: run the full test suite with `node .claude/ukit/index/test-batches.mjs run` — sequential small batches, one fresh process per batch, every test file runs; only verdict PASS satisfies a release gate (FAIL/INCOMPLETE/UNSAFE do not). Do not add parallel workers (pytest-xdist -n, maxWorkers) to fix test memory: workers multiply RAM.
|
|
6
|
+
- Pattern: test suite memory blow-up / swap is usually a per-test leak, not runner speed — a fixture builds a fresh app per test that is never freed (global app registry, OpenAPI/docs singleton, module-level routers holding app refs, background tasks never cancelled). Fix fixture teardown; smaller batches or files alone do not fix it.
|
|
7
|
+
- Pattern: every test fixture that builds an app, server, client, DB connection, browser, thread or async task tears it down (yield + finally / afterAll): cancel tasks, close connections, unregister from registries, clear singletons. Prefer one app per module (scope=module) when tests do not mutate app state.
|
|
8
|
+
- Pattern: plan test files before writing them — count cases including parametrize expansion; budgets per file: unit 40, integration 20, app-heavy 10, e2e 10; split by behaviour, never into one 200-case test file. Check with `test-batches.mjs audit --changed`.
|
|
9
|
+
- Pattern: test isolation — set data, DB, log and telemetry paths to a temp dir before the app module is imported; app code reads paths from config at call time, not at import; disable schedulers, sweeps and auto-fetch in tests. Tests must never touch real project data, auth/system DBs or shared logs; prove it with `test-batches.mjs run --guard <data dir>`.
|
|
10
|
+
- Pattern: never skip, deselect or xfail tests to save RAM or time; RAM thresholds only flag heavy test files. Suspected test memory leak → `test-batches.mjs detect-leaks --file <file>` and `--resource-warnings` for unclosed DB connections.
|