@@ -567,7 +567,7 @@ things based on that. It seems like it might be better to have a cleaner
567567separation at the datalayer port where the datalayer returns domain objects
568568consistently rather than sometimes returning raw dicts or ambiguous document
569569objects (which are really just a datalayer abstraction rather than a core
570- abstraction). The following subsections address this issue from different
570+ abstraction). The following subsections address this issue from different
571571angles.
572572
573573### Core should reliably get domain objects from datalayer, not raw dicts or datalayer-specific records
@@ -581,17 +581,17 @@ adapter expects, it should be able to say "Store this domain object" and
581581expect that the port and adapter will handle the details on its behalf. This
582582improves separation of concerns between core, port, and adapters.
583583
584- If a mapping layer is needed between core objects and datalayer records,
585- then that mapping layer belongs in an adapter not in core. The datalayer
586- port should really be about getting and storing domain objects, with
587- translation happening in the adapters as needed to convert between core
588- domain objects and datalayer records. That said, it may make sense for the
589- datalayer adapters to have a tiered structure where a thin adapter unifies
590- the translation (like everything is a document or key-value dicts etc. with
591- pydantic object definitions) and then storage-specific adapters decide how
584+ If a mapping layer is needed between core objects and datalayer records,
585+ then that mapping layer belongs in an adapter not in core. The datalayer
586+ port should really be about getting and storing domain objects, with
587+ translation happening in the adapters as needed to convert between core
588+ domain objects and datalayer records. That said, it may make sense for the
589+ datalayer adapters to have a tiered structure where a thin adapter unifies
590+ the translation (like everything is a document or key-value dicts etc. with
591+ pydantic object definitions) and then storage-specific adapters decide how
592592to generically persist those (into TinyDB, MongoDB, SQL, etc. as needed).
593- The key point is that if core is struggling to identify what it got back
594- from the datalayer, then we haven't got the right abstractions in place at
593+ The key point is that if core is struggling to identify what it got back
594+ from the datalayer, then we haven't got the right abstractions in place at
595595the port and adapter layers yet.
596596
597597## Datalayer storage records might need a rethink
@@ -604,27 +604,34 @@ core, and datalayer. Research into the codebase to understand the problem is
604604needed before implementing any refactoring. Both the investigation and the
605605refactoring should be tracked in the implementation plan.
606606
607- Core should be agnostic to datalayer's storage structure and organization,
608- not just the format. Core doesn't need to know if datalayer has separate
609- tables per type or just a giant blob of JSON records with a type field, or
610- whatever. Datalayer needs to care, but even that might be an
611- adapter-specific concern rather than a port-level concern (except insofar as
612- the port must provide sufficient abstractions to cover the core's need to do
607+ Core should be agnostic to datalayer's storage structure and organization,
608+ not just the format. Core doesn't need to know if datalayer has separate
609+ tables per type or just a giant blob of JSON records with a type field, or
610+ whatever. Datalayer needs to care, but even that might be an
611+ adapter-specific concern rather than a port-level concern (except insofar as
612+ the port must provide sufficient abstractions to cover the core's need to do
613613CRUD operations, plus find/search/query, usual database stuff.)
614614
615615### Vocabulary registry entanglement across wire, core, and datalayer
616616
617- Thirdly, the vocabulary registry was created when wire and core were the same
618- thing
619- and datalayer was a persistence detail. So there are places where the
620- vocabulary registry is being used for lookups for things outside of wire,
621- when in fact that is an artifact of the pre-hexagonal architecture.
617+ Thirdly, the vocabulary registry was created when wire and core were the same
618+ thing
619+ and datalayer was a persistence detail. So there are places where the
620+ vocabulary registry is being used for lookups for things outside of wire,
621+ when in fact that is an artifact of the pre-hexagonal architecture.
622622` db_record.py ` and ` rehydration.py ` are specific examples of this problem. We
623- need to tease these apart. The interaction between core and datalayer should
624- be in terms of core domain objects without the tight coupling to wire format
625- that the vocabulary registry creates. This is not to say that the datalayer
626- should be ignorant of data types or that the vocabulary registry should be
627- abandoned, but rather that the datalayer should have its own way to
628- recognize what kinds of objects it is handling and the core should be able
629- to work with the datalayer just as robustly (with typed objects) even if the
630- entire wire layer were removed.
623+ need to tease these apart. The interaction between core and datalayer should
624+ be in terms of core domain objects without the tight coupling to wire format
625+ that the vocabulary registry creates. This is not to say that the datalayer
626+ should be ignorant of data types or that the vocabulary registry should be
627+ abandoned, but rather that the datalayer should have its own way to
628+ recognize what kinds of objects it is handling and the core should be able
629+ to work with the datalayer just as robustly (with typed objects) even if the
630+ entire wire layer were removed.
631+
632+ ## VCR-019d is largely addressed by the ` transitions ` refactor
633+
634+ Although we've largely addressed VCR-019d through the ` transitions ` refactor,
635+ we should still do a sweep to identify any remaining procedural state logic that
636+ could benefit from using the newly created state machine factory functions
637+ in ` vultron.core.states.{em,rm,cs} ` and the state machines they enable.
0 commit comments