Repository navigation
cowork-bot: SHA-pin all GitHub Actions and remove silent-failure trap #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3c34e99
cowork-bot: SHA-pin all GitHub Actions and remove silent-failure || true
Coding-Dev-Tools 94467fa
cowork-bot: fix CI failures — precise MCP importorskip and remove red…
Coding-Dev-Tools c57ff44
style: apply ruff format to fixtures/sample.alembic.py
8b3b2fb
fix: add noqa: F401 to pytest import in test_mcp_server.py
Coding-Dev-Tools d9496e5
chore: add work-log.jsonl to gitignore
Coding-Dev-Tools 335c624
cowork-bot: surface silently-dropped SQL constraints and malformed ty…
7a73437
cowork-bot: diff & parser — silent schema drift fixes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,3 +79,4 @@ node_modules | |
| _audit_reqs.txt | ||
| nul | ||
| package-lock.json | ||
| work-log.jsonl | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| """Silent-failure regression tests: unsupported constructs must warn, not vanish.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
| import warnings | ||
| from schemaforge.generators.json_schema_generator import JSONSchemaGenerator | ||
| from schemaforge.parsers.sql_parser import SQLParser | ||
| from schemaforge.type_config import TypeConfig | ||
|
|
||
|
|
||
| def test_sql_parser_warns_on_foreign_key_constraint() -> None: | ||
| sql = """ | ||
| CREATE TABLE orders ( | ||
| id INTEGER PRIMARY KEY, | ||
| customer_id INTEGER, | ||
| FOREIGN KEY (customer_id) REFERENCES customers(id) | ||
| ); | ||
| """ | ||
| with warnings.catch_warnings(record=True) as caught: | ||
| warnings.simplefilter("always") | ||
| SQLParser().parse(sql) | ||
| assert any("FOREIGN KEY" in str(w.message) for w in caught) | ||
|
|
||
|
|
||
| def test_sql_parser_warns_on_named_check_constraint() -> None: | ||
| sql = """ | ||
| CREATE TABLE products ( | ||
| price NUMERIC, | ||
| CONSTRAINT positive_price CHECK (price >= 0) | ||
| ); | ||
| """ | ||
| with warnings.catch_warnings(record=True) as caught: | ||
| warnings.simplefilter("always") | ||
| SQLParser().parse(sql) | ||
| assert any("CHECK" in str(w.message) for w in caught) | ||
|
|
||
|
|
||
| def test_sql_parser_no_warning_for_plain_table() -> None: | ||
| sql = """ | ||
| CREATE TABLE users ( | ||
| id INTEGER PRIMARY KEY, | ||
| email VARCHAR(255) NOT NULL | ||
| ); | ||
| """ | ||
| with warnings.catch_warnings(record=True) as caught: | ||
| warnings.simplefilter("always") | ||
| SQLParser().parse(sql) | ||
| assert not caught | ||
|
|
||
|
|
||
| def test_json_schema_generator_warns_on_malformed_override() -> None: | ||
| from schemaforge.ir import Column, ColumnType | ||
|
|
||
| class MalformedOverrideCfg(TypeConfig): | ||
| """Returns an override that looks like JSON but fails to parse.""" | ||
|
|
||
| def get_override(self, col, fmt, type_args=None): # noqa: D102 | ||
| return "{broken json}" | ||
|
|
||
| col = Column(name="email", type=ColumnType.STRING, nullable=True) | ||
| gen = JSONSchemaGenerator(type_config=MalformedOverrideCfg()) | ||
| with warnings.catch_warnings(record=True) as caught: | ||
| warnings.simplefilter("always") | ||
| gen._column_to_prop(col) | ||
| assert any("failed to parse" in str(w.message) for w in caught) | ||
|
|
||
|
|
||
| def _make_column(name: str): | ||
| from schemaforge.ir import Column, ColumnType | ||
|
|
||
| return Column(name=name, type=ColumnType.STRING, nullable=True) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "sql", | ||
| [ | ||
| "CREATE TABLE t (a INT, CONSTRAINT fk_a FOREIGN KEY (a) REFERENCES o(a));", | ||
| "CREATE TABLE t (a INT, FOREIGN KEY (a) REFERENCES o(a));", | ||
| ], | ||
| ) | ||
| def test_warning_includes_table_name(sql: str) -> None: | ||
| with warnings.catch_warnings(record=True) as caught: | ||
| warnings.simplefilter("always") | ||
| SQLParser().parse(sql) | ||
| assert any("'t'" in str(w.message) for w in caught) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.