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

core(fr): add settings to context #12574

Merged
merged 6 commits into from
Jun 1, 2021
Merged

core(fr): add settings to context #12574

merged 6 commits into from
Jun 1, 2021

Conversation

adamraine
Copy link
Member

Opening as a draft because I'm not sold on the way I made settings into a dependency.

Some other options I considered:

  • Add settings directly to FRTransitionalContext
  • Inject settings manually in collectArtifactDependencies

I converted FullPageScreenshot as an example of how this would be used.

@brendankenny
Copy link
Member

Opening as a draft because I'm not sold on the way I made settings into a dependency.

I haven't been in any of these conversations, but at least on first read it does seem maybe too far for the sake of conceptual purity ("all artifacts come from gatherers"), but then having to special case its initialization in config.js means it's somewhat harder to follow its lifetime instead of easier due to conceptual unification with all the other artifacts.

Is it worth re-thinking how we use the settings artifact? I think the original reason for making it an artifact was for clarity in audits. It helps clear up which settings an audit is talking about since gathering and auditing can use different settings (we never got around to allowing much difference, but we still could), and we may just not have had settings on the audit context back then.

Since during gathering theres only one set of settings, having them on the context seems fine to me, personally. Then we could re-think if the artifact finalization step should sneak in settings into the artifacts at the very end or if audits could get settings access another way.

@adamraine
Copy link
Member Author

The more I look at this, the more I am inclined to agree. We are going to need to handle settings differently in any situation. Creating a pseudo-gatherer to house settings just so it can be used as a dependency is overly convoluted. Other base artifacts do make sense as normal gatherers, but settings does not.

I also don't like the idea of adding a Settings shell artifact to the config, when the actual settings are defined elsewhere in the config.

@patrickhulce
Copy link
Collaborator

I'm also completely fine with settings existing on the context in gathering phase. The only reason it wasn't part of the initial context was I was unsure how much of settings would remain as-is.

The important thing with settings, as @brendankenny already noted, is that the dependency on the auditing side is reflected, as the settings at gather mode time vs. audit time will in fact make a difference in some contexts.

@@ -63,8 +63,8 @@ describe('Fraggle Rock Config', () => {
});

it('should throw on invalid artifact definitions', () => {
const configJson = {artifacts: [{id: 'FullPageScreenshot', gatherer: 'full-page-screenshot'}]};
expect(() => initializeConfig(configJson, {gatherMode})).toThrow(/FullPageScreenshot gatherer/);
const configJson = {artifacts: [{id: 'ScriptElements', gatherer: 'script-elements'}]};
Copy link
Member Author

Choose a reason for hiding this comment

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

We are running out of candidates for this hehe

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah we are 😎

@adamraine adamraine marked this pull request as ready for review May 28, 2021 02:48
@adamraine adamraine requested a review from a team as a code owner May 28, 2021 02:48
@adamraine adamraine changed the title WIP: core(fr): settings dependency core(fr): add settings to context May 28, 2021
Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @adamraine !

@@ -63,8 +63,8 @@ describe('Fraggle Rock Config', () => {
});

it('should throw on invalid artifact definitions', () => {
const configJson = {artifacts: [{id: 'FullPageScreenshot', gatherer: 'full-page-screenshot'}]};
expect(() => initializeConfig(configJson, {gatherMode})).toThrow(/FullPageScreenshot gatherer/);
const configJson = {artifacts: [{id: 'ScriptElements', gatherer: 'script-elements'}]};
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah we are 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants