Skip to content

Fix create_archive: operator precedence, malformed zip bytea literals, repo scoping - #68

Merged
seanwevans merged 2 commits into
mainfrom
claude/fix-create-archive
Jul 5, 2026
Merged

seanwevans merged 2 commits into
mainfrom
claude/fix-create-archive

Conversation

@seanwevans

Copy link
Copy Markdown
Owner

Summary

create_archive errored on every call, in two different ways depending on the format.

Bugs fixed

  • tar — operator precedence. tf.path || '/' || e->>'name' parsed as (tf.path || '/' || e) ->> 'name' because || binds tighter than ->>, raising operator does not exist: text ->> unknown. Parenthesized the accessor.
  • zip — malformed bytea literals. The header/footer literals '\x50\x4B\x03\x04' repeat the \x prefix; PostgreSQL's bytea hex input takes a single \x prefix followed by all hex digits, so it rejected them with invalid hexadecimal digit: "\". Use '\x504B0304' / '\x504B0506'.
  • Cross-repo matching. The tree-ish resolution, recursive tree walk, and blob join weren't scoped by repo_id; they now are, and the archived columns are qualified via their table aliases.

Tests

test/sql/archive_test.sql (5 assertions): tar output is non-empty, embeds both file paths, and works with an explicit commit; the zip archive begins with the PK\x03\x04 signature. Wired into the core suite.

Verification

make test-core — PASS (full suite green against PostgreSQL 16).

🤖 Generated with Claude Code


Generated by Claude Code

claude and others added 2 commits July 5, 2026 15:43
…ping

create_archive errored on every call:

- tar path: `tf.path || '/' || e->>'name'` parsed as
  `(tf.path || '/' || e) ->> 'name'` because || binds tighter than ->>,
  raising "operator does not exist: text ->> unknown". Parenthesized the
  accessor.
- zip path: the header/footer bytea literals '\x50\x4B\x03\x04' repeated the
  \x prefix, which the bytea hex input format rejects as "invalid hexadecimal
  digit". Use single-prefix literals ('\x504B0304' / '\x504B0506').

Also scope the tree-ish resolution, tree walk and blob join to the target
repository (they previously matched objects across all repositories), and
qualify the archived columns via their table aliases.

Add test/sql/archive_test.sql covering tar output (non-empty, embeds file
paths, explicit-commit form) and the zip PK signature. Wired into the core
suite.
@seanwevans
seanwevans merged commit c58e60b into main Jul 5, 2026
2 checks passed
@seanwevans
seanwevans deleted the claude/fix-create-archive branch July 5, 2026 16:04
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