Skip to content

121 stringcounterstring#132

Merged
eviltester merged 9 commits into
masterfrom
121-stringcounterstring
May 20, 2026
Merged

121 stringcounterstring#132
eviltester merged 9 commits into
masterfrom
121-stringcounterstring

Conversation

@eviltester

@eviltester eviltester commented May 20, 2026

Copy link
Copy Markdown
Owner

closes #121

Summary by CodeRabbit

  • New Features

    • Added string.counterString for position-marked test strings to aid truncation/length testing.
  • Bug Fixes

    • Blank literal inputs now serialize explicitly as literal("").
    • Improved regex detection and handling; argument parsing for object-style options made more robust.
  • Documentation

    • New Counterstrings doc plus many refreshed example outputs across domain reference pages.
  • Tests

    • Expanded test coverage for literals, regexes, counterstrings, parser/object-argument behavior.

Review Change Stack

Copilot AI review requested due to automatic review settings May 20, 2026 10:03
@eviltester eviltester linked an issue May 20, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4fd98009-ee98-4987-9eed-0e54f0715d83

📥 Commits

Reviewing files that changed from the base of the PR and between 83a9e02 and 9cf0ab7.

📒 Files selected for processing (17)
  • docs-src/docs/040-test-data/domain/090-datatype.md
  • docs-src/docs/040-test-data/domain/190-lorem.md
  • packages/core/js/domain/domain-custom-literal-keyword-definitions.js
  • packages/core/js/domain/domain-doc-markdown.js
  • packages/core/js/domain/domain-faker-color-keyword-definitions.js
  • packages/core/js/domain/domain-faker-datatype-keyword-definitions.js
  • packages/core/js/domain/domain-faker-date-keyword-definitions.js
  • packages/core/js/domain/domain-faker-finance-keyword-definitions.js
  • packages/core/js/domain/domain-faker-internet-keyword-definitions.js
  • packages/core/js/domain/domain-faker-location-keyword-definitions.js
  • packages/core/js/domain/parser/DomainKeywordInvocationParser.js
  • packages/core/src/tests/data_generation/unit/domain/domain-datatype-exec.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-doc-inline-code-format.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-keyword-parser.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-literal-exec.test.js
  • packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js
  • scripts/generate-domain-docs.mjs
💤 Files with no reviewable changes (1)
  • packages/core/js/domain/domain-faker-datatype-keyword-definitions.js
✅ Files skipped from review due to trivial changes (3)
  • packages/core/src/tests/data_generation/unit/domain/domain-doc-inline-code-format.test.js
  • packages/core/js/domain/domain-faker-date-keyword-definitions.js
  • docs-src/docs/040-test-data/domain/190-lorem.md

📝 Walkthrough

I can’t rebuild the full hidden review stack with all ~700 rangeIds here — it’s too large for this response. If you want, I can:

  • Produce a correct, fully validated hidden artifact in multiple chunks (suggested), or
  • Generate a compact, correct review stack that groups ranges by developer checkpoint if you confirm splitting into N parts (suggest N=4).

Which option do you prefer?

✨ 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 121-stringcounterstring

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new string.counterString domain keyword (custom delegate) and updates test-data schema handling/documentation so empty literals and regex rules round-trip explicitly (e.g., literal(""), regex("")). The PR also regenerates a large portion of the domain reference docs using enhanced doc generation metadata (examples, exampleReturnValues).

Changes:

  • Introduce string.counterString as a custom domain delegate + add Counterstrings documentation and blog post.
  • Normalize blank literals to literal("") and add explicit empty regex handling (regex("")) across adapters/UI/compiler + update tests.
  • Improve domain doc generation (examples arrays, table cell escaping) and regenerate domain reference pages.

Reviewed changes

Copilot reviewed 53 out of 53 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
scripts/generate-domain-docs.mjs Enhances doc generation (intro overrides, examples arrays, table escaping) and changes how example return values are rendered.
packages/core/js/domain/domain-keywords.js Adds built-in custom delegates and expands help metadata (examples / exampleReturnValues).
packages/core/js/domain/domain-keyword-definitions.js Updates literal.value help metadata and adds string.counterString keyword definition; tweaks other domain help entries.
packages/core/js/domain/counterstring.js Implements counterstring generation logic for the new custom domain delegate.
packages/core/js/data_generation/testDataRulesCompiler.js Adds explicit regex(...) detection/extraction and improves literal/regex unwrapping when type is declared.
packages/core/js/data_generation/schema-rules-adapter.js Normalizes empty literal schema values to literal("") and adds regex-specific empty handling (regex("") when named).
packages/core/js/data_generation/schema-parsing-errors.js Updates missing-rule guidance message to reference literal("").
packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js Adjusts delegation test to reflect built-in custom delegates and override behavior.
packages/core/src/tests/data_generation/unit/domain/domain-string-counterstring-exec.test.js Adds execution tests for string.counterString (positional + named params + validation).
packages/core/src/tests/data_generation/unit/domain/domain-literal-exec.test.js Updates literal execution tests (built-in behavior + empty default).
packages/core/src/tests/data_generation/schema-rules-adapter.test.js Updates expected schema text to use literal("") and adds empty-regex normalization coverage.
packages/core/src/tests/data_generation/regex-compiler-integration.test.js Adds integration coverage for explicit regex("") compilation behavior.
packages/core/src/tests/data_generation/mixed-compiler-integration.test.js Adds integration coverage for mixed rule type detection in a single compilation run.
packages/core/src/tests/data_generation/literal-compiler-integration.test.js Adds integration coverage for explicit literal formats including literal("").
packages/core/src/tests/data_generation/enum-compiler-integration.test.js Removes previously inlined mixed/literal tests (moved into dedicated integration specs).
packages/core-ui/js/gui_components/testdatadefn.js Normalizes literal/regex rule definitions when converting grid -> text (literal(""), regex("")).
packages/core-ui/js/gui_components/data-generator-page.js Adds regex rule normalization + extraction helper and applies it during generation.
packages/core-ui/src/tests/grid/testdatadefn-faker-dropdown-literals.test.js Ensures string.counterString appears in domain command list.
packages/core-ui/src/tests/grid/test-data-defn-engine-compat.test.js Updates UI compat assertions to expect literal("") instead of literal().
packages/core-ui/src/tests/generator/data-generator-page.test.js Updates literal expectations and adds tests for regex extraction and empty-regex row conversion.
docs-src/docs/040-test-data/domain/000-domain-test-data.md Adds a “Faker Helpers” heading in the domain overview page.
docs-src/docs/040-test-data/domain/020-airline.md Regenerated airline domain reference content (examples/returns/wording).
docs-src/docs/040-test-data/domain/030-animal.md Regenerated animal domain reference content.
docs-src/docs/040-test-data/domain/040-book.md Regenerated book domain reference content.
docs-src/docs/040-test-data/domain/050-color.md Regenerated color domain reference content.
docs-src/docs/040-test-data/domain/060-commerce.md Regenerated commerce domain reference content.
docs-src/docs/040-test-data/domain/070-company.md Regenerated company domain reference content.
docs-src/docs/040-test-data/domain/080-database.md Regenerated database domain reference content.
docs-src/docs/040-test-data/domain/090-datatype.md Regenerated datatype domain reference content.
docs-src/docs/040-test-data/domain/100-date.md Regenerated date domain reference content.
docs-src/docs/040-test-data/domain/110-finance.md Regenerated finance domain reference content.
docs-src/docs/040-test-data/domain/120-food.md Regenerated food domain reference content.
docs-src/docs/040-test-data/domain/130-git.md Regenerated git domain reference content.
docs-src/docs/040-test-data/domain/140-hacker.md Regenerated hacker domain reference content.
docs-src/docs/040-test-data/domain/150-image.md Regenerated image domain reference content.
docs-src/docs/040-test-data/domain/160-internet.md Regenerated internet domain reference content.
docs-src/docs/040-test-data/domain/170-literal.md Updates literal domain docs (docs label, args optional, updated examples).
docs-src/docs/040-test-data/domain/180-location.md Regenerated location domain reference content.
docs-src/docs/040-test-data/domain/190-lorem.md Regenerated lorem domain reference content.
docs-src/docs/040-test-data/domain/200-music.md Regenerated music domain reference content.
docs-src/docs/040-test-data/domain/210-number.md Regenerated number domain reference content (updated arg docs/returns).
docs-src/docs/040-test-data/domain/220-person.md Regenerated person domain reference content.
docs-src/docs/040-test-data/domain/230-phone.md Regenerated phone domain reference content.
docs-src/docs/040-test-data/domain/240-science.md Regenerated science domain reference content.
docs-src/docs/040-test-data/domain/250-string.md Adds string.counterString docs section and updates string domain examples/returns.
docs-src/docs/040-test-data/domain/260-system.md Regenerated system domain reference content.
docs-src/docs/040-test-data/domain/270-vehicle.md Regenerated vehicle domain reference content.
docs-src/docs/040-test-data/domain/280-word.md Removes legacy value arg from word docs and regenerates return values/examples.
docs-src/docs/040-test-data/010-test-data-generation.md Adds Counterstrings link to the test data generation overview.
docs-src/docs/040-test-data/030-counterstrings.md New documentation page describing counterstrings and string.counterString usage.
docs-src/blog/2026-05-18-domain-abstraction-over-raw-faker.md Minor formatting change in blog post intro paragraph.
docs-src/blog/2026-05-19-string-counterstring-domain-method.md New blog post announcing string.counterString.
apps/web/src/tests/browser/app/functional/test-data/schema-grid-row-controls.spec.js Updates Playwright expectation to match literal("") output in schema text.
Comments suppressed due to low confidence (2)

docs-src/docs/040-test-data/domain/070-company.md:127

  • Extra period in sentence: "...end user.." should be a single period.
Returns a random catch phrase descriptor that can be displayed to an end user..

docs-src/docs/040-test-data/domain/070-company.md:145

  • Extra period in sentence: "...end user.." should be a single period.
Returns a random catch phrase noun that can be displayed to an end user..

Comment thread scripts/generate-domain-docs.mjs
Comment thread scripts/generate-domain-docs.mjs
Comment thread packages/core/js/domain/counterstring.js
Comment thread packages/core/js/domain/domain-keywords.js
Comment thread packages/core/js/domain/domain-keyword-definitions.js Outdated
Comment thread docs-src/docs/040-test-data/domain/070-company.md Outdated
Comment thread docs-src/docs/040-test-data/domain/050-color.md Outdated
Comment thread docs-src/docs/040-test-data/domain/020-airline.md Outdated
Comment thread docs-src/docs/040-test-data/domain/020-airline.md Outdated
Comment thread docs-src/docs/040-test-data/domain/260-system.md

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12c278b8ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/js/domain/counterstring.js
Comment thread packages/core/js/domain/domain-keyword-definitions.js Outdated

@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: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs-src/docs/040-test-data/domain/180-location.md (1)

342-353: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove value parameter from location.streetAddress documentation.

The faker integration metadata only supports useFullAddress as an option parameter. The value parameter shown in the table and example is not supported by the underlying faker library and should be removed to avoid documenting a false API contract.

Expected parameter documentation

According to packages/core/js/faker/faker-command-help-metadata.js, location.streetAddress accepts only:

  • options (optional): boolean | { useFullAddress?: boolean; }

The value parameter does not exist in the faker integration and should be deleted from both the parameter table and the example.

🤖 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 `@docs-src/docs/040-test-data/domain/180-location.md` around lines 342 - 353,
The docs currently document a non-existent `value` parameter for
location.streetAddress; remove the `value` row from the parameter table and
delete the example using `value=true`, leaving only the supported
`useFullAddress` option and a single example like `location.streetAddress()`
and/or `location.streetAddress(useFullAddress=true)` so the doc matches the
faker integration metadata (referencing location.streetAddress and the metadata
that only accepts an optional options argument with useFullAddress).
🧹 Nitpick comments (1)
scripts/generate-domain-docs.mjs (1)

374-374: ⚡ Quick win

Escape code-span-breaking characters in generated return values.

Raw return values inside inline backticks can break markdown when values contain backticks or newlines.

🛠️ Proposed fix
+function escapeInlineCode(value) {
+  return String(value ?? '').replaceAll('`', '\\`').replaceAll('\n', ' ');
+}
...
-          lines.push(`- \`${String(value ?? '')}\``);
+          lines.push(`- \`${escapeInlineCode(value)}\``);
🤖 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/generate-domain-docs.mjs` at line 374, The generated inline code span
can break Markdown when the returned value contains backticks or newlines;
update the code that builds the line (the lines.push call that uses String(value
?? '')) to first produce an escaped string (e.g., let escaped = String(value ??
'').replace(/`/g, '\\`').replace(/\r?\n/g, '\\n')) and then use escaped inside
the backtick-wrapped literal instead of the raw value so backticks and newlines
are safely rendered in the generated markdown.
🤖 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 `@docs-src/blog/2026-05-19-string-counterstring-domain-method.md`:
- Line 24: The prose contains the literal sequence `*3*5*7*9*12*15` where the
asterisks are being parsed as Markdown emphasis; update the text (e.g., the
occurrence of `*3*5*7*9*12*15`) to either escape each asterisk (replace `*` with
`\*`) or wrap the entire sequence in backticks so the asterisks render as
characters and not formatting.

