Skip to content

bug: chkit pull includes ObsessionDB metadata tables #126

Description

@KeKs0r

Bug Description

chkit pull includes ObsessionDB metadata tables in generated local schema files. These are product/system metadata tables rather than customer/business tables and should not be emitted as schema definitions.

Observed table names:

  • metadata_folder
  • metadata_table_folder
  • metadata_table_tag

Impact

Generated local schema files can include non-business ObsessionDB metadata tables, which pollutes the schema and can lead to accidental drift/migration expectations for tables users do not own.

Investigation Notes

  • The pull plugin maps all introspected table-like objects into table(...) definitions.
  • packages/plugin-pull/src/index.ts calls the configured introspector and directly canonicalizes/renders every returned object.
  • There was no denylist for ObsessionDB product metadata tables before rendering.
  • A regression test can reproduce this with an introspector returning a normal events table plus the three metadata tables: the payload previously had definitionCount: 4 instead of 1 and the rendered content contained metadata table definitions.

Expected Behavior

chkit pull should exclude ObsessionDB metadata tables from generated schema output while preserving normal business tables, views, and materialized views.

Proposed Fix

Filter pull introspection results before rendering when the object is a table named:

  • metadata_folder
  • metadata_table_folder
  • metadata_table_tag

Verification

A local fix has been prepared with:

  • Regression test: packages/plugin-pull/src/index.test.ts — excludes ObsessionDB metadata tables from pulled schema output
  • Test/type/lint/build commands:
    • PATH=$HOME/.bun/bin:$PATH ~/.bun/bin/bun test packages/plugin-pull/src/index.test.ts
    • PATH=$HOME/.bun/bin:$PATH ~/.bun/bin/bun run --cwd packages/plugin-pull typecheck
    • PATH=$HOME/.bun/bin:$PATH ~/.bun/bin/bun run --cwd packages/plugin-pull lint
    • PATH=$HOME/.bun/bin:$PATH ~/.bun/bin/bun run --cwd packages/plugin-pull build

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions