Skip to content

[codex] cover commercialization ownership gaps#4

Draft
chefbc2k wants to merge 2 commits intomasterfrom
codex/test-gap-retry-workflow-tests
Draft

[codex] cover commercialization ownership gaps#4
chefbc2k wants to merge 2 commits intomasterfrom
codex/test-gap-retry-workflow-tests

Conversation

@chefbc2k
Copy link
Owner

Summary

This branch tightened the commercialization workflow around an ownership check that now blocks packaging when the acting account is not the current on-chain owner of every source asset. Without focused tests, the new branch could silently regress in two places that matter to users: the early failure path could lose the authorized-but-not-owner diagnostics that explain why commercialization is blocked, and the default license-template creation payload could drift away from the new creator and timestamp fields required by the updated workflow.

The user-visible effect of those regressions would be confusing commercialization failures. A collaborator who still has authorization but no longer owns the asset would see a generic ownership conflict with missing context, and template auto-creation could stop reflecting the current creator metadata even though the write still appears to succeed. Both cases are narrow, but they sit directly on the changed workflow path and are the kind of gaps that are easy to miss when only the happy path is covered.

The root cause was incomplete test setup around the new preflight owner reads and missing assertions for the expanded template payload. I updated the dataset commercialization tests to account for the owner precheck, added a focused failure test for the plain ownership mismatch, added a second focused failure test that proves the workflow captures the authorized-but-not-owner diagnostics, and fixed the stale dataset-id timeout test so it exercises the intended branch again. I also pinned Date.now() in the license-template test and asserted the exact createTemplate payload so the new creator, createdAt, and updatedAt fields are now covered.

Validation

I ran:

  • pnpm vitest run packages/api/src/workflows/create-dataset-and-list-for-sale.test.ts packages/api/src/workflows/license-template.test.ts packages/api/src/workflows/commercialize-voice-asset.test.ts packages/api/src/workflows/rights-aware-commercialize-voice-asset.test.ts

Those targeted workflow suites all pass on this branch.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly strengthens the commercialization workflow by introducing mandatory on-chain ownership verification for all assets. It addresses potential regressions where confusing commercialization failures could occur due to incomplete ownership checks or incorrect license template metadata. The changes ensure that only true asset owners can commercialize, providing clearer diagnostics for unauthorized attempts and maintaining data integrity for license templates. Additionally, the robustness of workflow readback mechanisms has been improved to better handle transient errors.

Highlights

  • Enhanced Commercialization Ownership Checks: Implemented robust pre-flight ownership checks in the commercialization workflow, ensuring that the acting account is the current on-chain owner of all source assets before packaging. This prevents commercialization failures due to unauthorized actions.
  • Improved Error Diagnostics for Ownership Conflicts: Added detailed diagnostics for ownership mismatches, providing specific context when an authorized account is not the owner, to help users understand why commercialization is blocked.
  • Updated License Template Creation: Modified the default license template creation payload to include creator, createdAt, and updatedAt fields, ensuring accurate metadata for newly created templates.
  • Strengthened Workflow Readback Resilience: Enhanced waitForWorkflowReadback and waitForWorkflowEventQuery functions to retry transient read errors and surface comprehensive error messages when retries are exhausted, improving the stability of workflows.
  • Expanded Test Coverage: Added new test cases to cover early failure paths for ownership checks, authorized-but-not-owner scenarios, and updated assertions for license template creation, alongside fixing a stale dataset-id timeout test.
Changelog
  • packages/api/src/modules/voice-assets/workflows/register-voice-asset.test.ts
    • Added getTokenId mocks to various test scenarios.
    • Introduced tokenId to expected registration and summary results in tests.
    • Added a new test case to verify retries for transient token-id read errors.
    • Increased the expected call count for getVoiceAsset in a timeout test.
  • packages/api/src/modules/voice-assets/workflows/register-voice-asset.ts
    • Integrated tokenIdRead and tokenId into the registration workflow.
    • Updated waitForWorkflowReadback to include error handling for transient read errors.
    • Added isNumericLike and numericLikeToString helper functions for token ID processing.
  • packages/api/src/workflows/commercialize-voice-asset.ts
    • Added a comment clarifying that commercialization requires on-chain ownership, not just authorization.
  • packages/api/src/workflows/create-dataset-and-list-for-sale.test.ts
    • Updated the expected sequence of operations to include read-owner calls.
    • Added a new test case to verify early failure when the actor is not the asset owner.
    • Introduced a new test case to report detailed diagnostics when an actor is authorized but not the asset owner.
    • Updated the ownerOf mock to return a specific owner address.
  • packages/api/src/workflows/create-dataset-and-list-for-sale.ts
    • Imported HttpError and normalizeAddress for error handling and address normalization.
    • Implemented pre-flight ownership checks for all assets before commercialization.
    • Added logic to provide detailed diagnostics, including authorization status and voice hash, for ownership mismatch errors.
  • packages/api/src/workflows/license-template.test.ts
    • Pinned Date.now() in the template creation test to ensure consistent timestamps.
    • Added explicit assertions for the createTemplate payload, verifying creator, createdAt, and updatedAt fields.
  • packages/api/src/workflows/license-template.ts
    • Modified buildDefaultTemplate to accept creatorAddress as an argument.
    • Included creator, createdAt, and updatedAt fields in the default license template payload.
  • packages/api/src/workflows/register-whisper-block.test.ts
    • Added a test case for normalizing event-query route results with body arrays.
    • Introduced a test case to verify retries for transient event-query errors before success.
    • Added a test case to surface transient event-query errors after retries are exhausted.
  • packages/api/src/workflows/register-whisper-block.ts
    • Modified waitForWorkflowReadback to handle and surface transient read errors.
    • Updated waitForWorkflowEventQuery to handle RouteResult types and surface transient errors.
    • Added normalizeEventLogs helper function to standardize event log processing.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request enhances several workflow processes by introducing robust error handling and ownership verification. The register-voice-asset workflow now includes fetching and returning a tokenId, with waitForWorkflowReadback updated to surface transient read errors more effectively. Similarly, the create-dataset-and-list-for-sale workflow now performs a critical pre-check to ensure the acting account is the current owner of all assets, throwing a 409 Conflict error with detailed diagnostics if an ownership mismatch occurs. The license-template workflow was updated to include createdAt and updatedAt timestamps in the default template creation, and the register-whisper-block workflow's waitForWorkflowEventQuery was improved to handle transient event query errors and normalize event log results.

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