Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor getTopics #9584

Merged
merged 12 commits into from
Oct 21, 2024
Merged

Refactor getTopics #9584

merged 12 commits into from
Oct 21, 2024

Conversation

Rotorsoft
Copy link
Contributor

@Rotorsoft Rotorsoft commented Oct 17, 2024

Link to Issue

Closes: #9103

Description of Changes

  • Replaces Topic client state with TopicView schema, returned by query
  • Refactors get_topics with new query

"How We Fixed It"

Test Plan

  • Make sure you can view, create, update topics
  • @rbennettcw how can we test contest related stuff here?

Deployment Plan

Other Considerations

@rbennettcw
Copy link
Contributor

When I create a contest and go to the Create Thread page, there's an output validation error and the topics dropdown doesn't show

@rbennettcw
Copy link
Contributor

INTERNAL_SERVER_ERROR: [ZodError] thread.getTopics: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      2,
      "active_contest_managers",
      0,
      "contest_address"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      2,
      "active_contest_managers",
      0,
      "community_id"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      2,
      "active_contest_managers",
      0,
      "name"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "array",
    "received": "undefined",
    "path": [
      2,
      "active_contest_managers",
      0,
      "payout_structure"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "undefined",
    "path": [
      2,
      "active_contest_managers",
      0,
      "interval"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      2,
      "active_contest_managers",
      0,
      "created_at"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "array",
    "received": "null",
    "path": [
      2,
      "active_contest_managers",
      0,
      "content"
    ],
    "message": "Expected array, received null"
  }
]

@mzparacha
Copy link
Contributor

Create thread is failing with this error

ERROR (utils.ts): INTERNAL_SERVER_ERROR: [ZodError] thread.createThread: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      "reaction_weights_sum"
    ],
    "message": "Expected string, received number"
  }
] {"fingerprint":"INTERNAL_SERVER_ERROR-ZodError-thread.createThread-invalid_type"}
    err: {
      "type": "ZodError",
      "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"number\",\n    \"path\": [\n      \"reaction_weights_sum\"\n    ],\n    \"message\": \"Expected string, received number\"\n  }\n]",
      "stack":
          ZodError: [
            {
              "code": "invalid_type",
              "expected": "string",
              "received": "number",
              "path": [
                "reaction_weights_sum"
              ],
              "message": "Expected string, received number"
            }
          ]
              at get error [as error] (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs:587:31)
              at ZodObject.parseAsync (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs:715:22)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async outputMiddleware (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:308:26)
              at async callRecursive (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async callRecursive (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
              at <anonymous> (/Users/ninja/workspace/commonwealth/libs/adapters/src/trpc/middleware.ts:180:22)
              at async callRecursive (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async callRecursive (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async resolve (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:481:24)
      "aggregateErrors": [
        {
          "type": "Object",
          "message": "Expected string, received number",
          "stack":
              
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            "reaction_weights_sum"
          ]
        }
      ],
      "issues": [
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            "reaction_weights_sum"
          ],
          "message": "Expected string, received number"
        }
      ],
      "name": "ZodError"
    }

@Rotorsoft
Copy link
Contributor Author

Create thread is failing with this error

ERROR (utils.ts): INTERNAL_SERVER_ERROR: [ZodError] thread.createThread: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      "reaction_weights_sum"
    ],
    "message": "Expected string, received number"
  }
] {"fingerprint":"INTERNAL_SERVER_ERROR-ZodError-thread.createThread-invalid_type"}
    err: {
      "type": "ZodError",
      "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"number\",\n    \"path\": [\n      \"reaction_weights_sum\"\n    ],\n    \"message\": \"Expected string, received number\"\n  }\n]",
      "stack":
          ZodError: [
            {
              "code": "invalid_type",
              "expected": "string",
              "received": "number",
              "path": [
                "reaction_weights_sum"
              ],
              "message": "Expected string, received number"
            }
          ]
              at get error [as error] (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs:587:31)
              at ZodObject.parseAsync (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs:715:22)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async outputMiddleware (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:308:26)
              at async callRecursive (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async callRecursive (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
              at <anonymous> (/Users/ninja/workspace/commonwealth/libs/adapters/src/trpc/middleware.ts:180:22)
              at async callRecursive (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async callRecursive (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async resolve (file:///Users/ninja/workspace/commonwealth/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:481:24)
      "aggregateErrors": [
        {
          "type": "Object",
          "message": "Expected string, received number",
          "stack":
              
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            "reaction_weights_sum"
          ]
        }
      ],
      "issues": [
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            "reaction_weights_sum"
          ],
          "message": "Expected string, received number"
        }
      ],
      "name": "ZodError"
    }

@mzparacha can you provide some reproduction steps? Seems to be working fine on my end.

@mzparacha
Copy link
Contributor

@mzparacha can you provide some reproduction steps? Seems to be working fine on my end.

Apologies, I was missing a migration run from master branch.

Copy link
Contributor

@mzparacha mzparacha left a comment

Choose a reason for hiding this comment

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

lgtm!

@Rotorsoft Rotorsoft merged commit d5240f1 into master Oct 21, 2024
10 checks passed
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.

Add GetTopics to external API
3 participants