Skip to content

chore(codex): bootstrap tests and docs defaults#25

Closed
saagar210 wants to merge 4 commits intomasterfrom
codex/bootstrap-tests-docs-v1
Closed

chore(codex): bootstrap tests and docs defaults#25
saagar210 wants to merge 4 commits intomasterfrom
codex/bootstrap-tests-docs-v1

Conversation

@saagar210
Copy link
Owner

What

  • Bootstrap repository with global tests/docs enforcement defaults.
  • Add verification command contract and quality gate workflow.

Why

  • Ensure every new repository starts with mandatory tests + living docs policy.

Testing

  • bootstrap script created files and marker contract
  • repository gate commands must be run after dependency install

Risk / Notes

  • Update to exact repo commands if scaffold defaults differ.

- Add a lean dev entrypoint that uses temporary cache paths and cleans up on exit
- Add targeted and full cleanup scripts for reproducible local artifacts
- Make Vite/Tauri dev port and Vite cache path configurable for safe local overrides
- Document normal vs lean dev flow and cleanup tradeoffs in README

Tests: npm run lint && npm run build
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @saagar210, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes foundational quality and developer experience standards for new repositories. It introduces automated enforcement for comprehensive testing and up-to-date documentation, ensuring that all code changes meet predefined criteria. Additionally, it enhances the development workflow by providing options for disk-space-efficient development and robust cleanup utilities, aiming to streamline local development and maintain a clean project environment.

Highlights

  • Global Tests and Docs Enforcement: Bootstrapped the repository with global policies to enforce mandatory tests and living documentation. This includes a new QA test critic prompt, a 'Definition of Done' document, and a CI script to verify adherence to these policies for production code, API changes, and architectural changes.
  • Verification Command Contract and Quality Gate Workflow: Introduced a mechanism to define and run verification commands, such as linting, type-checking, and various test suites (coverage, integration, E2E smoke), via a new shell script and a .codex/verify.commands file. This sets up a quality gate for the repository.
  • Lean Development Mode and Cleanup Commands: Added a 'lean' development mode that uses temporary directories for heavy build caches (Rust cargo target and Vite cache) to reduce persistent disk space usage. Complementary cleanup scripts (clean:heavy, clean:full) were also introduced to manage build artifacts and node_modules.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .codex/bootstrap/tests-docs.v1.json
    • Added a new bootstrap contract file for tests and documentation enforcement.
  • .codex/prompts/test-critic.md
    • Added a markdown file outlining review criteria for QA test critics.
  • .codex/scripts/run_verify_commands.sh
    • Added a shell script to execute verification commands listed in a specified file.
  • .codex/verify.commands
    • Added a file listing standard verification commands for linting, type-checking, testing, and documentation checks.
  • AGENTS.md
    • Added a 'Definition of Done' document detailing requirements for tests and documentation in pull requests.
  • README.md
    • Updated documentation with new sections explaining 'Normal Dev vs Lean Dev' and 'Cleanup Commands'.
  • docs/adr/0000-template.md
    • Added a template for Architecture Decision Records (ADRs).
  • openapi/openapi.generated.json
    • Added an initial OpenAPI contract file.
  • package.json
    • Added new npm scripts: dev:lean for lean development, clean:heavy for targeted cleanup, and clean:full for comprehensive cleanup.
  • scripts/ci/require-tests-and-docs.mjs
    • Added a Node.js script to enforce policies requiring test updates for production code changes, documentation updates for API changes, and ADRs for architectural changes.
  • scripts/cleanup-full.sh
    • Added a shell script to remove all heavy build artifacts and node_modules for a full cleanup.
  • scripts/cleanup-heavy.sh
    • Added a shell script to remove heavy build artifacts like dist, src-tauri/target, and node_modules/.vite.
  • scripts/lean-dev.sh
    • Added a shell script to run the development server in a 'lean' mode, utilizing temporary directories for build caches.
  • src-tauri/tauri.conf.json
    • Modified the beforeDevCommand to dynamically set the port for the Tauri development server.
  • vite.config.ts
    • Updated Vite configuration to support dynamic port assignment and configurable cache directory for development.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/quality-gates.yml
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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

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

version: 9

- name: Install dependencies
run: pnpm install --frozen-lockfile

Choose a reason for hiding this comment

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

P1 Badge Replace frozen pnpm install with lockfile-compatible install

The new workflow will fail on every run at dependency installation because it executes pnpm install --frozen-lockfile in a repo that ships package-lock.json and no pnpm-lock.yaml; pnpm errors with ERR_PNPM_NO_LOCKFILE (Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent). This blocks all subsequent quality gates from running.

Useful? React with 👍 / 👎.

@@ -0,0 +1,7 @@
pnpm lint
pnpm typecheck

Choose a reason for hiding this comment

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

P1 Badge Align verify command contract with defined npm scripts

The verify command list references scripts that are not defined in package.json (typecheck, test:coverage, test:integration, test:e2e:smoke, docs:generate, docs:check), so the run_verify_commands.sh step aborts immediately with ERR_PNPM_NO_SCRIPT (for example, Missing script: typecheck). As written, the quality workflow cannot pass even after dependencies install.

Useful? React with 👍 / 👎.

.map((line) => line.trim())
.filter(Boolean);

const isProdCode = (file) => /^(src|app|server|api)\//.test(file) && !/\.(test|spec)\.[cm]?[jt]sx?$/.test(file);

Choose a reason for hiding this comment

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

P2 Badge Include Tauri backend paths in production-change policy checks

The production-code detector only matches src|app|server|api, so changes under src-tauri/ are never treated as production changes and can merge without any test updates despite the repository policy requiring tests for production changes. This creates a policy enforcement gap for backend Rust code in this project.

Useful? React with 👍 / 👎.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request bootstraps the repository with default configurations for enforcing tests and documentation, introducing several scripts for lean development and cleanup, and CI checks. A critical issue identified is a high-severity command injection vulnerability in scripts/ci/require-tests-and-docs.mjs due to the unsafe use of execSync with an unsanitized environment variable. Please address this vulnerability. Furthermore, the .github/workflows/quality-gates.yml workflow file, which is central to the new quality gate process, is missing and needs to be included to complete the implementation. Also, ensure to review the comment regarding a hardcoded user path in a configuration file.

})();

const baseRef = process.env.GITHUB_BASE_REF ? `origin/${process.env.GITHUB_BASE_REF}` : defaultBaseRef;
const diff = execSync(`git diff --name-only ${baseRef}...HEAD`, { encoding: 'utf8' })
Copy link
Contributor

Choose a reason for hiding this comment

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

security-high high

The script uses execSync with a template string that incorporates the baseRef variable, which is derived from the GITHUB_BASE_REF environment variable. GITHUB_BASE_REF is the name of the base branch in a pull request. If an attacker can influence the name of a branch in the repository (e.g., by creating a branch with a malicious name like main; touch /tmp/pwned), they could execute arbitrary commands on the CI runner when this script is executed. This could lead to the exfiltration of sensitive environment variables or secrets stored in the CI environment.

Suggested change
const diff = execSync(`git diff --name-only ${baseRef}...HEAD`, { encoding: 'utf8' })
const diff = execSync(`git diff --name-only ${baseRef.replace(/[^\w./-]/g, '')}...HEAD`, { encoding: 'utf8' })

Comment on lines +5 to +6
"generated_at": "2026-02-17T05:38:27.096Z",
"generated_by": "/Users/d/.codex/scripts/bootstrap/global_tests_docs_bootstrap.mjs",
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The generated_at field contains a future timestamp, and generated_by contains a hardcoded absolute path to a user's local machine. This exposes private user information and makes the configuration brittle. These fields should be removed or replaced with generic, non-user-specific placeholders if they are needed for auditing.

Suggested change
"generated_at": "2026-02-17T05:38:27.096Z",
"generated_by": "/Users/d/.codex/scripts/bootstrap/global_tests_docs_bootstrap.mjs",
"generated_at": "",
"generated_by": "",

@saagar210 saagar210 closed this Feb 17, 2026
@saagar210 saagar210 deleted the codex/bootstrap-tests-docs-v1 branch February 17, 2026 06:09
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.

1 participant