You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: stabilize diagnostics and low-end hooks (#441)
* refactor(core): isolate diagnostics sink boundary
Keep structured log construction and GDPR redaction renderer-neutral, then pass the typed LogEntry to the existing IDB, Tauri JSONL, and development-console adapters. Preserve all logger APIs and sink behavior; this slice does not switch production authority or migrate callers.\n\nValidation: targeted Vitest 22/22, Biome, tsgo, docs metrics, native-readiness, desktop import guardrail, and diff checks passed. No new dependency or suppression was added. Local hooks remain bypassed only because pnpm reports ERR_PNPM_VERIFY_DEPS_BEFORE_RUN on the existing install; CI remains authoritative.
* docs(native): keep diagnostics maturity evidence honest
Record the new typed sink boundary as locally proven and CI merge-gated until this PR lands; retain the existing CI-proven Core/redaction parity claims. No architecture or authority status changes.\n\nValidation: docs metrics, native-readiness, and diff checks passed. Local hook bypass remains limited to the known ERR_PNPM_VERIFY_DEPS_BEFORE_RUN install mismatch.
* fix(diagnostics): redact nested sensitive context
Address Amazon Q security finding PRRT_kwDOQOeAgc6bGOWM: nested password/token values could bypass the previous top-level-only redaction. Recursively sanitize JSON-like objects and arrays in TypeScript and Rust, preserve non-mutating behavior, and update the shared parity fixture.\n\nValidation: targeted Vitest 22/22, tsgo, Biome, cargo fmt --check, and worldscript-diagnostics unit plus shared-fixture tests passed. The full local Cargo test also reached only the separate doctest, which could not create its temporary directory because this environment exposes /tmp as read-only; the test-only command passed. No dependency, suppression, authority switch, or baseline change. Local hooks remain bypassed only for ERR_PNPM_VERIFY_DEPS_BEFORE_RUN.
* fix(diagnostics): route sinks through desktop platform
* chore(tooling): stabilize low-end git hooks
* fix(desktop): preserve adapter diagnostics context
* fix: close release and translation quality blind spots
* test: stabilize tauri runtime mock initialization
* fix: close diagnostics review and coverage gaps
* style: apply rustfmt to diagnostics redaction
* test: close diagnostics coverage gaps
* fix: allow tagless release-truth checks
* fix: align native IV redaction
Copy file name to clipboardExpand all lines: AGENTS.md
+24-10Lines changed: 24 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ The app supports a multi-provider AI stack (Gemini, OpenAI, Claude, Grok, OpenRo
33
33
```bash
34
34
pnpm run ci:prepush
35
35
```
36
-
This gate is mandatory before every push and after every local correction before re-pushing; all three checks must exit successfully. A targeted test or changed-file lint run alone is not push evidence. The pre-commit hook checks staged files with Biome, while the pre-push gate runs the full repository lint before typecheck and i18n validation. If branch switching or a lockfile/package-manifest change makes pnpm report dependency verification errors, repair first with `pnpm install --frozen-lockfile` and rerun the complete pre-push gate.
36
+
This gate is mandatory before every push and after every local correction before re-pushing; it runs sequentially with a single-checker project typecheck, i18n parity/quality and bundle checks, release/doc truth, and lightweight native guardrails. The pre-commit hook separately runs staged-file Biome checks. Full repository lint, coverage, E2E, Storybook, Lighthouse, and mutation checks belong to cloud CI. If branch switching or a lockfile/package-manifest change makes pnpm report dependency verification errors, run `node scripts/dependency-state.mjs reconcile` and rerun the complete pre-push gate.
37
37
Optional targeted smoke test: `pnpm exec vitest run <path>`**without**`--coverage`.
38
-
**Hard rule:** Never invoke `pnpm test`, `npm run test`, or a bare Vitest wrapper; always use an explicit `pnpm exec vitest run <path>` command to avoid watch-mode hangs on constrained hardware.
38
+
**Hard rule:** Never invoke `pnpm test`, `npm run test`, or a bare Vitest wrapper; always use an explicit `pnpm exec vitest run <path>` command to avoid watch-mode hangs on constrained hardware. Never start multiple heavyweight processes concurrently.
39
39
4.**Audit cloud CI logs, fix locally, then re-push** – If the cloud CI run fails, inspect the logs via GitHub web UI or `gh run watch`, reproduce the specific failing test or lint error in isolation, fix it locally (quick tier to verify), commit, and push again for another cloud CI run.
40
40
5.**Sequential execution** – Do not parallelize builds, tests, or processes locally. Use single-threaded modes and avoid background tasks that compete for RAM/CPU.
41
41
6.**Resource budget** – Avoid spinning up the dev server (`pnpm run dev`) for extended periods if not needed. Prefer one-off commands (`pnpm run build`, `pnpm run typecheck`) and stop the server when done.
After an explicit `pnpm run hooks:install`, the pre-commit hook runs `biome check --write` on staged
265
-
files via `simple-git-hooks` + `lint-staged`, and the pre-push hook runs `pnpm run ci:prepush`.
265
+
After an explicit `pnpm run hooks:install`, the pre-commit hook runs `lint-staged` on staged files
266
+
through `node scripts/hooks/pre-commit.mjs`; the pre-push hook runs
267
+
`node scripts/hooks/pre-push.mjs`. These direct Node entrypoints verify the content fingerprint
268
+
and invoke local binaries without pnpm's workspace-state preflight in the hook path.
266
269
The pre-commit hook is not a substitute for the complete pre-push gate; CI remains mandatory when
267
270
hooks are not installed.
268
271
@@ -273,12 +276,21 @@ hooks are not installed.
273
276
### Philosophy
274
277
275
278
-**Cloud CI-first:** The canonical quality gate is GitHub Actions. Low-end local machines should run only the "Quick" tier.
276
-
-**Quick tier (local, before every push):**`pnpm run ci:prepush` runs the full repository lint, then
277
-
the exact CI typecheck and i18n checks sequentially. Staged-file Biome validation still runs in
278
-
pre-commit. Run the gate
279
-
again after every correction before re-pushing; do not push based only on a targeted test or a
280
-
changed-file lint run. Optionally: `pnpm exec vitest run <path>`
281
-
**without**`--coverage`.
279
+
-**Quick tier (local, before every push):**`pnpm run ci:prepush` runs the project typecheck with
280
+
one checker, i18n parity/quality/bundle/content checks, release/doc truth, and lightweight desktop guardrails sequentially;
281
+
the pre-commit hook separately runs staged-file Biome checks. Run the gate again after every
282
+
correction before re-pushing; do not
283
+
push based only on a targeted test or a changed-file lint run. Optionally:
284
+
`pnpm exec vitest run <path>`**without**`--coverage`.
285
+
-**Dependency state:**`pnpm run deps:verify` compares a content fingerprint of dependency
286
+
manifests, workspace package manifests, and patches. After a dependency-related branch switch,
287
+
run `node scripts/dependency-state.mjs reconcile` (or `pnpm run deps:reconcile` when pnpm can
288
+
start); never use `--no-verify` as the
289
+
normal recovery path.
290
+
-**Low-resource policy:** Never run Biome, multiple TypeScript checkers, Vitest, Cargo, Vite,
291
+
Storybook, or other heavyweight processes concurrently on the development workstation. Full
292
+
repository lint/tests, E2E, coverage, Lighthouse, and mutation testing are cloud-CI work unless
293
+
the user explicitly requests a narrowly scoped local run.
282
294
-**Vitest watch-mode hard rule:** Never invoke `pnpm test`, `npm run test`, or a bare Vitest wrapper; use an explicit targeted `pnpm exec vitest run <path>` command so constrained hardware never waits on watch mode.
@@ -375,6 +387,8 @@ Never commit directly to `main` — always a feature branch + PR, even for a sin
375
387
376
388
**Review-comment completeness — check three independent channels before declaring a PR review-clean, every time:** (1) GraphQL `reviewThreads` for inline per-line comments; (2) `gh api repos/<owner>/<repo>/issues/<PR>/comments` for plain top-level bot comments (qodo-code-review posts its real findings only here, never as `reviewThreads`); (3) `gh api repos/<owner>/<repo>/pulls/<PR>/reviews`, reading each review's full `.body` text (CodeRabbit's "🧹 Nitpick comments" and outside-diff-range findings live here, collapsed, invisible to the other two channels). A bot using one channel on a PR doesn't mean the others are covered.
377
389
390
+
**Squash-merge verification:** Never infer a missing merge from `git merge-base --is-ancestor` alone. For every PR, verify `state=MERGED`, `merged_at`, and the resulting `merge_commit_sha`; compare the base commit immediately before the merge with that resulting `main` commit, including changed files, additions, and deletions. Use patch/tree equivalence as an optional corroboration. This is required because GitHub squash merges intentionally produce a new commit whose SHA is not the PR head SHA.
391
+
378
392
**Known review bots on this repo** (confirm still installed — this list can drift): CodeRabbit (`@coderabbitai review` to re-trigger), CodeAnt AI (5 CI status checks only — `CodeAnt - Quality Gates/SAST/SCA/SCR/Test Coverage` — not inline PR comments here), qodo-code-review (top-level comments, see above), Amazon Q Developer (`/q review` as a fresh top-level comment — not inside an existing thread; quota-conscious — call it once CodeRabbit/CodeAnt's own loop has already reached quiescence, not after every fix commit), Graphite AI Reviews (automatic, no confirmed manual trigger), chatgpt-codex-connector (intermittent/quota-limited availability — verify it's currently active rather than assuming silence means "nothing to report"). A bot's silence is not a clean pass by itself — for security/sandbox/IPC/FFI/packaging-adjacent PRs, verify at least one bot produced real review output (its actual comment/review text), not just a green check-run.
379
393
380
394
**PR size:** keep every PR's changed-file count under ~100 — several review bots skip inline comments above that threshold. Check with `git diff --name-only <base>...HEAD | wc -l` before pushing; split into the fewest stacked PRs that stay under the limit if needed.
|**Touched `packages/ai-core`, `workers/`, or `vite.config.ts`**|`pnpm run build && pnpm run smoke:prod` (prod-only crash guard) |
@@ -200,7 +200,9 @@ Coverage, E2E, Lighthouse, Stryker, and Storybook test-runner are **CI gate jobs
200
200
201
201
### Local vs CI (low-end friendly)
202
202
203
-
-**Before every push (recommended):**`pnpm run lint`, `pnpm run typecheck`, `pnpm run i18n:check`. Optional: targeted `pnpm exec vitest run <path>` for a quick smoke.
203
+
-**Before every push:**`pnpm run ci:prepush` (sequential single-checker typecheck, i18n parity/quality, release/doc truth, and lightweight guardrails); the pre-commit hook runs staged Biome checks. Optional: targeted `pnpm exec vitest run <path>` for a quick smoke.
204
+
-**Full local gate (manual):**`pnpm run ci:local:full`; full tests, coverage, E2E, Storybook, Lighthouse, and mutation testing remain CI-owned on low-end hardware.
205
+
-**Dependency recovery:** run `node scripts/dependency-state.mjs reconcile` when pnpm reports stale dependency state. It performs the frozen install and records the content fingerprint atomically; `pnpm run deps:reconcile` is the convenience wrapper when pnpm can launch.
204
206
-**Vitest hard rule:** Never invoke `pnpm test`, `npm run test`, or a bare Vitest wrapper; watch mode hangs constrained hardware. Use an explicit targeted `pnpm exec vitest run <path>` command.
205
207
-**Full gate:** GitHub Actions runs Vitest **with** coverage thresholds, Playwright (desktop + mobile emulation in CI), Lighthouse, etc. A **green CI run** is the merge bar — you are **not** required to pass full E2E or LHCI on a weak laptop.
206
208
-**Optional local E2E:**`CI=true pnpm run test:e2e` when debugging; optional mobile project: `RUN_MOBILE_E2E=1` (see [`docs/CI.md`](docs/CI.md)).
@@ -387,13 +389,11 @@ Open a **focused PR per theme** (storage vs. i18n vs. collaboration) to keep rev
387
389
388
390
1. Fork the repository and create a feature branch
389
391
2. Write or update tests for your changes
390
-
3. Let CI run the full test suite; locally use only targeted `pnpm exec vitest run <path>`.
391
-
4. Ensure Biome passes: `pnpm run lint`
392
-
5. Ensure i18n parity: `pnpm run i18n:check`
393
-
6. Ensure types compile: `pnpm run typecheck`
394
-
7. Ensure the build succeeds when build-affecting files changed; GitHub Actions runs the canonical build gate for every PR.
395
-
8. Submit a PR against `main` with a clear description
396
-
9. Request review from at least one maintainer
392
+
3. Run the sequential local gate: `pnpm run ci:prepush` (and the optional targeted `pnpm exec vitest run <path>` when useful).
393
+
4. Let CI run the full lint and test suite; it is authoritative for the heavy tier.
394
+
5. Ensure the build succeeds when build-affecting files changed; GitHub Actions runs the canonical build gate for every PR.
395
+
6. Submit a PR against `main` with a clear description
396
+
7. Request review from at least one maintainer
397
397
398
398
The CI pipeline will automatically run lint, i18n check, typecheck, tests, and build on every PR.
0 commit comments