Skip to content

Comments

fix: allow posting on pull-requests#65

Merged
gentlementlegen merged 7 commits intoubiquity-os:developmentfrom
gentlementlegen:feat/pr-comment
Feb 7, 2025
Merged

fix: allow posting on pull-requests#65
gentlementlegen merged 7 commits intoubiquity-os:developmentfrom
gentlementlegen:feat/pr-comment

Conversation

@gentlementlegen
Copy link
Member

@gentlementlegen gentlementlegen commented Feb 4, 2025

@gentlementlegen gentlementlegen marked this pull request as ready for review February 5, 2025 04:33
Copy link
Member

@whilefoo whilefoo left a comment

Choose a reason for hiding this comment

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

src/comment.ts Outdated
Comment on lines 132 to 138
const metadata = message.metadata
? {
message: message.metadata.message,
stack: message.metadata.stack || message.metadata.error?.stack,
caller: message.metadata.caller || message.metadata.error?.stack?.split("\n")[2]?.match(/at (\S+)/)?.[1],
}
: { ...message };
Copy link
Member

Choose a reason for hiding this comment

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

If I use logger.ok("something", { first: 1, second: 2 }), the metadata I provided won't be in the comment metadata. Was this intended from the beginning?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this is a mistake. Do you mean I introduced that during refactoring or was that like this before?

Copy link
Member Author

@gentlementlegen gentlementlegen Feb 6, 2025

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yeah it was like that from beginning but I've only noticed now

src/comment.ts Outdated
import { sanitizeMetadata } from "./util";

const HEADER_NAME = "UbiquityOS";
const lastCommentId = { reviewCommentId: null as number | null, issueCommentId: null as number | null };
Copy link
Member

Choose a reason for hiding this comment

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

I'm concerned that this can lead to some bugs. If I understand correctly Cloudflare workers sometimes run multiple requests in the same instance of the worker , so if two requests were posting comments it would cause some of them to get comment id from another request.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good point. To fix it I believe this should be then stored in a new class to make sure it is not shared between instances, but then it would mean that postComment could not be called via a function but rather would need to come from some object, which might be inconvenient? Might have to move postComment inside of the context or something similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

@whilefoo Wrapped the comment posting inside of a class, and exposed it from the context:
da526ff

I believe this is important to address because I actually have noticed the behavior you mentioned
ubiquity/ubiquity-dollar#985 (comment)

This will require changes from all the plugins sadly.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe Context should become a class in the future

@gentlementlegen gentlementlegen merged commit 5addd77 into ubiquity-os:development Feb 7, 2025
3 checks passed
@gentlementlegen gentlementlegen deleted the feat/pr-comment branch February 7, 2025 23:47
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 posting to pull-request review comment capability

2 participants