-
Notifications
You must be signed in to change notification settings - Fork 11
fix(e2e): resolve test failures from issue #244 #245
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
83c55f6
fix(e2e): resolve issue #244 test failures
visahak 253338f
fix ruff formatting
visahak 904c917
Merge branch 'main' into fix/e2e-244-test-failures
visahak 97a3e02
fix(filesystem): address Codex review on interrupted-write recovery
visahak da23440
addressing comments
visahak c2397e3
addressing code rabbit issues
visahak 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,3 +17,4 @@ dist | |
| .secrets | ||
| event.json | ||
| site/ | ||
| .codex | ||
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
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,69 @@ | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from altk_evolve.backend.filesystem import FilesystemEntityBackend | ||
| from altk_evolve.config.evolve import EvolveConfig | ||
| from altk_evolve.config.filesystem import FilesystemSettings | ||
| from altk_evolve.frontend.client.evolve_client import EvolveClient | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def client(tmp_path: Path) -> EvolveClient: | ||
| return EvolveClient(config=EvolveConfig(backend="filesystem", settings=FilesystemSettings(data_dir=str(tmp_path)))) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def backend(tmp_path: Path) -> FilesystemEntityBackend: | ||
| return FilesystemEntityBackend(config=FilesystemSettings(data_dir=str(tmp_path))) | ||
|
|
||
|
|
||
| @pytest.mark.unit | ||
| def test_ensure_namespace_recovers_from_zero_byte_file(client: EvolveClient, tmp_path: Path): | ||
| stale = tmp_path / "ns_stale.json" | ||
| stale.write_text("") | ||
| assert stale.exists() and stale.stat().st_size == 0 | ||
|
|
||
| ns = client.ensure_namespace("ns_stale") | ||
|
|
||
| assert ns.id == "ns_stale" | ||
| assert ns.num_entities == 0 | ||
| assert stale.exists() and stale.stat().st_size > 0 | ||
|
|
||
|
|
||
| @pytest.mark.unit | ||
| def test_ensure_namespace_recovers_from_corrupt_json(client: EvolveClient, tmp_path: Path): | ||
| corrupt = tmp_path / "ns_corrupt.json" | ||
| corrupt.write_text("{not json") | ||
|
|
||
| ns = client.ensure_namespace("ns_corrupt") | ||
|
|
||
| assert ns.id == "ns_corrupt" | ||
| assert ns.num_entities == 0 | ||
|
|
||
|
|
||
| @pytest.mark.unit | ||
| def test_ensure_namespace_recovers_from_schema_invalid_json(client: EvolveClient, tmp_path: Path): | ||
| """Valid JSON that doesn't match FilesystemNamespace must also trigger recovery, | ||
| not propagate pydantic.ValidationError and wedge startup.""" | ||
| bogus = tmp_path / "ns_bogus.json" | ||
| bogus.write_text('{"not_a_namespace": true}') | ||
|
|
||
| ns = client.ensure_namespace("ns_bogus") | ||
|
|
||
| assert ns.id == "ns_bogus" | ||
| assert ns.num_entities == 0 | ||
|
|
||
|
|
||
| @pytest.mark.unit | ||
| def test_save_tolerates_stale_shared_tmp(backend: FilesystemEntityBackend, tmp_path: Path): | ||
| """Stale <ns>.json.tmp from an interrupted write must not block subsequent saves. | ||
|
|
||
| Regression guard for concurrent CLI+MCP writers that used to share the tmp name. | ||
| """ | ||
| (tmp_path / "ns_busy.json.tmp").write_text("leftover") | ||
|
|
||
| backend.create_namespace("ns_busy") | ||
|
|
||
| target = tmp_path / "ns_busy.json" | ||
| assert target.exists() and target.stat().st_size > 0 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
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.