Repository navigation
feat(qir): SQL lowering (MVP) with deterministic output and COALESCE for lists - #42
Conversation
…r run only unit+snapshots in CI\n- core: fix snapshot tests (SQL generator return type, foreign key directive, unique snapshot names)\n- core: make MockDatabase matching more flexible for advisory lock tests\n- core: port vitest-based FK AST test to node:test\n- workflows: run Claude JSDoc workflow on pull_request, gate on secret to avoid push error
…ve-registry unit test
…by dedicated CLI workflow)
…s, @wesley/generator-js)
…o test()/it() in files)
… avoid node:test IPC flake on Node 20
…and test runner behavior\n\n- restore test scripts to vitest or original bats runner in non-core packages\n- remove CI-only filtering from core test runner (selection lives in workflows)\n- keep minimal CI prerequisites (bats + submodules) since main CI runs bats steps\n- keep earlier core test fixes and CLI quick path tweak intact
…ords ROLLBACK (fixes integration failure)
…apshot tests accordingly
…dentifiers; orchestrator sets artifacts.sql to string
…y for broad test compatibility
…fix integration and snapshot tests; update snapshots; make DEFAULT test run unit+integration+snapshots (property tests remain in test:property)\n- cli: skip Bats when plugins are missing; use host-node CLI in CI\n- tasks/slaps/generator-js/scaffold: switch vitest to non-watch and skip when no tests present\n- generator-supabase: run tests with node --test (uses node:test)\n- ci: point CLI model/validate steps to host-node entrypoint\n\nAlso tightened RLS preset plumbing and default handling in SchemaBuilder; fixed default value emission and foreign key alias handling; added safety/lock helpers for property tests (left opt-in).
…ops <dir> option to generate\n- Validates presence of ops directory and common filenames\n- Logs informational message; no generation yet
…der=ops, target=function, RLS reliance=prefer\n- Guardrails: nestedList.requireLimit/requireOrderBy booleans\n- Validates target and rlsReliance
feat(ops): QIR scaffold + --ops flag (doc-only behavior)
docs(rfc): QIR ops→SQL — incorporate maintainer feedback
… (rebased onto feature branch)
…y before uploading artifact; align schema apply path
…; align artifact paths across jobs
…cit fallback generation when artifact missing
…ing back to relative CLI import
…eneration (fix pino missing)
…for lists + unit tests
|
Caution Review failedThe pull request is closed. Summary by CodeRabbit
WalkthroughBroad refactor and expansion: dependency-cruiser and ESLint boundaries tightened; CI workflows simplified and rerouted to Node 20 and host-node entrypoint; directives renamed to wes_*; extensive schema file rewrites; host runtime gains shell and global ctx; CLI gains ops checks and bundle emission; core adds SQL/Zod/pgTAP generators, migration/rollback/repair planners, QIR stack; utilities replace Node built-ins; tests updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev
participant CLI as wesley-host-node CLI
participant Runtime as createNodeRuntime (ctx)
participant Core as wesley-core
participant Gen as Generators (DDL/pgTAP/RPC)
participant FS as ctx.fs
Note over Dev,CLI: Generate with optional ops scanning and evidence
Dev->>CLI: wesley.mjs generate --schema ... [--ops ops]
CLI->>Runtime: init() -> ctx { fs, shell, ... } (globalThis.wesleyCtx)
CLI->>FS: read schema
CLI->>Core: orchestrate(schema, options)
Core->>Gen: PostgreSQLGenerator/PgTAP/MigrationDiffer
Gen-->>Core: sql, tests, diff
Core-->>CLI: artifacts { sql, tests, migration, scores? }
CLI->>FS: write .wesley/{bundle.json,scores.json,history.json}
CLI-->>Dev: Done
Note right of CLI: ops dir is probed (queries.graphql etc.)
sequenceDiagram
autonumber
actor CI
participant GH as GitHub Actions
participant Node as Node 20
participant CLI as wesley-host-node
participant Lint as ESLint/dep-cruiser
Note over GH: Simplified pipelines with host-node entrypoint
CI->>GH: push/PR
GH->>Node: setup (pnpm, deps, Bats if needed)
GH->>Lint: boundary checks (dep-cruiser via dlx), ESLint scopes
GH->>CLI: node .../wesley.mjs generate --schema ...
alt Bundle exists
GH->>CLI: holmes investigate/verify/predict via node CLIs
else Fallback
GH->>CLI: regenerate bundle with out-dir
end
GH-->>CI: reports/artifacts
Estimated code review effort🎯 5 (Critical) | ⏱️ ~150 minutes Possibly related issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro ⛔ Files ignored due to path filters (18)
📒 Files selected for processing (94)
Note Free review on us!CodeRabbit is offering free reviews until Wed Oct 08 2025 to showcase some of the refinements we've made. Comment |
🚢 SHIPME[REALM] PASS — sha 16fc7ac |
🔍 The Case of Pull Request #42🕵️ SHA-lock HOLMES's Investigation════════════════════════════════════════════════════════════════════ 🔍 Executive Deduction"Watson, after careful examination of the evidence, I deduce..." Weighted Completion: ██████░░░░ 60.0% 📊 The Weight of Evidence"Observe, Watson, how not all features carry equal importance..."
🚪 Security & Performance Gates"Elementary security measures, Watson..."
📋 The Verdict
Signed and sealed,
[END OF INVESTIGATION FOR COMMIT 16fc7ac] 🩺 Dr. WATSON's Verification════════════════════════════════════════════════════════════════════ 🔬 Citation Verification"Let me examine each piece of evidence independently..."
Verification Rate: 100.0% 📊 Mathematical Verification"I shall recalculate Holmes's arithmetic..." Holmes claimed SCS: 60.0% 🔍 Consistency Analysis"Checking for contradictions in Holmes's deductions..." ✅ No logical inconsistencies detected 🩺 Dr. Watson's Medical OpinionVERIFICATION: PASSED ✅ "I have examined Holmes's evidence independently and concur with his" Respectfully submitted,
🔮 Professor MORIARTY's Predictions════════════════════════════════════════════════════════════════════ INSUFFICIENT DATA "I require at least two data points to predict the future." Filed at 221B Repository Street |
Summary\n- Adds QIR → SQL lowering in @wesley/core (SELECT/JOIN/LEFT/LATERAL/ORDER BY/LIMIT/OFFSET).\n- Predicates: null semantics (IS NULL/IS NOT NULL), eq null → IS NULL, IN → = ANY(::<type[]>), contains → @>.\n- JSON helpers: jsonb_build_object, jsonb_agg wrapped with COALESCE(..., '[]'::jsonb).\n- Deterministic ORDER BY: appends stable PK/unique tie-breaker (alias.id) when missing.\n- Unit tests: flat select (NULL + tie-break), nested list (COALESCE jsonb_agg), IN/ANY casting.\n\nNotes\n- Behind --ops; no CLI wiring or emission paths in this PR.\n- Pure module; no Node built-ins; param order via collectParams().\n- No workflow changes.\n\nAcceptance Criteria\n- lowerToSQL handles SELECT, JOIN/LEFT JOIN, LATERAL, ORDER BY, LIMIT/OFFSET.\n- Predicates map correctly incl. null and IN ANY casting.\n- Nested lists use COALESCE(jsonb_agg(...), '[]'::jsonb).\n- Deterministic ORDER BY with PK/unique tie-breaker.\n\nTesting\n- Local: pnpm -C packages/wesley-core test:unit (all core unit tests pass).\n- Sanity: host-node generate still works; no ops wiring changed.\n\nOut of scope (PR B)\n- Emission paths (VIEW/INVOKER) and CLI integration of --ops lowering; HOLMES gating.\n