8000 fix(postgres): give a host's row-count catalog its views' keys by colinhacks · Pull Request #126 · colinhacks/reylo · GitHub
[go: up one dir, main page]

Skip to content

fix(postgres): give a host's row-count catalog its views' keys - #126

Merged
colinhacks merged 2 commits into
mainfrom
catalog-view-keys
Oct 26, 2026
Merged

colinhacks merged 2 commits into
mainfrom
catalog-view-keys

Conversation

@colinhacks
@colinhacks colinhacks commented Oct 26, 2026 •
Copy link
Copy Markdown
Owner

A Rust host that runs the row-count proof itself asks postgres::catalog() for the catalog of the relations a statement reads. Since #105 an analysis pins a read by key through a view, reading the view's defining statement and the keys of the tables it reads, but catalog() gathered neither, so such a host never pinned one.

  • catalog() now reads the relations' columns as an analysis does, follows each view among them (a view over a view too) with the analysis's own viewed, and merges the keys of the tables they read.
  • viewed dropped each prefetch it issued, and which list a relation was asked in turned on how many views were known yet, so a round could settle with a view over a view still unread. It now answers only once every prefetch is answered, for catalog() and the analysis alike.
  • A unit test drives catalog() over a view of a view, and over two views whose chains meet, and proves a read by key through them is at most one row, and a read by another column is not.
  • packages/postgres/engine.wasm is rebuilt; the Postgres oracle cases pass unchanged.

Copilot AI balanced review requested due to automatic review settings October 26, 2026 19:14
@vercel
vercel Bot commented Oct 26, 2026 •
Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reylo Ready Ready Preview Oct 26, 2026 7:29pm UTC

Request Review

Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues. One edge case where the catalog settles early, inline.

Reviewed changes

I reviewed the change that makes postgres::catalog() follow views the same way the analysis does.

  • catalog() reads views: it prefetches the relations' columns, follows each view (a view over a view too) with Engine::viewed, asks catalog_rows for the tables those views read, merges their keys with merge_keys and sets catalog.views. This matches the analysis path at postgres.rs:696-742.
  • Unit test: the_row_count_catalog_reads_a_view_by_the_keys_its_statement_keeps checks a read by key through a view of a view (at most one row) and a read by another column (not bounded). I ran it locally and it passes.
  • engine.wasm: rebuilt for the new Postgres fingerprint.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread engine/postgres/src/postgres.rs Resolved
A host that runs the row-count proof itself asks catalog() for the
relations a statement reads. Views among them came with no defining
statement and none of the keys of the tables they read, so a read by key
through a view was never pinned, as an analysis pins it since #105.
viewed dropped each prefetch it issued, and which list a relation was
asked in turned on how many views were known yet, so a round could
settle with a view over a view still unread: a read by key through it
went unpinned. It now answers only once every prefetch is answered.
@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. The early-settle case is fixed.

Reviewed changes

I reviewed 6aec1ca, which makes Engine::viewed wait until every prefetch it issued has an answer.

  • viewed returns Lazy<…>: it now returns None while any prefetch(&unread) is still unanswered, instead of dropping that result. The replay still converges, because the set of known views only grows each round. Once every view is known, the traversal and its prefetch lists stay the same from round to round.
  • Both callers wait on it: catalog() uses ?, and run() adds viewed to its let … else { return None } guard. As a result, the analysis no longer settles with a nested view still unread.
  • Regression test: the catalog test now settles the a_v / c_v → x → y → todos layout to all four views, and checks that a read by key through c_v returns at most one row.
  • engine.wasm: rebuilt.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@colinhacks
colinhacks merged commit 2804d43 into main Oct 26, 2026
7 checks passed
@colinhacks
colinhacks deleted the catalog-view-keys branch October 26, 2026 19:35
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

0