Skip to content

fix(repo): un-skip three lint gates and guard against the shape - #364

Merged
prisis merged 6 commits into
alphafrom
ci/302-unskip-lint-large
Aug 8, 2026
Merged

prisis merged 6 commits into
alphafrom
ci/302-unskip-lint-large

Conversation

@prisis

@prisis prisis commented Aug 8, 2026 •

Copy link
Copy Markdown
Member

What

Three more packages whose lint gate reported success after ~13 ms of doing nothing, plus the guard that stops it coming back (plan 302 phases 7–10).

@lunora/db, @lunora/ai and @lunora/replica each declared lint:eslint in nx's shape (executor + nested options.command). vis reads only a top-level command, so it printed No command configured and recorded a pass — the declared target shadowed the manifest script, and CI's required context is that aggregate run.

Each package is one commit: clear the backlog, delete the targets block, so the gate and the cleanup land together.

Findings cleared

Package Findings Shape
db 38 (35 errors, 3 warnings) import/exports-last ×12, jsdoc/* ×7, no-underscore-dangle ×3, plus singles
ai 117 (2 errors, 115 warnings) 109 × vitest/prefer-expect-assertions, all in __tests__; src/ was already clean
replica 303 (0 errors, 303 warnings) 274 × prefer-expect-assertions, 12 × require-mock-type-parameters, 4 × no-console (the only src/ findings)

Measure after a build. Cold, db reports 109 and svelte 455 — the extra findings are phantom no-unsafe-* cascades from an unbuilt dependency's dist/. Every count above is post-build:packages.

vitest/prefer-expect-assertions was not exempted: it is on in 45 of 55 packages, off in 10, and no package anywhere uses the rule's granular options — the precedent is binary, so matching the 45 is the call and exempting two more would have been the drift. 383 tests got a count via a ts-morph codemod. Five were wrong because a module-level helper asserts on its caller's behalf; vitest failed loudly and they were corrected.

Behaviour-changing edits, disclosed

A lint cleanup that changes behaviour is the risk in a PR like this, so each one is named and was verified by execution, not inspection:

  • replica canonical-diff PRNG — module-level let seed → closure state. Same LCG, same initial seed, bit-identical sequence.
  • start() is idempotent asserted nothing at all. Rewritten; mutation-tested by deleting the guard at sync-events.ts:192, which now makes it fail.
  • Four if (x) guards → non-null assertions (result.value!.seq ×3, registeredCallback! ×1) so an iterator ending early throws instead of silently passing. Same verdict on the same input, worse message. (The replica commit body says three — integration.test.ts:465 is the fourth.)
  • else if → two guarded branches in an event-log fake, mutual exclusion moved to isSince = !isRange && …. Truth table identical.
  • Two floating void settled?.then(…) probes in db mutator tests → an awaited tracked async IIFE. Both call sites retain an expect(done).toBe(false) before the settlement point, so the empty-configs case still fails.

Phase 10 — the guard

scripts/check-project-json-targets.js, wired as the first step of the Lint workflow's eslint job and as pnpm run lint:project-json. Deliberately not in the root postinstall: a failing check there turns all ~20 CI jobs red in their setup step, and the cause is invisible in the job that "failed". **/project.json joins the path filter so a PR touching only a project.json cannot skip the job that catches this.

KNOWN_UNMIGRATED is self-cleaning — the check fails on a stale entry as well as a missing one, so an allowlist cannot outlive its fix.

⚠️ Merge-order dependency with #363

KNOWN_UNMIGRATED lists packages/svelte, which #363 makes clean. Whichever merges second must empty the allowlist (new Map()) or lint:project-json exits 1 on alpha, inside a required check, reading as "svelte lint broken".

Review — outstanding items

Both thermo passes ran against the full branch diff. The cleanup itself came back sound: all behaviour-changing edits verified safe, no unreported ones found, expect.assertions(n) confirmed to be an exact match in vitest (so a too-low count fails rather than passing silently), and all 7 added disables judged genuine against existing precedent.

