Skip to content

feat: initial implementation#1

Merged
b2m9 merged 13 commits into
mainfrom
feat/first-version
Jul 21, 2026
Merged

feat: initial implementation#1
b2m9 merged 13 commits into
mainfrom
feat/first-version

Conversation

@b2m9

@b2m9 b2m9 commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary by cubic

Initial release of @b2m9/anyall, a headless TypeScript library to build, validate, and evaluate serializable any‑of‑all (DNF) filters over declared record fields. Adds a small API to parse JSON or UI rows, then compile fast predicates to filter in‑memory data.

  • New Features

    • createFilter() returns { fromRows, parse, compile, filter } for end‑to‑end use.
    • Robust validation with clear issues; throws AnyallConfigError and AnyallExpressionError when misused.
    • Supports equals, contains, starts-with, ends-with, one-of, empty, plus not.
    • Field registry supports accessors and per‑field normalize, and snapshots these callables during registration to prevent runtime mutation.
    • Canonical JSON expression shape and strict parsing (strings treated as JSON).
    • ESM‑only, Node.js 22+, zero runtime dependencies; docs in README and AGENTS.md; comprehensive tests.
  • Dependencies

    • Adds CI (.github/workflows/ci.yml) running on Node 22/24/26 with voidzero-dev/setup-vp@v1; avoids duplicate installs by disabling auto‑install and running vp install once.
    • Uses vite-plus (vp) for build/test and a pnpm workspace/lockfile with minimumReleaseAge supply‑chain cooldown.
    • Adds CLAUDE.md portable include pointing to AGENTS.md for agent guidance.

Written for commit 5407888. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 28 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/validation.ts">

<violation number="1" location="src/validation.ts:88">
P1: Large expressions can allocate canonical arrays and run validation for every group/predicate without a limit, enabling memory/CPU exhaustion through `parse` or asserted `compile` input. Add documented cardinality caps before materializing `any` and `all`, returning a structured validation issue once exceeded.</violation>

<violation number="2" location="src/validation.ts:255">
P1: Unbounded token arrays and strings let untrusted expressions force arbitrary allocation and normalizer work. Enforce token-count and needle-length limits before iterating or normalizing values, with a structured validation failure.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread src/validation.ts

let valid = true;
const tokens: string[] = [];
for (const [index, token] of input.value.entries()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Unbounded token arrays and strings let untrusted expressions force arbitrary allocation and normalizer work. Enforce token-count and needle-length limits before iterating or normalizing values, with a structured validation failure.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/validation.ts, line 255:

<comment>Unbounded token arrays and strings let untrusted expressions force arbitrary allocation and normalizer work. Enforce token-count and needle-length limits before iterating or normalizing values, with a structured validation failure.</comment>

<file context>
@@ -0,0 +1,323 @@
+
+  let valid = true;
+  const tokens: string[] = [];
+  for (const [index, token] of input.value.entries()) {
+    if (typeof token !== "string") {
+      addIssue(context, "invalid-value", [...valuePath, index], "one-of tokens must be strings");
</file context>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I don't want to use arbitrary package-wide thresholds. It seems to be a valid threat model but I don't want to impose this on every consumer. If real consumers run into this issue, I might rethink my stance.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@cubic-dev-ai I don't want to use arbitrary package-wide thresholds. It seems to be a valid threat model but I don't want to impose this on every consumer. If real consumers run into this issue, I might rethink my stance.

Comment thread src/validation.ts
any = [];
} else {
// Array.from both visits holes and refuses an input subclass's species.
any = Array.from(anyInput, (group, index) => validateGroup(group, ["any", index], context));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Large expressions can allocate canonical arrays and run validation for every group/predicate without a limit, enabling memory/CPU exhaustion through parse or asserted compile input. Add documented cardinality caps before materializing any and all, returning a structured validation issue once exceeded.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/validation.ts, line 88:

<comment>Large expressions can allocate canonical arrays and run validation for every group/predicate without a limit, enabling memory/CPU exhaustion through `parse` or asserted `compile` input. Add documented cardinality caps before materializing `any` and `all`, returning a structured validation issue once exceeded.</comment>

<file context>
@@ -0,0 +1,323 @@
+    any = [];
+  } else {
+    // Array.from both visits holes and refuses an input subclass's species.
+    any = Array.from(anyInput, (group, index) => validateGroup(group, ["any", index], context));
+  }
+
</file context>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Same threat model as previous issue. Still no action taken.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@cubic-dev-ai Same threat model as previous issue. Still no action taken.

Comment thread src/fields.ts Outdated
Comment thread .github/workflows/ci.yml

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 28 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

@b2m9
b2m9 merged commit 950a485 into main Jul 21, 2026
4 checks passed
@b2m9
b2m9 deleted the feat/first-version branch July 21, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant