Skip to content

Fix TypeError in reload's metafile resort path - #114

Merged
roed314 merged 1 commit into
roed314:masterfrom
roed-math:reload-metafile-resort
Jul 21, 2026
Merged

Fix TypeError in reload's metafile resort path#114
roed314 merged 1 commit into
roed314:masterfrom
roed-math:reload-metafile-resort

Conversation

@roed-math

Copy link
Copy Markdown

The resort branch of reload() (marked "using code from _reload_meta") indexed the metafile's csv row and the jsonb position tuple with column names:

idx = jsonb_idx[col]                 # jsonb_idx is a tuple of ints -> TypeError
resort = line["id_ordered"] == 't'   # line is a csv list -> TypeError

so every reload(metafile=..., resort=True) call crashed — including the default path where resort is inferred because the searchfile has no ids. The intent is positional lookup via meta_cols.index(col), the same idiom _reload_meta and the table_name_idx lookup two lines above already use.

Adds three regression tests (all raise TypeError on master, pass with the fix):

  • reload(metafile=..., resort=True) round-trip
  • reload of an id-less searchfile with a metafile (resort inferred)
  • a malformed metafile (id_ordered not t/f) now raises the intended RuntimeError instead of TypeError

Full local suite: 562 passed, 12 skipped against PG18.

🤖 Generated with Claude Code

The resort branch of reload() indexed the metafile's csv row and the
jsonb position tuple with column names: jsonb_idx[col] and
line["id_ordered"] both raise TypeError, so every
reload(metafile=..., resort=True) call crashed.  Use
meta_cols.index(col) to get the positions, as _reload_meta does.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roed314
roed314 merged commit aace495 into roed314:master Jul 21, 2026
16 checks passed
roed-math pushed a commit to roed-math/psycodict that referenced this pull request Jul 22, 2026
Rebased onto main, which absorbed everything this PR used to anticipate;
the reconciliation:

- Version: 1.0.0 is now set in psycodict.__init__.__version__, the single
  source of truth roed314#121 established -- pyproject keeps main's dynamic
  version, SPDX license string and >=3.9 floor, and this PR's classifiers
  drop the License:: entry (setuptools >= 77 rejects it next to an SPDX
  string) and the 3.8 entry.

- README: the rewrite now carries the Versioning.md pointer (roed314#123) in its
  Documentation list, which switches to relative links -- on the Sphinx
  site (roed314#122) those resolve to the copied guide pages, and they still
  render on GitHub; CHANGELOG and LICENSE stay absolute since neither is
  on the site.  Supported Python is 3.9+; blob/master URLs become
  blob/main.

- CHANGELOG: entries for the late wave -- sum/random honoring saving
  (roed314#118) and the 3.9 floor (roed314#121) under breaking changes; the docs site
  (roed314#122), Versioning.md/CONTRIBUTING/SECURITY and __version__ (roed314#121)
  under added; reload metafile+resort (roed314#114), update_from_file stats
  publication (roed314#115), copy_dumps delimiter escaping (roed314#116) under fixed;
  config.ini untracking (roed314#120), this release workflow and CITATION.cff
  (roed314#124) under infrastructure.

- release.yml: the flow notes now say bump __init__.__version__ and merge
  to main.

- Fixes the docs build on main, broken by the roed314#119 x roed314#122 crossing (roed314#119
  merged after roed314#122's last CI run): the Configuration docstring's nested
  defaults list needed blank lines to be valid RST under autodoc, and the
  README's relative LICENSE link had no target on the site.

Suite 857 passed / 36 skipped; ruff clean; sphinx -W clean; python -m
build + twine check --strict pass with Version 1.0.0,
License-Expression GPL-2.0-or-later, Requires-Python >=3.9 and no
License classifier in the wheel metadata.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants