Skip to content

Release v0.9.5 SP1 + parser fix + CI fix - #40

Merged
Peter-L-SVK merged 9 commits into
mainfrom
stage
Oct 10, 2026
Merged

Peter-L-SVK merged 9 commits into
mainfrom
stage

Conversation

@Peter-L-SVK

@Peter-L-SVK Peter-L-SVK commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

Merge stage into main. This brings:

  1. v0.9.5 SP1 — service pack with 13 bug fixes, four new feature
    areas, and 212 unit tests
  2. Parser fix from @Sal-ami — see below
  3. CI fix — postgres service password via GitHub secret

Tag: v0.9.5-sp1

Changes Since SP1

fix(parser): stop dropping columns named like constraint keywords

Contributed by @Sal-ami.

The constraint check in _parse_column_line_robust used
str.startswith() against a tuple of keywords. That matched any
column whose name merely began with one of them, so unique_code,
constraint_name, check_flag, and excluded_at were all treated
as table constraints and silently dropped. The Schema Designer
then drew a table with fewer columns than the SQL declared and gave
no warning.

The keywords are now matched with a word boundary, so PRIMARY KEY (a, b), UNIQUE (email), and CONSTRAINT ... CHECK (...) are
still skipped while prefixed column names parse as columns.

Adds two tests: one that fails on the old code with unique_code
and constraint_name missing, and one that pins down that
table-level constraints are still skipped.

fix(ci): use GitHub secret for postgres service password

The postgres service container password is now read from the
repository secret TEST_DB_PASSWORD, and the same secret is passed
to the pytest step via the TEST_PASSWORD environment variable so
tests/conftest.py can pick it up.

Verification

  • ✅ CI green on Python 3.12 and 3.13
  • ✅ mypy clean (81 files)
  • ✅ flake8 clean
  • ✅ black clean
  • ✅ 214 unit tests passing (212 + 2 new from Sal-ami)

Sal-ami and others added 9 commits October 10, 2026 16:10
The constraint check in _parse_column_line_robust used
str.startswith() against a tuple of keywords. That matched any column
whose name merely began with one of them, so unique_code,
constraint_name, check_flag and excluded_at were all treated as table
constraints and silently dropped.

The Schema Designer then drew a table with fewer columns than the SQL
declares and gave no warning.

The keywords are now matched with a word boundary so PRIMARY KEY (a, b),
UNIQUE (email) and CONSTRAINT ... CHECK (...) are still skipped while
prefixed column names parse as columns.

Adds two tests. One fails on the old code with unique_code and
constraint_name missing from the column list. The other pins down that
table-level constraints are still skipped.
…from Sal-ami/fix/schema-parser-constraint-keyword-columns

The constraint check in `_parse_column_line_robust` used `str.startswith()` against a tuple of keywords. `startswith` matches prefixes, so any column whose name merely began with one of the keywords got treated as a table constraint and dropped.

This table loses three columns silently:

```sql
CREATE TABLE t (
    id SERIAL PRIMARY KEY,
    unique_code VARCHAR(10),
    constraint_name VARCHAR(50),
    check_flag BOOLEAN
);
```

Parsing it returns only `id`. The Schema Designer draws the table with a third of its columns missing and shows no error, so it looks like the SQL only ever declared one column.

The keywords are now matched with a word boundary. `PRIMARY KEY (a, b)`, `UNIQUE (email)` and `CONSTRAINT chk_len CHECK (...)` are still skipped, and prefixed column names parse as columns.

Two tests added:

- one covers the column names above and fails on the current code with `unique_code` and `constraint_name` missing from the result
- one pins down that table-level constraints are still skipped, so the fix cannot drift the other way

Verified locally with the four test files that do not need a live database:

```
pytest tests/test_schema_parser.py tests/test_schema_cache.py tests/test_settings.py tests/test_models.py
80 passed
```

`black --check` and `flake8` are clean on both changed files. mypy reports no issues on `schema_parser.py`. I could not run the database backed tests because there is no PostgreSQL server on my machine at this time.
The test database password was hardcoded as 'admin123' in
tests/conftest.py. While this is a throw-away database for local and
CI use, the value ended up in the repository history and could not be
overridden without editing source.

Now reads TEST_DB, TEST_USER, TEST_PASSWORD, TEST_HOST, and TEST_PORT
from the environment, with the previous values as defaults so
existing workflows (local + CI) keep working unchanged.

Also added .env.example as documentation and .env to .gitignore, so
contributors who point tests at a non-local PostgreSQL can keep the
real credentials out of the repo.

Reported-by: <GitHub handle of the reviewer>
The test database password was hardcoded as 'admin123' in
tests/conftest.py. While this is a throw-away database for local and
CI use, the value ended up in the repository history and could not be
overridden without editing source.

Now reads TEST_DB, TEST_USER, TEST_PASSWORD, TEST_HOST, and TEST_PORT
from the environment, with the previous values as defaults so
existing workflows (local + CI) keep working unchanged.

Also added .env.example as documentation and .env to .gitignore, so
contributors who point tests at a non-local PostgreSQL can keep the
real credentials out of the repo.

Reported-by: [Sal-ami](https://github.com/Sal-ami)
The test database password was hardcoded as 'admin123' in
tests/conftest.py. While this is a throw-away database for local and
CI use, the value ended up in the repository history and could not be
overridden without editing source.

Now reads TEST_DB, TEST_USER, TEST_PASSWORD, TEST_HOST, and TEST_PORT
from the environment, with the previous values as defaults so
existing workflows (local + CI) keep working unchanged.

Also added .env.example as documentation and .env to .gitignore, so
contributors who point tests at a non-local PostgreSQL can keep the
real credentials out of the repo.

Reported-by: [Sal-ami](https://github.com/Sal-ami)
@Peter-L-SVK Peter-L-SVK self-assigned this Oct 10, 2026
@Peter-L-SVK Peter-L-SVK added enhancement New feature or request good first issue Good for newcomers bugfix labels Oct 10, 2026
@Peter-L-SVK
Peter-L-SVK merged commit 541159a into main Oct 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants