Skip to content

EDH-330 add Passepartout output planner - #2

Merged
edhor1608 merged 1 commit into
mainfrom
feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions
May 24, 2026
Merged

edhor1608 merged 1 commit into
mainfrom
feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions

Conversation

@edhor1608

@edhor1608 edhor1608 commented May 21, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Documentation

    • Updated branch notes and experiment README to describe no-upscale behavior, portrait-fit expectations, and oversized-border clamping.
  • New Features

    • Planner now clamps impossible/oversized borders to avoid underflow, preserves images smaller than the content box, and fits portrait sources proportionally.
  • Tests

    • Added fixtures for no-upscale, portrait-fit, and oversized-border cases; expanded fixture assertions to validate final content dimensions.

Review Change Stack

@linear-code

linear-code Bot commented May 21, 2026 •

Copy link
Copy Markdown
EDH-330 Passepartout: Expand planner to no-upscale output decisions

Source

https://linear.app/edhorsagents/document/prd-zero-sense-multi-experiment-bench-edf4de601568

Branch: feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions

Commit: dcff6fa

What to build

Extend the Passepartout experiment from basic orientation and content-box selection into a fuller output planner that accounts for no-upscale behavior and max-canvas constraints. The slice should still avoid media processing and should remain demoable through the Zero check gate plus documented planner cases.

Acceptance criteria

  • The planner represents input dimensions, chosen ratio, max canvas, border size, and planned content box as one coherent output decision.
  • The planner handles no-upscale behavior for images smaller than the target canvas.
  • The planner keeps landscape, portrait, square, and border behavior from the fixture harness intact.
  • The README explains which parts are intended to be portable back to Passepartout and which media-processing concerns remain out of scope.
  • sh scripts/check.sh passes.
  • sh scripts/graph.sh experiments/passepartout-layout-planner shows the public surface remains small.

Verification

  • sh scripts/test-passepartout-planner-fixtures.sh
  • sh scripts/check.sh
  • sh scripts/graph.sh experiments/passepartout-layout-planner
  • sh scripts/test.sh

Stack / PR status

Stacked above EDH-328 in the Passepartout stack. Implementation is complete locally, but Graphite PR submission is blocked by EDH-335 because this checkout has no Git remote configured and Graphite cannot infer the GitHub owner/name.

Review in Linear

@coderabbitai

coderabbitai Bot commented May 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@edhor1608, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 4 reviews/hour. Refill in 8 minutes and 14 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f282ad41-5c97-4b11-ab9e-38e51fe062c4

📥 Commits

Reviewing files that changed from the base of the PR and between c9cd8cf and 283f3f3.

📒 Files selected for processing (4)
  • docs/branch-knowledge.md
  • experiments/passepartout-layout-planner/README.md
  • experiments/passepartout-layout-planner/src/main.0
  • tests/passepartout-planner-fixtures.test.mjs
📝 Walkthrough

Walkthrough

Adds integer aspect-ratio fitting helpers content_w/content_h that derive final content dimensions from content_max_w/content_max_h and return 0 for invalid or clamped boxes; extends and adds fixtures (border_fixture, small_no_upscale_fixture, portrait_fit_fixture, oversized_border_fixture), updates main() to include them, expands the JS fixture test to run the new fixture, and updates README and branch notes to document the changes.

Possibly related issues

  • EDH-328: Same experiment harness and fixture-driven planner introduced in EDH-328; this PR continues that work by adding fixture cases and sizing assertions.
  • EDH-330: Implements no-upscale behavior, proportional fitting, and oversized-border clamping described by EDH-330.

Possibly related PRs

  • edhor1608/passepartout#57: Updates passepartout layout math for border and inner/content dimensions; the new content_w/content_h expectations in this PR track the same core layout computations.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'EDH-330 add Passepartout output planner' directly reflects the main change—adding a Passepartout output planner as described in EDH-330.
Linked Issues check ✅ Passed All acceptance criteria from EDH-330 are satisfied: planner represents output decision surface [✓], implements no-upscale behavior [✓], preserves source aspect ratio [✓], maintains landscape/portrait/border behaviors [✓], stays free of media processing [✓], documents scope [✓], and verification commands pass [✓].
Out of Scope Changes check ✅ Passed All changes are scoped to the Passepartout planner implementation and its test fixtures, documentation, and README—directly aligned with EDH-330 objectives with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

These MCP integrations need to be re-authenticated in the Integrations settings: Linear


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

edhor1608 commented May 21, 2026 •

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dcff6fa700

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread experiments/passepartout-layout-planner/src/main.0 Outdated
@edhor1608
edhor1608 force-pushed the feature/edh-328-passepartout-add-planner-fixture-harness branch from e4ea580 to fab5a58 Compare May 21, 2026 15:46
@edhor1608
edhor1608 force-pushed the feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions branch from dcff6fa to 403157c Compare May 21, 2026 15:46

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@experiments/passepartout-layout-planner/src/main.0`:
- Around line 66-79: The plan_output function currently calls content_box with
the raw border_px which can make border_px*2 exceed the selected export spec max
dimensions and produce invalid content_w/content_h; update plan_output (after
calling select_export_spec) to validate and clamp/reject border_px so that
border_px*2 <= spec.max_w and border_px*2 <= spec.max_h (e.g., set border_px =
min(border_px, spec.max_w/2, spec.max_h/2) or return an error), then call
content_box with the validated border_px and compute content_w/content_h from
that safe box; ensure references to OutputDecision, select_export_spec,
content_box, content_w, content_h and border_px are preserved.

In `@tests/passepartout-planner-fixtures.test.mjs`:
- Around line 44-85: The test currently reimplements fixture logic in
fixturePasses and asserts its own JS computation instead of running the actual
planner fixtures; remove or stop using fixturePasses and instead invoke the
planner/fixtures runtime (e.g., call the existing fixture script or execute the
planner with target fixtures via zeroJson/graph execution) to get real runtime
outputs, then assert those outputs match expected values; keep the metadata
checks that functionsByName.get(name)?.returnType === "Bool" but replace
fixturePasses(...) assertions with assertions against the actual fixture
execution results for "landscape_fixture", "portrait_fixture", "square_fixture",
"border_fixture", and "small_no_upscale_fixture" (use
selectExportSpec/planOutput outputs produced by the planner runtime to form the
expected values).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 02c500c2-9cd4-4c67-8a44-fa88e5e0d07b

📥 Commits

Reviewing files that changed from the base of the PR and between dcff6fa and 403157c.

📒 Files selected for processing (2)
  • experiments/passepartout-layout-planner/src/main.0
  • tests/passepartout-planner-fixtures.test.mjs
📜 Review details
🔇 Additional comments (3)
experiments/passepartout-layout-planner/src/main.0 (2)

19-36: LGTM!


93-142: LGTM!

tests/passepartout-planner-fixtures.test.mjs (1)

87-109: LGTM!

Comment thread experiments/passepartout-layout-planner/src/main.0 Outdated
Comment thread tests/passepartout-planner-fixtures.test.mjs Outdated
@edhor1608
edhor1608 force-pushed the feature/edh-328-passepartout-add-planner-fixture-harness branch from fab5a58 to 5ed2479 Compare May 21, 2026 15:57
@edhor1608
edhor1608 force-pushed the feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions branch 3 times, most recently from 435275e to 22febac Compare May 21, 2026 16:10
@edhor1608
edhor1608 force-pushed the feature/edh-328-passepartout-add-planner-fixture-harness branch from 5ed2479 to a7d38e3 Compare May 21, 2026 16:10

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/branch-knowledge.md`:
- Line 29: Update the sentence in docs/branch-knowledge.md that currently states
"Passepartout now has named fixture functions for landscape, portrait, square,
and border planning" to either list all six fixtures (landscape, portrait,
square, border, no-upscale, oversized-border) or explicitly state it describes
the EDH-328 baseline and that EDH-330 later adds the no-upscale and
oversized-border probes; reference the document's mention of EDH-328/EDH-330 and
the term "Passepartout" so the change is made in the correct paragraph.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 01a8af79-1b5a-46d1-aa35-4c087df24f9a

📥 Commits

Reviewing files that changed from the base of the PR and between 403157c and 22febac.

📒 Files selected for processing (4)
  • docs/branch-knowledge.md
  • experiments/passepartout-layout-planner/README.md
  • experiments/passepartout-layout-planner/src/main.0
  • tests/passepartout-planner-fixtures.test.mjs
📜 Review details
🔇 Additional comments (8)
experiments/passepartout-layout-planner/README.md (1)

9-29: LGTM!

docs/branch-knowledge.md (1)

32-32: ⚡ Quick win

No terminology correction needed—"export c" is the correct Zero syntax.

The documentation accurately reflects the actual codebase. The export modifier "c" is consistently used across all fixture functions and is the correct Zero language syntax, not shorthand for "export const" or any other form.

			> Likely an incorrect or invalid review comment.
experiments/passepartout-layout-planner/src/main.0 (5)

33-56: LGTM!


58-74: LGTM!


113-120: LGTM!


122-137: LGTM!


139-148: LGTM!

tests/passepartout-planner-fixtures.test.mjs (1)

27-34: LGTM!

Comment thread docs/branch-knowledge.md Outdated
@edhor1608

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@edhor1608
edhor1608 force-pushed the feature/edh-328-passepartout-add-planner-fixture-harness branch from a7d38e3 to eb22b69 Compare May 21, 2026 16:47
@edhor1608
edhor1608 force-pushed the feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions branch 2 times, most recently from b5b1b70 to eff4d9a Compare May 21, 2026 16:59
@edhor1608
edhor1608 force-pushed the feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions branch from eff4d9a to caf3f7b Compare May 24, 2026 15:54
@edhor1608
edhor1608 force-pushed the feature/edh-328-passepartout-add-planner-fixture-harness branch from eb22b69 to 67229f9 Compare May 24, 2026 15:54
@edhor1608
edhor1608 force-pushed the feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions branch from caf3f7b to c9cd8cf Compare May 24, 2026 15:58
@edhor1608
edhor1608 force-pushed the feature/edh-328-passepartout-add-planner-fixture-harness branch from 67229f9 to 6ee3c59 Compare May 24, 2026 15:58

edhor1608 commented May 24, 2026 •

Copy link
Copy Markdown
Owner Author

Merge activity

  • May 24, 4:00 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 24, 4:00 PM UTC: Graphite rebased this pull request as part of a merge.
  • May 24, 4:01 PM UTC: @edhor1608 merged this pull request with Graphite.

@edhor1608
edhor1608 changed the base branch from feature/edh-328-passepartout-add-planner-fixture-harness to graphite-base/2 May 24, 2026 16:00
@edhor1608
edhor1608 changed the base branch from graphite-base/2 to main May 24, 2026 16:00
@edhor1608
edhor1608 force-pushed the feature/edh-330-passepartout-expand-planner-to-no-upscale-output-decisions branch from c9cd8cf to 283f3f3 Compare May 24, 2026 16:00
@edhor1608
edhor1608 merged commit c2888ff into main May 24, 2026
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.

1 participant