Skip to content

entity-model tests don't verify any MongoDB entity — cardinalities rest on a one-time REPL run #66

Description

@lambduhh

Problem

entity_model_test.clj guards the JVM-heap entities (Library, Namespace, Var) and the EDN-file entity (DialectCompat) against the running system, but it never connects to MongoDB. Every Mongo entity in entity-attribute-model.edn — Example, ExampleHistory, Note, SeeAlso, User, LegacyVarRedirect — and all their cardinalities and coverage figures (examples 2671, see-alsos 2494, users 4902, editors 1708/2671, deleted-at 54/2671, …) rest solely on a one-time dev/sidecar_repl.clj run against a snapshot. They carry :status {:state :exists :verified "2026-06-09"} with the same confidence as the tested entities, and the test-ns docstring claims REPL-verified findings are "now permanently guarded" — which is only true for the in-process entities. These numbers will drift as the database changes and nothing catches it.

Steps to Reproduce

  1. Read the :require in test/clojuredocs/entity_model_test.clj — no congomongo, no DB connection.
  2. Note assertions exist only for search/clojure-lib, static, compat, api.common.
  3. Change any Mongo cardinality in docs/entity-attribute-model.edn (e.g. examples → 9999) and run lein test clojuredocs.entity-model-test.
  4. Observed: tests pass.
  5. Expected: a test fails when a documented Mongo cardinality no longer matches the database.

Context

The model's value is the reliability ratchet — REPL findings hardened into tests. That ratchet stops at the MongoDB boundary. Options: (a) a DB-backed test tier that runs against seed data (data/mongodb/) and asserts key-universe + cardinalities; (b) downgrade the Mongo entities' status to reflect that they are snapshot-derived, not test-guarded; (c) both. Surfaced while verifying the model for #43.

References

  • test/clojuredocs/entity_model_test.clj
  • docs/entity-attribute-model.edn — Mongo entities: example, example-history, note, see-also, user, legacy-var-redirect
  • dev/sidecar_repl.clj L114-125 (the one-time counts)
  • define an entity-attribute model for ClojureDocs #43

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions