Friction log: Medintel¶
Medintel
is the reference app for the large-app roadmap:
trees, per-user grants, taxonomies, aggregates, saved charts, cross-model
search, both sign-in methods, the terms gate, markdown fields, navigation
from data, import and export, on synthetic data. It was built from
karni.yaml with karni build, and the project wrote only what the spec
could not say. Each entry below is a place where it had to opt out, work
around Karni or do without a feature. The file and line are in the example
at the commit that adds this page. This log is the input for the next
roadmap.
Fixed while building (each has its own commit):
karni seed --resetfailed on a tree, becauseparentprotects its children. It now deletes a tree leaves first (e033766e).assert_crud's list check looked at the first page only, so the generated tests failed on a seeded table. It now follows the pages (a9f53cec).
Open entries:
The spec cannot say what the model needs¶
on_deletehas no spec key.karni.yamlwrites everyfk:asCASCADE, andkarni checkthen warnsW965for an audited or financial model. The project declaresclass Karni: cascade = {...}with a reason for Trial.sponsor, Deal.acquirer and Deal.seller (intel/models.py:45,intel/models.py:59). Why: the spec maps tokarni make model, which has no flag for it. Belongs to the app spec (not a large-apps item). New issue: addon_delete: protect|set_null|cascadeto a relation's mapping form ({type: fk:Company, on_delete: protect}), and makekarni buildwrite thecascadereason for a deliberate cascade.keysets the import key, not the natural key. An export names a relation by the target's natural key, which is only a unique slug, char or email field. Company, Brand, Condition and Intervention havekey:but no unique column, so exports and imports named them by UUID. The project setsnatural_keyby hand (intel/models.py:12,:23,:34,:52). The spec also has no way to say a text field is unique, so the key is not a constraint (karni.yaml:23,:31,:43,:98). Belongs to the app spec and import and export. New issue:keyalso writesnatural_key, and a field type takes:uniquefor text as it does foremail.- No label for a row. The generated
__str__is the first field. For a tree whose first field is a code, facet counts and tree labels showedC6.1.1. The project overrides__str__(intel/models.py:15,:26). Belongs to the app spec. New issue:label: nameon an entity, written as__str__and used for the natural label in the UI. - No index key for a searched field.
search: [name, title]on Person raisedW967(no index coverstitle). The project droppedtitlefromsearch(karni.yaml:61). Belongs to the app spec. New issue: anindexlist on an entity, orsearchadding the index itself.
The scaffold and the build leave manual steps¶
karni newwrites an absolute path for@karni/uiinfrontend/package.jsonwhen run from a checkout, so the lockfile is not portable. The project changed it tofile:../../../packages/karni-ui(frontend/package.json:19). Belongs to the scaffold. New issue: write a path relative to the project when the checkout is reachable from it.karni add chartsdoes not add@karni/charts-ui. The page that draws a saved chart needs it, andkarni buildprinted no step for it. Added by hand (frontend/package.json:20). Belongs to the modules (saved charts). New issue: a module that ships a UI package adds it tofrontend/package.jsonand says so.- The menu from data needs a hand edit of the layout.
navigation:in the spec writesKARNI_NAVIGATION, butfrontend/src/layout.tsxstill renders the static routes untilnavSource="server"is added (frontend/src/layout.tsx:38). Belongs to large-apps item 13 (navigation). New issue:karni build(or the scaffold whennavigationis set) writes the prop. - A
codepage needs a hand-written route. The spec listsinsights,players,deals-chart,searchandloginascode, so the menu links to them, andkarni checkfails withE533until the routes exist. They are written by hand (frontend/src/routes.tsx:69to:73). Belongs to the app spec. New issue:karni buildwrites a route and an empty page file for acodepage, and leaves it alone afterwards. - A navigation entry for a
codepage requires only sign-in withnavigation: true, so a customer with no deal grant saw the deals chart link. The project lists the entries withrequires(karni.yaml:142to:144). Belongs to large-apps item 13. New issue: acodepage takesrequiresinpages, sonavigation: trueis enough. - The Google client id has no default. The settings block reads
env.list("KARNI_SOCIAL_GOOGLE_CLIENT_IDS"), so every command,karni checkand the firstkarni buildincluded, fails until it is in.env(config/settings.py:41). The project put a placeholder in.env.exampleand the CI job. Belongs to large-apps item 1a. New issue: writedefault=[]and let startup validation report an empty list as a problem only when a request needs it, or havekarni buildadd the line to.env.example. - The deprecated cache header warns in a fresh app. A project with
api_cacheon gets theX-Karni-Cachedeprecation warning in its first test run. The project setsKARNI_API_CACHE_LEGACY_HEADER=False(.env.example:156). Belongs to large-apps item 9. New issue: the scaffold writes that line, since a new project reads no old header.
Seeding and tests¶
- Seeding a tree needs hand-written code. The seeder plants a fixed
nested tree with short codes (
intel/seeds.py:64). The generated seeders infer random rows, which would give a flat or random hierarchy. Belongs to large-apps item 14 (seeding). New issue: aseed:form for a tree entity that takes a nested outline. - Grants cannot be seeded from the spec.
KARNI_SEED_LOGINScreates users with roles only, so the per-user grants of the demo customers are a seeder ofUserGrant(intel/seeds.py:145). Belongs to large-apps item 6. New issue:KARNI_SEED_LOGINStakes grants, orkarni.yamltakes aseed_grantslist. --resetdoes not wipe a module's table orUserGrant. A secondkarni seed --resetfailed on the saved chart's unique slug and doubled the grants, so both seeders clean up after themselves (intel/seeds.py:153,:167). Belongs to large-apps item 14. New issue:--resetwipes every model a seeder names.- No test helper for ID tokens. The tests need a signing key and a
fake key-set fetcher, and Karni's own copy lives in its test tree
(
tests/idtokens.py, 33 lines here). Belongs to large-apps item 1a. New issue:karni.testing.id_tokenswithmint()and the fetcher. - Reading a sign-in code in a test takes three settings and a fixture.
The in-memory backend, the on-commit capture and a lookup in its outbox
(
tests/test_sign_in.py:32). Belongs to large-apps item 1b. New issue: akarni.testing.last_login_code(email)helper. -
Importing 300 unchanged rows took 16 seconds (PostgreSQL, a busy laptop), with markdown columns and two tags per row (
tests/test_transfer.py:57). A preview and a commit each validate every row through the serializer. Belongs to import and export. New issue: measure the import per row on a model with taxonomies, and skip the second validation when the preview's rows are stored. -
The settings block breaks the project's own lint.
karni buildwritesfrom karni.conf import envin the middle ofconfig/settings.py, so ruff reportsE402there (config/settings.py:31). The block is Karni-owned, so the project cannot add anoqa. Belongs to the app spec. New issue: write the import above the block, or a# noqa: E402. karni planalways reports a navigation change. After a successfulkarni build,karni build --dry-runstill lists~ navigation: home, Trial, ...as a change, with a grouped menu that hasrequiresentries (karni.yaml:137to:146). Nothing is written, so it is noise, but it hides a real change. The cause was not tracked down. Belongs to large-apps item 13. New issue: make the plan compare the menu it would write with the menu in the settings.
Missing features¶
- A tree cannot be scoped to its granted subtree. A customer sees every
node of Condition and Intervention (their read is
authenticated), and only the rows under their nodes.tree:<path>needs a relation, so a tree has no scope over itself.TreeView'saccessgreys the other nodes in the UI, but the API lists them (karni.yaml:27,:35). Belongs to large-apps item 5. New issue: atree:selfscope that reads a tree's own rows under the granted nodes plus their ancestors. - No Google sign-in helper in
@karni/ui.SocialButtontakesgetIdToken, and each app writes the script loader and the One Tap call (frontend/src/google.ts, 38 lines). Belongs to large-apps item 1a. New issue:loadGoogleIdToken(clientId)in@karni/ui, which loads no SDK until it is called. - A grant on one tree and a grant on another are a union. An analyst
granted Oncology and Biologics sees a trial in either, which is what the
customer asked for, but the spec cannot say "both". Documented in the
README and tested (
tests/test_grants.py). Belongs to large-apps item 7. New issue: anall_ofform for tree grants if a project needs it.