Extract a 3-method SettingsStore port (worked example for ISP)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- backend, testing-qa
Research direction
Start with application/cache.py to follow the existing port pattern, then read src/aitts/settings.py and tests/test_settings_service.py. Define the three-method protocol and update the service type, replace the test store fixture with a dict-backed fake, and run the settings service tests to confirm the validation rules still pass without SQLite.
Written by the indexing model from the issue text.
Description
The problem
SettingsService is constructed with the whole Store. It uses three of its
41 public methods:
get_setting, has_setting, set_setting
That is an Interface Segregation failure: a client depending on 38 methods it
never calls. It also keeps aitts.settings out of the core, because importing
Store drags SQLite in behind it.
The fix, and the precedent
application/cache.py already does this correctly:
class CacheMetadataPort(Protocol):
def protected_audio_paths(self) -> frozenset[str]: ...
def forget_terminal_audio(self, path: Path) -> int: ...
CacheController takes that two-method port, lives in the core, and Store
satisfies it structurally — it is a Protocol, so there is no inheritance,
no registration, and Store needed no changes at all.
Do the same here:
class SettingsStorePort(Protocol):
def get_setting(self, key: str, default: str) -> str: ...
def has_setting(self, key: str) -> bool: ...
def set_setting(self, key: str, value: str) -> None: ...
SettingsService.__init__(self, store: SettingsStorePort, environment: SettingsEnvironment).
Store continues to satisfy it with no edit.
Why this one first
It is the smallest of the five and the shape is identical for the others, so it
is the worked example. It also means tests/test_settings_service.py can drop
its real SQLite store for a dict-backed fake, which is the point of the port —
the tests already prove the validation rules and would then prove them without
a database.
Scope
src/aitts/settings.py— the Protocol and the constructor typesrc/aitts/daemon.py— no change needed; it passesself._storealreadytests/test_settings_service.py— swap thestorefixture for a fake
Part of #12.
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- Avg merge
- 2h 13m
- Merged PRs (30d)
- 51
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from flyingrobots/AI-TTS
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
flyingrobots/AI-TTS#225 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
flyingrobots/AI-TTS#8 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
flyingrobots/AI-TTS#166 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 38/100
flyingrobots/AI-TTS#165 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 1-2 days Newbie friendliness 58/100
flyingrobots/AI-TTS#163 ·
Maintainers usually reply within 1 day
All issues in flyingrobots/AI-TTS
Similar issues
-
accepted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
future-agi/future-agi#6392 ·
Maintainers usually reply within 1 day
-
memmapped_arange ignores the start value and drops the last point above the memmap thresholdPossibly taken @prathameshfuke claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
StingraySoftware/HENDRICS#213 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day