Skip to content

Check that a manifest's schema is a string before looking it up - #357

Merged
Deicyde merged 1 commit into
mainfrom
fix/publication-schema-must-be-a-string
Oct 17, 2026
Merged

Deicyde merged 1 commit into
mainfrom
fix/publication-schema-must-be-a-string

Conversation

@Deicyde

@Deicyde Deicyde commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Fixes a crash on main that cove-b9 reported on the board after #336; there is no issue for it. Opened at the user's request.

Problem

Since #336, every capture of the Lean sources asks whether each publication.json it finds marks a complete Autoform site, so it can skip rendered copies. _is_complete_publication looked the manifest's schema up in a set, which hashes it. A publication.json under the Lean root whose schema is a JSON object or array, such as another tool's manifest, raised TypeError: unhashable type instead of being treated as not ours. Every command that captures the sources crashed with a traceback. On main 619cc54, check --lean-root, audit and work all do.

Skeleton's guard against overwriting a foreign packet directory, _validate_managed_output, makes the same lookup on (kind, schema). A packet manifest.json with the right kind and an object or array schema crashed instead of being refused.

Change

Both checks now test that the schema is a string before looking it up, as _is_managed_output_manifest_bytes beside the first one already does. A publication.json with any other schema is not an Autoform publication, so its folder is captured like any other, and such a packet manifest is refused with the existing "refusing to overwrite non-Autoform packet output" error. A string schema behaves as before.

Tests

  • test_only_a_complete_publication_manifest_hides_its_folder (tests/test_lean_sources.py) gains an object schema and an array schema; both folders are captured.
  • test_a_packet_manifest_whose_schema_is_not_a_string_is_refused (tests/test_skeleton.py) checks both kinds of schema.
  • All three cases fail on main with the TypeError, and pass here.

Overlap

Merges cleanly with main (619cc54). Two open drafts make the same lookup on the lines next to these, so whichever lands second keeps both changes:

This machine is over the agreed load limit for local pytest runs. The tests were called directly in Python, and CI on this PR is the full run.

Since #336, every capture of the Lean sources asks whether each
publication.json it finds marks a complete Autoform site. That check
looked the manifest's schema up in a set, which hashes it, so a
publication.json whose schema is a JSON object or array raised
TypeError and crashed every command that captures the sources, such as
check --lean-root, audit and work. Skeleton's guard against overwriting
a foreign packet directory made the same lookup, and crashed instead of
refusing. Both now check that the schema is a string first, as the
managed-output check beside the first one already does.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 17, 2026
@Deicyde

Deicyde commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Verdict: ready to merge. This is the swarm's own PR, reviewed at head d5fdfbb. All its checks pass on the merge with current main (619cc54).

What was checked

  • The crash is real, and this fixes it. On main, a publication.json under the Lean root whose schema is a JSON object or array makes check --lean-root, audit and work crash with TypeError: unhashable type. On this branch all three run, and that folder is captured like any other.
  • Nothing else changes. A string schema takes the same path as before. Any other schema now means "not an Autoform publication", and in skeleton "refuse to overwrite". Before, a number or null already did; only an object or array crashed.
  • The tests pin it. The capture test gains an object schema and an array schema, and the new skeleton test refuses both. All three cases fail on main with the TypeError and pass here.
  • No other lookup has this shape. The other membership tests on parsed manifest values either check for a string first (_is_managed_output_manifest_bytes) or compare against a tuple (library/index.py).
  • Overlap. Scale roadmap inventories and the full DAG explorer #90 and the Show statement review on the site #217 stack edit the neighbouring lines and still make the same lookup; the description says how to keep both changes.

The machine's free memory was below the agreed limit for review agents, so this rests on my own review, which found nothing to change.

Posted by PR swarm: PR Swarm Lead

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

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant