Skip to content

Add CIP-179 v5 linked survey linking and voting - #4184

Merged
kusssal merged 13 commits into
IntersectMBO:developfrom
Cerkoryn:feat/cip-179-surveys
Sep 16, 2026
Merged

kusssal merged 13 commits into
IntersectMBO:developfrom
Cerkoryn:feat/cip-179-surveys

Conversation

@Cerkoryn

Copy link
Copy Markdown
Contributor

Summary

Supersedes #4152 with an implementation based on the stabilized CIP-179 v5 specification and the published cip-179 package from @mpizenberg's Tessara.

This PR focuses on linking, rendering, and submitting survey responses. Tally calculation and results display from the previous proposal are left out of scope for simplicity.

List of changes

  • Add an immutable backend endpoint that returns exact metadata-label-17 CBOR by transaction hash and survey index
  • Add a feature-flagged transaction-hash field when creating a governance action
  • Validate linked definitions, survey indices, governance-action expiry, and UI renderability before authoring
  • Add the CIP-179 link to CIP-108 JSON-LD without changing metadata hashes for actions that do not use surveys
  • Render public and sealed surveys within the governance-action voting form
  • Support single-choice, multi-select, ranking, numeric-range, points-allocation, rating, and registered custom methods
  • Verify and optionally apply hash-anchored external presentation content
  • Encode response metadata with the existing Cardano serialization library and attach it to the governance vote transaction
  • Seal eligible responses using the published tlock integration
  • Add limits and defensive handling for malformed, oversized, unavailable, or unsupported surveys
  • Keep the feature disabled by default through VITE_IS_CIP179_ENABLED

Verification

  • Frontend TypeScript and lint pass
  • Production frontend build passes
  • 216 frontend tests pass, including native metadatum CBOR, link authoring, envelope validation, and rendering limits
  • Desktop and mobile Storybook scenarios were visually inspected with no page errors, MUI warnings, or overflow
  • Haskell changes were statically reviewed but not compiled locally because the Haskell toolchain is unavailable

Checklist

  • My changes generate no new warnings
  • My code follows the project style guidelines
  • I have commented code where additional context is useful
  • I have made corresponding changelog changes
  • I have added tests that prove the feature works

I was unfortunately unable to build all of the necessary dependencies to validate all of the changes. But I was able to build the storyboard and visually inspect some example surveys that were attached to governance actions. If this PR passes validation and we can get it merged into https://govtool-preview.cardanoapi.io/ at least, then I would be happy to do some conformance testing of my own with real surveys that are live on Preview and compare them against other tools' CIP-179 implementations.

This PR was constructed with heavy assistance from GPT-5.6 Sol High and I did my best to validate what I could locally. My apologies for not being able to test the entire end-to-end flow however 馃檹

@Cerkoryn

Copy link
Copy Markdown
Contributor Author

Tagging @spannercode @mesudip and @bosko-m for review if possible 馃檹

@Cerkoryn Cerkoryn mentioned this pull request Jul 12, 2026
5 tasks
@mesudip
mesudip self-requested a review July 13, 2026 15:01
@kusssal

kusssal commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

83a9678
Above commit is deployed at https://pr-4184.dev.gov.tools/.
with pr specific docker images built at https://github.com/IntersectMBO/govtool/actions/runs/32009346968

Unwrap label 17 from the singleton metadata map stored by db-sync,
while preserving compatibility with already-extracted payloads.
Reject maps that do not contain the integer label 17.

Read auxiliary data back from the unsigned transaction when assembling
the signed transaction. CSL consumes the original auxiliary-data object
in Transaction.new; reusing it silently dropped the metadata while
retaining its hash in the transaction body.

Add independent CBOR fixtures and CardanoProvider regression tests with
real coin selection, serialization and signatures. Cover public/sealed
survey votes, unrelated/empty/absent metadata, certificate and proposal
transactions, and wallet rejection. Leave feature flags unchanged.

