Skip to content

[codex] add auto increment timestamp generator#201

Merged
eviltester merged 8 commits into
masterfrom
197-autoincrement-timestamp
Jun 13, 2026
Merged

[codex] add auto increment timestamp generator#201
eviltester merged 8 commits into
masterfrom
197-autoincrement-timestamp

Conversation

@eviltester

@eviltester eviltester commented Jun 13, 2026

Copy link
Copy Markdown
Owner

What changed

  • adds a new awd.autoIncrement.timestamp(...) domain command for deterministic timestamp sequences
  • surfaces the command in the domain picker, help configuration, modules dialog, and tooltip/help metadata
  • wires row-aware execution context through standard and pairwise generation so timestamp defaults can increment consistently from a stable run start
  • adds docs, schema examples, and a release blog note for the new command
  • hardens local API Playwright execution on Windows with a repo-local transform cache and serialized API workers so the required local gate is stable

Why

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:ui
  • pnpm run verify:local
  • pre-push hook reran pnpm run verify:local

Summary by CodeRabbit

  • New Features

    • Added autoIncrement.timestamp for deterministic, per-row UTC timestamp generation with configurable start, step, units, and input/output formats (including optional stateful progression).
    • Row generation now passes run/start context (row index + run start time) so value generation can stay consistent across generated rows.
  • Documentation

    • Expanded autoIncrement docs and added full autoIncrement.timestamp method reference, examples, and return-value behavior.
  • Tests

    • Added and extended unit/integration/acceptance coverage for timestamp increments, parsing/formatting, state behavior, and safe-mode/MCP generation.
  • Chores

    • Updated test runners/configs and added date/time parsing/formatting dependencies.

Copilot AI review requested due to automatic review settings June 13, 2026 14:15
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 0e16abe8-71c4-4e19-96df-e52f9247ac8a

📥 Commits

Reviewing files that changed from the base of the PR and between a9462c2 and 13f4c8f.

📒 Files selected for processing (1)
  • packages/core/js/domain/auto-increment-timestamp.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/js/domain/auto-increment-timestamp.js

📝 Walkthrough

Walkthrough

Implements a new domain keyword autoIncrement.timestamp generating deterministic UTC timestamps per-row (with optional state), threads {rowIndex, runStartedAt} and executionContext through generators, registers the keyword and safe-mode acceptance, updates docs and release notes, and adds comprehensive tests plus test-runner adjustments.

Changes

Auto-increment timestamp feature

Layer / File(s) Summary
Execution context propagation through data generation
packages/core/js/data_generation/domain/domainTestDataGenerator.js, packages/core/js/data_generation/n-wise/pairwiseTestDataGenerator.js, packages/core/js/data_generation/rulesBasedDataGenerator.js, packages/core/js/data_generation/testDataGenerator.js, packages/core/src/tests/data_generation/unit/domain/domainTestDataGenerator-state.test.js
Generators now compute a single runStartedAt per run and forward { rowIndex, runStartedAt } (and executionContext where accepted) into domain and random-value generators; single-row generation sets rowIndex: 0. Tests verify generator-owned faker and args override execution-context values.
Timestamp generation logic and keyword contract
packages/core/js/domain/auto-increment-timestamp.js, packages/core/js/domain/domain-custom-autoincrement-keyword-definitions.js, packages/core/package.json, packages/core/src/tests/data_generation/unit/domain/domain-autoincrement-timestamp-exec.test.js
executeCustomAutoIncrementTimestamp parses multiple start formats (Date, epoch, ISO, formatted, natural language via chrono-node), normalizes step units, applies per-step increments via date-fns, formats output (ISO Z or custom UTC), supports autoIncrementState.nextDate stateful advancement. Declares keyword args (start, step, type, outputFormat, inputFormat). Adds chrono-node, date-fns, and date-fns-tz runtime dependencies. Unit tests cover default/explicit ISO stepping, input/output formatting, invalid unit rejection, and stateful advancement.
Domain system integration and safe-mode validator
packages/core/js/domain/domain-keywords.js, packages/core/src/index.js, packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js, packages/core-ui/src/tests/grid/schema/test-data-command-catalog.test.js, packages/core-ui/src/tests/shared/help-model-builder.test.js, packages/core-ui/src/tests/utils/domain-command-help-metadata.test.js, packages/core/src/tests/core-api/generateFromTextSpec.test.js
Registers autoIncrement.timestamp as a built-in custom delegate and updates safe-mode faker-rule validation to accept registered domain keyword aliases. Tests verify keyword metadata contracts (delegate type, return type), UI command discovery, help model rendering, docs URL mapping, and safe-mode acceptance of keyword-based faker expressions.
End-to-end generation and MCP coverage
packages/core/src/tests/data_generation/autoincrement-timestamp-integration.test.js, packages/core/src/tests/data_generation/generateDataFromMultiLineSpec.test.js, apps/mcp/src/mcp.test.js, packages/core/src/tests/mcp/anywaydata-mcp-contract.test.js
Integration and contract tests ensure timestamps advance by the configured step across generated rows in rules-based, pairwise, multiline spec, and MCP contract flows with deterministic UTC ISO output.
User documentation and release announcement
docs-src/docs/040-test-data/domain/040-autoIncrement.md, docs-src/docs/040-test-data/018-Schema-Definition.md, docs-src/docs/040-test-data/domain/000-domain-test-data.md, docs-src/blog/2026-06-12-release-prep-combinatorial-grid-workflows.md
Documents autoIncrement.timestamp (args, examples, sample outputs), updates domain and schema examples with CreatedAt field, adds domain list entry, and inserts a new release-prep section describing deterministic timestamp generation (renumbers subsequent headings).
Test runner script and localhost configuration
package.json, playwright-api.config.js, scripts/run-playwright-api-tests.mjs, scripts/run-storybook-tests.mjs, vitest.config.mjs
Root npm test:api uses a custom Playwright runner that recreates a transform cache directory; Playwright workers defaults to 1 locally (6 in CI); Storybook/Vitest Storybook runner binds to 127.0.0.1; and Playwright API tests target localhost with explicit port.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • eviltester/grid-table-editor#200: The PR's autoIncrementState plumbing and custom-domain delegate/definition wiring extend the autoIncrement.sequence generator implementation introduced in that PR.

Poem

🐰 I nibble dates in tidy rows,
Each tick-tock step where soft wind blows,
From start or state I hop through time,
Laying timestamps in ordered rhyme. ✨

🚥 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 summarizes the main change: adding an auto increment timestamp generator.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 197-autoincrement-timestamp

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 and usage tips.

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 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.timestamp as a custom domain keyword backed by chrono-node + date-fns, plus unit/integration tests.
  • Wires rowIndex + runStartedAt through 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

Comment thread packages/core/js/data_generation/domain/domainTestDataGenerator.js
Comment thread docs-src/docs/040-test-data/018-Schema-Definition.md Outdated

@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: 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".

Comment thread packages/core/js/data_generation/testDataGenerator.js
@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR implements autoIncrement.timestamp, a new domain keyword that produces a deterministic sequence of timestamps starting from a configurable point and incrementing by a configurable step and unit for each generated row. It wires rowIndex and a stable runStartedAt through bulk generation, pairwise generation, and single-row generation paths, and fixes validateSafeFakerRules so all registered domain keywords bypass the faker-only safety check.

  • Core generator (auto-increment-timestamp.js): dual-mode design — stateful (autoIncrementState) when called through DomainTestDataGenerator (all normal UI/API paths), offset-via-rowIndex for direct keyword invocation (MCP contract). Date parsing handles ISO-8601, custom inputFormat patterns, and chrono-node natural-language input; UTC normalization via toUtcDatePreservingClock is consistent across all parse paths.
  • Execution context threading: rowIndex and runStartedAt are now propagated from rulesBasedDataGeneratorDomainTestDataGenerator.generateFromexecuteDomainKeyword; the spread order in domainTestDataGenerator.js correctly pins rule-level faker and args after spreading caller context, confirmed by new targeted tests.
  • Safe-mode fix: getDomainKeywordByAlias is used as an early-continue guard in validateSafeFakerRules so domain commands (not just the new timestamp one) are accepted without going through the faker argument-safety check, which is appropriate since domain args are parsed by their own safe literal grammar.

Confidence Score: 5/5

Safe 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

Filename Overview
packages/core/js/domain/auto-increment-timestamp.js New implementation of the timestamp auto-increment generator; dual-mode design (stateful via autoIncrementState or offset-via-rowIndex) is correct, date parsing chain and UTC normalization are sound.
packages/core/js/data_generation/domain/domainTestDataGenerator.js generateFrom now accepts and spreads executionContext (rowIndex, runStartedAt) before pinning faker, parsed args, and autoIncrementState; spread order guarantees rule-level values always win over caller-supplied context, confirmed by new tests.
packages/core/js/data_generation/rulesBasedDataGenerator.js Threads rowIndex and a stable runStartedAt into generateRandomRow; capture/restore of autoIncrementState on constraint retries is correct because addStep always returns a new Date rather than mutating in place.
packages/core/js/data_generation/testDataGenerator.js generateRow hard-codes rowIndex=0 (flagged in a prior review); in practice this is masked by the stateful autoIncrementState path, but the index-based offset mode will always return the start value for single-row additions if state is ever absent.
packages/core/src/index.js validateSafeFakerRules now skips the unknown-command check for any registered domain keyword via getDomainKeywordByAlias; domain args go through their own safe parser so skipping the faker argument safety check is correct.
packages/core/js/data_generation/n-wise/pairwiseTestDataGenerator.js generateCompleteDataRecords now supplies rowIndex and a single runStartedAt to each non-enum column; domain values go through DomainTestDataGenerator which manages stateful incrementation correctly across pairwise combinations.
scripts/run-playwright-api-tests.mjs New wrapper script that provisions a fresh per-run transform cache directory via PWTEST_CACHE_DIR before spawning the Playwright CLI; exit-code forwarding including signal re-raise is handled correctly.
vitest.config.mjs Storybook server bound to 127.0.0.1 and Vitest browser API fixed to port 51315 with strictPort:true; fixed port with strictPort can cause CI agent port conflicts (flagged in prior review).

Sequence Diagram

sequenceDiagram
    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)
Loading

Reviews (7): Last reviewed commit: "Accept zero row index for timestamp incr..." | Re-trigger Greptile

Comment thread playwright-api.config.js Outdated
Comment thread vitest.config.mjs

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

🧹 Nitpick comments (1)
packages/core/js/domain/auto-increment-timestamp.js (1)

177-178: 💤 Low value

Minor: rowIndex condition could be clearer.

The condition executionContext.rowIndex > 0 correctly defaults to 0 for missing or zero rowIndex, but it's slightly confusing because it treats explicit 0 the same as missing/undefined. Consider executionContext.rowIndex >= 0 with Number.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

📥 Commits

Reviewing files that changed from the base of the PR and between 6b120f7 and c40ba09.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (24)
  • docs-src/blog/2026-06-12-release-prep-combinatorial-grid-workflows.md
  • docs-src/docs/040-test-data/018-Schema-Definition.md
  • docs-src/docs/040-test-data/domain/000-domain-test-data.md
  • docs-src/docs/040-test-data/domain/025-autoIncrement.md
  • package.json
  • packages/core-ui/src/tests/grid/schema/test-data-command-catalog.test.js
  • packages/core-ui/src/tests/shared/help-model-builder.test.js
  • packages/core-ui/src/tests/utils/domain-command-help-metadata.test.js
  • packages/core/js/data_generation/domain/domainTestDataGenerator.js
  • packages/core/js/data_generation/n-wise/pairwiseTestDataGenerator.js
  • packages/core/js/data_generation/rulesBasedDataGenerator.js
  • packages/core/js/data_generation/testDataGenerator.js
  • packages/core/js/domain/auto-increment-timestamp.js
  • packages/core/js/domain/domain-custom-autoincrement-keyword-definitions.js
  • packages/core/js/domain/domain-keyword-definitions.js
  • packages/core/js/domain/domain-keywords.js
  • packages/core/package.json
  • packages/core/src/tests/data_generation/autoincrement-timestamp-integration.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-autoincrement-timestamp-exec.test.js
  • packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js
  • playwright-api.config.js
  • scripts/run-playwright-api-tests.mjs
  • scripts/run-storybook-tests.mjs
  • vitest.config.mjs

Comment thread docs-src/docs/040-test-data/domain/025-autoIncrement.md Outdated
@eviltester eviltester merged commit e6aa6c2 into master Jun 13, 2026
16 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.

2 participants