Skip to content

refactor(server): break cfstore.py into recceiver/cf/ subpackage#160

Merged
anderslindho merged 21 commits into
masterfrom
refactor-cf-subpackage
May 11, 2026
Merged

refactor(server): break cfstore.py into recceiver/cf/ subpackage#160
anderslindho merged 21 commits into
masterfrom
refactor-cf-subpackage

Conversation

@anderslindho
Copy link
Copy Markdown
Contributor

No behaviour changes.

@anderslindho anderslindho requested a review from jacomago May 8, 2026 14:08
@anderslindho anderslindho self-assigned this May 8, 2026
@anderslindho anderslindho marked this pull request as draft May 8, 2026 14:11
Copy link
Copy Markdown
Contributor

@simon-ess simon-ess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems an improvement to me!

Copy link
Copy Markdown
Contributor

@jacomago jacomago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks fine.

Comment thread server/pyproject.toml
Comment thread server/recceiver/cfstore.py
Comment thread server/recceiver/cf/processor.py
Comment thread server/recceiver/cf/adapter.py Outdated
@anderslindho anderslindho force-pushed the refactor-cf-subpackage branch from 537b40a to 9133c8a Compare May 8, 2026 15:28
@anderslindho anderslindho marked this pull request as ready for review May 8, 2026 15:28
@anderslindho anderslindho requested review from shroffk and tynanford May 8, 2026 15:29
@anderslindho anderslindho force-pushed the refactor-cf-subpackage branch 3 times, most recently from 321fedc to c89d65e Compare May 8, 2026 15:46
@anderslindho anderslindho marked this pull request as draft May 11, 2026 08:48
@anderslindho anderslindho force-pushed the refactor-cf-subpackage branch from c89d65e to 56c2641 Compare May 11, 2026 12:04
Fix _merge_property_lists mutable default argument — safe in practice
since the set is only read, but still wrong form.
str enum inheritance silently allowed enum members to be used wherever
strings were expected, masking boundary crossings and causing
inconsistent .value usage across the codebase.
Factory methods mixed owner (a runtime concern) with property type and
value (domain constants), making the API semantically confusing. Direct
construction via CFProperty(CFPropertyName.X.value, owner, value) is
already the established pattern for IOC properties in create_ioc_properties;
this makes the whole file consistent.
runtime_checkable is only available in typing from Python 3.8, but was
imported without the typing_extensions fallback that Protocol has. Since
no isinstance check against ChannelFinderAdapter exists anywhere, the
decorator serves no purpose.
Config tests and processor tests had no reason to share a file. Moves
make_adapter to conftest.py so both test modules can use it without
duplication.
…to adapter

The pipe-joining and 600-char URL chunking loop belonged to the CF
query format, not to the processor. The adapter boundary now speaks
lists; the wire detail is contained in PyCFClientAdapter.
…turn List[str]

The only consumer immediately extracted p["name"] from every dict.
Moving that extraction into the adapter removes the raw CF wire shape
from the processor and makes the return type self-documenting.
IOC is an acronym — the mixed-case form was inconsistent with
CFPropertyName.IOC_ID, IOC_NAME, etc. The ioc_id property becomes id
since the class name already carries the IOC context.
make_adapter was duplicated between test_processors.py and cf/conftest.py;
moved to tests/unit/conftest.py as the single source. make_ioc and a new
make_channel (generalising make_active_channel with name, recceiver_id,
and active params) now live in tests/unit/cf/conftest.py for shared use
across all cf tests.
- IOCInfo docstring: "ioc_id property" -> ".id property"
- test_model.py: rename test_ioc_id_combines_host_and_port to test_id_combines_host_and_port
- test_processor.py: drop unused adapter binding in test_is_no_op_when_no_active_channels
- cf/conftest.py: introduce DEFAULT_RECCEIVER_ID constant so make_channel's
  default and make_processor_with_mock share a single source of truth
- adapter.py: replace magic 600 with _CF_NAME_QUERY_LIMIT constant and comment
@anderslindho anderslindho force-pushed the refactor-cf-subpackage branch from 56c2641 to 6ea5a5a Compare May 11, 2026 12:24
@sonarqubecloud
Copy link
Copy Markdown

Comment thread server/tests/unit/cf/conftest.py Dismissed
Comment thread server/tests/unit/cf/conftest.py Dismissed
Comment thread server/tests/unit/cf/test_processor.py Dismissed
Comment thread server/tests/unit/cf/test_processor.py Dismissed
Comment thread server/tests/unit/cf/test_processor.py Dismissed
Comment thread server/tests/unit/cf/test_processor.py Dismissed
@anderslindho anderslindho marked this pull request as ready for review May 11, 2026 12:33
@anderslindho anderslindho merged commit 9e618fe into master May 11, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants