Skip to content

bug: concept_aliases missing from ALLOWED_TABLES in CLI — table is unqueryable via raw_query #201

@yibeichan

Description

@yibeichan

Problem

cli/schist/sqlite_query.py:9 defines the set of tables the CLI permits in raw_query calls:

ALLOWED_TABLES = {'docs', 'concepts', 'edges', 'docs_fts', 'paper_metadata'}

The concept_aliases table (defined at cli/schist/schema.sql:111-118) is absent. Any CLI query targeting that table is rejected at validation time:

Error: table "concept_aliases" is not allowed (allowed: concepts, docs, docs_fts, edges, paper_metadata)

concept_aliases was added to the schema independently of ALLOWED_TABLES. The MCP tool add_concept_alias (mcp-server/src/sqlite-reader.ts:702-728) can write alias rows, but there is no supported path for CLI users to read them back.

File:line references

  • cli/schist/sqlite_query.py:9ALLOWED_TABLES constant missing concept_aliases
  • cli/schist/sqlite_query.py:188-192 — table-allowlist check that rejects the query
  • cli/schist/schema.sql:111-118concept_aliases table definition

Why it matters

The add_concept_alias MCP tool is the primary way to record canonical-slug redirects. Operators and agents who want to audit, inspect, or cross-reference aliases via the CLI (e.g. schist query "SELECT * FROM concept_aliases") get a hard error with no obvious workaround. The discrepancy between what the MCP layer can write and what the CLI layer can read is confusing and blocks legitimate diagnostic queries.

Suggested fix

Add 'concept_aliases' to ALLOWED_TABLES in cli/schist/sqlite_query.py:9:

ALLOWED_TABLES = {'docs', 'concepts', 'edges', 'docs_fts', 'paper_metadata', 'concept_aliases'}

Also add a comment noting the table to keep in sync with schema.sql (analogous to the existing REQUIRED_TABLES comment on line 10).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions