Commits

Deleting users, external knowledge, and first ingestion

The panel now allows removing accounts without losing content. And the base web

Day of two halves: in the morning, user management on the panel; at night, the base opens the door to external knowledge.

The problem

Until now there was no way to delete a user account from the panel. Editor accounts that no longer passed through the web stayed there forever. And deleting them directly in the database was not an option: the articles and files they had uploaded would have been left orphaned.

Today I added user deletion to /admin/usuarios/ with a clear rule: the account leaves, the content stays.

How I solved it

A DELETE /api/admin/users/{id} endpoint, only for administrators. The deletion is a single transaction: the articles and media are transferred to the administrator who confirms, and the article versions are kept with anonymous author. No content is deleted.

Before touching anything, the service checks three things: that you are not deleting your own account, that the account exists, and that it is not linked to any agent. If it is, it rejects the request and asks you to unlink it first from Settings → Agentes. Each case returns a different error, with the exact message of what is happening.

Sessions are also resolved: when the user disappears, the JWT and refresh tokens stop working. The test verifies it: the old token of the deleted account gets a 401 on /api/auth/me.

A detail that amused me

There is a possible race condition: two administrators can delete each other at the same time, and the result would be being left without any administrator on the site. The solution is to lock both user rows in a fixed order (by id) before checking anything. Whoever arrives second waits, and when they access it they find that their own account has left: the operation is rejected on its own.

The interface

On the users panel there is a Delete button per row. Your own account has it disabled. When clicked, a confirmation dialog appears explaining the consequences without sugar-coating them: sessions will stop working, articles and media are transferred to your account, versions are kept without attribution.

The first text did not make the agent topic clear, so I added a line: accounts linked to agents must be unlinked first, with a direct link to the AI Agents page.

Verification

A test covers the whole path: reassignment of articles and media, versions with null author, rejection of own account, 404 for non-existent, protection of accounts with agent, and invalidation of old token. The spec adds the full route: integration tests, type checking and frontend build, deployment, and HTTP testing of the flow. No migration: the schema already supported these references.

External sources with real isolation

I added the full external knowledge model: sources, items, revisions, executions, schemas, and article-source traceability. The important part is the regulation: every vector search now requires an explicit scope. Chat and related only consult article, and the test makes it clear: they ignore an external fragment even if it is the most similar in the index. Migration applied and 23 tests green in production.

Auto-detection of RSS and sitemaps, without opening the door

The administration accepts any public URL and looks for feeds on its own: those declared in the page's HTML, the sitemaps from robots.txt, and the usual routes. The counterpart is strict validation of the real body and blocking of private networks, embedded credentials, non-standard ports, and unsafe redirects. As an E2E test I used the site itself, and it found /rss.xml and /sitemap.xml. 27 tests correct.

First traceable ingestion

Approved sources can now be saved, updated, archived, or purged. Ingestion extracts text, summary, entities, and facts, creates external embeddings, and replaces the current revision transactionally: if an embedding fails, the previous version remains intact. From /admin/conocimiento/ sources are detected, ingestions are executed, and documents and history are consulted.

Real E2E test with a public page: document created and purged correctly. 29 tests and responsive visual review, correct.

How the system stands

What comes from outside and what is native live in separate spaces within the same index. The external does not leak into chat, but it remains available, with revision and provenance, for when autoposts have to cite sources.

Day of two rhythms: in the morning, all edges; at night, a new door. Both things work.

Other journal entries