Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Drop write protection + Drop param merging in the pipeline + Write sections back into the dom/mdast/htast #260

Merged
merged 2 commits into from
May 16, 2019

Conversation

koraa
Copy link
Contributor

@koraa koraa commented Apr 12, 2019

In this pull request I will aim to address three issues:

#228 – By removing write protection from steps in the pipeline
#223 – By getting rid of parameter merging and refactoring all steps accordingly
#143 – By making sections a part of mdast and dom instead of a separate sections property. For this purpose I will extend the mdast with section nodes; in the dom I will probably use section tags and probably something like domNode._helix.metadata to store the metadata we extracted (although this will be subject for research).

I will at first not add a sections property to the context for backwards compatibily as we can decide how to cross that bridge after the main part of the work is done.

@codecov
Copy link

codecov bot commented Apr 12, 2019

Codecov Report

Merging #260 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #260   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          46     45    -1     
  Lines         965    999   +34     
=====================================
+ Hits          965    999   +34
Impacted Files Coverage Δ
src/html/find-embeds.js 100% <ø> (ø) ⬆️
src/defaults/json.pipe.js 100% <ø> (ø) ⬆️
src/utils/dump-context.js 100% <ø> (ø) ⬆️
src/html/responsify-images.js 100% <ø> (ø) ⬆️
src/utils/coerce-secrets.js 100% <ø> (ø) ⬆️
src/html/fetch-markdown.js 100% <100%> (ø) ⬆️
src/defaults/xml.pipe.js 100% <100%> (ø) ⬆️
src/defaults/html.pipe.js 100% <100%> (ø) ⬆️
src/utils/is-production.js 100% <100%> (ø) ⬆️
src/html/parse-frontmatter.js 100% <100%> (ø) ⬆️
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 682d478...2cbfe58. Read the comment docs.

@ghost

This comment has been minimized.

@tripodsan
Copy link
Contributor

Maybe we should handle the mdast changes in a separate PR.

@koraa
Copy link
Contributor Author

koraa commented Apr 13, 2019

Well, tbh I think those changes are interdependent, so I would like to make sure that the write protection/parameter merging changes are done in such a way to facilitate the mdast refactor…

@koraa
Copy link
Contributor Author

koraa commented Apr 13, 2019

Although they should be three separate commits…

@kptdobe
Copy link
Contributor

kptdobe commented Apr 24, 2019

The 2 first issues might be interdependent but merging the sections in the document is not related (they might change same code area) and must be treated separately (like in #279 ;) ).
Fixing / changing multiple things at the same time is a good way to break other things.

@ghost

This comment has been minimized.

@trieloff
Copy link
Contributor

trieloff commented May 2, 2019

@koraa I've build a quick and dirty section fix for @davidnuescheler in #301 – the dirty part is where I had to build a workaround to the pipeline merging. I'd suggest we concentrate this PR on the merging and I'll finish the other PR.

@ghost

This comment has been minimized.

@ghost

This comment has been minimized.

@ghost

This comment has been minimized.

3 similar comments
@ghost

This comment has been minimized.

@ghost

This comment has been minimized.

@ghost

This comment has been minimized.

@koraa
Copy link
Contributor Author

koraa commented May 10, 2019

@tripodsan Thanks for all the fixes!

@ghost

This comment has been minimized.

@koraa koraa marked this pull request as ready for review May 10, 2019 10:23
@koraa koraa force-pushed the karo/rework branch 5 times, most recently from fe0cb12 to 26d4825 Compare May 10, 2019 12:32
Copy link
Contributor

@trieloff trieloff left a comment

Choose a reason for hiding this comment

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

@koraa thanks for pulling through with this ginormous effort.

It might be a matter of taste, but I find the frequent-param-reassignments we do now a bit confusing, at least they make it harder to follow the data flow, because the most important returns are implicit rather than through explicit return statements. Having been bitten by the inability to delete stuff from the context in the past, I realize that this might be the price we have to pay for the feature.

On the side of the error handling, I'm not in agreement. It looks like what we have now is a relatively hard catch-all solution, but it's not even making clear why there should be multiple error handlers if they can't take their position in the pipeline into consideration.

src/html/fetch-markdown.js Show resolved Hide resolved
src/defaults/html.pipe.js Show resolved Hide resolved
src/html/get-metadata.js Show resolved Hide resolved
src/html/make-html.js Show resolved Hide resolved
src/html/split-sections.js Show resolved Hide resolved
src/pipeline.js Outdated Show resolved Hide resolved
Adding non functions is a bug which we should not hide…
@adobe adobe deleted a comment May 16, 2019
@tripodsan tripodsan requested a review from trieloff May 16, 2019 06:56
BREAKING CHANGE: return value from pipeline functions are no longer merged into the context

NOTE: Most of the functional changes live in src/pipeline.js;
most other changes are just refactoring the rest of the code
base to utilize the changes there.

feat(pipe): Drop write protection in pipeline fixes #228
feat(pipe): Get rid of parameter merging fixes #223

  This specific change necessitated the bulk of the changes to the code
  bases; most of the code that was refactored relied on parameter
  merging before.

feat(pipe): Fuller error reporting in pipeline

  Specifically, all errors are now reported by printing an
  error message the stack trace with additional information
  identifying the specific pipeline step.
  On the http level a 500 status code is transmitted.

Co-authored-by: Tobias Bocanegra <tripod@adobe.com>
@tripodsan tripodsan merged commit 4ec24c1 into master May 16, 2019
@adobe-bot
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tripodsan tripodsan deleted the karo/rework branch July 18, 2019 01:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants