refactor(core): split typed_api.rs and move its inline tests out

Offen
#460 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Refactoring
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust

Rechercherichtung

Start with aimdb-core/src/typed_api.rs and its inline tests, then inspect aimdb-core/src/typed_record.rs and aimdb-core/src/session/client.rs to understand the module conventions and feature gates. Split the typed API concerns into the suggested modules, preserve public paths, and reorganize the tests around shared mocks; assess whether typed_record's gated blocks can use internal helpers. Done when the files are easier to navigate and the refactor introduces no behavior change.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

🏗️ core enhancement

Problem

A few aimdb-core modules have grown well past the size where they are easy to navigate or review.

  • aimdb-core/src/typed_api.rs — 3,748 lines. The non-test part (lines 1–1783) holds five separate concerns: Producer<T> (104), Consumer<T> (226), RecordRegistrar (468), OutboundLinkBuilder (917) and InboundLinkBuilder (1241). The remaining ~1,960 lines are one inline mod tests containing five hand-written mock trait impls whose methods are unimplemented!("not needed for … tests") (lines 1837, 1861, 2968, 3062, 3261).
  • aimdb-core/src/typed_record.rs — 1,726 lines, 54 cfg(feature …) gates, the highest gate density in the workspace, plus four #[allow(unused_mut)] (858, 1167, 1203, 1279) that exist only because of those gates.
  • aimdb-core/src/session/client.rs — 1,685 lines (tests from line 1013).

Suggested work

  1. Turn typed_api.rs into a typed_api/ module: producer.rs, consumer.rs, registrar.rs, link_outbound.rs, link_inbound.rs, re-exported from mod.rs so the public paths do not change.
  2. Move the inline tests into per-concern test modules and share one mock connector/runtime between them instead of five partial mocks.
  3. For typed_record.rs, look at whether the gated blocks can be grouped behind a small number of internal helper functions so the unused_mut allows disappear.

No behaviour change intended; purely a move/re-organise refactor.

Notes

Line numbers are from the tree at d9c7be0. Sizes were measured with wc -l; the split points are the first top-level #[cfg(test)] in each file.

Vorherrschende Sprache
Rust
Sterne
101
Forks
20
Ø Merge
2 Std. 33 Min.
Gemergte PRs (30 T.)
90

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus aimdb-dev/aimdb

Alle Issues in aimdb-dev/aimdb

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.