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

comment --pr=true default #1139

Closed
casperdcl opened this issue Sep 4, 2022 · 12 comments · Fixed by #1228
Closed

comment --pr=true default #1139

casperdcl opened this issue Sep 4, 2022 · 12 comments · Fixed by #1228
Assignees
Labels
ci-github cml-comment Subcommand discussion Waiting for team decision enhancement New feature or request p1-important High priority

Comments

@casperdcl
Copy link
Contributor

casperdcl commented Sep 4, 2022

https://github.blog/changelog/2022-08-04-commit-comments-no-longer-appear-in-the-pull-request-timeline/ meaning the --pr flag is now mandatory for CML reports to show up in PRs. Kinda a UX breaking change potentially.

Options (pick just one):

  1. update docs & examples, adding --pr everywhere (breaking change, examples: add --pr cml.dev#331)
also auto-detect this/print warnings?
$ cml comment ...
(ok)
$ cml pr ...
(ok)
$ cml comment ...
WARNING: did you forget `--pr` flag?
  1. cml comment ... [--pr=true] by default (UX friendly)
    • iff not in a PR, print a warning and fallback to --pr=false (commit-comment)
    • users need explicit --pr=false/--no-pr to use commit-comments in PRs (edge case)
  2. cml comment ... [--pr=auto] by default (better fail-not-warn error handling)
    • try to PR-comment, fallback to commit-comment
    • explicit --pr={true,false} throws error on failure (no fallback)
    • however, is this implementation possible? does yargs allow --flag=foo == "foo" && --flag == true (latter needed for backwards compat)?
@0x2b3bfa0
Copy link
Member

0x2b3bfa0 commented Sep 4, 2022

Historical context

Traditionally, cml send-comment has operated on individual commits rather than pull requests.

We promoted a workflow where users opened a single pull request per “experimentation session” and then pushed [potentially] several commits, each one with a different “experiment” like modifying an hyperparameter. Reports for every of these changes would be available as a commit comment1 as soon as the training process finished, and were guaranteed to match the code from a specific commit.

Then, there was a request for creating pull request comments rather than commit comments (#735) to avoid losing comments when rebasing a pull request.

Footnotes

  1. Only if supported by the forge. Bitbucket used a pull request comment with the commit hash on it as a workaround.

@0x2b3bfa0
Copy link
Member

Suggested solution

Commit comments are unequivocally tied to a commit, but aren't supported on every forge.1 Wouldn't it be better if we used --pr everywhere and, perhaps, added a footer showing the commit hash?

Footnotes

  1. Bitbucket, as usual, does not support commit comments.

@casperdcl
Copy link
Contributor Author

blocked on #1172 ?

@casperdcl casperdcl added the p1-important High priority label Sep 26, 2022
@casperdcl casperdcl changed the title send-comment --pr on GH PRs comment --pr on GH PRs Sep 27, 2022
@tasdomas
Copy link
Contributor

One problem with requiring

      - uses: actions/checkout@v3
        with:
          ref: ${{ github.event.pull_request.head.sha }}

in the workflow definition for cml comment create --pr to work is that we're not including any master changes in the context of the action.

I think we should augment cml drivers with forge-specific logic for determining the pull request (if there is one) to add comments to.

@dacbd
Copy link
Contributor

dacbd commented Sep 29, 2022

we're not including any master changes in the context of the action.

I'm not following, can you elaborate?

@casperdcl
Copy link
Contributor Author

casperdcl commented Oct 3, 2022

I think @tasdomas means checking $GITHUB_HEAD_REF instead of requiring explicit checkout.with.ref: ${{ github.event.pull_request.head.sha }} 301 Moved Permanently to #1204

@casperdcl casperdcl changed the title comment --pr on GH PRs comment --pr=auto default Oct 4, 2022
@casperdcl casperdcl changed the title comment --pr=auto default comment --pr=true (fallback false) default Oct 4, 2022
@casperdcl casperdcl changed the title comment --pr=true (fallback false) default comment --pr=true default Oct 4, 2022
@casperdcl casperdcl added the discussion Waiting for team decision label Oct 4, 2022
@casperdcl
Copy link
Contributor Author

updated the title & description a bit, clearer now?

@casperdcl casperdcl added the enhancement New feature or request label Oct 4, 2022
@tasdomas
Copy link
Contributor

tasdomas commented Oct 4, 2022

1. Bitbucket, as usual, does not support commit comments. [leftwards_arrow_with_hook](#user-content-fnref-1-bc519f06fb4bd021a0f1bade91b47e07)

What about this ?

@0x2b3bfa0
Copy link
Member

What about this?

Probably a layer-8 error on my side 🤔

@casperdcl
Copy link
Contributor Author

opened #1223

@dacbd
Copy link
Contributor

dacbd commented Jan 18, 2023

@casperdcl, with the improved options and logic with the introduction of cml comment create --target=x, I think we can close this?

@casperdcl casperdcl linked a pull request Jan 26, 2023 that will close this issue
4 tasks
@casperdcl
Copy link
Contributor Author

Yes closed by #1228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-github cml-comment Subcommand discussion Waiting for team decision enhancement New feature or request p1-important High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants