Skip to content

fix: rename validity system argument to category - #58

Merged
gipert merged 6 commits into
mainfrom
rename-system-to-category
Jul 13, 2026
Merged

fix: rename validity system argument to category#58
gipert merged 6 commits into
mainfrom
rename-system-to-category

Conversation

@gipert

@gipert gipert commented Jul 9, 2026

Copy link
Copy Markdown
Owner

The validity axis (phy/cal/lar/all…) was referred to by two different names depending on where you looked in catalog.py, even though it is a single concept. The serialized field and Catalog.get_files use category, but TextDB.on and Catalog.valid_for exposed the same thing as system, and the internal build_catalog/save_format/write_to code oscillated between the two.

They are genuinely the same axis, not two filters: build_catalog reads the label only from the file category field (system = props.get("category", "all")) and keys self.entries by it, while valid_for looks its system argument up in that same dict. "system" is never read from the data anywhere; it existed purely as a parameter/variable name.

This PR makes the whole validity API speak one name, category (the name users already see in their files and in get_files):

  • TextDB.on(..., category="all") and Catalog.valid_for(..., category="all").
  • Internal system/syst variables in build_catalog, get_dict_format, write_to, and Entry.save_format renamed to category.
  • Tests migrated to category=.

Backward compatibility

system= is kept as a deprecated keyword-only alias that emits a DeprecationWarning; positional callers are unaffected since the argument position is unchanged. Downstream code (e.g. pylegendmeta, legend-dataflow) keeps working, but should migrate system=category=; the alias can be removed in a future major release.

New tests cover the alias via pytest.deprecated_call().

Notes

Unrelated to this axis, detector/channel-map records may carry a data field literally named system (e.g. system: geds); Catalog never touches it, so it is untouched here.

gipert added 3 commits July 9, 2026 16:57
The validity-file schema key, `Catalog.get_files`, and the internal catalog
storage already use `category`, but `TextDB.on` and `Catalog.valid_for` exposed
the same concept as `system`. Rename the argument to `category` everywhere so
the whole validity API speaks one name.

`system=` stays as a deprecated keyword-only alias that emits a
DeprecationWarning, so existing keyword callers keep working; positional callers
are unaffected since the argument position is unchanged.
Add a project skill under .claude/skills documenting how to load, query, and
verify dbetto-format text databases with the TextDB / AttrsDict / Catalog /
Props API, plus a reference on validity files (modes, category resolution, the
legacy JSONL variant, and the low-level Catalog API).
Point Claude Code at the existing AGENTS.md contributor instructions via a
CLAUDE.md import directive, so both toolchains share one source of guidance.
@gipert

gipert commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@ggmarshall

gipert added 3 commits July 9, 2026 17:55
Add a `dbetto-tools` marketplace manifest (.claude-plugin/marketplace.json)
and a plugin manifest for the inspect-textdb skill, so the skill can be
installed from the remote repo without cloning it:

    /plugin marketplace add gipert/dbetto
    /plugin install inspect-textdb@dbetto-tools

The plugin reuses the existing .claude/skills/inspect-textdb folder as its
source. Validated with `claude plugin validate` and an end-to-end local
add/install/uninstall round-trip.
Extract the `system` -> `category` deprecation shim into a shared
`_resolve_category_alias` helper in catalog.py, reused by both
`Catalog.valid_for` and `TextDB.on`. Removes the duplicated block that
tripped pylint's duplicate-code check (R0801).
Drop the stale OpenAI Codex section and note that `nox -s lint` runs only
the pre-commit hooks, while PyLint (`nox -s pylint`) and the bare `nox` run
are what CI additionally enforces. Mypy is manual-stage and not run by lint.
@gipert
gipert merged commit 566f24e into main Jul 13, 2026
12 checks passed
@gipert
gipert deleted the rename-system-to-category branch July 13, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant