Skip to content

[codex] Expand domain command params#294

Open
eviltester wants to merge 5 commits into
masterfrom
286-expand-command-params
Open

[codex] Expand domain command params#294
eviltester wants to merge 5 commits into
masterfrom
286-expand-command-params

Conversation

@eviltester

@eviltester eviltester commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #286.

  • expands domain command parameter metadata, usage examples, docs, and test coverage for commands with supported options
  • adds a generated domain-vs-Faker parameter comparison report and check script
  • removes domain-only params from Faker-backed commands where Faker does not implement them, including the ineffective word.*(max=...) and lorem.word(min/max=...) cases

Validation

  • pnpm run verify:local
  • pre-push hook reran pnpm run verify:local successfully

Summary by CodeRabbit

  • Documentation / New Features

    • Expanded domain reference docs and in-app command help with argument tables and richer examples for airline, git, image, internet, location, person, system, and number.
    • Updated lorem.word and word.* helpers to match current supported options (e.g., removed max; word.words now documents count).
  • Bug Fixes

    • Improved validation for number.bigInt bounds/multiples.
    • Added/strengthened validation for internet.httpStatusCode(types) to reject unsupported categories.
  • Tests / Chores

    • Added automated checks ensuring domain parameters align with Faker option metadata, updating unit tests accordingly.

Copilot AI review requested due to automatic review settings July 1, 2026 15:42
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 821ac140-3fa3-4741-9c38-bd1f76447ed0

📥 Commits

Reviewing files that changed from the base of the PR and between 66cb6a4 and e8fd4c7.

📒 Files selected for processing (53)
  • docs-src/docs/040-test-data/domain/020-airline.md
  • docs-src/docs/040-test-data/domain/190-location.md
  • docs-src/docs/040-test-data/domain/200-lorem.md
  • docs-src/docs/040-test-data/domain/250-science.md
  • packages/core/js/data_generation/domain/domainTestDataRuleValidator.js
  • packages/core/js/data_generation/testDataRulesCompiler.js
  • packages/core/js/domain/domain-keyword-arg-validators.js
  • packages/core/js/domain/domain-keywords.js
  • packages/core/js/keywords/domain/airline/flight-number-keyword-definition.js
  • packages/core/js/keywords/domain/date/betweens-keyword-definition.js
  • packages/core/js/keywords/domain/finance/account-number-keyword-definition.js
  • packages/core/js/keywords/domain/finance/pin-keyword-definition.js
  • packages/core/js/keywords/domain/git/commit-sha-keyword-definition.js
  • packages/core/js/keywords/domain/image/data-uri-keyword-definition.js
  • packages/core/js/keywords/domain/image/url-keyword-definition.js
  • packages/core/js/keywords/domain/image/url-picsum-photos-keyword-definition.js
  • packages/core/js/keywords/domain/internet/http-status-code-keyword-definition.js
  • packages/core/js/keywords/domain/internet/password-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/lines-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/lorem-arg-validators.js
  • packages/core/js/keywords/domain/lorem/paragraph-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/paragraphs-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/sentence-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/sentences-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/slug-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/word-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/words-keyword-definition.js
  • packages/core/js/keywords/domain/number/big-int-keyword-definition.js
  • packages/core/js/keywords/domain/shared/common-arg-validators.js
  • packages/core/js/keywords/domain/string/alpha-keyword-definition.js
  • packages/core/js/keywords/domain/string/alphanumeric-keyword-definition.js
  • packages/core/js/keywords/domain/string/binary-keyword-definition.js
  • packages/core/js/keywords/domain/string/from-characters-keyword-definition.js
  • packages/core/js/keywords/domain/string/hexadecimal-keyword-definition.js
  • packages/core/js/keywords/domain/string/nanoid-keyword-definition.js
  • packages/core/js/keywords/domain/string/numeric-keyword-definition.js
  • packages/core/js/keywords/domain/string/octal-keyword-definition.js
  • packages/core/js/keywords/domain/string/sample-keyword-definition.js
  • packages/core/js/keywords/domain/string/symbol-keyword-definition.js
  • packages/core/js/keywords/domain/word/adjective-keyword-definition.js
  • packages/core/js/keywords/domain/word/adverb-keyword-definition.js
  • packages/core/js/keywords/domain/word/conjunction-keyword-definition.js
  • packages/core/js/keywords/domain/word/interjection-keyword-definition.js
  • packages/core/js/keywords/domain/word/noun-keyword-definition.js
  • packages/core/js/keywords/domain/word/preposition-keyword-definition.js
  • packages/core/js/keywords/domain/word/sample-keyword-definition.js
  • packages/core/js/keywords/domain/word/verb-keyword-definition.js
  • packages/core/js/keywords/domain/word/words-keyword-definition.js
  • packages/core/src/tests/data_generation/unit/domain/domain-doc-generator-output.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-test-data-rule-validator.test.js
  • packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js
  • scripts/generate-domain-docs.mjs
 ________________________________________
< My other transformer is Optimus Prime. >
 ----------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
📝 Walkthrough

Walkthrough

This PR aligns Faker-backed domain keyword parameter metadata with generated help docs, adds comparison tooling and tests, introduces BigInt bounds validation, and updates lorem/word parameter shapes and related expectations.

Changes

Domain command parameter parity with Faker

Layer / File(s) Summary
Comparison tool and report
scripts/compare-domain-faker-params.mjs, docs/domain-faker-param-comparison.md, packages/core/src/tests/data_generation/unit/domain/domain-faker-param-comparison.test.js
Adds the comparison CLI, generated parameter matrix, and tests for parsing Faker declarations, diffing params, and rendering reports.
Usage-example support plumbing
packages/core/js/domain/domain-keywords.js, packages/core/js/faker/faker-helper-keyword-definitions.js, packages/core/src/tests/command-help/command-help-examples.test-support.js, packages/core/src/tests/command-help/command-help-examples.test.js, packages/core-ui/src/tests/interaction/matrix/schema-interaction-scenario-builder.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-param-invocation-coverage.test-helper.js, packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js
Propagates usageExampleSupported through domain help params and updates coverage/runtime tests to skip unsupported args.
BigInt validation and support
packages/core/js/domain/domain-keywords.js, packages/core/js/keywords/domain/number/big-int-keyword-definition.js, packages/core/src/tests/data_generation/unit/domain/domain-keyword-sample-values.test-helper.js, packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js, docs-src/docs/040-test-data/domain/220-number.md
Adds bigint type matching, shared sample-value helpers, number.bigInt bounds validation, and matching docs/tests for min, max, and multipleOf.
Airline, Git, Image, Internet, Location, Person, and System params
packages/core/js/keywords/domain/airline/*.js, packages/core/js/keywords/domain/git/*.js, packages/core/js/keywords/domain/image/*.js, packages/core/js/keywords/domain/internet/*.js, packages/core/js/keywords/domain/location/*.js, packages/core/js/keywords/domain/person/*.js, packages/core/js/keywords/domain/system/*.js, docs-src/docs/040-test-data/domain/020-airline.md, docs-src/docs/040-test-data/domain/140-git.md, docs-src/docs/040-test-data/domain/160-image.md, docs-src/docs/040-test-data/domain/170-internet.md, docs-src/docs/040-test-data/domain/190-location.md, docs-src/docs/040-test-data/domain/230-person.md, docs-src/docs/040-test-data/domain/270-system.md
Adds optional-argument help metadata and example calls for the listed keyword families, with matching doc updates.
Lorem and word parameter rework
packages/core/js/keywords/domain/lorem/word-keyword-definition.js, packages/core/js/keywords/domain/word/*.js, docs-src/docs/040-test-data/domain/200-lorem.md, docs-src/docs/040-test-data/domain/290-word.md, packages/core/src/tests/data_generation/unit/domain/domain-keyword-parser.test.js
Removes documented min/max word-length params, switches to length/strategy/count, and updates docs and parser expectations.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: expanding domain command parameters.
Linked Issues check ✅ Passed The PR adds parameter definitions, validation, and a comparison report/script, which matches the linked issue's request to align commands with Faker signatures.
Out of Scope Changes check ✅ Passed The docs, tests, comparison report, and keyword updates all support the parameter-metadata work and do not appear unrelated.
✨ 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 286-expand-command-params

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.

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

ℹ️ 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".

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

This PR addresses #286 by expanding/aligning domain keyword parameter metadata (especially for Faker-delegated commands), updating docs and tests accordingly, and adding an automated Domain-vs-Faker options-parameter comparison report plus a script to generate/check it.

Changes:

  • Added a script + generated markdown report to compare Faker options?: { ... } top-level keys against domain help.args.
  • Expanded multiple Faker-backed domain keyword definitions to include option parameters (with argTransform: 'optionsFromHelpArgs') and added/updated related unit/UI tests.
  • Removed domain-only parameters that Faker doesn’t implement (e.g., legacy word.*(max=...), lorem.word(min/max=...)) and updated docs/tests.

Reviewed changes

Copilot reviewed 48 out of 48 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/compare-domain-faker-params.mjs New script to extract Faker option-param keys from .d.ts and compare vs domain keyword metadata (JSON/Markdown + optional check).
packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js Updates sample-value helpers to handle bigint type tokens in test scaffolding.
packages/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js Updates type sampling and adds per-arg sample overrides for new option params.
packages/core/src/tests/data_generation/unit/domain/domain-keyword-parser.test.js Updates parser expectations for Faker-unsupported lorem.word(min/max=...).
packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js Updates sampling for bigint and adds overrides/skip logic for specific params (e.g. zipCode state).
packages/core/src/tests/data_generation/unit/domain/domain-faker-param-comparison.test.js New Jest coverage asserting no missing/domain-only params vs Faker options, plus a focused check for number.bigInt.
packages/core/src/tests/command-help/command-help-examples.test.js Adjusts usage-example coverage logic to ignore params that are not usage-example supported.
packages/core/src/tests/command-help/command-help-examples.test-support.js Adds isUsageExampleSupportedParam helper and exports it for usage-example tests.
packages/core/js/keywords/domain/word/words-keyword-definition.js Removes unsupported max param/example for word.words.
packages/core/js/keywords/domain/word/verb-keyword-definition.js Removes unsupported max param/example for word.verb.
packages/core/js/keywords/domain/word/sample-keyword-definition.js Removes unsupported max param/example for word.sample.
packages/core/js/keywords/domain/word/preposition-keyword-definition.js Removes unsupported max param/example for word.preposition.
packages/core/js/keywords/domain/word/noun-keyword-definition.js Removes unsupported max param/example for word.noun.
packages/core/js/keywords/domain/word/interjection-keyword-definition.js Removes unsupported max param/example for word.interjection.
packages/core/js/keywords/domain/word/conjunction-keyword-definition.js Removes unsupported max param/example for word.conjunction.
packages/core/js/keywords/domain/word/adverb-keyword-definition.js Removes unsupported max param/example for word.adverb.
packages/core/js/keywords/domain/word/adjective-keyword-definition.js Removes unsupported max param/example for word.adjective.
packages/core/js/keywords/domain/system/network-interface-keyword-definition.js Adds options args + optionsFromHelpArgs and expands usage examples.
packages/core/js/keywords/domain/system/file-name-keyword-definition.js Adds extensionCount arg + optionsFromHelpArgs and updates examples.
packages/core/js/keywords/domain/person/sex-type-keyword-definition.js Expands enum (generic) + adds includeGeneric option + optionsFromHelpArgs.
packages/core/js/keywords/domain/person/full-name-keyword-definition.js Adds firstName/lastName/sex options + optionsFromHelpArgs and examples.
packages/core/js/keywords/domain/number/big-int-keyword-definition.js Reworks params to min/max/multipleOf, adds args validation, and updates examples.
packages/core/js/keywords/domain/lorem/word-keyword-definition.js Removes unsupported min/max params/examples; keeps length/strategy.
packages/core/js/keywords/domain/location/zip-code-keyword-definition.js Adds state/format args + optionsFromHelpArgs; marks state as not usage-example supported.
packages/core/js/keywords/domain/internet/http-status-code-keyword-definition.js Adds types option + optionsFromHelpArgs and updates examples.
packages/core/js/keywords/domain/internet/example-email-keyword-definition.js Adds firstName/lastName/allowSpecialCharacters options + optionsFromHelpArgs.
packages/core/js/keywords/domain/internet/display-name-keyword-definition.js Adds firstName/lastName options + optionsFromHelpArgs.
packages/core/js/keywords/domain/image/url-picsum-photos-keyword-definition.js Adds width/height/grayscale/blur options + optionsFromHelpArgs and examples.
packages/core/js/keywords/domain/image/person-portrait-keyword-definition.js Adds sex/size options + optionsFromHelpArgs and examples.
packages/core/js/keywords/domain/image/data-uri-keyword-definition.js Adds width/height/color/type options + optionsFromHelpArgs and expanded examples.
packages/core/js/keywords/domain/git/commit-sha-keyword-definition.js Adds length option + optionsFromHelpArgs and updates examples.
packages/core/js/keywords/domain/git/commit-entry-keyword-definition.js Adds merge/eol/refDate options + optionsFromHelpArgs and expands examples.
packages/core/js/keywords/domain/git/commit-date-keyword-definition.js Adds refDate option + optionsFromHelpArgs and updates examples.
packages/core/js/keywords/domain/airline/record-locator-keyword-definition.js Adds option args + optionsFromHelpArgs and new examples.
packages/core/js/keywords/domain/airline/flight-number-keyword-definition.js Adds length/addLeadingZeros options + optionsFromHelpArgs and expanded examples.
packages/core/js/domain/domain-keywords.js Adds bigint support to type-matching.
packages/core-ui/src/tests/interaction/matrix/schema-interaction-scenario-builder.test.js Adjusts scenario arg-coverage expectations to exclude location.zipCode.state.
docs/domain-faker-param-comparison.md Generated report documenting current parity between domain args and Faker option keys.
docs-src/docs/040-test-data/domain/290-word.md Updates domain docs to remove unsupported max params/examples for word.*.
docs-src/docs/040-test-data/domain/270-system.md Updates docs for system.fileName/system.networkInterface to include args + () examples.
docs-src/docs/040-test-data/domain/230-person.md Updates docs for person.fullName and person.sexType args + examples.
docs-src/docs/040-test-data/domain/220-number.md Updates number.bigInt docs to min/max/multipleOf examples/args.
docs-src/docs/040-test-data/domain/200-lorem.md Removes lorem.word(min/max) docs/examples.
docs-src/docs/040-test-data/domain/190-location.md Adds args/docs/examples for location.zipCode.
docs-src/docs/040-test-data/domain/170-internet.md Adds args/docs/examples for internet.displayName, internet.exampleEmail, internet.httpStatusCode.
docs-src/docs/040-test-data/domain/160-image.md Adds args/docs/examples for image.dataUri, image.personPortrait, image.urlPicsumPhotos.
docs-src/docs/040-test-data/domain/140-git.md Adds args/docs/examples for git.commitDate, git.commitEntry, git.commitSha.
docs-src/docs/040-test-data/domain/020-airline.md Adds args/docs/examples for airline.flightNumber and airline.recordLocator.

Comment thread scripts/compare-domain-faker-params.mjs Outdated
Comment thread packages/core/src/tests/command-help/command-help-examples.test.js
@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown

Greptile Summary

This PR expands domain command parameter metadata, usage examples, and documentation for Faker-backed keywords across airline, git, image, internet, location, lorem, number, person, system, and word domains. It also introduces a new compare-domain-faker-params.mjs script and test suite to keep domain args in sync with Faker's TypeScript declaration, and removes unsupported min/max params from lorem.word and word.* where Faker does not implement them.

  • Adds argTransform: 'optionsFromHelpArgs' and full arg metadata (with examples) to ~15 previously empty args: [] keyword definitions, and wires a new argsValidator for number.bigInt (ordered min/max, multipleOf > 0) and internet.httpStatusCode (enum type check).
  • Introduces a shared domain-keyword-sample-values.test-helper.js to consolidate three previously-duplicated sampleValueForType/sampleValueForKeywordArg implementations, and adds a usageExampleSupported flag to let individual params opt out of example-coverage checks (used by location.zipCode.state).
  • Adds a new domain-faker-param-comparison.test.js suite backed by the new comparison script to enforce that domain param names stay aligned with Faker's TypeScript option signatures in both directions.

Confidence Score: 5/5

Safe to merge — changes are additive metadata expansion with no modifications to runtime data generation paths except the corrected bigInt arg mapping.

All production changes are keyword metadata (args, examples, argTransform, argsValidator) and the new comparison script/tests. The number.bigInt validator correctly enforces ordered bounds and a positive multipleOf. The usageExampleSupported flag threads cleanly through the catalog builder, the Faker help mapper, and both test coverage assertions. The one latent inconsistency — sampleValueForType returning a JS Number rather than a BigInt — is in a test helper and has no current impact since no keyword param uses bigint as its declared type today.

No files require special attention for correctness. The domain-keyword-sample-values.test-helper.js bigint sample value is worth tidying for future-proofing.

Important Files Changed

Filename Overview
packages/core/js/keywords/domain/number/big-int-keyword-definition.js Replaces the single value placeholder arg with proper min, max, multipleOf params matching Faker's options object, adds argsValidator for ordered bounds and positive-multipleOf check, and updates sample return values to BigInt literals.
scripts/compare-domain-faker-params.mjs New script that parses Faker's TypeScript declaration bundle to extract options-object param names and compares them against domain keyword metadata; supports --markdown and --check (exits 1 on any gap in either direction).
packages/core/src/tests/data_generation/unit/domain/domain-keyword-sample-values.test-helper.js New shared helper consolidating three previously-duplicated sampleValueForType/sampleValueForKeywordArg implementations; adds bigint type handling but returns a JS Number (7) instead of a BigInt (7n), inconsistent with the new isTypeMatch bigint check.
packages/core/src/tests/command-help/command-help-examples.test.js Correctly threads the new usageExampleSupported flag through both example-count and zero-arg coverage assertions so that params like location.zipCode.state are excluded from coverage requirements without breaking other commands.
packages/core/js/keywords/domain/internet/http-status-code-keyword-definition.js Adds types arg with an inline enum validator (validateHttpStatusCodeTypes) that guards against unknown category names; correctly defers non-array values to the type system.
packages/core/src/tests/data_generation/unit/domain/domain-faker-param-comparison.test.js New test suite covering missing-in-domain, domain-only, overloaded-method merging, and bigInt-specific comparison; dynamically imports the companion script via process.cwd()-relative path which assumes Jest runs from the repo root.
packages/core/js/keywords/domain/location/zip-code-keyword-definition.js Adds state (usageExampleSupported: false) and format args with argTransform; the state flag correctly suppresses its example-coverage requirement while format gets its own focused example.
packages/core/js/domain/domain-keywords.js Propagates the new usageExampleSupported flag through the catalog builder, and adds a bigint branch to isTypeMatch so BigInt values are accepted for bigint-typed params.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Domain keyword definition\nkeyword + delegate + help.args] --> B{argTransform?\noptionsFromHelpArgs}
    B -->|yes| C[help.args mapped to\nFaker options object]
    B -->|no| D[positional / legacy args]
    C --> E[Faker function called\nwith options object]
    D --> E

    A --> F{argsValidator?}
    F -->|number.bigInt| G[validateBigIntBounds\nmin ≤ max, multipleOf > 0]
    F -->|internet.httpStatusCode| H[validateHttpStatusCodeTypes\nenum check on types array]
    F -->|others| I[no cross-param validation]
    G --> J[executeDomainKeyword]
    H --> J
    I --> J
    E --> J

    K[compare-domain-faker-params.mjs] --> L[Parse Faker .d.ts\nextract options params]
    L --> M[Compare with\nDOMAIN_KEYWORDS help.args]
    M --> N{Gaps?}
    N -->|missingInDomain or\ndomainOnlyParams| O[Exit 1 / test fail]
    N -->|none| P[Pass]

    Q[usageExampleSupported: false\ne.g. location.zipCode.state] --> R[Excluded from\nexample-coverage tests]
    Q --> S[Excluded from\nruntime param-usage tests]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Domain keyword definition\nkeyword + delegate + help.args] --> B{argTransform?\noptionsFromHelpArgs}
    B -->|yes| C[help.args mapped to\nFaker options object]
    B -->|no| D[positional / legacy args]
    C --> E[Faker function called\nwith options object]
    D --> E

    A --> F{argsValidator?}
    F -->|number.bigInt| G[validateBigIntBounds\nmin ≤ max, multipleOf > 0]
    F -->|internet.httpStatusCode| H[validateHttpStatusCodeTypes\nenum check on types array]
    F -->|others| I[no cross-param validation]
    G --> J[executeDomainKeyword]
    H --> J
    I --> J
    E --> J

    K[compare-domain-faker-params.mjs] --> L[Parse Faker .d.ts\nextract options params]
    L --> M[Compare with\nDOMAIN_KEYWORDS help.args]
    M --> N{Gaps?}
    N -->|missingInDomain or\ndomainOnlyParams| O[Exit 1 / test fail]
    N -->|none| P[Pass]

    Q[usageExampleSupported: false\ne.g. location.zipCode.state] --> R[Excluded from\nexample-coverage tests]
    Q --> S[Excluded from\nruntime param-usage tests]
Loading

Reviews (4): Last reviewed commit: "Address command param review feedback" | Re-trigger Greptile

Comment thread scripts/compare-domain-faker-params.mjs Outdated
Comment thread packages/core/src/tests/command-help/command-help-examples.test-support.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: 2

🧹 Nitpick comments (6)
scripts/compare-domain-faker-params.mjs (2)

106-136: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Method overload collisions silently drop earlier signatures.

methods.set(methodName, ...) (Line 131) overwrites any prior entry for the same methodName within a module body. Faker frequently declares overloaded methods (e.g., a no-args overload plus an options-object overload); the regex-driven scan will only retain whichever overload the loop encounters last, which may not be the options-bearing one, potentially skewing fakerOptionParams for that command.

🤖 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/compare-domain-faker-params.mjs` around lines 106 - 136, Method
overloads in compare-domain-faker-params.mjs are being collapsed because
methods.set(methodName, ...) overwrites earlier entries in the body scan. Update
the parsing logic around the methods Map and the methodStartRegex loop to
preserve overloads for the same methodName, and ensure the options-bearing
overload is selected (or merged) rather than replaced by the last-seen
signature. Use the existing findMatching, getObjectOptionKeys, and paramsText
extraction flow to collect all overload signatures before deciding which
signature should drive fakerOptionParams.

68-84: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid string-matching the Faker declaration bundle. This still couples the script to an internal declare class NumberModule detail; if it needs to keep working across faker upgrades, switch to a stable declaration path or export-based lookup instead.

🤖 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/compare-domain-faker-params.mjs` around lines 68 - 84, The
getFakerDeclarationPath() lookup is still brittle because it scans the dist
bundle and matches the internal "declare class NumberModule" text. Replace that
string-based bundle search with a stable resolution strategy, such as using the
known exported declaration path from `@faker-js/faker/package.json` or another
export-based lookup that does not depend on internal declaration contents, while
keeping the fallback error in place if resolution fails.
packages/core-ui/src/tests/interaction/matrix/schema-interaction-scenario-builder.test.js (1)

19-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Hardcoded exclusion duplicates the definition-level usageExampleSupported flag.

Same concern as in command-help-examples.test-support.js: isScenarioArgCoverageRequired re-encodes the location.zipCode/state exception as a literal string comparison instead of deriving it from arg.usageExampleSupported (already set to false in LOCATION_ZIP_CODE_KEYWORD_DEFINITION). Passing the full arg object (instead of just argName) would let this check generalize automatically to any future param marked unsupported, rather than requiring another hardcoded exception here.

♻️ Proposed simplification
-function isScenarioArgCoverageRequired(command, argName) {
-  return !(command === 'location.zipCode' && argName === 'state');
-}
+function isScenarioArgCoverageRequired(arg) {
+  return arg?.usageExampleSupported !== false;
+}
       (metadata.args || [])
-        .filter((arg) => isScenarioArgCoverageRequired(command, arg.name))
+        .filter((arg) => isScenarioArgCoverageRequired(arg))
         .forEach((arg) => {
           expect(bucket.coveredArgs.has(arg.name)).toBe(true);
         });

Also applies to: 89-93

🤖 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/core-ui/src/tests/interaction/matrix/schema-interaction-scenario-builder.test.js`
around lines 19 - 22, `isScenarioArgCoverageRequired` is hardcoding the
`location.zipCode`/`state` exception instead of using the argument metadata.
Update the helper in `schema-interaction-scenario-builder.test.js` to accept the
full `arg` object (as in `command-help-examples.test-support.js`) and decide
coverage from `arg.usageExampleSupported` rather than string-matching `command`
and `argName`. Then update the related call sites and any duplicate logic around
the referenced scenario coverage checks so unsupported args are excluded
automatically.
packages/core/src/tests/command-help/command-help-examples.test-support.js (1)

33-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Redundant hardcoded exclusion — already covered by param.usageExampleSupported.

LOCATION_ZIP_CODE_KEYWORD_DEFINITION already sets usageExampleSupported: false on the state arg, so the fallback param?.usageExampleSupported !== false on line 38 already excludes it. The explicit entry?.command === 'location.zipCode' && param?.name === 'state' branch is dead code that duplicates the single source of truth and must be manually kept in sync if similar exclusions are ever added elsewhere.

♻️ Proposed simplification
 function isUsageExampleSupportedParam(entry, param) {
-  if (entry?.command === 'location.zipCode' && param?.name === 'state') {
-    return false;
-  }
-
   return param?.usageExampleSupported !== false;
 }
🤖 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/core/src/tests/command-help/command-help-examples.test-support.js`
around lines 33 - 40, Remove the hardcoded `entry?.command ===
'location.zipCode' && param?.name === 'state'` բացառion from
`isUsageExampleSupportedParam`; it duplicates the existing
`param?.usageExampleSupported !== false` check and is already covered by
`LOCATION_ZIP_CODE_KEYWORD_DEFINITION`. Keep the function relying only on
`param.usageExampleSupported` so `isUsageExampleSupportedParam` stays the single
source of truth.
packages/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js (1)

19-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Consider consolidating triplicated sample-value helpers.

sampleValueForType/sampleValueForKeywordArg are duplicated near-verbatim across this file, domain-keyword-params-usage.test.js, and domainKeywords.test.js. This PR's bigint handling had to be patched in all three, and the implementations already diverged slightly (this file folds bigint into the same numeric branch as number/integer on line 35, while the other two files add a separate if (allowed.includes('bigint')) return 7; block) — evidence that keeping them in sync manually is fragile.

Extracting a single shared test utility module would remove this maintenance burden going forward.

Also applies to: 56-92

🤖 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/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js`
around lines 19 - 54, The sample-value helpers are duplicated across this test
helper and the related domain tests, and the bigint logic is already drifting
between copies. Extract the shared logic into a single reusable test utility and
have sampleValueForType/sampleValueForKeywordArg in this file and the matching
helpers in domain-keyword-params-usage.test.js and domainKeywords.test.js call
it, keeping bigint handling centralized in one place.
packages/core/js/keywords/domain/internet/http-status-code-keyword-definition.js (1)

8-8: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Args added correctly match faker.internet.httpStatusCode options.

Confirmed the types categories (informational, success, redirection, clientError, serverError) match faker's HttpStatusCodeType. No enum-level validation is added for types values, so an invalid category will surface as whatever error faker itself throws, rather than a domain-level validation message. Given this mirrors the existing pattern for other array-typed args in this cohort, this is a minor nice-to-have rather than a blocker.

Also applies to: 18-37

🤖 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/core/js/keywords/domain/internet/http-status-code-keyword-definition.js`
at line 8, The `httpStatusCode` keyword definition uses `optionsFromHelpArgs`
correctly, but `types` still lacks enum-level validation, so invalid values fall
through to faker errors instead of a domain validation message. Update the
`http-status-code-keyword-definition` setup to validate `types` against the
allowed `HttpStatusCodeType` values in the same pattern used by other
array-typed args in this cohort, keeping the existing `argTransform` behavior
intact.
🤖 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/keywords/domain/number/big-int-keyword-definition.js`:
- Around line 8-16: The big-int keyword validation is comparing and
range-checking raw values without accounting for the declared
bigint/number/string types, so quoted numeric inputs can be misordered and
non-number multipleOf values bypass validation. Update the validation path in
validateBigIntBounds to normalize min/max before the createOrderedArgsValidator
comparison, and adjust createNumericArgRangeValidator usage so multipleOf is
coerced or validated across bigint/string/number inputs instead of skipping
non-number values. Keep the fix localized to the big-int keyword validators and
preserve the existing argument names and error behavior.

In `@scripts/compare-domain-faker-params.mjs`:
- Around line 220-234: The runCli check logic only fails when rows are missing
in the domain, so it can miss regressions where domainOnlyParams are
reintroduced. Update the --check path in runCli to also inspect the
domainOnlyParams data from getFakerOptionParamComparison() and set
process.exitCode = 1 whenever any row has non-empty domain-only params. Keep the
existing missingRows check, but expand the failure condition so the CLI enforces
both no missing Faker params and no domain-only params.

---

Nitpick comments:
In
`@packages/core-ui/src/tests/interaction/matrix/schema-interaction-scenario-builder.test.js`:
- Around line 19-22: `isScenarioArgCoverageRequired` is hardcoding the
`location.zipCode`/`state` exception instead of using the argument metadata.
Update the helper in `schema-interaction-scenario-builder.test.js` to accept the
full `arg` object (as in `command-help-examples.test-support.js`) and decide
coverage from `arg.usageExampleSupported` rather than string-matching `command`
and `argName`. Then update the related call sites and any duplicate logic around
the referenced scenario coverage checks so unsupported args are excluded
automatically.

In
`@packages/core/js/keywords/domain/internet/http-status-code-keyword-definition.js`:
- Line 8: The `httpStatusCode` keyword definition uses `optionsFromHelpArgs`
correctly, but `types` still lacks enum-level validation, so invalid values fall
through to faker errors instead of a domain validation message. Update the
`http-status-code-keyword-definition` setup to validate `types` against the
allowed `HttpStatusCodeType` values in the same pattern used by other
array-typed args in this cohort, keeping the existing `argTransform` behavior
intact.

In `@packages/core/src/tests/command-help/command-help-examples.test-support.js`:
- Around line 33-40: Remove the hardcoded `entry?.command === 'location.zipCode'
&& param?.name === 'state'` բացառion from `isUsageExampleSupportedParam`; it
duplicates the existing `param?.usageExampleSupported !== false` check and is
already covered by `LOCATION_ZIP_CODE_KEYWORD_DEFINITION`. Keep the function
relying only on `param.usageExampleSupported` so `isUsageExampleSupportedParam`
stays the single source of truth.

In
`@packages/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js`:
- Around line 19-54: The sample-value helpers are duplicated across this test
helper and the related domain tests, and the bigint logic is already drifting
between copies. Extract the shared logic into a single reusable test utility and
have sampleValueForType/sampleValueForKeywordArg in this file and the matching
helpers in domain-keyword-params-usage.test.js and domainKeywords.test.js call
it, keeping bigint handling centralized in one place.

In `@scripts/compare-domain-faker-params.mjs`:
- Around line 106-136: Method overloads in compare-domain-faker-params.mjs are
being collapsed because methods.set(methodName, ...) overwrites earlier entries
in the body scan. Update the parsing logic around the methods Map and the
methodStartRegex loop to preserve overloads for the same methodName, and ensure
the options-bearing overload is selected (or merged) rather than replaced by the
last-seen signature. Use the existing findMatching, getObjectOptionKeys, and
paramsText extraction flow to collect all overload signatures before deciding
which signature should drive fakerOptionParams.
- Around line 68-84: The getFakerDeclarationPath() lookup is still brittle
because it scans the dist bundle and matches the internal "declare class
NumberModule" text. Replace that string-based bundle search with a stable
resolution strategy, such as using the known exported declaration path from
`@faker-js/faker/package.json` or another export-based lookup that does not depend
on internal declaration contents, while keeping the fallback error in place if
resolution fails.
🪄 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: 6d6abd09-c118-4a9c-ad3b-34adbb8a1cea

📥 Commits

Reviewing files that changed from the base of the PR and between bf4c65f and 7d304d3.

📒 Files selected for processing (48)
  • docs-src/docs/040-test-data/domain/020-airline.md
  • docs-src/docs/040-test-data/domain/140-git.md
  • docs-src/docs/040-test-data/domain/160-image.md
  • docs-src/docs/040-test-data/domain/170-internet.md
  • docs-src/docs/040-test-data/domain/190-location.md
  • docs-src/docs/040-test-data/domain/200-lorem.md
  • docs-src/docs/040-test-data/domain/220-number.md
  • docs-src/docs/040-test-data/domain/230-person.md
  • docs-src/docs/040-test-data/domain/270-system.md
  • docs-src/docs/040-test-data/domain/290-word.md
  • docs/domain-faker-param-comparison.md
  • packages/core-ui/src/tests/interaction/matrix/schema-interaction-scenario-builder.test.js
  • packages/core/js/domain/domain-keywords.js
  • packages/core/js/keywords/domain/airline/flight-number-keyword-definition.js
  • packages/core/js/keywords/domain/airline/record-locator-keyword-definition.js
  • packages/core/js/keywords/domain/git/commit-date-keyword-definition.js
  • packages/core/js/keywords/domain/git/commit-entry-keyword-definition.js
  • packages/core/js/keywords/domain/git/commit-sha-keyword-definition.js
  • packages/core/js/keywords/domain/image/data-uri-keyword-definition.js
  • packages/core/js/keywords/domain/image/person-portrait-keyword-definition.js
  • packages/core/js/keywords/domain/image/url-picsum-photos-keyword-definition.js
  • packages/core/js/keywords/domain/internet/display-name-keyword-definition.js
  • packages/core/js/keywords/domain/internet/example-email-keyword-definition.js
  • packages/core/js/keywords/domain/internet/http-status-code-keyword-definition.js
  • packages/core/js/keywords/domain/location/zip-code-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/word-keyword-definition.js
  • packages/core/js/keywords/domain/number/big-int-keyword-definition.js
  • packages/core/js/keywords/domain/person/full-name-keyword-definition.js
  • packages/core/js/keywords/domain/person/sex-type-keyword-definition.js
  • packages/core/js/keywords/domain/system/file-name-keyword-definition.js
  • packages/core/js/keywords/domain/system/network-interface-keyword-definition.js
  • packages/core/js/keywords/domain/word/adjective-keyword-definition.js
  • packages/core/js/keywords/domain/word/adverb-keyword-definition.js
  • packages/core/js/keywords/domain/word/conjunction-keyword-definition.js
  • packages/core/js/keywords/domain/word/interjection-keyword-definition.js
  • packages/core/js/keywords/domain/word/noun-keyword-definition.js
  • packages/core/js/keywords/domain/word/preposition-keyword-definition.js
  • packages/core/js/keywords/domain/word/sample-keyword-definition.js
  • packages/core/js/keywords/domain/word/verb-keyword-definition.js
  • packages/core/js/keywords/domain/word/words-keyword-definition.js
  • packages/core/src/tests/command-help/command-help-examples.test-support.js
  • packages/core/src/tests/command-help/command-help-examples.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-faker-param-comparison.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/compare-domain-faker-params.mjs
💤 Files with no reviewable changes (12)
  • packages/core/js/keywords/domain/word/noun-keyword-definition.js
  • packages/core/js/keywords/domain/word/sample-keyword-definition.js
  • packages/core/js/keywords/domain/word/words-keyword-definition.js
  • packages/core/js/keywords/domain/word/interjection-keyword-definition.js
  • docs-src/docs/040-test-data/domain/200-lorem.md
  • packages/core/js/keywords/domain/word/adverb-keyword-definition.js
  • packages/core/js/keywords/domain/word/verb-keyword-definition.js
  • packages/core/js/keywords/domain/word/conjunction-keyword-definition.js
  • packages/core/js/keywords/domain/word/adjective-keyword-definition.js
  • packages/core/js/keywords/domain/word/preposition-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/word-keyword-definition.js
  • docs-src/docs/040-test-data/domain/290-word.md

Comment thread scripts/compare-domain-faker-params.mjs
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.

Bug some commands do not have params defined

2 participants