[codex] add auto increment timestamp generator#201
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughImplements a new domain keyword ChangesAuto-increment timestamp feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new deterministic autoIncrement.timestamp domain keyword and propagates row/run context through generators so timestamp sequences increment predictably across generated rows, with accompanying tests, docs, and CI/test-runner hardening for Storybook/Vitest and Playwright API runs.
Changes:
- Introduces
autoIncrement.timestampas a custom domain keyword backed by chrono-node + date-fns, plus unit/integration tests. - Wires
rowIndex+runStartedAtthrough standard and pairwise generation paths to support stable per-run increments. - Updates docs/blog and adjusts Storybook/Vitest + Playwright API test execution to be more stable (host binding, fixed API port, serialized workers, repo-local transform cache).
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.mjs | Binds Storybook and Vitest browser API to loopback and pins browser API port for stability. |
| scripts/run-storybook-tests.mjs | Runs Storybook Vitest project with explicit API host binding. |
| scripts/run-playwright-api-tests.mjs | Adds a repo-local Playwright transform cache dir and runs API tests with controlled env. |
| pnpm-lock.yaml | Locks new dependencies for timestamp parsing/formatting (chrono-node, date-fns, date-fns-tz). |
| playwright-api.config.js | Serializes Playwright API tests by forcing workers: 1. |
| packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js | Asserts the new domain keyword is registered as a custom delegate with string return type. |
| packages/core/src/tests/data_generation/unit/domain/domain-autoincrement-timestamp-exec.test.js | Unit tests for autoIncrement.timestamp execution behavior and validation. |
| packages/core/src/tests/data_generation/autoincrement-timestamp-integration.test.js | Integration tests verifying cross-row increments in rules-based + pairwise generation. |
| packages/core/package.json | Adds runtime dependencies used by the new timestamp generator. |
| packages/core/js/domain/domain-keywords.js | Wires the new custom keyword delegate into domain execution. |
| packages/core/js/domain/domain-keyword-definitions.js | Includes the new custom autoIncrement keyword definition set in the catalog. |
| packages/core/js/domain/domain-custom-autoincrement-keyword-definitions.js | Defines help/args metadata for autoIncrement.timestamp and docs link. |
| packages/core/js/domain/auto-increment-timestamp.js | Implements parsing, incrementing, and UTC formatting for deterministic timestamp sequences. |
| packages/core/js/data_generation/testDataGenerator.js | Passes rowIndex + runStartedAt into row generation for consistent defaults. |
| packages/core/js/data_generation/rulesBasedDataGenerator.js | Propagates rowIndex + stable per-run runStartedAt through multi-row generation. |
| packages/core/js/data_generation/n-wise/pairwiseTestDataGenerator.js | Propagates rowIndex + stable per-run runStartedAt through pairwise generation. |
| packages/core/js/data_generation/domain/domainTestDataGenerator.js | Accepts/forwards execution context into domain keyword execution. |
| packages/core-ui/src/tests/utils/domain-command-help-metadata.test.js | Validates docs URL mapping for the new domain command help. |
| packages/core-ui/src/tests/shared/help-model-builder.test.js | Ensures schema help rendering includes new autoIncrement timestamp help content. |
| packages/core-ui/src/tests/grid/schema/test-data-command-catalog.test.js | Ensures the domain command catalog/picker includes autoIncrement.timestamp. |
| package.json | Adds root deps and routes test:api through the new runner script. |
| docs-src/docs/040-test-data/domain/025-autoIncrement.md | Adds the new domain documentation page for autoIncrement timestamps. |
| docs-src/docs/040-test-data/domain/000-domain-test-data.md | Links the new domain page and adds an example usage snippet. |
| docs-src/docs/040-test-data/018-Schema-Definition.md | Adds an example showing autoIncrement timestamps in schema definitions. |
| docs-src/blog/2026-06-12-release-prep-combinatorial-grid-workflows.md | Adds release-note section describing the new timestamp feature with example output. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c40ba099a8
ℹ️ 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".
Greptile SummaryThis PR implements
Confidence Score: 5/5Safe to merge; the new timestamp generator is well-structured, both increment modes are exercised by tests, and the context-threading changes through the bulk and pairwise paths are mechanical and correct. The dual-mode design (stateful vs. offset) is clearly separated and each path has dedicated unit, integration, and MCP contract tests. The safe-mode bypass in validateSafeFakerRules is narrowly scoped to registered domain keywords and domain args are parsed by their own literal grammar. State capture/restore during constraint retries is correct because addStep always returns a new Date. The tooling changes are isolated to local developer experience. No logic errors were found in the changed paths. No files require special attention; the hard-coded rowIndex=0 in testDataGenerator.generateRow was flagged in a prior review and is masked in practice by the stateful autoIncrementState path. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller as Caller (MCP / UI / API)
participant RBG as RulesBasedDataGenerator
participant DTG as DomainTestDataGenerator
participant TS as auto-increment-timestamp.js
Caller->>RBG: generateFromRules(n, rules)
RBG->>RBG: "runStartedAt = new Date()"
loop row 0..n-1
RBG->>DTG: "generateFrom(rule, {rowIndex, runStartedAt})"
DTG->>DTG: parse ruleSpec → keyword + args
DTG->>DTG: "#getAutoIncrementStateForRule → state {}"
DTG->>TS: "executeDomainKeyword({...ctx, faker, args, autoIncrementState:state})"
alt state.nextDate exists (rows 1+)
TS->>TS: "currentDate = state.nextDate"
else first call
TS->>TS: "currentDate = resolveStartDate(startArg, inputFormat, runStartedAt)"
end
TS->>TS: "state.nextDate = addStep(currentDate, step, type)"
TS-->>DTG: formatTimestamp(currentDate, outputFormat)
DTG-->>RBG: dataResponse(timestamp)
RBG-->>Caller: row data
end
Note over Caller,TS: Direct API path (no DomainTestDataGenerator)
Caller->>TS: "executeDomainKeyword({args, rowIndex, runStartedAt})"
Note right of TS: autoIncrementState absent → offset mode
TS->>TS: "offsetDate = startDate + step * rowIndex"
TS-->>Caller: formatTimestamp(offsetDate, outputFormat)
Reviews (7): Last reviewed commit: "Accept zero row index for timestamp incr..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/core/js/domain/auto-increment-timestamp.js (1)
177-178: 💤 Low valueMinor: rowIndex condition could be clearer.
The condition
executionContext.rowIndex > 0correctly defaults to0for missing or zero rowIndex, but it's slightly confusing because it treats explicit0the same as missing/undefined. ConsiderexecutionContext.rowIndex >= 0withNumber.isInteger()for clarity, though the current logic produces correct results.♻️ Optional refactor for clarity
const rowIndex = - Number.isInteger(executionContext.rowIndex) && executionContext.rowIndex > 0 ? executionContext.rowIndex : 0; + Number.isInteger(executionContext.rowIndex) && executionContext.rowIndex >= 0 ? executionContext.rowIndex : 0;🤖 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/domain/auto-increment-timestamp.js` around lines 177 - 178, The expression that computes rowIndex treats explicit 0 the same as missing because it checks executionContext.rowIndex > 0; update the check in the rowIndex assignment to use Number.isInteger(executionContext.rowIndex) && executionContext.rowIndex >= 0 so explicit zero is accepted and the intent is clearer (adjust the existing const rowIndex assignment accordingly, leaving the rest of the function unchanged).
🤖 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/docs/040-test-data/domain/025-autoIncrement.md`:
- Around line 1-25: The frontmatter sidebar_position (sidebar_position: 25)
places autoIncrement before animal, breaking strict alphabetical ordering;
update the frontmatter so the sidebar positions reflect alphabetical order
(e.g., set sidebar_position to 30 for autoIncrement so airline:20, animal:25,
autoIncrement:30) or, if a deliberate non-alphabetical ordering is intended, add
a short comment in the docs explaining the ordering rule instead of changing
numbers.
---
Nitpick comments:
In `@packages/core/js/domain/auto-increment-timestamp.js`:
- Around line 177-178: The expression that computes rowIndex treats explicit 0
the same as missing because it checks executionContext.rowIndex > 0; update the
check in the rowIndex assignment to use
Number.isInteger(executionContext.rowIndex) && executionContext.rowIndex >= 0 so
explicit zero is accepted and the intent is clearer (adjust the existing const
rowIndex assignment accordingly, leaving the rest of the function unchanged).
🪄 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: 4ee1665c-f8a1-4eb0-b4f1-ed4cd95922c7
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (24)
docs-src/blog/2026-06-12-release-prep-combinatorial-grid-workflows.mddocs-src/docs/040-test-data/018-Schema-Definition.mddocs-src/docs/040-test-data/domain/000-domain-test-data.mddocs-src/docs/040-test-data/domain/025-autoIncrement.mdpackage.jsonpackages/core-ui/src/tests/grid/schema/test-data-command-catalog.test.jspackages/core-ui/src/tests/shared/help-model-builder.test.jspackages/core-ui/src/tests/utils/domain-command-help-metadata.test.jspackages/core/js/data_generation/domain/domainTestDataGenerator.jspackages/core/js/data_generation/n-wise/pairwiseTestDataGenerator.jspackages/core/js/data_generation/rulesBasedDataGenerator.jspackages/core/js/data_generation/testDataGenerator.jspackages/core/js/domain/auto-increment-timestamp.jspackages/core/js/domain/domain-custom-autoincrement-keyword-definitions.jspackages/core/js/domain/domain-keyword-definitions.jspackages/core/js/domain/domain-keywords.jspackages/core/package.jsonpackages/core/src/tests/data_generation/autoincrement-timestamp-integration.test.jspackages/core/src/tests/data_generation/unit/domain/domain-autoincrement-timestamp-exec.test.jspackages/core/src/tests/data_generation/unit/domain/domainKeywords.test.jsplaywright-api.config.jsscripts/run-playwright-api-tests.mjsscripts/run-storybook-tests.mjsvitest.config.mjs
What changed
awd.autoIncrement.timestamp(...)domain command for deterministic timestamp sequencesWhy
Issue #197 asked for an auto-incrementing timestamp data-generation command with sensible defaults, flexible parsing, and full product/documentation coverage.
Impact
Users can now generate sequential timestamps directly from schema rules, including custom starts, increments, units, and output formatting, without falling back to manual post-processing.
Validation
pnpm run verify:uipnpm run verify:localpnpm run verify:localSummary by CodeRabbit
New Features
autoIncrement.timestampfor deterministic, per-row UTC timestamp generation with configurablestart,step, units, and input/output formats (including optional stateful progression).Documentation
autoIncrementdocs and added fullautoIncrement.timestampmethod reference, examples, and return-value behavior.Tests
Chores