All six findings are now fixed (commit ci: close the gate's own escape hatches and its blind spots):

  1. The gate could be switched off by editing the gate. scripts/check-project-json-targets.js, .github/workflows/lint.yml and .github/file-filters.yml now all appear in frontend_lintable, matching the worker_size precedent — a PR that edits the gate now matches a filter and runs it. lint-required-check fails only on failure/cancelled, so a skipped job did pass it.
  2. db no longer fights no-underscore-dangle. The allow-list block from packages/client/eslint.config.js was copied in and eight suppression sites deleted — the five file-level blankets plus three line-level ones.
  3. Sweep widened to apps, examples, packages, tests, and the denominator now counts only files that exist (72, checked against ls).
  4. False positive fixed: executor with a top-level command is a shape vis runs correctly and now passes, matching the check's own printed advice. options.command without executor still passes, as it should.
  5. Malformed project.json now fails instead of being silently counted clean.
  6. Stale figures corrected in the docstring and workflow comment, and the commit bodies now disclose all four non-null-assertion edits and why db gained no assertion counts.

Also done: ordered() deleted and plan.deletes ?? [] inlined at both call sites; the event-log fake collapsed to one bound selection plus one filter with the regexes hoisted to module constants; and onlyDerivedKey reworked to return keys rather than assert, which removes the coupling that made five unrelated tests depend on a helper's assertion count.

The checker was re-verified across nine branches — clean tree, executor without command, executor with command, options.command without executor, malformed JSON, an examples/ offender, a stale allowance, a deleted allowlisted file, and both defect classes at once — each by mutating a copy of the tree and restoring it.

Verification

db 86 / ai 123 / replica 337 tests · lint:eslint --max-warnings=0 and tsc --noEmit clean on all three · repo-wide lint:eslint 58 projects, 158 tasks, exit 0 · api:check 47 snapshots · lint:package-json 74 files · Prettier clean on all 35 changed files. Both directions of the new check tested: reintroducing a block → exit 1; allowlisting a clean project → exit 1.

🤖 Generated with Claude Code

https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation of project configuration to detect invalid build and lint targets before checks run.
    • Preserved reliable processing of database plans and clearer handling of warning and error conditions.
  • Chores

    • Updated linting workflows and project configurations for more consistent checks.
    • Added safeguards to identify malformed or outdated project target definitions.
  • Documentation

    • Corrected developer documentation links and clarified intentional warning and error logging.

@netlify

netlify Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for lunorash ready!

Name Link
🔨 Latest commit b83991c
🔍 Latest deploy log https://app.netlify.com/projects/lunorash/deploys/6a773538254565000910a236
😎 Deploy Preview https://deploy-preview-364--lunorash.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 98d38d2a-56e0-414d-aa7b-f33135f0051a

📥 Commits

Reviewing files that changed from the base of the PR and between 877570a and b83991c.

⛔ Files ignored due to path filters (6)
  • packages/db/__tests__/apply-plan.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/db/__tests__/define-collections.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/db/__tests__/internals.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/db/__tests__/outbox-replay.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/apply-diff.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/event-log-append-atomicity.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
📒 Files selected for processing (8)
  • .github/file-filters.yml
  • .github/workflows/lint.yml
  • packages/db/eslint.config.js
  • packages/db/src/apply-plan.ts
  • packages/db/src/collection-options.ts
  • packages/db/src/define-mutators.ts
  • packages/db/src/internals.ts
  • scripts/check-project-json-targets.js

Walkthrough

Changes

The pull request adds project target validation to the lint workflow, removes obsolete package lint targets, adds targeted ESLint suppressions, and reorganizes database package code without changing documented runtime behavior.

Lint validation and remediation

Layer / File(s) Summary
Project target validator
scripts/check-project-json-targets.js
The new script scans workspace manifests, validates target shapes and migration allowances, and reports validation results.
Lint workflow integration
.github/file-filters.yml, .github/workflows/lint.yml, packages/*/project.json
Project configuration changes trigger frontend lint jobs. The lint workflow validates target shapes before package checks. Obsolete package ESLint targets are removed.
Intentional lint exceptions
packages/db/eslint.config.js, packages/db/src/*, packages/replica/src/*
Targeted ESLint rules and suppressions document approved naming and console logging patterns. Documentation links are corrected.

Database code maintenance

Layer / File(s) Summary
Plan application cleanup
packages/db/src/apply-plan.ts
Database appliers iterate directly over optional plan arrays. Insert handling preserves _id forwarding through clientId.
Checkpoint registry organization
packages/db/src/collection-options.ts
Registry declarations move earlier in the module. Documentation links are qualified. The stats return is reformatted without changing counters.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the restoration of three lint gates and the guard for the unsupported project configuration shape.
Description check ✅ Passed The description is detailed and covers the change, linked issue dependency, test results, reviewer notes, and implementation risks.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/302-unskip-lint-large

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for confirming the Contributor License Agreement! 🙏

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/db/src/apply-plan.ts`:
- Around line 179-182: Update the insert handling in applyPlanToCollections to
validate a present entry.row._id before calling db.insert: reject any non-string
value, including null, instead of silently omitting it. Pass clientId only when
_id is absent or a valid string, preserving the existing insert behavior for
valid rows.
- Around line 179-182: Update the insert call in the apply-plan loop to avoid
spreading the conditional array. Branch on whether clientId is a string and call
db.insert with the client-id option only in that branch; otherwise call it with
just the table and body arguments, preserving the existing behavior.

In `@scripts/check-project-json-targets.js`:
- Around line 61-71: Update the project-manifest validation loop around
projectFiles and its later success summary to fail closed: track unreadable or
malformed manifests, validate that the parsed value is a non-null object before
accessing manifest.targets, and treat missing manifests as errors rather than
successful candidates. Ensure any such error causes a non-zero exit before
printing the success summary, including the corresponding logic referenced near
the later validation block.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d8839261-286e-4883-bd12-cb098178b747

📥 Commits

Reviewing files that changed from the base of the PR and between 6ae3dca and 877570a.

⛔ Files ignored due to path filters (22)
  • package.json is excluded by none and included by none
  • packages/ai/__tests__/build-provider.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/ai/__tests__/create-ai.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/ai/__tests__/gateway.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/ai/__tests__/rag-primitives.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/ai/__tests__/rag.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/db/__tests__/apply-plan.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/db/__tests__/define-mutators.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/adapters.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/apply-diff-canonical.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/apply-diff.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/core.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/dsl.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/event-log-append-atomicity.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/event-log-do-client.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/event-log-do.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/events-context.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/integration.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/local-core.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/react.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/runtime-edges.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/replica/__tests__/sync-events.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
📒 Files selected for processing (13)
  • .github/file-filters.yml
  • .github/workflows/lint.yml
  • packages/ai/project.json
  • packages/db/project.json
  • packages/db/src/apply-plan.ts
  • packages/db/src/collection-options.ts
  • packages/db/src/define-mutators.ts
  • packages/replica/project.json
  • packages/replica/src/define-materializer.ts
  • packages/replica/src/event-log-do.ts
  • packages/replica/src/event-source.ts
  • packages/replica/src/sync-events.ts
  • scripts/check-project-json-targets.js

Comment on lines +179 to +182
const { _id: clientId, ...body } = entry.row;

// eslint-disable-next-line no-await-in-loop -- see above
await db.insert(entry.table as never, body, ...(typeof _id === "string" ? [{ clientId: _id }] : []));
await db.insert(entry.table as never, body, ...(typeof clientId === "string" ? [{ clientId }] : []));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject a non-string _id instead of silently dropping it.

applyPlanToCollections rejects an insert whose _id is not a string at Lines 146-149. This database path removes every _id and forwards only string values. A row with _id: 42 or _id: null is therefore inserted without clientId, which can create a different persisted identity. Validate a present _id before the insert. Omit clientId only when _id is absent.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/db/src/apply-plan.ts` around lines 179 - 182, Update the insert
handling in applyPlanToCollections to validate a present entry.row._id before
calling db.insert: reject any non-string value, including null, instead of
silently omitting it. Pass clientId only when _id is absent or a valid string,
preserving the existing insert behavior for valid rows.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 5 'interface PlanWriter|await db\.insert' packages/db/src/apply-plan.ts
pnpm run lint:affected:types

Repository: anolilab/lunora

Length of output: 14889


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== tsconfig references =="
fd -a 'tsconfig.*json' . | sed 's#^\./##' | head -80

echo
echo "== apply-plan surrounding =="
sed -n '1,230p' packages/db/src/apply-plan.ts

echo
echo "== tsconfig apply-plan relevant =="
rg -n '"files"|"include"|"compilerOptions"|"strict"|"noImplicitThis"|"alwaysStrict"|"moduleResolution"|"rootDir"' -S tsconfig*.json 2>/dev/null | head -120

echo
echo "== standalone type probe =="
tmp="$(mktemp -d)"
cat > "$tmp/probe.ts" <<'TS'
interface PlanWriter {
  insert: (tableName: never, document: Record<string, unknown>, options?: { clientId?: string }) => Promise<unknown>;
}

declare function apply(db: PlanWriter): Promise<void>;
async function f(db: PlanWriter) {
  const clientId: string | undefined = "x";
  await db.insert("t" as never, {} as Record<string, unknown>, ...(typeof clientId === "string" ? [{ clientId }] : []));
}
TS

# Use the repository node_modules TypeScript if available; otherwise print unavailable.
if [ -x node_modules/.bin/tsc ]; then
  node_modules/.bin/tsc --strict --noEmit --lib esnext --target esnext "$tmp/probe.ts"
  status=$?
  echo "tsc status=$status"
else
  echo "node_modules/.bin/tsc unavailable"
fi
rm -rf "$tmp"

Repository: anolilab/lunora

Length of output: 4236


🏁 Script executed:

#!/usr/bin/env bash
set -u

echo "== apply-plan.ts relevant section =="
sed -n '1,240p' packages/db/src/apply-plan.ts

echo
echo "== packages/db/tsconfig.json =="
cat -n packages/db/tsconfig.json

echo
echo "== package scripts relevant =="
python3 - <<'PY'
import json
from pathlib import Path
for p in [Path("package.json"), Path("packages/db/package.json")]:
    if p.exists():
        data=json.load(open(p))
        print(f"-- {p}")
        for k,v in data.get("scripts",{}).items():
            if "lint" in k or "affected" in k:
                print(f"{k}: {v}")
PY

echo
echo "== standalone TypeScript probe =="
tmp="$(mktemp -d)"
cat > "$tmp/probe.ts" <<'TS'
interface PlanWriter {
  insert: (tableName: never, document: Record<string, unknown>, options?: { clientId?: string }) => Promise<unknown>;
}

function apply(db: PlanWriter): void {
  const clientId: string | undefined = "x";
  const body: Record<string, unknown> = {};
  const entry = { table: "t" as never, row: { _id: clientId, body } };
  void applyPlanToDb([{ entry }], db);
}

function applyPlanToDb(inserts: {entry: {table: never; row: { clientId?: string; body: Record<string, unknown>}}}[], db: PlanWriter): void {
  for (const { entry } of inserts) {
    const { _id: clientId, ...body } = entry.row;
    void db.insert(entry.table, body, ...(typeof clientId === "string" ? [{ clientId }] : []));
  }
}
TS

if [ -x node_modules/.bin/tsc ]; then
  node_modules/.bin/tsc --strict --noEmit --lib esnext --target esnext "$tmp/probe.ts"
  status=$?
  echo "tsc status=$status"
else
  echo "node_modules/.bin/tsc unavailable"
fi
rm -rf "$tmp"

Repository: anolilab/lunora

Length of output: 9545


🌐 Web query:

TypeScript spread non-empty tuple optional fixed parameters TS2556 rest parameter spread non-tuple array

💡 Result:

The error TS2556 ("A spread argument must either have a tuple type or be passed to a rest parameter") occurs because TypeScript cannot guarantee that a standard array has the exact number of elements required by a function's fixed parameters [1][2][3]. Since a non-tuple array (e.g., number[]) can have any length, spreading it into a function expecting a specific arity is unsafe [4][3]. To resolve this error, you must ensure the spread argument is treated as a tuple or refactor the target function [2][3]. Common solutions include: 1. Use 'as const': If the values are known at the call site, use 'as const' to assert the array as a read-only tuple, which TypeScript can then validate against the function parameters [1][2][3]. function foo(a: number, b: number) {} const args = [1][2] as const; foo(...args); // OK 2. Explicitly Define a Tuple Type: If the array is variable, annotate it as a tuple so TypeScript knows the exact structure [1][2]. const args: [number, number] = [1][2]; foo(...args); // OK 3. Refactor to Rest Parameters: If the function should handle a variable number of arguments, update its definition to use a rest parameter [2][3]. function foo(...args: number[]) {} const args = [1][2][5]; foo(...args); // OK 4. Use Function.prototype.apply: In cases where TypeScript's spread rules are too restrictive (such as with unions of tuples), using.apply may bypass the check [1][6]. Note that TypeScript's spread rules are strict regarding arity [7][3]. Even if a variable is a union of tuples, TypeScript often cannot resolve the correct overload or parameter list when spreading, leading to TS2556 [6]. In such complex scenarios, you may need to use explicit indexing (e.g., fn(args, args[1])) or type assertions [1][6].

Citations:


🌐 Web query:

TypeScript 5.3 empty tuple spread non-tuple array no error fixed arguments

💡 Result:

The error "A spread argument must either have a tuple type or be passed to a rest parameter" (TS2556) is a long-standing constraint in TypeScript that has not been fundamentally removed or changed in version 5.3 [1][2][3]. The compiler issues this error when it cannot statically guarantee that an array being spread has enough elements to satisfy the fixed parameters of a function [4][5]. Even if an array or a union of tuples is logically sufficient, TypeScript's current overload resolution and type inference logic often fail to bridge this gap, leading to the error even when developers can verify the safety of the call [6][7][3]. There is no "fix" in TypeScript 5.3 that enables spreading a non-tuple array into fixed arguments without this error [1][2]. The community and the TypeScript team have discussed this behavior extensively, but it remains a known design limitation rather than a bug that has been addressed [7][3][5]. Common workarounds include: 1. Const Assertion: Using as const on the array to force TypeScript to treat it as a read-only tuple, which guarantees its length and element types [4]. 2. Explicit Type Annotation: Defining the array explicitly as a tuple type (e.g., const args: [string, number] = ['a', 1];) before spreading it [4]. 3. Rest Parameters: Changing the function signature to accept rest parameters instead of fixed arguments, which allows for dynamic array spreading [4]. 4. Function Apply: Using func.apply(null, args) as an alternative, which is sometimes permitted even when the spread operator ... triggers the error [3]. The issue persists across versions because it involves complex interactions between type parameter inference, contextual typing, and overload resolution that the TypeScript team has been cautious about changing to avoid breaking existing logic [7].

Citations:


🌐 Web query:

TypeScript empty tuple literal [] rest argument non-tuple array TS2556

💡 Result:

The TypeScript error TS2556 ("A spread argument must either have a tuple type or be passed to a rest parameter") occurs because TypeScript cannot guarantee that a standard array has the correct length or structure to satisfy a function's expected fixed arguments [1][2][3]. When you use the spread syntax (...) on an array (e.g., func(...myArray)), TypeScript must ensure that myArray is a tuple with a fixed length and known element types that perfectly match the target function's parameters [1][4]. Standard arrays (like number[]) are mutable and have variable lengths, so the compiler cannot safely assume they will match the function's requirements [2][4]. Even an empty array literal [] is inferred as any[] or never[], which lacks the necessary fixed-tuple structure [5][2]. To resolve TS2556, use one of the following approaches: 1. Const Assertion (Recommended): Add as const to your array literal. This tells TypeScript to treat the array as a read-only tuple, allowing it to accurately infer the length and types [1][3][4]. typescript const args = [1, 2, 3] as const; myFunc(...args); // Correct 2. Explicit Type Annotation: Define the array explicitly as a tuple [1][3]. typescript const args: [number, number, number] = [1, 2, 3]; myFunc(...args); // Correct 3. Update Function Signature: If the function is intended to handle a dynamic number of arguments, update it to use a rest parameter instead of fixed parameters [1][3]. typescript function myFunc(...args: number[]) { /* ... */ } myFunc(...myArray); // Now allowed If you are dealing with a scenario where the array size is not statically known, spreading it into a function expecting a fixed number of arguments is inherently unsafe in TypeScript, as it risks runtime errors [1][6][2]. In such cases, you may need to reconsider the function design or use type assertions if you are certain of the runtime structure [1][2][7].

