Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat(quality): audit measured CI efficiency and stage placement
Adam Eivyf50d98fe4bae
diff --git a/server/lib/auditQuality.js b/server/lib/auditQuality.jsindex 6ec822dd21..a1f8599acd 100644--- a/server/lib/auditQuality.js+++ b/server/lib/auditQuality.js@@ -32,7 +32,7 @@ export const AUDIT_DISCOVERY = Object.freeze({'better-dependency-freedom': 'Inventory manifests and actual imports across packages; rank dependency cost, advisory exposure and removable surface against the complexity of a concrete replacement.','better-test-quality': 'Inventory suites and public boundaries; search assertion-free tests, overmocking, tautologies and redundant cases, prioritizing suites that falsely protect critical behavior.','better-dev-environment': 'Diff host state around one bounded run of the dev commands (see the mission), then inventory the fixture, spawn, watcher and cache sites behind each change; rank by what accumulates per run times how often the loop runs.',- infrastructure: 'Inventory infrastructure-as-code, container, orchestration, deployment and CI files; scan exposure, identity grants, secrets, pinning, resource limits and probes, ranking reachable production exposure and irreproducible deploys first.',+ infrastructure: 'Inventory infrastructure-as-code, container, orchestration, deployment and CI files; scan exposure, identity grants, secrets, pinning, resource limits and probes, rank deployment risk alongside measured CI waste. Trace CI planners/runners; measure run frequency, job duration and critical path, then inspect trigger/path selection, duplicate work, dependencies, cache/artifact reuse, cancellation/concurrency and risk-based PR/MR versus merge/nightly/release placement. Coordinate test-value evidence with Test Quality; preserve essential correctness/security coverage.','data-integrity': 'Inventory every write path, ingestion entry point, consumer, batch/backfill job and stored data format; trace retry and redelivery behavior and multi-step writes, ranking silent duplication, loss and wrong results first.',reliability: 'Inventory process entry points, signal handling, health endpoints, queues, workers and scheduled jobs; trace shutdown, restart, overload and multi-instance behavior, ranking dropped work and outage amplification first.',privacy: 'Inventory personal and sensitive fields in schemas and payloads, then trace them to logs, errors, analytics, caches, exports, third-party calls and deletion paths; rank exposure already happening over missing governance.',diff --git a/server/services/cosTaskGenerator.auditMode.test.js b/server/services/cosTaskGenerator.auditMode.test.jsindex 70724e6f02..4db99a33c3 100644--- a/server/services/cosTaskGenerator.auditMode.test.js+++ b/server/services/cosTaskGenerator.auditMode.test.js@@ -188,6 +188,41 @@ describe('issues-only audit dispatch never acquires code-shipping instructions (}});+ it.each([true, false])('infrastructure renders measured CI efficiency and safe delivery with fileIssues=%s', async (fileIssues) => {+ const { DEFAULT_TASK_PROMPTS } = await import('./taskPromptDefaults.js');+ const { getTaskInterval } = await import('./taskSchedule.js');+ promptTemplate.body = DEFAULT_TASK_PROMPTS.infrastructure;+ getTaskInterval.mockResolvedValue({ type: 'on-demand', taskMetadata: { fileIssues, useWorktree: true, openPR: true } });+ const task = await generate('infrastructure');+ const prompt = renderPrompt(task);+ for (const instruction of [+ 'CI efficiency and placement', 'sample window and count', 'execution frequency',+ 'summed runner time', 'critical path', 'measured avoidable runner time',+ 'coverage/required-check failure', 'trigger/path selection', 'affected-test',+ 'duplicate work', 'unnecessary serialization', 'cache hits/misses',+ 'artifact upload/download cost', 'superseded-run', 'risk-based PR/MR',+ 'stronger surviving coverage', 'A slow test is not a valueless test',+ 'representative', 'required-check behavior', 'do not invent savings',+ 'preserve essential correctness/security coverage',+ ]) expect(prompt).toContain(instruction);+ expect(prompt).not.toContain('{modeInstructions}');+ if (fileIssues) {+ expectNoCodeDelivery(prompt, 'infrastructure');+ expect(prompt).toContain('Mode: file issues, change nothing');+ } else {+ expect(task.metadata.fileIssues).toBe(false);+ expect(task.metadata.noCodeOutput).not.toBe(true);+ expect(prompt).toContain('Mode: audit and fix');+ expect(prompt).toContain('## Completion Workflow');+ }+ });++ it('keeps CI-efficiency discovery in customized infrastructure prompts', async () => {+ const task = await generate('infrastructure');+ expect(renderPrompt(task)).toContain('measure run frequency, job duration and critical path');+ expect(renderPrompt(task)).toContain('preserve essential correctness/security coverage');+ });+it('bails out before generating an audit that cannot apply, advancing the cadence', async () => {applicability.inapplicable = { 'mobile-responsive': 'no user interface found in this repository' };const { recordExecution } = await import('./taskSchedule.js');diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex 7f638a04d8..2087771a3c 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -30,7 +30,7 @@"error-handling": "137b371f38398042c0a2c7e2279c92ce","feature-completeness": "00d8916cc6032e74817657375375115b","feature-ideas": "804f62f1dadadbfa8a0bcd4aff16b2e8",- "infrastructure": "b4ad755eb115b82679c601a0df1ffd7b",+ "infrastructure": "bd31db72a371136f6c32d119d76c0281","issue-reconcile": "716c87476d77d7e4f98613dadc06f228","jira-sprint-manager": "3e63c8a3bdf0d5a05a30faaa2dc07980","jira-status-report": "9d374a9d8ccb92c5c8fd0aa9899e79a5",@@ -94,7 +94,7 @@"error-handling": 3,"feature-completeness": 1,"feature-ideas": 11,- "infrastructure": 1,+ "infrastructure": 2,"issue-reconcile": 8,"jira-sprint-manager": 1,"jira-status-report": 1,@@ -341,6 +341,9 @@"0741418bd275b8953131155f8bc89460","d3282f16da29efe2d53595b3b34778bc"],+ "infrastructure": [+ "b4ad755eb115b82679c601a0df1ffd7b"+ ],"issue-reconcile": ["6f33db6ad0b57c36909229694b78891a","c57a39aaa118173a496f030f5878bfc1",diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex fe8d767a60..f958517ff7 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -1906,6 +1906,46 @@ the project's documented deployment model decides which exposure is intended.reads it) that disagree about a port, a variable, or a resource, so the firstdeploy to the other one fails.+## CI efficiency and placement++This is part of the audit, alongside deployment safety. Trace workflow files+through their planner, runners, scripts and required-check rules; YAML alone+may hide what actually runs.++- **Measure before changing.** Sample recent representative PR/MR, merge,+ nightly and release runs, including a small change and a broad-risk change.+ Record run links/commit SHAs, sample window and count, execution frequency,+ per-job/step durations, queue time, summed runner time and the dependency+ critical path. Separate measured data from estimates and explain missing+ telemetry; estimate savings per run and at the observed cadence.+- **Select work by risk.** Inspect event triggers, path filters, affected-test+ selection and full-suite fallbacks. Check that small unrelated changes do+ not select expensive work without a reason, and relevant changes cannot skip+ required coverage. Evaluate PR/MR versus merge, nightly, release and opt-in+ placement against the failures each check catches and when detection is+ needed. Preserve required status reporting and fail closed on uncertain scope.+- **Remove demonstrated duplicate work.** Trace overlapping workflows, matrix+ jobs, installs, builds, test processes and setup. Inspect job dependencies for+ unnecessary serialization or repeated prerequisites. Distinguish runner-time+ savings from critical-path latency; more parallelism can increase total cost.+- **Reuse safely.** Check cache hits/misses, keys and invalidation, restore cost,+ artifact upload/download cost, retention and same-input build reuse. Preserve+ platform/toolchain compatibility, provenance and untrusted-PR isolation.+- **Bound obsolete work.** Inspect concurrency groups, superseded-run+ cancellation, failure cancellation, retries and timeouts. Keep release work,+ required gates and failure diagnostics reliable; do not trade waste for+ missing results or restart loops.+- **Prove test value.** Coordinate with Test Quality for redundant or vacuous+ tests: identify the stronger surviving coverage or use a bounded mutation+ probe, reverted before commit. A slow test is not a valueless test. Improve+ fixtures, imports or setup before removing useful correctness/security checks.++For a CI finding, give the measured baseline, exact selection/dependency change,+expected savings, retained risk coverage and validation. Test representative+changed-path/event cases and required-check behavior, then compare equivalent+before/after runs where available. If access prevents measurement, report that+limit; do not invent savings or weaken essential coverage to obtain green CI.+## Not yoursApplication-code vulnerabilities belong to the security work; package version@@ -1917,7 +1957,8 @@ reliability work. Name the overlap if it is the cause, then leave it to its owneEvery finding names the file and line, the environment it affects, and theconcrete consequence: who can reach what, what a leaked credential grants, or-which deploy breaks. Redact before you publish — describe a secret's location+which deploy breaks, measured avoidable runner time or critical-path delay,+or a coverage/required-check failure. Redact before you publish — describe a secret's locationand shape, never its value, and never paste account ids, hostnames, or addresses.`,'data-integrity': `[Improvement: {appName}] Data integrity and pipeline auditdiff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.jsindex 007b5f7628..d5ec4a6c21 100644--- a/server/services/taskPromptDefaults/versions.js+++ b/server/services/taskPromptDefaults/versions.js@@ -68,7 +68,7 @@ export const PROMPT_VERSIONS = {'better-structural-drift': 1, // v1: derived artifacts as a second source of truth, position-keyed records, hand-synced registries, incidental-layout coupling — carved out of code-quality v3.'better-runtime-safety': 3, // v3: adds cross-module contract breaks in untyped code (missing members, missing named exports, dropped wrapper arguments) with a guard-test fix. Previous version: Framework-neutral UI lifecycle overlap. Previous version: v1: latent defects (floating promises, unowned rejections, unguarded access, sentinel confusion, races, leaks) requiring a concrete failure scenario.'better-dependency-freedom': 1, // v1: dependency NECESSITY (the do:depfree lens) — classify, prove usage, size the replacement. Distinct from dependency-updates, which bumps what stays.- 'infrastructure': 1, // v1: IaC/container/orchestration/CI audit — exposure, identity grants, secrets, pinning, runtime guardrails, state config, CI supply chain, environment drift. Net-new type. Mode injected at dispatch.+ 'infrastructure': 2, // v2: measured CI efficiency, risk-based stage placement and test-value evidence. v1: IaC/container/orchestration/CI audit — exposure, identity grants, secrets, pinning, runtime guardrails, state config, CI supply chain, environment drift. Net-new type. Mode injected at dispatch.'data-integrity': 1, // v1: runtime data-correctness audit — idempotency under redelivery, partial writes, lost updates, boundary validation, schema evolution, semantic corruption, pagination, retention, transfer checks. Net-new type.'reliability': 1, // v1: service reliability audit — shutdown draining, truthful health checks, backpressure, job leasing/checkpoints, startup fragility, mixed-version deploys. Net-new type.'privacy': 1, // v1: personal/sensitive-data audit — operational exposure, third-party minimization, API over-exposure, retention, erasure reach, real data in fixtures. Honors the project's documented sharing model. Net-new type.