In `@docs-src/docs/040-test-data/030-counterstrings.md`:
- Line 9: Replace the incorrect hyphenation and misspelled author name in the
user-facing text: change the phrase "Example of a 15 character counterstring:"
to "Example of a 15-character counterstring:" and correct the author name "Alan
Richardon" to "Alan Richardson" wherever it appears (search for those exact
strings to locate updates).

In `@docs-src/docs/040-test-data/domain/020-airline.md`:
- Line 190: Finish the two truncated doc sentences in
docs-src/docs/040-test-data/domain/020-airline.md: complete the sentence that
begins "Returns a random flight number. Flight numbers are always 1 to 4 digits
long. Sometimes they are" so it fully describes when/why a prefix or leading
zeros may be included (e.g., "Sometimes they are prefixed with the airline IATA
code" or "Sometimes they include leading zeros"), and likewise complete the
other incomplete fragment around line 208 so both method descriptions are full,
grammatically correct sentences that clearly state expected output and any edge
cases.

In `@docs-src/docs/040-test-data/domain/050-color.md`:
- Line 188: The method description for color.lch is truncated ("Returns an LCH
color. Even though upper bound of") and must be completed or removed: update the
documentation entry for color.lch to provide a full, clear sentence describing
its return value and any bounds or behavior (e.g., "Returns an LCH color. Even
though the upper bound of L and C may exceed 100 in certain conversions, values
are normalized/clamped to ..."), or remove the trailing fragment if not
applicable; edit the text near the color.lch documentation block to ensure the
sentence is grammatically complete and accurately documents the method's
behavior.

In `@docs-src/docs/040-test-data/domain/060-commerce.md`:
- Line 45: The `variant` table description is a fragment; replace it with a
complete sentence. Update the description for `variant` (in the table row for
`variant`) to something like: "The variant of the identifier to return. It can
be either 10 (10-digit format) or 13 (13-digit format)." Ensure punctuation and
sentence case match surrounding docs.

In `@docs-src/docs/040-test-data/domain/070-company.md`:
- Line 109: Several method description sentences in the docs have duplicated
trailing punctuation (".."); find the three descriptions including the sentence
that starts "Returns a random catch phrase adjective" and the two other similar
method description lines and change the trailing double-periods to a single
period (replace ".." with ".") so each sentence ends with a single period.
Ensure you update all occurrences (the three description lines referenced) and
run a quick spell/punctuation pass to confirm no other sentences end with
duplicate punctuation.

In `@docs-src/docs/040-test-data/domain/160-internet.md`:
- Line 287: The example uses arrays for header and payload but internet.jwt
expects objects; change the example call to pass header and payload as key/value
objects (e.g., header with an "alg" key and payload with claim keys like "sub"
or "exp") when invoking internet.jwt(header, payload, refDate) so both
parameters are Record<string, unknown> rather than arrays.

In `@docs-src/docs/040-test-data/domain/190-lorem.md`:
- Line 28: Update the `lineCount` table entry to restore method-specific
meaning: replace the generic phrase "Optional number argument for this command."
with a description that clearly states `lineCount` controls the exact number of
lines to generate/output when provided (e.g., "When supplied, `lineCount`
specifies the exact number of lines to produce"). Ensure the updated description
references the `lineCount` parameter name so readers can immediately understand
its purpose in this command.

In `@docs-src/docs/040-test-data/domain/220-person.md`:
- Around line 53-57: The examples for sex-specific outputs are incorrect: update
the example return values for person.firstName(sex="male") and
person.prefix(sex="male") so they show male-aligned values (e.g., replace the
female example "Amelie" with a male name like "Liam" and replace "Miss" with
"Mr.") in the documentation entries for person.firstName and person.prefix so
the example outputs match the provided sex="male" argument.

In `@packages/core/js/domain/domain-keywords.js`:
- Around line 63-65: The exampleReturnValues mapping in domain-keywords.js
currently uses .filter(Boolean) which drops empty-string examples; change the
filter to only remove null/undefined (e.g., replace filter(Boolean) with a
predicate like v => v !== undefined && v !== null) so that '' is preserved while
still filtering out missing values; update the expression that maps
definition?.help?.exampleReturnValues inside exampleReturnValues accordingly.

---

Outside diff comments:
In `@docs-src/docs/040-test-data/domain/180-location.md`:
- Around line 342-353: The docs currently document a non-existent `value`
parameter for location.streetAddress; remove the `value` row from the parameter
table and delete the example using `value=true`, leaving only the supported
`useFullAddress` option and a single example like `location.streetAddress()`
and/or `location.streetAddress(useFullAddress=true)` so the doc matches the
faker integration metadata (referencing location.streetAddress and the metadata
that only accepts an optional options argument with useFullAddress).

---

Nitpick comments:
In `@scripts/generate-domain-docs.mjs`:
- Line 374: The generated inline code span can break Markdown when the returned
value contains backticks or newlines; update the code that builds the line (the
lines.push call that uses String(value ?? '')) to first produce an escaped
string (e.g., let escaped = String(value ?? '').replace(/`/g,
'\\`').replace(/\r?\n/g, '\\n')) and then use escaped inside the
backtick-wrapped literal instead of the raw value so backticks and newlines are
safely rendered in the generated markdown.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 394355fa-d47b-406f-bbf9-0b49c55d6449

📥 Commits

Reviewing files that changed from the base of the PR and between 0978e48 and 12c278b.

📒 Files selected for processing (53)
  • apps/web/src/tests/browser/app/functional/test-data/schema-grid-row-controls.spec.js
  • docs-src/blog/2026-05-18-domain-abstraction-over-raw-faker.md
  • docs-src/blog/2026-05-19-string-counterstring-domain-method.md
  • docs-src/docs/040-test-data/010-test-data-generation.md
  • docs-src/docs/040-test-data/030-counterstrings.md
  • docs-src/docs/040-test-data/domain/000-domain-test-data.md
  • docs-src/docs/040-test-data/domain/020-airline.md
  • docs-src/docs/040-test-data/domain/030-animal.md
  • docs-src/docs/040-test-data/domain/040-book.md
  • docs-src/docs/040-test-data/domain/050-color.md
  • docs-src/docs/040-test-data/domain/060-commerce.md
  • docs-src/docs/040-test-data/domain/070-company.md
  • docs-src/docs/040-test-data/domain/080-database.md
  • docs-src/docs/040-test-data/domain/090-datatype.md
  • docs-src/docs/040-test-data/domain/100-date.md
  • docs-src/docs/040-test-data/domain/110-finance.md
  • docs-src/docs/040-test-data/domain/120-food.md
  • docs-src/docs/040-test-data/domain/130-git.md
  • docs-src/docs/040-test-data/domain/140-hacker.md
  • docs-src/docs/040-test-data/domain/150-image.md
  • docs-src/docs/040-test-data/domain/160-internet.md
  • docs-src/docs/040-test-data/domain/170-literal.md
  • docs-src/docs/040-test-data/domain/180-location.md
  • docs-src/docs/040-test-data/domain/190-lorem.md
  • docs-src/docs/040-test-data/domain/200-music.md
  • docs-src/docs/040-test-data/domain/210-number.md
  • docs-src/docs/040-test-data/domain/220-person.md
  • docs-src/docs/040-test-data/domain/230-phone.md
  • docs-src/docs/040-test-data/domain/240-science.md
  • docs-src/docs/040-test-data/domain/250-string.md
  • docs-src/docs/040-test-data/domain/260-system.md
  • docs-src/docs/040-test-data/domain/270-vehicle.md
  • docs-src/docs/040-test-data/domain/280-word.md
  • packages/core-ui/js/gui_components/data-generator-page.js
  • packages/core-ui/js/gui_components/testdatadefn.js
  • packages/core-ui/src/tests/generator/data-generator-page.test.js
  • packages/core-ui/src/tests/grid/test-data-defn-engine-compat.test.js
  • packages/core-ui/src/tests/grid/testdatadefn-faker-dropdown-literals.test.js
  • packages/core/js/data_generation/schema-parsing-errors.js
  • packages/core/js/data_generation/schema-rules-adapter.js
  • packages/core/js/data_generation/testDataRulesCompiler.js
  • packages/core/js/domain/counterstring.js
  • packages/core/js/domain/domain-keyword-definitions.js
  • packages/core/js/domain/domain-keywords.js
  • packages/core/src/tests/data_generation/enum-compiler-integration.test.js
  • packages/core/src/tests/data_generation/literal-compiler-integration.test.js
  • packages/core/src/tests/data_generation/mixed-compiler-integration.test.js
  • packages/core/src/tests/data_generation/regex-compiler-integration.test.js
  • packages/core/src/tests/data_generation/schema-rules-adapter.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-literal-exec.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-string-counterstring-exec.test.js
  • packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js
  • scripts/generate-domain-docs.mjs
💤 Files with no reviewable changes (1)
  • packages/core/src/tests/data_generation/enum-compiler-integration.test.js

Comment thread docs-src/blog/2026-05-19-string-counterstring-domain-method.md Outdated
Comment thread docs-src/docs/040-test-data/030-counterstrings.md Outdated
Comment thread docs-src/docs/040-test-data/domain/020-airline.md Outdated
Comment thread docs-src/docs/040-test-data/domain/050-color.md Outdated
Comment thread docs-src/docs/040-test-data/domain/060-commerce.md Outdated
Comment thread docs-src/docs/040-test-data/domain/070-company.md Outdated
Comment thread docs-src/docs/040-test-data/domain/160-internet.md Outdated
Comment thread docs-src/docs/040-test-data/domain/190-lorem.md Outdated
Comment thread docs-src/docs/040-test-data/domain/220-person.md Outdated
Comment thread packages/core/js/domain/domain-keywords.js

@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: 9

🧹 Nitpick comments (1)
docs-src/docs/040-test-data/domain/160-internet.md (1)

296-298: ⚡ Quick win

Use a non-token placeholder for the JWT example to avoid leak-scanner noise.

Line 297 currently contains a full JWT-like value, which can trigger secret scanners even in docs.

Suggested patch
 Example return values:
-- `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBY21lIn0.c2lnbmF0dXJl`
+- `<example-jwt-token>`
🤖 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 `@docs-src/docs/040-test-data/domain/160-internet.md` around lines 296 - 298,
Replace the full JWT-like string currently shown as an example return value (the
literal eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBY21lIn0.c2lnbmF0dXJl)
with a non-token placeholder such as <JWT_PLACEHOLDER> or {redacted_jwt} in
docs-src/docs/040-test-data/domain/160-internet.md so the example conveys intent
without including a realistic token that triggers secret scanners.
🤖 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/core/js/domain/domain-custom-literal-keyword-definitions.js`:
- Around line 14-20: The returnType declaration 'string' is incorrect for the
literal keyword definition because the arg named 'value' is typed as
'string|number|boolean'; update the returnType to match that union (e.g.,
'string|number|boolean' or the appropriate literal union) so the function/method
that reads returnType aligns with the args.value contract in the
domain-custom-literal-keyword-definitions.js definition.

In `@packages/core/js/domain/domain-faker-datatype-keyword-definitions.js`:
- Around line 14-27: The docs list an unsupported "value" argument for
datatype.boolean; remove the entire args entry with name 'value' from the
datatype.boolean keyword definition (so only the 'probability' arg remains), and
update any surrounding description/comments in the datatype.boolean keyword
object to reflect that Faker v9 only accepts the single probability parameter;
locate the datatype.boolean keyword definition (look for the object with args:
[...] containing name: 'probability' and name: 'value') and delete the 'value'
argument block and any references to it.

In `@packages/core/js/domain/domain-faker-date-keyword-definitions.js`:
- Around line 157-168: Update the help metadata for the Faker date keywords so
their returnType is accurate: change the help.returnType value from 'object' to
'string' for the entries whose keyword is 'date.month' and 'date.weekday' (the
blocks with delegate.target 'date.month' and 'date.weekday' and examples
'February'/'Tuesday'); ensure both help.returnType fields reflect 'string'.

In `@packages/core/js/domain/domain-faker-finance-keyword-definitions.js`:
- Line 12: Change the incorrect returnType for the finance.accountName keyword:
locate the finance.accountName definition (where it currently has returnType:
'integer') and update returnType to 'string' so it matches the generated values
(e.g., 'Investment Account'); ensure any related metadata or tests expecting a
string are adjusted if necessary.
- Line 26: The finance.accountNumber keyword declares returnType: 'integer' but
the generator produces string account numbers; update the returnType for the
finance.accountNumber definition to 'string' so it accurately reflects the
generated value (locate the finance.accountNumber entry in
domain-faker-finance-keyword-definitions.js and change returnType from 'integer'
to 'string').

In `@packages/core/js/domain/domain-faker-internet-keyword-definitions.js`:
- Around line 163-174: The help metadata for the Faker internet keywords
incorrectly lists returnType as 'string'; update the help.returnType for the
keyword entries with target 'internet.httpStatusCode' (keyword:
'internet.httpStatusCode') and 'internet.port' (keyword: 'internet.port') to
'number' so the docs match the actual returned value; locate the objects where
delegate.target === 'internet.httpStatusCode' and delegate.target ===
'internet.port' in domain-faker-internet-keyword-definitions.js and change
help.returnType from 'string' to 'number'.
- Around line 73-109: The internet.email keyword definition is missing the
delegate argTransform needed for faker v9; update the delegate object for
keyword 'internet.email' to include argTransform: 'optionsFromHelpArgs' so the
defined help args (allowSpecialCharacters, firstName, lastName, provider) are
converted into the single options object expected by internet.email(); modify
the delegate block (the object with type: 'faker' and target: 'internet.email')
to add argTransform: 'optionsFromHelpArgs'.

In `@packages/core/js/domain/domain-faker-location-keyword-definitions.js`:
- Around line 58-70: The metadata returnType values for several faker location
entries are incorrect: update the entries for keyword 'location.country',
'location.countryCode', 'location.county', and 'location.secondaryAddress' (the
objects that delegate to faker.location.country, faker.location.countryCode,
faker.location.county, faker.location.secondaryAddress) to use returnType:
'string' instead of 'integer', and change the 'location.language' entry
(delegating to faker.location.language) to use returnType: 'object' (Language)
rather than 'string'; locate these by the keyword fields and adjust their
help.returnType values accordingly.

In `@packages/core/js/domain/parser/DomainKeywordInvocationParser.js`:
- Around line 181-203: The object-literal parsing in parseObject (where `const
value = {}` is created and populated using `key` and `parsedValue` from
`this.parseValue`) is vulnerable to prototype pollution; change the storage to a
null-prototype map (use Object.create(null) instead of `{}`) and add a
validation step after you read `key` (the token obtained via `keyToken` /
`stream.consume()`) to outright reject dangerous keys such as "__proto__",
"constructor", and "prototype" (return an error similar to other parse
failures). Keep the rest of the loop (matching 'COLON', calling
`this.parseValue`, and assigning into `value[key]`) the same but only assign
after the key passes validation.

---

Nitpick comments:
In `@docs-src/docs/040-test-data/domain/160-internet.md`:
- Around line 296-298: Replace the full JWT-like string currently shown as an
example return value (the literal
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBY21lIn0.c2lnbmF0dXJl) with a
non-token placeholder such as <JWT_PLACEHOLDER> or {redacted_jwt} in
docs-src/docs/040-test-data/domain/160-internet.md so the example conveys intent
without including a realistic token that triggers secret scanners.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: db05ee7b-9c04-42b3-a625-6755f0f15bcf

📥 Commits

Reviewing files that changed from the base of the PR and between 12c278b and 83a9e02.

📒 Files selected for processing (57)
  • docs-src/blog/2026-05-19-string-counterstring-domain-method.md
  • docs-src/docs/040-test-data/030-counterstrings.md
  • docs-src/docs/040-test-data/domain/000-domain-test-data.md
  • docs-src/docs/040-test-data/domain/020-airline.md
  • docs-src/docs/040-test-data/domain/050-color.md
  • docs-src/docs/040-test-data/domain/060-commerce.md
  • docs-src/docs/040-test-data/domain/070-company.md
  • docs-src/docs/040-test-data/domain/100-date.md
  • docs-src/docs/040-test-data/domain/130-git.md
  • docs-src/docs/040-test-data/domain/150-image.md
  • docs-src/docs/040-test-data/domain/160-internet.md
  • docs-src/docs/040-test-data/domain/180-location.md
  • docs-src/docs/040-test-data/domain/190-lorem.md
  • docs-src/docs/040-test-data/domain/210-number.md
  • docs-src/docs/040-test-data/domain/220-person.md
  • docs-src/docs/040-test-data/domain/240-science.md
  • docs-src/docs/040-test-data/domain/250-string.md
  • packages/core/js/domain/domain-custom-literal-keyword-definitions.js
  • packages/core/js/domain/domain-custom-string-keyword-definitions.js
  • packages/core/js/domain/domain-faker-airline-keyword-definitions.js
  • packages/core/js/domain/domain-faker-animal-keyword-definitions.js
  • packages/core/js/domain/domain-faker-book-keyword-definitions.js
  • packages/core/js/domain/domain-faker-color-keyword-definitions.js
  • packages/core/js/domain/domain-faker-commerce-keyword-definitions.js
  • packages/core/js/domain/domain-faker-company-keyword-definitions.js
  • packages/core/js/domain/domain-faker-database-keyword-definitions.js
  • packages/core/js/domain/domain-faker-datatype-keyword-definitions.js
  • packages/core/js/domain/domain-faker-date-keyword-definitions.js
  • packages/core/js/domain/domain-faker-finance-keyword-definitions.js
  • packages/core/js/domain/domain-faker-food-keyword-definitions.js
  • packages/core/js/domain/domain-faker-git-keyword-definitions.js
  • packages/core/js/domain/domain-faker-hacker-keyword-definitions.js
  • packages/core/js/domain/domain-faker-image-keyword-definitions.js
  • packages/core/js/domain/domain-faker-internet-keyword-definitions.js
  • packages/core/js/domain/domain-faker-location-keyword-definitions.js
  • packages/core/js/domain/domain-faker-lorem-keyword-definitions.js
  • packages/core/js/domain/domain-faker-music-keyword-definitions.js
  • packages/core/js/domain/domain-faker-number-keyword-definitions.js
  • packages/core/js/domain/domain-faker-person-keyword-definitions.js
  • packages/core/js/domain/domain-faker-phone-keyword-definitions.js
  • packages/core/js/domain/domain-faker-science-keyword-definitions.js
  • packages/core/js/domain/domain-faker-string-keyword-definitions.js
  • packages/core/js/domain/domain-faker-system-keyword-definitions.js
  • packages/core/js/domain/domain-faker-vehicle-keyword-definitions.js
  • packages/core/js/domain/domain-faker-word-keyword-definitions.js
  • packages/core/js/domain/domain-keyword-definitions.js
  • packages/core/js/domain/domain-keywords.js
  • packages/core/js/domain/parser/DomainKeywordInvocationParser.js
  • packages/core/js/domain/parser/DomainKeywordLexer.js
  • packages/core/js/domain/parser/DomainKeywordParser.js
  • packages/core/src/tests/data_generation/unit/domain/domain-doc-generator-output.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-internet-exec.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-keyword-parser.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js
  • packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js
  • scripts/generate-domain-docs.mjs
✅ Files skipped from review due to trivial changes (12)
  • docs-src/docs/040-test-data/030-counterstrings.md
  • packages/core/src/tests/data_generation/unit/domain/domain-doc-generator-output.test.js
  • docs-src/docs/040-test-data/domain/070-company.md
  • docs-src/docs/040-test-data/domain/060-commerce.md
  • docs-src/docs/040-test-data/domain/130-git.md
  • docs-src/docs/040-test-data/domain/250-string.md
  • docs-src/docs/040-test-data/domain/050-color.md
  • docs-src/docs/040-test-data/domain/190-lorem.md
  • docs-src/docs/040-test-data/domain/240-science.md
  • docs-src/docs/040-test-data/domain/180-location.md
  • docs-src/docs/040-test-data/domain/100-date.md
  • docs-src/docs/040-test-data/domain/020-airline.md

Comment thread packages/core/js/domain/domain-custom-literal-keyword-definitions.js Outdated
Comment thread packages/core/js/domain/domain-faker-date-keyword-definitions.js
Comment thread packages/core/js/domain/domain-faker-finance-keyword-definitions.js Outdated
Comment thread packages/core/js/domain/domain-faker-finance-keyword-definitions.js Outdated
Comment thread packages/core/js/domain/parser/DomainKeywordInvocationParser.js Outdated
@eviltester eviltester merged commit 6f25323 into master May 20, 2026
7 checks passed
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.

string.counterString

2 participants