Skip to content

fix: fall back to wasm hash in contract history when unpublished - #62

Merged
pselle merged 6 commits into
mainfrom
fix/contract-history-hash-fallback
Sep 8, 2026
Merged

fix: fall back to wasm hash in contract history when unpublished#62
pselle merged 6 commits into
mainfrom
fix/contract-history-hash-fallback

Conversation

@pselle

@pselle pselle commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Show wasm hash in contract history if there is not a published wasm.

Before (note the "null/null" links)
Screenshot 2026-09-08 at 1 23 17 PM
After (local screenshot):
Screenshot 2026-09-08 at 1 23 47 PM
The full wasm hash shows in the "title" property
Screenshot 2026-09-08 at 1 24 05 PM

When there are published versions to the registry, those show:
Screenshot 2026-09-08 at 1 28 09 PM

Because of the length of wasm hashes, I added more UI structure and CSS to prevent overflow or limiting the window's size/losing responsiveness.

A contract's version history (/v1/contracts/{name}) includes every
on-chain wasm transition, not just published ones — wasm_name/
wasm_version/wasm_channel are null for transitions that never resolved
to a published wasm (e.g. predate the registry, or were never
published). The Contract History list assumed these were always
present and linked every entry to /wasms/{name}/v/{version}, which
broke (or rendered nothing useful) for contracts with unpublished
history — see stellar-registry/tansu on testnet.

Minimal-surface fix on the UI side only: when a version entry has no
published wasm_name, render its wasm_hash as plain text instead of a
link. Entries that do resolve to a published wasm keep linking to the
registry wasm page as before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFkp8Uduc8SWRMmeUS9c1E
@pselle
pselle force-pushed the fix/contract-history-hash-fallback branch from 78a059f to ed058c6 Compare September 8, 2026 15:11
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
registry-ui 6925b0c Sep 08 2026, 05:23 PM

pselle and others added 5 commits September 8, 2026 13:15
Long wasm hashes (or the fallback labels) could wrap the version list
onto multiple lines per entry. Truncate each row with an ellipsis and
expose the full '<index>: <label> <kind>' text via the title attribute
so it's still available on hover.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFkp8Uduc8SWRMmeUS9c1E
DetailFields is a grid item under .layout's grid-template-columns: 1fr
13rem. Grid items default to min-width: auto, sizing to their content's
min-content width — the new white-space: nowrap on history rows made
that min-content width the full unwrapped line, forcing the 1fr track
(and the page) wider than the viewport rather than actually
truncating. min-width: 0 lets the item shrink below that, so the
history rows' overflow: hidden + text-overflow: ellipsis clips at the
column's real width instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFkp8Uduc8SWRMmeUS9c1E
The whole row (index + hash/label + kind) shared one nowrap+ellipsis
block, so a long hash consumed the entire truncation budget and cut
off 'initial'/'upgrade' entirely — the one part of the row that's
always short and worth keeping visible.

Split each row into a flex layout: the variable-length label
(index + hash or wasm name/version) truncates on its own, while kind
sits in a flex-shrink: 0 slot that's never squeezed out.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFkp8Uduc8SWRMmeUS9c1E
The '(latest)' marker was a ::after on li:first-child in the shared
detail-field.module.css — fine when the li's content was inline text,
but the previous commit made that content a block-level flex div, so
the generated text had nowhere to go but its own line below it.

Render '(latest)' as a normal flex-shrink: 0 child of .historyRow
instead, alongside kind, so it always shares the row. Drops the
::after rule (only ever used by this one list).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFkp8Uduc8SWRMmeUS9c1E

.field ol {
list-style-type: circle;
> li:first-child::after {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Switched this content to be in the markup itself, since it needs to be computed with the flex rules

Comment thread app/lib/types.ts
wasm_name: string
wasm_version: string
wasm_channel?: string
wasm_hash: string | null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All these values are not guaranteed -- including wasm_hash. Name/version/etc only apply if it's published to registry. Hash may not be present if say, the contract changed to an executable; then there's not a wasm hash there

@pselle
pselle marked this pull request as ready for review September 8, 2026 17:35
@pselle
pselle requested a review from chadoh September 8, 2026 17:35

@chadoh chadoh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Big improvement! Thanks.

@pselle
pselle merged commit 6369f47 into main Sep 8, 2026
3 of 4 checks passed
@pselle
pselle deleted the fix/contract-history-hash-fallback branch September 8, 2026 20:15
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