-
Notifications
You must be signed in to change notification settings - Fork 3
[DBA-136] Highlight new build in chat #75
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
Open
SimonKaran13
wants to merge
4
commits into
main
Choose a base branch
from
simon.karan/DBA-136-highlight-new-build-in-chat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5c04371
[DBA-136] add new-build notification banner in chat UI
SimonKaran13 f4cb76f
[DBA-136] fix flaky test and handle missing initial build
SimonKaran13 d0d5a6d
[DBA-136] address PR review: reduce coupling and fix stale banner
SimonKaran13 d31c16d
[DBA-136] move deferred imports to top level where safe
SimonKaran13 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
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,62 @@ | ||
| """Tests for build fingerprint detection and new-build notification logic.""" | ||
|
|
||
| import os | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from databao_cli.project.layout import BUILD_SENTINEL, ProjectLayout | ||
| from databao_cli.ui.project_utils import get_build_fingerprint | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def project_with_sentinel(tmp_path: Path) -> ProjectLayout: | ||
| """Create a minimal project layout with a build sentinel file.""" | ||
| domain_dir = tmp_path / "databao" / "domains" / "root" | ||
| domain_dir.mkdir(parents=True) | ||
| (domain_dir / BUILD_SENTINEL).write_text("") | ||
| return ProjectLayout(tmp_path) | ||
|
|
||
|
|
||
| def test_fingerprint_returns_zero_without_sentinel(tmp_path: Path) -> None: | ||
| """Fingerprint is 0.0 when the sentinel file does not exist.""" | ||
| domain_dir = tmp_path / "databao" / "domains" / "root" | ||
| domain_dir.mkdir(parents=True) | ||
| project = ProjectLayout(tmp_path) | ||
| assert get_build_fingerprint(project) == 0.0 | ||
|
|
||
|
|
||
| def test_fingerprint_returns_zero_for_missing_domain(tmp_path: Path) -> None: | ||
| """Fingerprint is 0.0 when the domain directory does not exist.""" | ||
| project = ProjectLayout(tmp_path) | ||
| assert get_build_fingerprint(project) == 0.0 | ||
|
|
||
|
|
||
| def test_fingerprint_returns_nonzero_with_sentinel( | ||
| project_with_sentinel: ProjectLayout, | ||
| ) -> None: | ||
| """Fingerprint is positive when sentinel file exists.""" | ||
| fp = get_build_fingerprint(project_with_sentinel) | ||
| assert fp > 0.0 | ||
|
|
||
|
|
||
| def test_fingerprint_changes_after_new_build( | ||
| project_with_sentinel: ProjectLayout, | ||
| ) -> None: | ||
| """Fingerprint changes when sentinel is rewritten (simulating a new build).""" | ||
| fp_before = get_build_fingerprint(project_with_sentinel) | ||
|
|
||
| sentinel = project_with_sentinel.root_domain_dir / BUILD_SENTINEL | ||
| os.utime(sentinel, (fp_before + 10, fp_before + 10)) | ||
|
|
||
| fp_after = get_build_fingerprint(project_with_sentinel) | ||
| assert fp_after > fp_before | ||
|
|
||
|
|
||
| def test_fingerprint_stable_without_changes( | ||
| project_with_sentinel: ProjectLayout, | ||
| ) -> None: | ||
| """Fingerprint is stable when sentinel is not rewritten.""" | ||
| fp1 = get_build_fingerprint(project_with_sentinel) | ||
| fp2 = get_build_fingerprint(project_with_sentinel) | ||
| assert fp1 == fp2 |
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.