Skip to content

feat(ogar-doc-ir): two-axis resolved projection (SlotOutcome::Grid) + typst emit_grid - #307

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/brave-mayer-65y3cy
Sep 23, 2026
Merged

AdaWorldAPI merged 1 commit into
mainfrom
claude/brave-mayer-65y3cy

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Why

resolve_slot could only produce flat (label, value) rows. That leaves no lawful way to project an object that is addressed by two coordinates, such as an aggregate/pivot result, a cross-tab, or a matrix-shaped measurement:

  • u8 rail positions cannot address those coordinates;
  • folding the second axis into labels loses information.

The first consumer is a lance-graph report result embedded in a composed document through an ordinary ObjectSlot.

What

  • resolve.rs gains three things. It is still behind the classview feature, so the default build is unchanged.
    • ResolvedGrid { rows, columns: GridAxis { keys, labels }, measures, cells }, with cells stored row-major.
    • A SlotOutcome::Grid { class, grid } variant.
    • An optional DocObjectSource::grid_of(key, view) -> Option<ResolvedGrid> that defaults to None. Every existing source is untouched.
  • Where grid_of sits in resolution. It is consulted after the existing root-class agreement gate. A malformed grid fails closed, to the fallback or to Unresolvable, never to a half-rendered table.
  • Orientation is the view's choice. Two slots can name the same target through two views. They present the same cells rotated, and nothing about the object is copied into the DocCompose.
  • Traceability. Axis keys keep the canonical coordinates, so a rendered cell can be traced back to its aggregate coordinate.
  • ogar-render-typst gets emit_grid beside emit_field_view.
  • The dual_render test walker handles the new arm.
  • DOCIR-COMPOSITION-LAYER.md §8 gets a dated note: the doctrine's Table arm is realized at the resolve layer. DocNode is unchanged (§3: a table is an object reached through a slot), so there is no doc-compose.v2 bump. The askama-side FieldView::Table widening is still unbuilt.

Tests

cargo test -p ogar-doc-ir --features classview -p ogar-render-typst passes: 30 + 6 + 2 dual-render. Clippy -D warnings is clean.

New tests:

  • a grid view resolves to a Grid, and the same object through a non-grid view still walks the rails (the stay-silent twin);
  • a malformed grid fails closed;
  • a grid view aimed at an object of another class is Unresolvable, because the class gate still applies;
  • emit_grid layout, including the transposed input.

Disable check: making resolution ignore grid_of fails 2 of the new tests.

Companion

lance-graph claude/brave-mayer-65y3cy adds lance-graph-report-ogar, which implements DocObjectSource::grid_of for report results.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DCEP2fZdHYdMCtcEVcTpS2


Generated by Claude Code

… typst emit_grid

The ObjectSlot resolver could only emit flat (label, value) rows, so an
object addressed by TWO coordinates (an aggregate result, a cross-tab, a
matrix-shaped measurement) had no lawful projection: u8 rail positions
cannot address its coordinates and folding the second axis into labels is
lossy.

- resolve.rs: `ResolvedGrid` { rows, columns: GridAxis{keys, labels},
  measures, cells (row-major) }, `SlotOutcome::Grid`, and an optional
  `DocObjectSource::grid_of(key, view) -> Option<ResolvedGrid>` defaulting
  to `None` (every existing source is unchanged). Consulted only after the
  root-class agreement gate; a malformed grid fails closed.
- Orientation is the VIEW's: two slots naming one target through two views
  present the same cells rotated; nothing about the object is copied into
  the composition. Axis keys keep canonical coordinates for back-trace.
- ogar-render-typst: `emit_grid` beside `emit_field_view`.
- dual_render test walker handles the new arm.
- DOCIR-COMPOSITION-LAYER.md §8: dated note recording where the doctrine's
  Table arm was realized (resolve layer; DocNode unchanged, no v2 bump).

Tests: 3 new resolver tests (grid resolves + non-grid view still walks
rails; malformed grid fails closed; class gate still applies) and one
emit_grid test. Disable-verified: bypassing grid_of fails 2 of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCEP2fZdHYdMCtcEVcTpS2
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 0601f1c5-681b-4727-8b35-b7a280e9d6da

📥 Commits

Reviewing files that changed from the base of the PR and between 7c6ddba and d85a9c7.

📒 Files selected for processing (4)
  • crates/ogar-doc-ir/src/resolve.rs
  • crates/ogar-render-typst/src/lib.rs
  • crates/ogar-render-typst/tests/dual_render.rs
  • docs/DOCIR-COMPOSITION-LAYER.md
 _________________________________________________________________
< This PR is a classic: 'small change' with 'large consequences'. >
 -----------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Sep 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_0ac85351-4f85-4169-acab-80edec43deb4)

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review September 23, 2026 18:23
@AdaWorldAPI
AdaWorldAPI merged commit 2264f18 into main Sep 23, 2026
4 of 5 checks passed
@cursor

cursor Bot commented Sep 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_b3923e76-14e7-44bf-b5c5-030c81741709)

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