gabriel / musehub public
feat BREAKING mist task/mist-advanced-tests #1 / 1
AI Agent gabriel · 145 days ago · May 1, 2026 · Diff

feat(mist): comprehensive test coverage + docstring cleanup

Source fixes: - musehub_intel_providers.py: rewrite MistProvider docstring to reflect current dual-path behavior (snapshot index + MusehubMist blob); remove stale 'Phase 1:'/'Phase 3:' TDD labels; fix ProfileSnapshotProvider docstring from '5-domain' to '6-domain' (mist canvas added in phase 5) - musehub_mist_indexer.py: extract _HISTORY_WEEKS = 12 constant; use it in intel row initialisation instead of magic literal 11 - models/mists.py: document that _MAX_CONTENT_BYTES is enforced by ContentSizeLimitMiddleware, not by Pydantic validators

New tests (tests/test_mist_advanced.py — 32 tests): - State integrity: indexer idempotency (ON CONFLICT DO NOTHING), intel upsert replaces not appends, version monotonicity on content updates, metadata-only update does not bump version, per-mist counter isolation, history entries accumulate across commits, empty/no-anchor manifests - Performance: build_mist_anchor_index < 500 ms, MistProvider.compute < 1 s, list_mists(100 rows) < 500 ms, persist_intel_results(50) < 1 s - Security: unauthenticated fork → 401, non-owner fork of secret mist → 403/404, non-owner fork of public mist succeeds, garbage cursor silently ignored, empty cursor treated as first page - Validator: empty manifest is valid, errors accumulate across bad files, unrecognised extensions are warnings not errors - Docstrings: MistProvider, ProfileSnapshotProvider, indexer constant, _MAX_CONTENT_BYTES enforcement documented

Total: 471 tests passing (330 existing + 109 phase suite + 32 new)

sha256:2bd9bca1d3bdee3a6a1f227e4bbae607577236b2823b6d2f22cca3de5a664c92 sha
+67 ~3 symbols
sha256:b8cbd73958c702e3321008d84800dae6868c62eb5026904f3833438d7e27b50b snapshot
+67
symbols added
~3
symbols modified
0
dead code introduced
Semantic Changes 70 symbols
~ tests/test_mist_advanced.py .py 66 symbols added
+ TestAdditionalSecurity class class TestAdditionalSecurity L616–775
+ test_empty_cursor_in_list_treated_as_first_page method async_method test_empty_cursor_in_list_treated_as_first_page L739–743
+ test_garbage_cursor_in_list_does_not_crash method async_method test_garbage_cursor_in_list_does_not_crash L726–736
+ test_non_owner_fork_of_public_mist_succeeds method async_method test_non_owner_fork_of_public_mist_succeeds L691–723
+ test_non_owner_fork_of_secret_mist_blocked method async_method test_non_owner_fork_of_secret_mist_blocked L656–688
+ test_unauthenticated_fork_returns_401 method async_method test_unauthenticated_fork_returns_401 L620–653
+ test_validate_mist_manifest_accumulates_all_errors method method test_validate_mist_manifest_accumulates_all_errors L753–765
+ test_validate_mist_manifest_empty_manifest_is_valid method method test_validate_mist_manifest_empty_manifest_is_valid L745–751
+ test_validate_mist_manifest_warnings_do_not_block method method test_validate_mist_manifest_warnings_do_not_block L767–775
+ TestCRUDStateIntegrity class class TestCRUDStateIntegrity L393–500
+ test_deleted_mist_absent_from_list method async_method test_deleted_mist_absent_from_list L474–486
+ test_embed_count_per_mist_independent method async_method test_embed_count_per_mist_independent L455–471
+ test_fork_count_matches_number_of_direct_forks method async_method test_fork_count_matches_number_of_direct_forks L489–500
+ test_metadata_only_update_does_not_increment_version method async_method test_metadata_only_update_does_not_increment_version L417–432
+ test_version_increments_on_each_content_update method async_method test_version_increments_on_each_content_update L397–414
+ test_view_count_per_mist_independent method async_method test_view_count_per_mist_independent L435–452
+ TestDocstrings class class TestDocstrings L782–826
+ test_build_mist_anchor_index_has_docstring method method test_build_mist_anchor_index_has_docstring L803–805
+ test_history_weeks_constant_exported method method test_history_weeks_constant_exported L807–810
+ test_max_content_bytes_constant_documented method method test_max_content_bytes_constant_documented L820–826
+ test_mist_provider_class_has_docstring class method test_mist_provider_class_has_docstring L785–787
+ test_mist_provider_compute_has_no_stale_phase_labels method method test_mist_provider_compute_has_no_stale_phase_labels L789–794
+ test_mist_validation_result_has_docstring method method test_mist_validation_result_has_docstring L816–818
+ test_profile_snapshot_provider_docstring_says_six_domains method method test_profile_snapshot_provider_docstring_says_six_domains L796–801
+ test_validate_mist_manifest_has_docstring method method test_validate_mist_manifest_has_docstring L812–814
+ TestIndexerIdempotency class class TestIndexerIdempotency L167–345
+ test_empty_manifest_returns_empty_list method async_method test_empty_manifest_returns_empty_list L222–260
+ test_history_entries_accumulate_across_commits method async_method test_history_entries_accumulate_across_commits L287–345
+ test_no_anchor_artifacts_returns_empty_list method async_method test_no_anchor_artifacts_returns_empty_list L263–284
+ test_reindex_same_commit_no_duplicate_history_entries method async_method test_reindex_same_commit_no_duplicate_history_entries L171–197
+ test_reindex_same_commit_no_duplicate_intel_rows method async_method test_reindex_same_commit_no_duplicate_intel_rows L200–219
+ TestIntelResultsUpsert class class TestIntelResultsUpsert L352–386
+ test_second_persist_call_overwrites_not_duplicates method async_method test_second_persist_call_overwrites_not_duplicates L356–386
+ TestPerformance class class TestPerformance L507–609
+ test_build_mist_anchor_index_under_500ms method async_method test_build_mist_anchor_index_under_500ms L511–525
+ test_list_mists_100_rows_under_500ms method async_method test_list_mists_100_rows_under_500ms L546–586
+ test_mist_provider_compute_under_1s method async_method test_mist_provider_compute_under_1s L528–543
+ test_persist_intel_results_50_tuples_under_1s method async_method test_persist_intel_results_50_tuples_under_1s L589–609
+ _FIVE_FN_PY variable variable _FIVE_FN_PY L142–142
+ _OWNER variable variable _OWNER L144–144
+ _commit_id function function _commit_id L64–65
+ _create function async_function _create L157–160
+ _manifest_blob function function _manifest_blob L72–73
+ _mist_payload function function _mist_payload L147–154
+ _now function function _now L56–57
+ _oid function function _oid L60–61
+ _seed_repo function async_function _seed_repo L76–139
+ _snap_id function function _snap_id L68–69
+ AsyncClient import import AsyncClient L42–42
+ AsyncSession import import AsyncSession L45–45
+ JSONObject import import JSONObject L49–49
+ JSONValue import import JSONValue L49–49
+ StrDict import import StrDict L49–49
+ annotations import import annotations L34–34
+ blob_id import import blob_id L43–43
+ compute_identity_id import import compute_identity_id L47–47
+ compute_repo_id import import compute_repo_id L47–47
+ datetime import import datetime L38–38
+ db import import db L48–48
+ func function import func L44–44
+ msgpack import import msgpack L40–40
+ pytest import import pytest L41–41
+ select import import select L44–44
+ time import import time L36–36
+ timezone import import timezone L38–38
+ uuid import import uuid L37–37
~ musehub/services/musehub_mist_indexer.py .py 1 symbol added, 1 symbol modified
+ _HISTORY_WEEKS variable variable _HISTORY_WEEKS L37–37
← Older Oldest on task/mist-advanced-tests
All commits
Newer → Latest on task/mist-advanced-tests

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:2bd9bca1d3bdee3a6a1f227e4bbae607577236b2823b6d2f22cca3de5a664c92 --body "your comment"