Citations:


Avoid spreading an ordinary array into this three-parameter call.

PlanWriter.insert has a fixed three-parameter signature with one optional third parameter, so the conditional array union here is not a tuple and violates strict spread typing. Use inline branches for the client-id path so TypeScript can see exactly 0 or 1 optional option is passed.

Proposed fix
-        await db.insert(entry.table as never, body, ...(typeof clientId === "string" ? [{ clientId }] : []));
+        if (typeof clientId === "string") {
+            await db.insert(entry.table as never, body, { clientId });
+        } else {
+            await db.insert(entry.table as never, body);
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const { _id: clientId, ...body } = entry.row;
// eslint-disable-next-line no-await-in-loop -- see above
await db.insert(entry.table as never, body, ...(typeof _id === "string" ? [{ clientId: _id }] : []));
await db.insert(entry.table as never, body, ...(typeof clientId === "string" ? [{ clientId }] : []));
const { _id: clientId, ...body } = entry.row;
// eslint-disable-next-line no-await-in-loop -- see above
if (typeof clientId === "string") {
await db.insert(entry.table as never, body, { clientId });
} else {
await db.insert(entry.table as never, body);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/db/src/apply-plan.ts` around lines 179 - 182, Update the insert call
in the apply-plan loop to avoid spreading the conditional array. Branch on
whether clientId is a string and call db.insert with the client-id option only
in that branch; otherwise call it with just the table and body arguments,
preserving the existing behavior.

Sources: Path instructions, MCP tools

Comment thread scripts/check-project-json-targets.js Outdated
Comment on lines +61 to +71
for (const relativePath of projectFiles) {
let manifest;

try {
manifest = JSON.parse(readFileSync(join(rootDir, relativePath), "utf8"));
} catch {
continue;
}

const targets = manifest.targets ?? {};
const nxShaped = Object.keys(targets).filter((name) => typeof targets[name] === "object" && targets[name] !== null && "executor" in targets[name]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Fail closed on unreadable or malformed project manifests.

The catch at Lines 64-68 treats missing files, read errors, and invalid JSON as clean. This lets the validator ignore a malformed project.json. A valid JSON null then reaches Line 70 and throws because manifest.targets is accessed outside the catch. The success count also includes candidate directories that do not contain a manifest. Track these errors, validate the manifest shape, and exit non-zero before printing the success summary.

Proposed validation fix
-import { readdirSync, readFileSync } from "node:fs";
+import { existsSync, readdirSync, readFileSync } from "node:fs";

+const invalidManifests = [];

-    return entries.filter((entry) => entry.isDirectory()).map((entry) => `${workspace}/${entry.name}/project.json`);
+    return entries
+        .filter((entry) => entry.isDirectory() && existsSync(join(rootDir, workspace, entry.name, "project.json")))
+        .map((entry) => `${workspace}/${entry.name}/project.json`);

    try {
        manifest = JSON.parse(readFileSync(join(rootDir, relativePath), "utf8"));
-    } catch {
+    } catch (error) {
+        invalidManifests.push(`${relativePath}: ${error instanceof Error ? error.message : String(error)}`);
         continue;
    }

+    if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) {
+        invalidManifests.push(`${relativePath}: root must be a JSON object`);
+        continue;
+    }

Also applies to: 105-113

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/check-project-json-targets.js` around lines 61 - 71, Update the
project-manifest validation loop around projectFiles and its later success
summary to fail closed: track unreadable or malformed manifests, validate that
the parsed value is a non-null object before accessing manifest.targets, and
treat missing manifests as errors rather than successful candidates. Ensure any
such error causes a non-zero exit before printing the success summary, including
the corresponding logic referenced near the later validation block.

prisis and others added 5 commits August 8, 2026 15:06
The package declared `lint:eslint` in nx's `executor` + `options.command`
shape, which the task runner does not understand: it reported "No command
configured" and passed in ~13 ms, shadowing the `package.json` script that
carries `--max-warnings=0`. Deleting the block restores the manifest script,
matching the 48 projects that only declare `{name, tags}`.

Un-skipping surfaced 35 errors + 3 warnings, fixed here rather than silenced:

- `import/exports-last` — moved the module-private helpers (`ordered`, the
  fallback warner, the two registry WeakMap/WeakSets) above the first export
  instead of interleaving them between exported declarations.
- `jsdoc/no-undefined-types` — qualified sibling-member `{@link}`s
  (`{@link CheckpointRegistry.resolve}`, `{@link BindMutatorsContext.shardKey}`).
- `@typescript-eslint/naming-convention` — the plan applier destructures the
  document id as `clientId`, which is what it is forwarded as anyway.
- `no-void` / `promise/always-return` — the two "has it settled yet?" probes in
  the mutator tests now await a tracked async IIFE instead of a floating
  `void …then()`.
- `e18e/prefer-static-regex`, `vitest/*`, `arrow-body-style` — mechanical.

No `expect.assertions` counts appear in this diff: unlike `ai` and `replica`,
this package turns `vitest/prefer-expect-assertions` off for test files, and
its tests already carry counts anyway.

One new suppression: `unicorn/prevent-abbreviations` on `applyPlanToDb`, whose
name and `db` parameter mirror the framework's own `ctx.db`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
The package declared `lint:eslint` in nx's `executor` + `options.command`
shape, which the task runner does not understand: it reported "No command
configured" and passed in ~13 ms, shadowing the `package.json` script that
carries `--max-warnings=0`. Deleting the block restores the manifest script.

Un-skipping surfaced 117 findings, all in `__tests__` — `src/` was already
clean. 109 of them were `vitest/prefer-expect-assertions`: the rule is on in 45
of the 55 linted packages and two of this package's own suites already opened
every test with `expect.assertions(n)`, so the fix is to finish the job rather
than exempt the package. Each test now declares its count, or
`expect.hasAssertions()` where the expects sit inside a loop or a callback and
no static count is sound; the suite passing (123 tests) is what proves every
count right.

The rest: `vitest/require-mock-type-parameters` on four `vi.fn()`s (typed from
the callback signatures they stand in for), plus a
`unicorn/no-useless-fallback-in-spread`, an `arrow-body-style` and two padding
findings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
The package declared `lint:eslint` in nx's `executor` + `options.command`
shape, which the task runner does not understand: it reported "No command
configured" and passed in ~13 ms, shadowing the `package.json` script that
carries `--max-warnings=0`. Deleting the block restores the manifest script.

Un-skipping surfaced 303 findings — flagged as pre-existing as far back as the
event-log work and never addressed, because nothing ever ran. 274 were
`vitest/prefer-expect-assertions`; every test now declares its count, or
`expect.hasAssertions()` where the expects sit inside a loop or callback and no
static count is sound. Five counts had to include a shared helper that asserts
on behalf of its caller — the suite (337 tests) is what proves each one right.

Behaviour-affecting cleanups, all verified against the suite:

- The canonical-diff PRNG moves its seed into a closure, so no module-level
  mutable binding is shared across the file.
- `start() is idempotent` asserted nothing at all. It now drives the fake clock
  one poll interval and asserts a single fetch — a second `start()` arming a
  second loop is what the title always claimed to cover.
- The event-log fake's `else if` becomes two guarded branches with the same
  precedence.
- Four `if (…)` narrowing guards become non-null assertions, so a value that
  never arrives fails instead of silently skipping the work it guarded: three
  `if (!result.done)` around an async iterator in runtime-edges, and one
  `if (registeredCallback)` around the subscribe callback in integration.

Four suppressions, each where the rule is wrong for that line: `no-console` on
the two unknown-event `warn` strategies (reporting the skipped event IS the
strategy), on the DO's server-side error log (the response deliberately carries
none of it), and on the `onError` fallback; `vitest/require-top-level-describe`
on the sql.js WASM init, which is shared by every `describe.each` block in the
file; and `vitest/require-to-throw-message` on a post-close query, where two of
the three engines throw a bare string rather than an Error.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
A target declared in nx's `executor` + `options.command` shape is not an error
to vis — it reports "No command configured" and exits 0, and because a declared
target shadows the `package.json` script it would otherwise fall back to, the
real command never runs. Ten packages carried one for `lint:eslint`, so the
repo lint printed a green tick for each of them after ~13ms of doing nothing,
and that aggregate run is a required status check.

`scripts/check-project-json-targets.js` scans every `packages/*` and `apps/*`
project.json and fails on any target carrying an `executor` key. Config-only
blocks (`cache` / `inputs` / `dependsOn`) are untouched — vis merges those onto
the manifest script, so they are correct as written.

Wired as the FIRST step of the Lint workflow's eslint job, so a skipped gate is
reported before the build and cannot be masked by a later step; runnable as
`pnpm run lint:project-json`. Deliberately not in the root `postinstall`, where
a failing check turns every CI job red in its setup step and buries the cause.
`project.json` joins the `frontend_lintable` path filter, since without it a PR
touching only a project.json would skip the very job that catches this.

One project (`packages/svelte`) is still unmigrated and listed in
`KNOWN_UNMIGRATED`. That list is a debt marker, not an exemption: the check
also fails when a listed project is already clean, so an entry cannot outlive
the fix it points at.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
Review follow-ups on the project.json guard and the two cleanups.

The guard could be switched off by editing the guard. `frontend_lintable`
matched `**/project.json` but not the checker, the workflow, or the filter
file, so a PR deleting the check step matched no filter, skipped the eslint
job, and passed `lint-required-check` — which only fails on `failure` /
`cancelled`, never `skipped`. All three are now listed, the same way
`worker_size` already does it two entries below.

Four defects in the checker itself:

- It swept only `packages` and `apps`. pnpm's workspaces are `apps/*`,
  `examples/*`, `packages/*`, `tests/*` — 14 project.json files sat outside the
  sweep while the path filter still fired the job.
- `"executor" in target` also rejected `{executor, command}`, which vis runs
  correctly — contradicting the error text's own advice to add a `command`. The
  predicate now requires an `executor` AND no top-level `command`.
- A malformed project.json was skipped and still counted as clean. A guard
  whose premise is "a silent skip must not be possible" now fails on one.
- The summary mapped every directory to a path without checking it existed, so
  it reported a denominator one higher than the number of files.

Also: a deleted allowlisted project now reports as deleted rather than as
already-clean, and both defect classes are collected before exiting so one run
shows everything.

@lunora/db was fighting `no-underscore-dangle` instead of configuring it. 45 of
55 packages carry an allow-list block that already contains both `_id` and
`__lunoraRef`; db had none, so it carried five file-level blanket disables that
blinded whole files to the rule — including any genuinely accidental dangle.
Copied the block from a sibling and deleted all eight suppression sites.

Two code-judo cuts: `ordered()` was a five-line `?? []` defaulter that had to
sit above the interfaces its own return type names, so the file read backwards
— inlined at both call sites. And the event-log fake's two guarded branches are
one bound selection and one filter, which is what the `else if` meant before it
was split to satisfy the linter.

`onlyDerivedKey` asserted on its caller's behalf, so five tests baked its `+1`
into their declared counts and one edit inside it would fail all five pointing
at the wrong file. It now returns the keys and each caller asserts the whole
array — the count and the values in one assertion instead of two.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
@prisis
prisis force-pushed the ci/302-unskip-lint-large branch from 877570a to 08a3396 Compare August 8, 2026 13:07
@codecov-commenter

codecov-commenter commented Aug 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (alpha@a3e100f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/db/src/collection-options.ts 70.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             alpha     #364   +/-   ##
========================================
  Coverage         ?   87.07%           
========================================
  Files            ?     1170           
  Lines            ?    63254           
  Branches         ?    15551           
========================================
  Hits             ?    55079           
  Misses           ?     7654           
  Partials         ?      521           
Files with missing lines Coverage Δ
packages/db/src/apply-plan.ts 100.00% <100.00%> (ø)
packages/db/src/define-mutators.ts 100.00% <ø> (ø)
packages/db/src/internals.ts 98.63% <ø> (ø)
packages/replica/src/define-materializer.ts 91.00% <ø> (ø)
packages/replica/src/event-log-do.ts 95.08% <ø> (ø)
packages/replica/src/event-source.ts 98.94% <ø> (ø)
packages/replica/src/sync-events.ts 100.00% <ø> (ø)
packages/db/src/collection-options.ts 92.16% <70.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed

codspeed Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.38%

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 251 untouched benchmarks
⏩ 10 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ flat 3 primitives (the notify.send attribute shape) 55.5 µs 62.5 µs -11.14%
⚡ count, no attributes 67.2 µs 60.2 µs +11.68%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ci/302-unskip-lint-large (b83991c) with alpha (bd5216d)2

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on alpha (a3e100f) during the generation of this report, so bd5216d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@prisis
prisis merged commit a0d1513 into alpha Aug 8, 2026
14 of 16 checks passed
@prisis
prisis deleted the ci/302-unskip-lint-large branch August 8, 2026 13:55
prisis added a commit that referenced this pull request Aug 8, 2026
The svelte cleanup (#363) and the guard that allowlisted it (#364) both
landed, so the entry now describes an already-clean project. The check
fails on a stale entry by design, which is what makes an allowlist
unable to outlive its fix — so alpha went red the moment the second of
the two merged, and every open PR inherits it through refs/pull/N/merge.


Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using our GitHub Discussions tab for questions.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 8, 2026

This branch was previously deployed

1 inactive deployment
benchmarks — b83991c4 Deployed Aug 8, 2026 by prisis via Benchmarks #1541
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants