codex/askr-cli-database - #33
Conversation
There was a problem hiding this comment.
🟡 Not ready to approve
There are confirmed correctness/portability issues in the updated solver memoization signature, OpenAPI path boundary check, and test/fixture path handling that should be fixed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR updates the Askr CLI by introducing a new askr database command that delegates to project-installed @askrjs/orm tooling and wires database validation into askr check when a project has database/index.ts, while removing the verify-hydration command (and its Playwright dependency) and simplifying parts of the analyzer and benchmark suite.
Changes:
- Added
askr databasecommand plumbing (src/bin/database.ts, CLI dispatch/help/docs) and integrated database validation into guardrailscheck. - Removed hydration verification command/tests/docs and dropped
playwright-corefrom dependencies and bundling config. - Simplified analyzer rules and benchmark coverage, and updated shipped templates to avoid analyzer/perf pitfalls (switching some
<For>usages to.map()where appropriate).
File summaries
| File | Description |
|---|---|
| vite.config.ts | Adds new database bin entry and updates bundling exclusions. |
| tests/verify-hydration.test.ts | Removes hydration verification test suite. |
| tests/update.range.test.ts | Adjusts test timeout usage. |
| tests/update.cli.test.ts | Updates CLI expectations after removing verify-hydration and Playwright. |
| tests/guardrails.test.ts | Adds database validation ordering assertion and updates template path handling. |
| tests/generate.test.ts | Updates OpenAPI boundary/pivot tests. |
| tests/database.test.ts | Adds tests for new database command delegation and validation capture. |
| tests/analyze.rules.test.ts | Updates analyzer rule tests to match simplified rule behavior. |
| tests/analyze.cli.test.ts | Removes generated-output exclusion test. |
| tests/analyze.benchmark-contract.test.ts | Removes benchmark coverage contract test. |
| templates/startkit/src/pages/workspace/dashboard.tsx | Switches a stat list render from <For> to .map(). |
| templates/startkit/src/components/data-table.tsx | Reworks loading/error/empty rendering and reduces control primitives usage. |
| templates/startkit/src/components/app-sidebar.tsx | Switches nav rendering from <For> to .map(). |
| templates/ssg/src/pages/home.tsx | Switches highlight rendering from <For> to .map(). |
| templates/ssg/src/pages/content.tsx | Switches route card rendering from <For> to .map(). |
| templates/ssg/src/pages/about.tsx | Switches workflow step rendering from <For> to .map(). |
| templates/ssg/src/components/site-shell.tsx | Switches header nav rendering from <For> to .map(). |
| templates/spa/src/pages/public/home.tsx | Switches capability rendering from <For> to .map(). |
| templates/spa/src/pages/app/agent-runs.tsx | Removes per-run id and switches rendering from <For> to .map(). |
| templates/spa/src/pages/app/admin-home.tsx | Refactors conditional UI away from <Show>/<For> into explicit branches and .map(). |
| templates/spa/src/pages/app/_layout.tsx | Switches nav rendering from <For> to .map(). |
| src/update/planner.ts | Changes memoization signature for workspace solver states. |
| src/guardrails/runner.ts | Adds optional database validation hook and runs database validation before scripts when present. |
| src/generate/generator.ts | Changes local OpenAPI reference boundary checking logic. |
| src/bin/verify-hydration.ts | Removes the CLI hydration verifier implementation. |
| src/bin/database.ts | Adds database command delegation to project-installed @askrjs/orm/tooling. |
| src/bin/cli.ts | Registers database command and removes verify-hydration dispatch/help lines. |
| src/analyze/rules.ts | Removes transitive call-graph logic and render-side-effect rule; tightens prefer-for detection to reactive collections. |
| src/analyze/project.ts | Adjusts default analyzer excludes (stops excluding .askr/**). |
| src/analyze/call-graph.ts | Removes call-graph implementation. |
| skills/askr-ssr-ssg/SKILL.md | Updates route registration guidance snippet. |
| README.md | Documents new database command and removes hydration verification documentation. |
| package.json | Removes playwright-core, removes analyze script from check, and drops local analyze excludes config. |
| package-lock.json | Removes playwright-core and updates lockfile entries accordingly. |
| docs/workflows.md | Documents database workflow and validation in askr check. |
| docs/verify-hydration.md | Removes hydration verification reference doc. |
| docs/README.md | Adds database docs entry and removes hydration docs entry. |
| docs/overview.md | Adds database commands to quick overview and removes hydration verifier mention. |
| docs/database.md | Adds new database command reference page. |
| docs/analyze.md | Updates analyzer rule descriptions/bench coverage narrative. |
| benchmarks/cli.mjs | Removes verify-hydration from CLI dispatch benchmarks and tightens analyze budget. |
| benchmarks/analyze.bench.ts | Removes several analyzer benchmark fixtures/sweeps and simplifies workloads. |
| benchmarks/analyze-workloads.ts | Removes workload classification utilities. |
| benchmarks/analyze-budget-reporter.ts | Simplifies budget enforcement (drops stale-budget detection and several budgets). |
| .github/workflows/ci.yml | Updates conditional browser install logic after hydration removal. |
Review details
Comments suppressed due to low confidence (2)
src/generate/generator.ts:460
- The OpenAPI local-root escape check uses a hard-coded "/" path separator (startsWith(
${options.localRootDirectory}/)), which breaks on Windows because real paths use backslashes; this will incorrectly reject valid in-root refs (and makes the boundary check platform-dependent). Use a path-relative check instead (e.g., path.relative + !startsWith('..') + !isAbsolute).
async function readSource(uri: string, options: ResolvedLoadOptions): Promise<SourceDocument> {
if (uri.startsWith("http://") || uri.startsWith("https://")) return fetchSource(uri, options);
const path = fileURLToPath(uri);
const canonical = await realpath(path);
if (
!options.localRootDirectory ||
(canonical !== options.localRootDirectory &&
!canonical.startsWith(`${options.localRootDirectory}/`))
)
throw new GenerationError(
`Local OpenAPI reference escapes the specification directory: ${path}`,
);
skills/askr-ssr-ssg/SKILL.md:41
- The example snippet now calls
registerRoutes(...)without showing where it comes from. Since this section is meant to be copy/pasted, include the import so the snippet is self-contained.
```ts
registerRoutes(() => {
page("/docs/{slug}", DocsPage, {
entries: async () => [{ slug: "getting-started" }, { slug: "routing" }],
});
});
- Files reviewed: 41/45 changed files
- Comments generated: 4
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Automated branch merge for local outstanding work.