Repository navigation
app-contract 1.12.0: optional window hint (schema_minor 1); card-host opens at it - #207
Merged
Merged
Conversation
An app could not ask for a larger desktop window: the manifest had no size
field and refuses unknown keys. PDF Tools v2 was designed at 1536 x 1024,
and in the shell's default window its Combine button and Home captions fall
below the fold.
The manifest gains an optional `window` field, `WindowHint { width,
height }` in points: the size the app prefers its desktop window to open
at. It is a hint, not a grant. Hosts clamp it to the screen, phones and
other full-screen hosts ignore it, the person can still resize, and the
resolved AppPolicy does not change.
It is an optional field in the growth rule's sense, so SCHEMA_MINOR moves
to 1, its first bump. A manifest that sets `window` must declare
"schema_minor": 1 or later, and parse and resolve refuse it otherwise. A
host on an earlier contract then reads the manifest leniently, ignores
`window`, lists it among the ignored fields and computes the same signing
bytes, instead of refusing an unknown field (checked against the published
1.8.0, whose lenient path is unchanged through 1.11.0). Width must be 320 to
4096 and height 240 to 4096. Only an object is accepted: a derived
Deserialize would also take [w, h], which would then sign as an object
rather than as written. The field is skipped when absent, so existing
manifests and their signing bytes are unchanged; the fixture corpus still
reproduces, and gains test-window-hint and refuse-window-without-minor.
With the bump, a manifest at schema_minor 1 is read strictly like any at
this build's minor. The lenient-path tests now use SCHEMA_MINOR + 1, so
they keep testing the lenient path.
card-host: without --size, the window opens at the manifest's `window`
size, sized like --size (no caption bar, not clamped), so App Flow can
capture an app at its design size.
Docs: the manifest reference in PUBLISHING (en and zh-CN) gains `window`
and its rules, and `schema_minor` is no longer always left out; the
card-host --size default and its log line in DEVELOPMENT (en and zh-CN).
No crates.io publication is claimed: 1.12.0 is unreleased.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
An app could not ask for a larger desktop window. The manifest had no size field and refuses unknown keys, and the OctoSense desktop opens every app at about 72% × 76% of the desk, capped at 1000 × 720 points. PDF Tools v2 was designed at 1536 × 1024, so in that window its Combine button and its Home captions fall below the fold.
What changes
Contract (
octosense-app-contract1.12.0, unreleased)window:WindowHint { width, height }in points, built withWindowHint::new. It is the size the app prefers its desktop window to open at.AppPolicydoes not change. A test checks that the resolved policy is the same with and without the hint.SCHEMA_MINORgoes from 0 to 1, its first bump.windowmust declare"schema_minor": 1or later.parseandresolverefuse it otherwise:window requires "schema_minor": 1 or later, so that hosts which predate window ignore it instead of refusing the app.window, lists it inignored_fields(), and computes the same signing bytes, instead of refusing an unknown field.parsechecks the size: width 320 to 4096, height 240 to 4096.Deserialize,[1536, 1024]would also parse, and it would then serialize and sign as an object rather than as written.WindowHinttherefore has a small hand-writtenDeserialize. It behaves like the derived one withdeny_unknown_fields, except that it accepts only an object. It still names its fields to the lenient reader, so an unknown key insidewindowin a newer-minor manifest is ignored and listed like any other.windowis skipped when absent, so existing manifests and their signing bytes do not change.test-window-hintandrefuse-window-without-minor.schema_minor1 is now read strictly, like any manifest at this build's minor. The lenient-path tests used minor 1 as "newer"; they now useSCHEMA_MINOR + 1.card-host
--size, the window opens at the manifest'swindowsize. It is sized exactly as with--size: no caption bar, and not clamped, because card-host is a render target. A second log line says that the size came from the manifest.octo runcapture an app at its design size.Docs
docs/PUBLISHING.mdand its zh-CN twin:windowrow;schema_minorrow now says to set1when the manifest useswindow;schema_minorrule, what hosts do with the hint, that it grants nothing, and how older hosts treat it.docs/DEVELOPMENT.mdand its zh-CN twin: the--sizedefault and thewindow sizedlog line.Validation
Ran:
The contract crate copied out of the workspace, as
app-contract.ymldoes (macOS):cargo test --all-targets: unit, fixture corpus and growth tests, 33 of them in growth;cargo test --doc;cargo clippy --all-targets --no-deps -- -D warnings;cargo doc --no-depswith no warnings;cargo package --listandcargo publish --dry-run.The
native-tools.ymlsteps on Linux, against plain sibling checkouts prepared by Octoscript-Makepad'stools/runtime.py prepareat the pinned revisions (makepad d653bc44, Octoscript-Makepad 6cf2d90a, Octoscript 2e37d9e6). All passed:runtime.py verify --cargo-manifest, which runscargo metadata --locked;card-hostandhub;card-hostCLI tests;appstoreandapp-hub-applib tests with--no-default-features;card-hostbin tests, including the new manifest-size test.An older contract reading the new manifest. A scratch crate links the published 1.8.0 beside this crate. 1.8.0 has SCHEMA_MINOR 0, and its
lenient.rsandparse_newerare byte-identical to 1.11.0's. Given aschema_minor: 1manifest withwindow, 1.8.0:["window"]as ignored;Without
schema_minor, 1.8.0 refusesunknown field window, and 1.12.0 refuses with the new message.Not run locally (CI runs them):
cargo semver-checks, which is not installed here;native_fonts.pystep;The OctoSense side (repin, the shell opening a script app at its hint, PDF Tools asking for 1536 × 1024) follows in a separate OctoSense PR.
🤖 Generated with Claude Code