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

READMEs: Import problem-specifications commits #354

Merged
merged 16 commits into from
Nov 4, 2017
Merged

READMEs: Import problem-specifications commits #354

merged 16 commits into from
Nov 4, 2017

Conversation

petertseng
Copy link
Member

No description provided.

@petertseng
Copy link
Member Author

petertseng commented Oct 4, 2017

If you ask, the import was done by hand. I'll think about automating it later.

It is intended that all commit messages link to the original problem-specifications PR, and that the author of each commit is the author of the problem-specifications commit. Let me know if I got any of that wrong.

@petertseng
Copy link
Member Author

In case someone ask: No, it's not too bad if this gets squashed. My preference is to keep them separate commits so the rationale for each change is maintained, but I wouldn't complain if they get squashed into one commit with "regenerate READMEs from problem-specifications" since this is basically what this is doing (minus space-age). The strength of my preference is 4/10, so if someone has any stronger preference, you pick which way you like.

@ijanos
Copy link
Contributor

ijanos commented Oct 5, 2017

I would prefer squashing these, the repo history would be cleaner in my opinion.

@petertseng
Copy link
Member Author

petertseng commented Oct 5, 2017

OK, I defer. A reason that it is OK to defer is that if someone wants to see the individual commits, they at least have this PR to refer to, as long as GitHub continues to exist.

@petertseng
Copy link
Member Author

The effect of Squash and Merge button on this PR seems to be (based on what I observed in exercism/haskell#603) that the resulting commit will have author of me (I submitted the PR) and committer of the one who merges. I'm fine with that.

@petertseng
Copy link
Member Author

petertseng commented Oct 23, 2017

Since we will be using Squash and Merge on this PR: I will not be squashing the commits before merging because I prefer to be able to see the history of the individual changes, and since they are going to be squashed on merge, I need to have this PR as a fallback as where to see it.

I plan to use something like the following for the commit message of the squashed commit.

regenerate READMEs

Corresponding problem-specifications PRs (and issues, if appropriate):

* https://github.com/exercism/problem-specifications/pull/892
    * and https://github.com/exercism/problem-specifications/issues/889
* https://github.com/exercism/problem-specifications/pull/909
* https://github.com/exercism/problem-specifications/pull/913
* https://github.com/exercism/problem-specifications/pull/915
* https://github.com/exercism/problem-specifications/pull/916
    * and https://github.com/exercism/problem-specifications/issues/810
* https://github.com/exercism/problem-specifications/pull/929
    * and https://github.com/exercism/problem-specifications/issues/356
* https://github.com/exercism/problem-specifications/pull/946
    * and https://github.com/exercism/problem-specifications/pull/945
    * and https://github.com/exercism/problem-specifications/pull/880

For this PR I see no need to violate my policy, so until it receives Approval (in the GitHub sense), I'm just going to keep lumping on problem-specifications changes into this same PR.

Sean Perry and others added 16 commits October 23, 2017 16:29
The paragraphs rambled without newlines. They are now line wrapped to match
the other exercises.

exercism/problem-specifications#909
There was a missing article 'a' in the beginning. The phrasing "after the
throw" is a little confusing. Does this mean either the 2nd or 3rd throws?
No, it means they are knocked down by THIS throw. Update accordingly.

exercism/problem-specifications#909
Overwrite replaces the oldest item in the buffer if the buffer is
empty. Otherwise it is just like write. This commit documents what
overwrite on a buffer with available space looks like and clarifies
what the oldest element is after an overwrite operation succeeds.

exercism/problem-specifications#889
exercism/problem-specifications#892
The final example in the crypto-square description is inconsistent with
the [source of the
exercise](http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html),
the canonical data, and with itself. This change does a few things to
correct that:

- While the encoding method is called a "square code," we're really
dealing with all sorts of rectangles, squares included. The description
gets this right up until the last example, and this change clarifies
that.

- In both the source of the exercise and the canonical data, when a
"chunk" is shorter than the length of a row, a blank space is added to
the end of that chunk. This change fixes that in the final example.

- The copy before the final example says that "spaces should be
distributed evenly across the last `n` rows," but it doesn't explain
how. This change specifies that the spaces should be added to the end of
each chunk.

Here's a related discussion:
exercism/problem-specifications#356

exercism/problem-specifications#929
@petertseng
Copy link
Member Author

The kindergarten-garden commit was a mistake; that exercise is not in this track.

Copy link
Member

@coriolinus coriolinus left a comment

Choose a reason for hiding this comment

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

The changes made all look good, and I think we shouldn't just sit on this; the problem-specifications repo is pretty active, and we're already starting to encounter synchronization issues.

@@ -1,16 +1,18 @@
# Proverb
Copy link
Member

Choose a reason for hiding this comment

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

As soon as exercism/problem-specifications#994 is merged, this will no longer be in sync.

@coriolinus coriolinus merged commit 6404756 into exercism:master Nov 4, 2017
@coriolinus
Copy link
Member

@petertseng Given the amount of activity in the problem specifications, and the amount of work you do checking that various readmes match the generated version, is there a strong reason to put them in the repo at all? It's easy to imagine a system in which they're generated dynamically by merging relevant info from the problem-specifications repo and .meta; this seems superior to having to manually track and update them.

@petertseng petertseng deleted the readmes branch November 4, 2017 21:34
@petertseng
Copy link
Member Author

is there a strong reason to put them in the repo at all

There is a reason. I'll leave it up to you to determine whether exercism/meta#15 is considered strong.

It's easy to imagine a system in which they're generated dynamically by merging relevant info from the problem-specifications repo and .meta

https://github.com/exercism/trackler/blob/master/lib/trackler/implementation.rb#L51
https://github.com/exercism/trackler/blob/master/lib/trackler/implementation.rb#L92-L125
https://github.com/exercism/prototype/blob/4d093ec7766b292f014205d1747015b90b6468c5/app/services/git/syncs_track.rb#L94

this seems superior to having to manually track and update them.

I agree.

@coriolinus
Copy link
Member

Ok, it looks like it's exercism policy to have READMEs which are stored within the repo but dynamically generated. I still think it's a bad idea for humans to have to manage this stuff manually.

I propose the following:

  1. Someone (maybe me) writes a server capable of handling a GitHub PullRequestEvent webhook.
  2. Someone (not me) runs this server somewhere permanently online.
  3. This server monitors PRs: on merge, it calls the appropriate already-existing scripts to generate the README.
  4. The server uploads/updates the exercise README using the API
  5. We add a note in the Rust track README telling people not to bother with manually writing READMEs, but instead to add entries to .meta as appropriate for their exercise.

Sound plausible?

@petertseng
Copy link
Member Author

The only thing I would advise before potentially starting this work is just making sure that Katrina did not already do the same, given the statement of intent in exercism/discussions#200 (comment) - I will assume that it's just a statement of intent and that nothing has been done yet, but still good to check.

Here are some things you might take into account when making such a thing:

I want the resulting commit to:

  • contain the original commit message (so we can see the rationale, not just "automatically regenerate")
  • contain a link to the problem-specifications PR (so that we can find any discussion that may have happened there)
  • have its Author set to be the author of the original commit (it's only fair to give credit where credit is due)
  • have its AuthorDate set to be the date of the original commit (this generally seems like the right thing to do, but I don't really have a reason why this needs to be important)
  • (obviously those above two points don't apply to Committer and CommitterDate; those get to be the bot or whatever we want)

Feel free to convince me that I should not want any of those things, though.

@coriolinus
Copy link
Member

Good point. Digging around, I discovered exercism/meta#96, which seems to cover the scope of this work. However, there's still some discussion as to how much it should actually do; the thrust of the comments seems to be that it's simpler and generally more correct to trigger CI fails when something goes wrong than it is to attempt to generate things automatically.

There are good points there, so let's reformulate again: what if we simply added a test which runs configlet generate and fails the CI if the output is not the same as the existing README.md? I'm not familiar with how Travis is configured; could it be as simple as simply adding a script to /_test?

@petertseng
Copy link
Member Author

what if we simply added a test which runs configlet generate and fails the CI if the output is not the same as the existing README.md

I will find this useful, especially for new exercises. We have seen today that we have not applied some README changes to new exercises.

We have to be careful of situations such as: I make a change to exercise X, but in problem-specifications a change to exercise Y is made so my change to exercise X can't proceed until we match the change to exercise Y.

I'm not familiar with how Travis is configured; could it be as simple as simply adding a script to /_test?

It could be as simple as adding a script; the location does not matter, only that it is listed in https://github.com/exercism/rust/blob/master/.travis.yml#L3

@coriolinus
Copy link
Member

Is that actually a problem, though? If the default behavior of configlet generate is to regenerate the READMEs for every exercise in the track, we can add an instruction for submitters which says "if the build fails because of READMEs, just run configlet generate and update your PR; that should cause the build to succeed".

Pros: easy for contributors; keeps all exercise READMEs updated.
Cons: Multiple README updates get packed into a single commit; theoretical chance that the README and exercise implementation could diverge.

@petertseng
Copy link
Member Author

we can add an instruction for submitters which says "if the build fails because of READMEs, just run configlet generate and update your PR; that should cause the build to succeed".

I can't say for sure that the following will be a contributor's reaction to this, but I would think "why do I have to make these irrelevant changes in order to get the build to succeed? Why do I have to download this random tool that I don't even know I can trust, and who knows what will happen if I run it?" I would find it a bad experience for contributors.

It may make life slightly harder for maintainers too, since if we intend to merge (say) a PR that adds an exercise and it has a commit for unrelated README change, we can no longer use Squash and Merge button since it doesn't make sense to make the two unrelated things into one commit, whereas we might otherwise be able to (and want to).

@coriolinus
Copy link
Member

Those are good points. In that case, what we want is for Travis to be able to detect which exercises are affected by the current PR, and only generate and compare READMEs for those. Something like

for exercise in $(git diff --name-only master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do
    # `$exercise` is a track name here, so Travis needs to run 
    # `configlet generate --only $exercise` and compare its output to the existing README
done

Using a loop like that, we can fail if and only if a README already affected by the PR is now out of sync.

@petertseng
Copy link
Member Author

The approach is acceptable because it doesn't start requiring PRs to have unrelated changes.

Note that with this approach, our READMEs still may remain out of date for an unbounded amount of time, simply if there are no PRs affecting a README that goes out of date. Someone interested in that might try to devise a scheme that can help with that.

@petertseng petertseng added the sync/readme Keep a README in sync with exercism/problem-specifications label Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sync/readme Keep a README in sync with exercism/problem-specifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants