Skip to content

Commit 524995d

Browse files
authored
feat: workspace with the refuse-all pipeline, census and quality gates (#2)
* feat: Rust workspace with the refuse-all pipeline and census Replace the early skeleton with small crates: sqlquack-core (parsing, construct classification, refusals, tree comparison and both re-parse checks), sqlquack-rules (empty catalogue), sqlquack-snowflake, sqlquack-duckdb and sqlquack-compare (empty), and sqlquack (pipeline, census and command line). Polyglot is pinned without its transpile feature. * ci: blocking quality gates and CI make check-ci runs rustfmt, clippy with -D warnings, fensu with the Rust rule pack, ruff and ty. CI runs check-ci and the tests with a cached dependency build. * docs: README, architecture notes and agent instructions * fix: treat INTEGER and INT as one spelling in tree comparison
1 parent 2433e2f commit 524995d

160 files changed

Lines changed: 5050 additions & 1681 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
16+
jobs:
17+
verify:
18+
name: Verify
19+
runs-on: ubuntu-24.04
20+
timeout-minutes: 20
21+
env:
22+
CARGO_TERM_COLOR: always
23+
CARGO_INCREMENTAL: "0"
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: astral-sh/setup-uv@v5
27+
with:
28+
version: "0.12.3"
29+
enable-cache: true
30+
cache-dependency-glob: uv.lock
31+
- name: Install the pinned Rust toolchain
32+
run: rustup toolchain install
33+
# Caches the dependency builds, polyglot above all, keyed by Cargo.lock and the toolchain.
34+
- uses: Swatinem/rust-cache@v2
35+
with:
36+
shared-key: verify
37+
- name: Install Python
38+
run: uv python install 3.12
39+
- name: Install development tools
40+
run: uv sync --locked
41+
- name: Run static checks
42+
run: make check-ci
43+
- name: Run tests
44+
run: make test

‎.gitignore‎

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
# Generated by Cargo
2-
# will have compiled files and executables
3-
debug
4-
target
5-
6-
# These are backup files generated by rustfmt
1+
# Rust
2+
/target/
73
**/*.rs.bk
8-
9-
# MSVC Windows builds of rustc generate these, which store debugging information
104
*.pdb
11-
12-
# Generated by cargo mutants
13-
# Contains mutation testing data
145
**/mutants.out*/
156

16-
# Python
7+
# Python tooling
178
__pycache__/
189
*.py[cod]
10+
.venv/
11+
.ruff_cache/
12+
13+
# Fensu
14+
.fensu/cache/
15+
.fensu/memory/
16+
17+
# Local data
18+
*.duckdb
19+
*.duckdb.wal
20+
.tmp*
21+
22+
# Editors and OS files
23+
.DS_Store
24+
.idea/
25+
.vscode/
1926

20-
# RustRover
21-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
22-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
23-
# and can be added to the global gitignore or merged into this file. For a more nuclear
24-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
25-
#.idea/
27+
# Local agent configuration and generated skills
28+
.claude/*
29+
/.agents/skills/
30+
/.claude/skills/
31+
/.opencode/skills/

‎AGENTS.md‎

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Agent Instructions
2+
3+
## Product Rules
4+
5+
- SQLQuack refuses to guess. Never emit a DuckDB node that no verified rule produced, and never pass
6+
a source construct through because it prints identically in DuckDB. Identical syntax is not
7+
evidence of identical meaning.
8+
- Every refusal names its construct, its source position and its category: missing rule, not
9+
expressible in DuckDB, or parse fidelity. Add categories rather than overloading one.
10+
- Do not trust or enable polyglot's `transpile` feature or any of its dialect conversions. Use
11+
polyglot for parsing, name resolution and printing only.
12+
- The source dialect is a parameter of every entry point. Do not hard-code Snowflake below the
13+
command line.
14+
- Entries in the spelling-only field list and normalisations (`sqlquack-core` comparison constants)
15+
weaken the re-parse checks. Each needs a reason and a test showing two spellings differ only
16+
there. Do not add one to make a failing check pass.
17+
18+
## Evidence Integrity
19+
20+
- Recorded warehouse results are the only arbiter of correctness. Agents never record, re-record,
21+
edit or delete recorded results, and never contact a warehouse. Report pending cases to the
22+
maintainer instead.
23+
- Recorded results are append-only and named by the hash of their case. A changed case is a new
24+
case.
25+
- Everything that could be weakened to make a failing case pass (comparator tolerances, required
26+
edge-case inputs, known divergences) lives in one reviewed policy file. There are no per-case or
27+
per-rule overrides elsewhere.
28+
- When a case fails, either fix the rule or make it refuse. Never widen a rule to raise the
29+
conversion rate.
30+
31+
## Testing
32+
33+
- Every behaviour change ships with tests. Prefer tests that run the real pipeline and the real
34+
`sqlquack` binary over tests of isolated helpers.
35+
- Tests follow the fensu Rust test layout: a `tests.rs` harness of `#[path]` modules, a sibling
36+
`test_types.rs` with test-case structs, a local `test_cases` array per test, one loop, and
37+
assertion messages carrying `test_case.description`.
38+
- Run focused tests with `cargo test -p <crate> <filter>`. `make test` runs the workspace suite.
39+
- Before pushing, run `make check-ci`.
40+
41+
## Public Repository Hygiene
42+
43+
- Treat every tracked file, fixture, filename, commit, branch, pull request, review comment and CI
44+
log as publicly visible, including history.
45+
- Use only neutral synthetic examples such as orders, customers, products, inventory, fulfilment
46+
and support tickets. Never copy organisation-, client-, provider-, environment- or
47+
production-specific names, SQL, data, query output, identifiers or counts into the repository,
48+
even when the source was read-only.
49+
- Measurements on private projects stay private. A bug they expose becomes a rewritten neutral
50+
reproduction.
51+
- Load and follow the `public-repository-hygiene` skill before editing or publishing. Run its
52+
scanner over the working tree and introduced history before every push. Never bypass the
53+
configured Git hooks; a missing or failing scanner blocks publication.
54+
- Do not copy the private restricted-vocabulary list or scanner into this repository.
55+
56+
## Command-Line User Experience
57+
58+
- Potentially slow phases print a concise start message and an explicit completion or failure
59+
message on stderr.
60+
- Machine-readable output (`--json`) goes to stdout alone; progress goes to stderr.
61+
- Reports never print SQL text or file names unless the user asks for them.
62+
63+
## Native Builds
64+
65+
- Polyglot is one large crate. Keep crates small so a rule change does not rebuild everything, and
66+
do not add dependencies that rebuild polyglot.
67+
- Pin polyglot to the same revision as SQLBuild and bump it deliberately, with a census before and
68+
after.
69+
70+
## Subagent Verification
71+
72+
- The primary agent owns the verification plan. Implementation subagents run only tests covering
73+
their change plus focused static checks; review subagents are read-only.
74+
- Follow-up reviews verify only previously reported findings and their boundaries.
75+
76+
## Delivery Workflow
77+
78+
- Consolidate related work for one release into one branch and one pull request.
79+
- Run focused tests and `make check-ci` before pushing; CI is the broad gate.
80+
- Pull request titles follow Conventional Commits. Descriptions have `## Why`, `## Changes` and
81+
`## Verification` sections.
82+
- Monitor CI after every push and address failures before considering delivery complete.
83+
84+
## Review Discipline
85+
86+
- Treat review findings as hypotheses to validate against supported behaviour and realistic
87+
execution paths.
88+
- Prioritise correctness: a conversion that changes meaning is the worst possible defect, and a
89+
refusal is always an acceptable fix.
90+
- Keep fixes within scope. Escalate anything that expands supported behaviour, recorded evidence or
91+
the policy file to the maintainer.

0 commit comments

Comments
 (0)