Validation: 235 frontend tests pass with TZ=UTC; frontend type check,
lint and production build pass. Independent cross-repository decoder
and actual wallet-callback checks pass. Live Preview acceptance remains
pending redeployment.
@Cerkoryn

Cerkoryn commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@kusssal apologies for the delay. I just pushed an update to fix a CBOR decoding issue in part of the code I introduced (also in IntersectMBO/govtool-voting-pillar#28). I was looking into the example you deployed at https://pr-4184.dev.gov.tools/ for testing, but it appears the feature flag isn't enabled.

Is it possible you can update to the latest commit in this PR and then re-deploy with the feature flag injected through the container entrypoint and enabled? If so, I would be happy to test it with live CIP-179 surveys on Preview myself.

@Cerkoryn

Cerkoryn commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Apologies, but could you pull the latest commit and then redeploy the updated frontend and backend with VITE_IS_CIP179_ENABLED=true one more time?

I was testing the latest deployment and discovered several isseus: Malformed survey presentation data that could break rendering, oversized/stalled downloads, missing expiry and index validation, and clearing optional answers incorrectly blocking submission.

All of these are fixed in the latest commit and I am now creating a CIP-179 survey linked to a governance action on Preview for further testing.

@kusssal

kusssal commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Hey @Cerkoryn ,the latest commit is now deployed, with VITE_IS_CIP179_ENABLED=true

@Cerkoryn

Copy link
Copy Markdown
Contributor Author

@kusssal thank you for your patience 馃檹

I successfully tested the deployed CIP-179 public survey-response flow on Preview: transaction.

The survey answers were correctly encoded, with valid constraints, survey linkage, credential proof, and signatures. The governance vote and rationale anchor were also preserved correctly.

I did push a small numeric-input fix that is mostly a cosmetic change in the UI. Previously, the fields visually accepted text even though invalid answers already blocked submission. They now reject nonnumeric input and display clear bounds/step errors while retaining GovTool鈥檚 styling.

From this testing, I would feel comfortable merging if you are. Alternatively, we can re-deploy one more time if you鈥檇 prefer to validate the numeric-input fix first.

Preserve upstream dependency upgrades and form typings alongside CIP-179. Regenerate the frontend lockfile and update the wallet test to mock react-router.
@Cerkoryn
Cerkoryn force-pushed the feat/cip-179-surveys branch from a5f5829 to 6196f61 Compare September 12, 2026 21:03
@kusssal

kusssal commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Thanks! @Cerkoryn ,The latest commit has been deployed and and I also successfully completed the CIP-179 flow on Preview: transaction. Before merging, could you document the relevant scenarios using our user-story testing format and add corresponding Playwright tests? With that coverage in place, we鈥檒l feel comfortable merging the PR.

@Cerkoryn

Copy link
Copy Markdown
Contributor Author

@kusssal how is that looking for you?

@kusssal

kusssal commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

@Cerkoryn Thanks for adding the user stories and Playwright coverage.Looks good , ready to merge

@kusssal
kusssal merged commit 34e313e into IntersectMBO:develop Sep 16, 2026
3 checks passed
@kusssal

kusssal commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

@Cerkoryn Thanks again for the contribution. As we are migrating the backend from Haskell to TypeScript, I鈥檇 really value your feedback: how did you find making the backend changes in Haskell for this feature? Were there any parts that felt particularly difficult, slow, or hard to validate that we should improve as part of the TypeScript migration?

@Cerkoryn

Copy link
Copy Markdown
Contributor Author

@kusssal actually the Haskell changes were quite difficult for me and I could not have done them without the help of AI and significant trial-and-error testing 馃槄

I don't have much experience with Haskell or functional programming, but Typescript is much more familiar and something that I have worked a lot with. I think simplifying the development stack into Typescript as much as possible would be a huge step in the right direction.

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