Skip to content

Add a zero-tolerance TypeDoc documentation gate#58

Open
leynos wants to merge 2 commits into
mainfrom
typedoc-rollout
Open

Add a zero-tolerance TypeDoc documentation gate#58
leynos wants to merge 2 commits into
mainfrom
typedoc-rollout

Conversation

@leynos

@leynos leynos commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

This branch adds a zero-tolerance TypeDoc documentation gate to
make all. TypeDoc's notDocumented validation runs over the package
entry point (src/index.ts, resolve strategy) with emit: "none"
and validation warnings treated as errors: every declaration in the
public surface must carry a JSDoc comment. The gate reports the
qualified name of each undocumented declaration, writes no
documentation artefacts, and fails on a single omission. CI already
runs make all, so it reaches the gate with no workflow changes.

The first commit documents the surface (the initial inventory was 1,450
warnings, almost all zod-inference noise); the second wires the gate.

Review walkthrough

  • Start with typedoc.json
    for the gate's configuration, then the
    Makefile
    and package.json:
    docs-check sits between typecheck and lint in make all, after
    typecheck so the generated GraphQL types exist.
  • The zod schema constants under
    src/store/entities/
    carry documented /** … @internal */ blocks, and each schema field
    surfaced through the fixture builders now has a one-line JSDoc at its
    field site (including the transform-derived fields at their
    return { … } sites in commit.ts, issue.ts, pull-request.ts,
    and ref.ts).
  • One deliberate type-level change in
    src/store/entities/
    and src/store/builders.ts:
    the GitHub* output aliases become
    interface … extends z.infer<…> {} (type unchanged) and the
    build*Fixture helpers gain explicit return-type annotations.
    TypeDoc cannot preserve z.infer alias references, so without this
    the builders' return types expand into hundreds of undocumentable
    structural properties.
  • src/index.ts
    documents the simulator argument surface, and
    docs/development.md
    documents the local command and updates the gate flowchart.

Validation

  • make all (check-fmt, typecheck, docs-check, lint via Biome and
    Oxlint, test, spelling): exit 0.
  • Mutation check: deleting the JSDoc line from the exported
    InitialState alias makes bun run docs:check exit 4 naming the
    symbol; restoring it returns the gate to green.
  • A clean docs:check run emits no files.

Notes

leynos added 2 commits July 18, 2026 00:13
Prepare for a zero-tolerance TypeDoc documentation gate: document every
declaration reachable from the package entry point, including one-line
JSDoc on each zod schema field surfaced through the fixture builders
and the transform-derived fields at their `return { … }` sites.

Tag the zod schema constants with documented `/** … @internal */`
blocks — they are validation seams whose meaning is carried by the
named output types. Convert the `GitHub*` output aliases from
`type … = z.infer<…>` to `interface … extends z.infer<…> {}` so
TypeDoc renders builder return types as references to the documented
interfaces instead of expanding the inferred structural type (the type
is unchanged; TypeDoc cannot preserve `z.infer` alias references), and
give each `build*Fixture` an explicit return-type annotation.
Add `docs-check` to `make all` between `typecheck` and `lint` (after
`typecheck` so the generated GraphQL types exist): TypeDoc's
`notDocumented` validation over the package entry point
(`src/index.ts`, `resolve` strategy, `emit: "none"`, validation
warnings as errors), configured by `typedoc.json` and run through
`bun run docs:check`. The gate requires 100% documentation of the
public surface, reports the qualified name of each undocumented
declaration, and writes no documentation artefacts. CI already runs
`make all`, so the gate needs no workflow changes.
@coderabbitai

coderabbitai Bot commented Jul 17, 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

Summary

  • Added a zero-tolerance TypeDoc documentation validation gate to make all, executed between typecheck and lint via a new docs-check phase.
  • Introduced a docs:check script and typedoc.json configuration to validate only declarations reachable from src/index.ts, emit no documentation artefacts, and treat TypeDoc validation warnings as errors (with notDocumented enabled).
  • Updated contributor workflow documentation (docs/development.md) to describe the new documentation gate and its rules (including @internal usage to keep Zod schema constants out of the documented surface).
  • Added/expanded JSDoc across the public API:
    • Documented the simulator argument surface and developer workflow.
    • Added JSDoc to fixture builders, schemas, and fields (including internal guidance/normalisation notes where appropriate).
    • Adjusted exported public types for TypeDoc compatibility (notably changing several type exports to interface extensions and adding explicit builder return annotations) without changing runtime behaviour.
  • CI now reaches the gate through its existing make all target.

Validation

  • make all completed successfully with the TypeDoc gate passing.
  • Mutation checks completed successfully.

Walkthrough

Add a TypeDoc documentation check, document exported APIs and fixture schemas, configure warning enforcement without artefacts, and include docs-check in the make all workflow.

Changes

TypeDoc documentation gate

Layer / File(s) Summary
Configure TypeDoc validation
package.json, typedoc.json
Add the docs:check script, TypeDoc development dependency, entry-point configuration, internal/private exclusions, and documentation validation rules.
Document public API and fixture types
src/index.ts, src/store/builders.ts, src/store/entities*
Add JSDoc for exported APIs and fixture schemas, provide explicit builder return types, and represent inferred entity shapes as exported interfaces.
Wire the documentation quality gate
Makefile, docs/development.md
Run docs-check from make all and document the TypeDoc notDocumented gate in the contributor workflow and diagram.

Possibly related PRs

  • leynos/dakar#5: Introduces the same TypeDoc docs:check wiring and configuration pattern.
  • leynos/df12-build#62: Adds the same TypeDoc gate across Makefile, package scripts, and configuration.
  • leynos/simulacat-core#19: Updates the exported simulator API around extendRouter, which is also documented in this change.

Poem

Types bloom where comments gleam,
Docs now guard the buildstream.
Checks march through the Makefile bright,
Warnings turn to errors overnight.
Public shapes stand clear and true.


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
Testing (Overall) ❌ Error No new tests guard the new docs-check gate or the seeded user created_at default; existing user tests only assert id/login/name/email. Add focused tests that break if the user created_at default is removed and a command-level check that exercises docs:check/make all behaviour.
Testing (Unit And Behavioural) ⚠️ Warning No test file changed, and nothing exercises bun run docs:check or make all; the new CLI/workflow gate is only configured, not verified. Add an end-to-end regression test that runs the new gate (or make all) and asserts both the success path and a documented failure when a JSDoc is removed.
Testing (Compile-Time / Ui) ⚠️ Warning The PR adds TypeDoc/docs-check and type-shape changes, but I found no trybuild/tsd/type-assertion test or docs:check test; only oxlint and runtime snapshot tests exist. Add a TypeScript compile-time test (tsd/expect-type or equivalent) that fails on the undocumented/public-surface cases this gate is meant to catch.
Domain Architecture ⚠️ Warning FAIL: issue.ts and pull-request.ts still document globally unique IDs, but the transform only computes offset + number, so the model claims an invariant it does not enforce. Either allocate IDs through a repository-aware/global allocator, or rewrite the docs to describe the deterministic per-number fallback.
✅ Passed checks (16 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding a zero-tolerance TypeDoc documentation gate.
Description check ✅ Passed The description is detailed and directly describes the TypeDoc gate, docs updates, and supporting type changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
User-Facing Documentation ✅ Passed No user-facing behaviour changed; the diff only adds documentation gates and declaration/JSDoc updates, and docs/users-guide.md was untouched.
Developer Documentation ✅ Passed PASS: docs/development.md documents the new docs-check gate, and the repo has no docs/developers-guide.md or relevant roadmap/execplan items to update.
Module-Level Documentation ✅ Passed Every changed source module has a top-level @file doc comment; the lone header-less file is src/generated/resolvers-types.ts, which is excluded from lint/docs.
Testing (Property / Proof) ✅ Passed PASS: the PR only adds docs/type annotations and a docs gate; no new invariant or proof obligation is introduced, and existing fast-check tests already cover the key properties.
Unit Architecture ✅ Passed PASS: The PR only adds docs/build gating and type annotations; it does not add query writes, hidden I/O, ambient context, or new mixed-responsibility units.
Observability ✅ Passed PASS: The diff only adds a TypeDoc docs-check gate, config, and docs; it changes build-time workflow, not runtime operational behaviour, so observability additions are not required.
Security And Privacy ✅ Passed PASS: Added docs-only gates and JSDoc; no secrets, credentials, auth changes, or unsafe sinks appear in the added lines.
Performance And Resource Use ✅ Passed PASS: The diff is doc/type-only plus a bounded build-time TypeDoc gate; no new runtime loops, repeated I/O, unbounded collections, or hot-path cloning appears.
Concurrency And State ✅ Passed Treat this patch as non-stateful; it only adds docs/type annotations and gate wiring, with no new shared mutable state, async tasks, or locks.
Architectural Complexity And Maintainability ✅ Passed PASS: The PR adds an explicit TypeDoc validation gate and documentation-only type/interface tweaks, with no new runtime layer or hidden abstraction; the changes simplify maintenance.
Rust Compiler Lint Integrity ✅ Passed PASS: The diff only touches Makefile, docs, package.json, bun.lock and typedoc.json; no Rust files or lint-suppression/clone changes appear.
✨ 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 typedoc-rollout
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch typedoc-rollout

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@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: 11ae114060

ℹ️ 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 Makefile
# Zero-tolerance documentation gate: TypeDoc's notDocumented validation over
# the package entry point (typedoc.json). Runs after typecheck so the
# generated GraphQL types already exist. Emits no documentation artefacts.
docs-check:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make docs-check depend on generated types

When make docs-check is run after make clean, or make -j all allows this target to start before typecheck, src/__generated__/resolvers-types.ts is absent even though the TypeDoc entry-point import graph reaches src/graphql/resolvers.ts, which imports that file. Merely placing docs-check after typecheck in all does not enforce ordering for parallel Make, so the documentation gate can fail before generation finishes; declare typecheck or generate as an actual prerequisite.

Useful? React with 👍 / 👎.

@buzzybee-df12

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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)
src/store/entities/ref.ts (1)

66-83: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep qualifiedName unqualified during normalization.

When both values are supplied, qualifiedName becomes the full ref such as
refs/heads/main. refStoreKey() and the derived node_id then use that prefixed
value, so equivalent branch fixtures can receive different identities. Normalize the
prefix into ref only and retain main/v1.2.3 as qualifiedName.

Proposed normalization
-    const qualifiedName = ref.ref ?? ref.qualifiedName;
-    const fullRef = qualifiedName.startsWith('refs/')
-      ? qualifiedName
-      : `${defaultRefPrefix(ref.object.type)}${qualifiedName}`;
+    const rawRef = ref.ref ?? ref.qualifiedName;
+    const fullRef = rawRef.startsWith('refs/')
+      ? rawRef
+      : `${defaultRefPrefix(ref.object.type)}${rawRef}`;
+    const qualifiedName = fullRef.replace(/^refs\/(?:heads|tags)\//, '');

Add regression tests covering both branch and tag inputs.

🤖 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 `@src/store/entities/ref.ts` around lines 66 - 83, Update the normalization
transform around rawRef, fullRef, and qualifiedName so qualifiedName remains the
unqualified branch or tag name while ref receives the fully prefixed path.
Ensure refStoreKey and derived node_id use the unqualified qualifiedName, and
add regression tests for both branch and tag inputs.
🤖 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/development.md`:
- Around line 36-39: Update the documentation-gate description in
docs/development.md to identify src/index.ts as TypeDoc’s package entry point,
while referring to typedoc.json only as the configuration that selects it.
Preserve the existing notDocumented validation, zero-tolerance warning behavior,
and no-artifact details.
- Around line 33-35: Update the contributor workflow guidance in
docs/development.md so the documented manual gate includes bun run docs:check,
or replace it with make all as the sole contributor gate. Keep the documented
command order and existing workflow description consistent with the new TypeDoc
check.

In `@Makefile`:
- Around line 22-34: The Makefile currently documents a serial order that is not
preserved by parallel Make execution. Add an explicit typecheck prerequisite to
docs-check, encode any required downstream ordering such as lint, and update
docs/development.md to describe the guaranteed dependency rather than relying on
prerequisite-list order; apply the Makefile change at Makefile lines 22-34 and
the documentation clarification at docs/development.md lines 33-35.

In `@src/index.ts`:
- Around line 22-41: The exported TypeScript API lacks compile-time coverage.
Add a type-only test covering GitHubSimulatorArgs.extend.extendRouter in
src/index.ts, plus the exported GitHubBranch alias in
src/store/entities/branch.ts, GitHubCommit in src/store/entities/commit.ts, and
GitHubPullRequest in src/store/entities/pull-request.ts; verify these symbols
can be imported and used with their intended types without runtime tests.

In `@src/store/entities.ts`:
- Around line 56-61: Update the documentation comment for the minimal GitHub
user fixture validator to state that name is derived from login only when
missing, then a missing contact email is derived from the normalized name;
clarify that a caller-provided name is preserved.

In `@src/store/entities/blob.ts`:
- Around line 34-41: Add executable JSDoc examples to both exported key helpers:
in src/store/entities/blob.ts lines 34-41, document blob coordinates and the
resulting canonical key; in src/store/entities/branch.ts lines 50-55, document
branch coordinates and the resulting key. Keep the examples consistent with each
helper’s documented input and output format.

In `@src/store/entities/branch.ts`:
- Line 48: Add a concise JSDoc description immediately above the GitHubBranch
interface declaration, documenting its public API purpose while leaving the
interface and githubBranchSchema unchanged.

In `@src/store/entities/issue.ts`:
- Around line 76-81: The timestamp fields in both schemas accept arbitrary
strings despite documenting ISO 8601 values. Update issue.ts fields created_at,
updated_at, and closed_at, and repository.ts fields pushed_at, updated_at, and
created_at to enforce Zod datetime validation while preserving optional/default
and nullable behavior; add malformed-input tests covering these fields in both
schemas.

In `@src/store/entities/repository.ts`:
- Around line 32-39: Update the documentation comment for the repository fixture
normalization schema to accurately state that REST URL fields are accepted when
provided, rather than claiming omitted fields are filled in. Keep the
descriptions of generated id, node_id, and derived full_name unchanged.
- Around line 220-249: Replace the z.string() validators for the four security
status fields in the repository schema with z.enum(['enabled', 'disabled']) so
only documented values are accepted. Update the schema tests to cover both
allowed statuses and rejection of other strings, preserving the existing
defaults of {status: 'enabled'}.

---

Outside diff comments:
In `@src/store/entities/ref.ts`:
- Around line 66-83: Update the normalization transform around rawRef, fullRef,
and qualifiedName so qualifiedName remains the unqualified branch or tag name
while ref receives the fully prefixed path. Ensure refStoreKey and derived
node_id use the unqualified qualifiedName, and add regression tests for both
branch and tag inputs.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5f87d8ba-055b-4843-94c2-faae450af742

📥 Commits

Reviewing files that changed from the base of the PR and between d65cd49 and 11ae114.

⛔ Files ignored due to path filters (2)
  • bun.lock is excluded by !**/*.lock
  • src/__generated__/resolvers-types.ts is excluded by !**/__generated__/**
📒 Files selected for processing (17)
  • Makefile
  • docs/development.md
  • package.json
  • src/index.ts
  • src/store/builders.ts
  • src/store/entities.ts
  • src/store/entities/blob.ts
  • src/store/entities/branch.ts
  • src/store/entities/commit.ts
  • src/store/entities/installation.ts
  • src/store/entities/issue.ts
  • src/store/entities/organization.ts
  • src/store/entities/pull-request.ts
  • src/store/entities/ref.ts
  • src/store/entities/repository.ts
  • src/store/entities/shared.ts
  • typedoc.json

Comment thread docs/development.md
Comment on lines +33 to +35
`make all` runs `check-fmt`, `typecheck`, `docs-check`, `lint`, `test`, and
`spelling` in the repository's preferred order. The `lint` target runs the
`biomejs` and `oxlint` sub-targets. The `docs-check` target (`bun run

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Include the TypeDoc gate in the normal contributor workflow.

The manual gate immediately above still lists only formatting, linting, typechecking, and
tests. Add bun run docs:check or make make all the sole documented contributor gate
so local guidance does not bypass the new zero-tolerance check.

Triage: [type:docstyle]

🤖 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/development.md` around lines 33 - 35, Update the contributor workflow
guidance in docs/development.md so the documented manual gate includes bun run
docs:check, or replace it with make all as the sole contributor gate. Keep the
documented command order and existing workflow description consistent with the
new TypeDoc check.

Comment thread docs/development.md
Comment on lines +36 to +39
docs:check`) is the zero-tolerance documentation gate: TypeDoc's
`notDocumented` validation over the package entry point (`typedoc.json`),
requiring a JSDoc block on every declaration in the public surface, treating
warnings as errors, and emitting no documentation artefacts. Zod schema

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Name the actual TypeDoc entry point.

typedoc.json is the configuration file; src/index.ts is the package entry point
configured by it. Rewrite this sentence so the documentation does not describe the
configuration file as the entry point.

Triage: [type:docstyle]

🤖 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/development.md` around lines 36 - 39, Update the documentation-gate
description in docs/development.md to identify src/index.ts as TypeDoc’s package
entry point, while referring to typedoc.json only as the configuration that
selects it. Preserve the existing notDocumented validation, zero-tolerance
warning behavior, and no-artifact details.

Comment thread Makefile
Comment on lines +22 to +34
all: check-fmt typecheck docs-check lint test spelling

check-fmt:
bunx @biomejs/biome check --linter-enabled=false --assist-enabled=false .

typecheck:
bun run check:types

# Zero-tolerance documentation gate: TypeDoc's notDocumented validation over
# the package entry point (typedoc.json). Runs after typecheck so the
# generated GraphQL types already exist. Emits no documentation artefacts.
docs-check:
bun run docs:check

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Make the TypeDoc ordering guarantee explicit.

make -j can start docs-check before typecheck completes, so the documented
“after typecheck” order is not guaranteed. Add the prerequisite dependency in
Makefile, and either encode the subsequent lint dependency or document that the
order applies only to serial Make execution.

  • Makefile#L22-L34: add docs-check: typecheck and any required downstream ordering.
  • docs/development.md#L33-L35: describe the guaranteed dependency rather than relying
    on prerequisite-list order.

As per coding guidelines, changes involving ordering or parallelism must make the
execution model explicit.

📍 Affects 2 files
  • Makefile#L22-L34 (this comment)
  • docs/development.md#L33-L35
🤖 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 `@Makefile` around lines 22 - 34, The Makefile currently documents a serial
order that is not preserved by parallel Make execution. Add an explicit
typecheck prerequisite to docs-check, encode any required downstream ordering
such as lint, and update docs/development.md to describe the guaranteed
dependency rather than relying on prerequisite-list order; apply the Makefile
change at Makefile lines 22-34 and the documentation clarification at
docs/development.md lines 33-35.

Source: Coding guidelines

Comment thread src/index.ts
Comment on lines 22 to 41
type FoundationRouter = Parameters<
NonNullable<Parameters<typeof createFoundationSimulationServer>[0]['extendRouter']>
>[0];

/** Configuration options accepted by {@link simulation}. */
export type GitHubSimulatorArgs = {
/** Seed data validated against `githubInitialStoreSchema` before use. */
initialState?: GitHubInitialStore;
/** Base URL the simulated GitHub REST and GraphQL APIs are served from. */
apiUrl?: string;
/** OpenAPI schema file or inline schema used to generate REST handlers. */
apiSchema?: SchemaFile | string;
/** Hooks for extending the simulated store, REST handlers, and router. */
extend?: {
/** Additional store slices merged into the GitHub simulation store. */
extendStore?: GitHubExtendStoreInput;
/** Builds extra OpenAPI-backed handlers from the extended store. */
openapiHandlers?: (simulationStore: ExtendedSimulationStore) => SimulationHandlers;
/** Registers extra routes on the underlying foundation router. */
extendRouter?: (router: FoundationRouter, simulationStore: ExtendedSimulationStore) => void;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== Files ==\n'
git ls-files | rg '(^|/)(test|tests|spec|__tests__|type|types|compile).*|(\.test|\.spec)\.(ts|tsx|js|jsx)$|tsconfig.*\.json$|package\.json$|src/index\.ts$|src/store/entities/(branch|commit|pull-request)\.ts$'

printf '\n== Search for type/compile-time tests ==\n'
rg -n --hidden --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' \
  '\b(expectTypeOf|assertType|tsd|dtslint|//\s*`@ts-expect-error`|type-level|compile-time|satisfies\b|as const\b)' .

printf '\n== Search for references to the affected exported types ==\n'
rg -n --hidden --glob '!**/node_modules/**' --glob '!**/dist/**' \
  'GitHubBranch|GitHubCommit|GitHubPullRequest|GitHubSimulatorArgs|extendRouter|openapiHandlers|extendStore' src test tests __tests__ .

Repository: leynos/simulacat-core

Length of output: 30909


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== package.json ==\n'
cat -n package.json | sed -n '1,220p'

printf '\n== tsconfig files ==\n'
for f in $(git ls-files '*tsconfig*.json'); do
  printf '\n--- %s ---\n' "$f"
  cat -n "$f" | sed -n '1,220p'
done

printf '\n== likely test files ==\n'
git ls-files | rg '(^|/)(test|tests|__tests__)/|(\.test|\.spec)\.(ts|tsx|js|jsx)$|\.test-d\.ts$|\.d\.ts$|\.d\.test\.ts$'

Repository: leynos/simulacat-core

Length of output: 6089


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for f in src/index.ts src/store/entities/branch.ts src/store/entities/commit.ts src/store/entities/pull-request.ts; do
  printf '\n== %s ==\n' "$f"
  cat -n "$f" | sed -n '1,260p'
done

Repository: leynos/simulacat-core

Length of output: 24181


Add a compile-time test for the exported TypeScript API. Cover GitHubSimulatorArgs.extend.extendRouter in src/index.ts and the exported GitHubBranch, GitHubCommit, and GitHubPullRequest aliases with a type-only test file.

📍 Affects 4 files
  • src/index.ts#L22-L41 (this comment)
  • src/store/entities/branch.ts#L48-L48
  • src/store/entities/commit.ts#L137-L138
  • src/store/entities/pull-request.ts#L184-L185
🤖 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 `@src/index.ts` around lines 22 - 41, The exported TypeScript API lacks
compile-time coverage. Add a type-only test covering
GitHubSimulatorArgs.extend.extendRouter in src/index.ts, plus the exported
GitHubBranch alias in src/store/entities/branch.ts, GitHubCommit in
src/store/entities/commit.ts, and GitHubPullRequest in
src/store/entities/pull-request.ts; verify these symbols can be imported and
used with their intended types without runtime tests.

Source: Coding guidelines

Comment thread src/store/entities.ts
Comment on lines +56 to +61
/**
* Validates and normalizes a minimal GitHub user fixture, deriving a display
* name and contact email from `login` when they are omitted.
*
* @internal
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the email fallback description.

State that the schema derives name from login only when missing, then derives a missing email from the normalised name. A caller-provided name is not replaced by login.

- * name and contact email from `login` when they are omitted.
+ * name from `login` when omitted, then derives a missing contact email
+ * from the normalised name.
🤖 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 `@src/store/entities.ts` around lines 56 - 61, Update the documentation comment
for the minimal GitHub user fixture validator to state that name is derived from
login only when missing, then a missing contact email is derived from the
normalized name; clarify that a caller-provided name is preserved.

Comment on lines +34 to +41
/**
* Derives the canonical store key for a Git blob, preferring `path` over
* `sha` when both are present.
*
* @param blob Blob coordinate parts containing owner, repo, path, and sha.
* @returns The canonical key in `owner/repo:reference` format.
* @throws Error when neither `path` nor `sha` is provided.
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add examples to both exported key helpers.

The new JSDoc describes output formats but omits executable usage examples.

  • src/store/entities/blob.ts#L34-L41: add an @example showing blob coordinates and the returned key.
  • src/store/entities/branch.ts#L50-L55: add an @example showing branch coordinates and the returned key.

As per coding guidelines, function documentation should include clear examples showing usage and outcome.

📍 Affects 2 files
  • src/store/entities/blob.ts#L34-L41 (this comment)
  • src/store/entities/branch.ts#L50-L55
🤖 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 `@src/store/entities/blob.ts` around lines 34 - 41, Add executable JSDoc
examples to both exported key helpers: in src/store/entities/blob.ts lines
34-41, document blob coordinates and the resulting canonical key; in
src/store/entities/branch.ts lines 50-55, document branch coordinates and the
resulting key. Keep the examples consistent with each helper’s documented input
and output format.

Source: Coding guidelines

});

export type GitHubBranch = z.infer<typeof githubBranchSchema>;
export interface GitHubBranch extends z.infer<typeof githubBranchSchema> {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== File map ==\n'
git ls-files src/store/entities/branch.ts src/store/entities | sed 's#^`#-` #'

printf '\n== Outline ==\n'
ast-grep outline src/store/entities/branch.ts --view expanded || true

printf '\n== Relevant references ==\n'
rg -n --hidden --glob '!**/node_modules/**' --glob '!**/dist/**' \
  'GitHubBranch|buildBranchFixture|githubBranchSchema|`@internal`|TypeDoc|typedoc|documentation' \
  src package.json .github docs . 2>/dev/null | sed -n '1,220p'

printf '\n== Target file ==\n'
wc -l src/store/entities/branch.ts
cat -n src/store/entities/branch.ts | sed -n '1,220p'

printf '\n== buildBranchFixture definition/usages ==\n'
rg -n --hidden --glob '!**/node_modules/**' --glob '!**/dist/**' \
  'function buildBranchFixture|const buildBranchFixture|buildBranchFixture\s*[:=]|export .*buildBranchFixture|buildBranchFixture\(' \
  src test tests . 2>/dev/null | sed -n '1,240p'

Repository: leynos/simulacat-core

Length of output: 27902


Document GitHubBranch with JSDoc. Add a short description above src/store/entities/branch.ts:48; the interface is part of the public API surface, so the TypeDoc notDocumented gate will flag it even though githubBranchSchema is @internal.

🤖 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 `@src/store/entities/branch.ts` at line 48, Add a concise JSDoc description
immediately above the GitHubBranch interface declaration, documenting its public
API purpose while leaving the interface and githubBranchSchema unchanged.

Comment on lines +76 to 81
/** ISO 8601 timestamp recording when the issue was created. */
created_at: z.string().optional().default(defaultTimestamp),
/** ISO 8601 timestamp recording when the issue was last updated. */
updated_at: z.string().optional().default(defaultTimestamp),
/** ISO 8601 timestamp recording when the issue was closed, or `null` while open. */
closed_at: z.string().nullable().optional(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Align the timestamp contracts across both schemas.

The new public documentation promises ISO 8601 timestamps, while both schemas accept
arbitrary strings. Enforce .datetime() and add malformed-input tests, or weaken both
descriptions to match the actual validators.

  • src/store/entities/issue.ts#L76-L81: align created_at, updated_at, and closed_at.
  • src/store/entities/repository.ts#L57-L71: align pushed_at, updated_at, and created_at.

As per coding guidelines, validate I/O boundaries, including persisted data, with Zod.

📍 Affects 2 files
  • src/store/entities/issue.ts#L76-L81 (this comment)
  • src/store/entities/repository.ts#L57-L71
🤖 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 `@src/store/entities/issue.ts` around lines 76 - 81, The timestamp fields in
both schemas accept arbitrary strings despite documenting ISO 8601 values.
Update issue.ts fields created_at, updated_at, and closed_at, and repository.ts
fields pushed_at, updated_at, and created_at to enforce Zod datetime validation
while preserving optional/default and nullable behavior; add malformed-input
tests covering these fields in both schemas.

Source: Coding guidelines

Comment on lines +32 to +39
/**
* Validates and normalizes a minimal GitHub repository fixture, filling in
* the wide set of GitHub REST URLs, counters, and security settings that
* callers omit. During transformation, `id` and `node_id` are generated when
* absent, and `full_name` is derived from `owner`/`name`.
*
* @internal
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Describe the repository defaults accurately.

The schema description says omitted REST URL fields are filled in, but those fields are
only optional() and remain absent when omitted. Change the wording to say that the
schema accepts URL fields, or add actual defaults.

🤖 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 `@src/store/entities/repository.ts` around lines 32 - 39, Update the
documentation comment for the repository fixture normalization schema to
accurately state that REST URL fields are accepted when provided, rather than
claiming omitted fields are filled in. Keep the descriptions of generated id,
node_id, and derived full_name unchanged.

Comment on lines +220 to +249
/** Advanced Security enablement state for the repository. */
advanced_security: z
.object({
/** Whether Advanced Security is `enabled` or `disabled`. */
status: z.string()
})
.optional()
.default({status: 'enabled'}),
/** Secret scanning enablement state for the repository. */
secret_scanning: z
.object({
/** Whether secret scanning is `enabled` or `disabled`. */
status: z.string()
})
.optional()
.default({status: 'enabled'}),
/** Secret scanning push protection enablement state for the repository. */
secret_scanning_push_protection: z
.object({
/** Whether secret scanning push protection is `enabled` or `disabled`. */
status: z.string()
})
.optional()
.default({status: 'enabled'}),
/** Secret scanning non-provider pattern detection enablement state for the repository. */
secret_scanning_non_provider_patterns: z
.object({
/** Whether non-provider pattern secret scanning is `enabled` or `disabled`. */
status: z.string()
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Enforce the documented security-status values.

The four status fields are documented as enabled or disabled, but each uses
z.string(). Use z.enum(['enabled', 'disabled']), or document these as free-form
strings and test the accepted contract.

As per coding guidelines, validate I/O boundaries with Zod and add tests for behavioural
invariants.

🤖 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 `@src/store/entities/repository.ts` around lines 220 - 249, Replace the
z.string() validators for the four security status fields in the repository
schema with z.enum(['enabled', 'disabled']) so only documented values are
accepted. Update the schema tests to cover both allowed statuses and rejection
of other strings, preserving the existing defaults of {status: 'enabled'}.

Source: Coding guidelines

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

Caution

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

⚠️ Outside diff range comments (1)
docs/development.md (1)

26-31: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Include the TypeDoc gate in the normal contributor gate.

The listed manual gate still runs only formatting, linting, typechecking, and tests. Add bun run docs:check after typechecking, or make make all the sole documented contributor gate.

Triage: [type:docstyle]

🤖 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/development.md` around lines 26 - 31, Update the “normal contributor
gate” in the development documentation to include the TypeDoc validation command
`bun run docs:check` immediately after `bun check:types`, while preserving the
existing formatting, linting, typechecking, and test steps.
♻️ Duplicate comments (5)
docs/development.md (1)

35-38: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Name src/index.ts as the package entry point.

typedoc.json configures TypeDoc; it is not the package entry point. Rewrite the sentence to identify src/index.ts as the entry point and retain typedoc.json as its configuration.

Triage: [type:docstyle]

🤖 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/development.md` around lines 35 - 38, Update the documentation gate
description to identify src/index.ts as the package entry point, while retaining
typedoc.json solely as the TypeDoc configuration reference. Preserve the
existing explanation of notDocumented validation and public-surface JSDoc
requirements.
src/store/entities/issue.ts (1)

76-81: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Enforce the documented timestamp contract across both schemas.

The fields are documented as ISO 8601 timestamps, but arbitrary strings still pass validation. Apply .datetime() while preserving each field’s existing optional, default, and nullable semantics, then add malformed-input tests.

  • src/store/entities/issue.ts#L76-L81: validate created_at, updated_at, and closed_at.
  • src/store/entities/repository.ts#L57-L71: validate pushed_at, updated_at, and created_at.

As per coding guidelines, validate I/O boundaries with Zod.

🤖 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 `@src/store/entities/issue.ts` around lines 76 - 81, Apply Zod .datetime()
validation to created_at, updated_at, and closed_at in
src/store/entities/issue.ts:76-81, preserving their current optional, default,
and nullable behavior. Apply the same validation to pushed_at, updated_at, and
created_at in src/store/entities/repository.ts:57-71, then add tests confirming
malformed timestamps are rejected at both schema boundaries.

Source: Coding guidelines

src/store/entities/repository.ts (2)

220-249: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Enforce the documented security-status values.

Replace all four status: z.string() validators with z.enum(['enabled', 'disabled']), preserve the existing defaults, and add acceptance/rejection tests.

As per coding guidelines, validate I/O boundaries with Zod.

🤖 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 `@src/store/entities/repository.ts` around lines 220 - 249, In the repository
schema, update the status validators for advanced_security, secret_scanning,
secret_scanning_push_protection, and secret_scanning_non_provider_patterns from
unrestricted strings to z.enum(['enabled', 'disabled']). Preserve each existing
enabled default and add tests confirming both values are accepted and any other
status is rejected at the Zod I/O boundary.

Source: Coding guidelines


32-39: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Stop claiming that omitted URLs are filled.

Only counters and security settings receive defaults; the URL fields remain optional and absent when omitted. Rewrite this description to state that caller-supplied URLs are accepted, or implement actual URL defaults.

🤖 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 `@src/store/entities/repository.ts` around lines 32 - 39, Update the
documentation for the repository fixture normalizer near its exported function
or class to remove the claim that omitted GitHub REST URLs are populated. State
that caller-supplied URL fields are preserved or accepted as optional, while
retaining the documented defaults for counters and security settings.
Makefile (1)

22-34: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Encode the TypeDoc execution dependency.

The documented order is not guaranteed under make -j. Make docs-check depend on typecheck, and make downstream lint ordering explicit if TypeDoc must complete before lint. Update the documentation to describe the guaranteed dependency rather than prerequisite-list order.

  • Makefile#L22-L34: add the required Make dependency chain.
  • docs/development.md#L33-L35: document the enforced dependency, not merely the preferred order.

As per coding guidelines, changes involving ordering or parallelism must make the execution model explicit.

🤖 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 `@Makefile` around lines 22 - 34, Make the Makefile dependency graph explicit:
update docs-check to depend on typecheck, and add any required dependency
ensuring lint runs only after docs-check completes. In docs/development.md,
describe this enforced dependency chain rather than relying on prerequisite-list
order. Apply the Makefile change at Makefile lines 22-34 and update the
corresponding documentation at docs/development.md lines 33-35.

Source: Coding guidelines

🤖 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 `@src/store/entities.ts`:
- Around line 93-101: Update the full seeded store description in the
documentation above the validation/normalization implementation to include
issues alongside commits and pull requests, accurately reflecting the schemas
parsed by the full-store flow.

In `@src/store/entities/issue.ts`:
- Around line 56-61: The fallback issue ID generation using
ENTITY_ID_OFFSETS.ISSUE plus issue.number is not instance-wide unique across
repositories. Replace it with a repository-aware or global allocator, or require
callers to supply unique IDs, while preserving the documented uniqueness
contract for id. Add a regression test covering identical issue numbers in
different repositories.

In `@src/store/entities/pull-request.ts`:
- Around line 173-176: Update the JSDoc comments for the base and head fields in
the pull request entity mapping to state that missing owner and repo values
default to the owning repository, rather than claiming normalization to it.
Leave the normalizePullRequestRef calls unchanged.
- Around line 115-116: Update the documentation for the pull-request `id` field
in the entity schema to describe the current deterministic fallback as the
configured pull-request offset plus `number`; do not claim uniqueness across
repositories unless store-wide allocation and duplicate validation are
implemented.

In `@src/store/entities/ref.ts`:
- Around line 60-61: The sha schema in the ref entity must enforce the
documented SHA-1 format rather than accepting arbitrary non-empty strings.
Update the Zod validation for sha to require exactly 40 hexadecimal characters,
and add fixture tests covering valid and invalid hashes at the I/O boundary.

In `@src/store/entities/repository.ts`:
- Around line 52-53: Update the full_name field documentation and normalization
contract in the repository entity schema to accurately reflect that the
transform always derives it from owner and name, or change the transform to
preserve a caller-supplied value. Ensure tests cover the selected behavior and
reference the full_name normalization logic.

---

Outside diff comments:
In `@docs/development.md`:
- Around line 26-31: Update the “normal contributor gate” in the development
documentation to include the TypeDoc validation command `bun run docs:check`
immediately after `bun check:types`, while preserving the existing formatting,
linting, typechecking, and test steps.

---

Duplicate comments:
In `@docs/development.md`:
- Around line 35-38: Update the documentation gate description to identify
src/index.ts as the package entry point, while retaining typedoc.json solely as
the TypeDoc configuration reference. Preserve the existing explanation of
notDocumented validation and public-surface JSDoc requirements.

In `@Makefile`:
- Around line 22-34: Make the Makefile dependency graph explicit: update
docs-check to depend on typecheck, and add any required dependency ensuring lint
runs only after docs-check completes. In docs/development.md, describe this
enforced dependency chain rather than relying on prerequisite-list order. Apply
the Makefile change at Makefile lines 22-34 and update the corresponding
documentation at docs/development.md lines 33-35.

In `@src/store/entities/issue.ts`:
- Around line 76-81: Apply Zod .datetime() validation to created_at, updated_at,
and closed_at in src/store/entities/issue.ts:76-81, preserving their current
optional, default, and nullable behavior. Apply the same validation to
pushed_at, updated_at, and created_at in src/store/entities/repository.ts:57-71,
then add tests confirming malformed timestamps are rejected at both schema
boundaries.

In `@src/store/entities/repository.ts`:
- Around line 220-249: In the repository schema, update the status validators
for advanced_security, secret_scanning, secret_scanning_push_protection, and
secret_scanning_non_provider_patterns from unrestricted strings to
z.enum(['enabled', 'disabled']). Preserve each existing enabled default and add
tests confirming both values are accepted and any other status is rejected at
the Zod I/O boundary.
- Around line 32-39: Update the documentation for the repository fixture
normalizer near its exported function or class to remove the claim that omitted
GitHub REST URLs are populated. State that caller-supplied URL fields are
preserved or accepted as optional, while retaining the documented defaults for
counters and security settings.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5f87d8ba-055b-4843-94c2-faae450af742

📥 Commits

Reviewing files that changed from the base of the PR and between d65cd49 and 11ae114.

⛔ Files ignored due to path filters (2)
  • bun.lock is excluded by !**/*.lock
  • src/__generated__/resolvers-types.ts is excluded by !**/__generated__/**
📒 Files selected for processing (17)
  • Makefile
  • docs/development.md
  • package.json
  • src/index.ts
  • src/store/builders.ts
  • src/store/entities.ts
  • src/store/entities/blob.ts
  • src/store/entities/branch.ts
  • src/store/entities/commit.ts
  • src/store/entities/installation.ts
  • src/store/entities/issue.ts
  • src/store/entities/organization.ts
  • src/store/entities/pull-request.ts
  • src/store/entities/ref.ts
  • src/store/entities/repository.ts
  • src/store/entities/shared.ts
  • typedoc.json

Comment thread src/store/entities.ts
Comment on lines +93 to +101
/**
* Validates and normalizes the full seeded initial store: users,
* installations, organizations, repositories, branches, blobs, refs,
* commits, and pull requests. During transformation, installations without
* an `id` are allocated one, and any organization lacking a matching
* installation account is granted a generated installation.
*
* @internal
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

List issues in the full-store description.

The schema also parses issues, so the documentation is incomplete while calling this the “full” seeded store.

- * installations, organizations, repositories, branches, blobs, refs,
- * commits, and pull requests.
+ * installations, organizations, repositories, branches, blobs, refs,
+ * commits, issues, and pull requests.
🤖 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 `@src/store/entities.ts` around lines 93 - 101, Update the full seeded store
description in the documentation above the validation/normalization
implementation to include issues alongside commits and pull requests, accurately
reflecting the schemas parsed by the full-store flow.

Comment on lines +56 to 61
/** Unique numeric identifier for the issue across the whole simulated instance. */
id: z.number().optional(),
/** The GraphQL global node identifier for the issue. */
node_id: z.string().optional(),
/** Issue number, unique within the owning repository. */
number: z.number().int().positive(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Make generated issue IDs unique across repositories.

The fallback ENTITY_ID_OFFSETS.ISSUE + issue.number collides for issue #1 in multiple repositories, although the documentation promises instance-wide uniqueness. Allocate IDs from a repository-aware/global allocator, or require callers to provide unique IDs, and add a regression test.

Also applies to: 94-95

🤖 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 `@src/store/entities/issue.ts` around lines 56 - 61, The fallback issue ID
generation using ENTITY_ID_OFFSETS.ISSUE plus issue.number is not instance-wide
unique across repositories. Replace it with a repository-aware or global
allocator, or require callers to supply unique IDs, while preserving the
documented uniqueness contract for id. Add a regression test covering identical
issue numbers in different repositories.

Comment on lines +115 to 116
/** Unique numeric identifier for the pull request across the whole simulated instance. */
id: z.number().optional(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not claim global pull-request ID uniqueness without enforcing it.

The fallback uses only number plus a constant, so pull request number 1 can produce the same id in multiple repositories. Either implement store-wide allocation and duplicate validation, or describe the current deterministic fallback accurately.

-/** Unique numeric identifier for the pull request across the whole simulated instance. */
+/** Numeric identifier, defaulting to the configured pull-request offset plus `number`. */

Also applies to: 165-166

🤖 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 `@src/store/entities/pull-request.ts` around lines 115 - 116, Update the
documentation for the pull-request `id` field in the entity schema to describe
the current deterministic fallback as the configured pull-request offset plus
`number`; do not claim uniqueness across repositories unless store-wide
allocation and duplicate validation are implemented.

Comment on lines +173 to 176
/** Base (target) branch reference, normalized to the owning repository. */
base: normalizePullRequestRef(pullRequest.base, pullRequest.owner, pullRequest.repo),
/** Head (source) branch reference, normalized to the owning repository. */
head: normalizePullRequestRef(pullRequest.head, pullRequest.owner, pullRequest.repo),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Describe reference normalization accurately.

normalizePullRequestRef preserves supplied owner and repo values; it only defaults missing values to the pull request repository. Replace the current wording accordingly.

-/** Base (target) branch reference, normalized to the owning repository. */
+/** Base (target) branch reference; missing owner and repo default to the owning repository. */
-/** Head (source) branch reference, normalized to the owning repository. */
+/** Head (source) branch reference; missing owner and repo default to the owning repository. */
🤖 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 `@src/store/entities/pull-request.ts` around lines 173 - 176, Update the JSDoc
comments for the base and head fields in the pull request entity mapping to
state that missing owner and repo values default to the owning repository,
rather than claiming normalization to it. Leave the normalizePullRequestRef
calls unchanged.

Comment thread src/store/entities/ref.ts
Comment on lines +60 to 61
/** SHA-1 hash of the object the ref points to. */
sha: z.string().trim().min(1),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Enforce the documented object-hash contract.

z.string().trim().min(1) accepts arbitrary values despite documenting sha as a SHA-1 hash. Enforce the intended hash format with Zod, or describe the field as an opaque identifier, and add valid/invalid fixture tests.

As per coding guidelines, validate I/O boundaries with Zod.

🤖 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 `@src/store/entities/ref.ts` around lines 60 - 61, The sha schema in the ref
entity must enforce the documented SHA-1 format rather than accepting arbitrary
non-empty strings. Update the Zod validation for sha to require exactly 40
hexadecimal characters, and add fixture tests covering valid and invalid hashes
at the I/O boundary.

Source: Coding guidelines

Comment on lines +52 to 53
/** Fully qualified `owner/name` identifier, derived automatically if omitted. */
full_name: z.string().optional().default(''),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Describe full_name normalisation accurately.

The transform always replaces repo.full_name with ${repo.owner}/${repo.name}, even when input supplies another value. State that the field is always derived, or preserve the caller-supplied value and test the chosen contract.

🤖 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 `@src/store/entities/repository.ts` around lines 52 - 53, Update the full_name
field documentation and normalization contract in the repository entity schema
to accurately reflect that the transform always derives it from owner and name,
or change the transform to preserve a caller-supplied value. Ensure tests cover
the selected behavior and reference the full_name normalization logic.

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