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

Support inclusion of configuration #1412

Open
wants to merge 1 commit into
base: skosmos-2
Choose a base branch
from

Conversation

nichtich
Copy link
Contributor

Reasons for creating this PR

This adds repeatable configuration property skosmos:includeConfig to include configuration from file or URL. The configuration is cached as usual, based on modification time of config.ttl only.

Link to relevant issue(s), if any

Description of the changes in this PR

Introduce non-recursive inclusion of configuration.

Known problems or uncertainties in this PR

The code is not fully covered by tests, in particular caching of configuration (was not covered before neither) and error messages (would require to add more example configuration files but I did not manage to get this into GlobalConfigTest.php).

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@nichtich nichtich force-pushed the issue-1403 branch 2 times, most recently from 588cdaf to 93159a2 Compare March 1, 2023 14:16
@codecov
Copy link

codecov bot commented Mar 1, 2023

Codecov Report

Patch coverage: 89.47% and project coverage change: +0.14 🎉

Comparison is base (a22b389) 69.55% compared to head (2c708ea) 69.70%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1412      +/-   ##
============================================
+ Coverage     69.55%   69.70%   +0.14%     
- Complexity     1650     1665      +15     
============================================
  Files            32       32              
  Lines          4257     4291      +34     
============================================
+ Hits           2961     2991      +30     
- Misses         1296     1300       +4     
Impacted Files Coverage Δ
model/GlobalConfig.php 88.23% <88.23%> (-0.66%) ⬇️
model/SkosmosTurtleParser.php 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@osma
Copy link
Member

osma commented Mar 10, 2023

Thanks a lot, this looks promising! I like the way this sidesteps the thorny cache invalidation problem by relying only on the timestamp of config.ttl.

Copy link
Member

@osma osma left a comment

Choose a reason for hiding this comment

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

I started looking at this but unfortunately didn't finish testing everything. However, I found two issues:

  1. The Content-type header (see comment)

  2. The test are passing, but there is now some extra output Error: $prefix should only contain alpha-numeric characters, as can be seen here in the CI output under "Run PHPUnit tests". I think this happens because EasyRdf doesn't like namespace prefixes with hyphens (only letters, numbers and underscores are allowed). I did a little digging and found out that the problematic prefix is multiple-schemes: but I have no idea where that comes from. Could you take a look?

model/GlobalConfig.php Outdated Show resolved Hide resolved
This adds repeatable configuration property `skosmos:includeConfig` to
include configuration from file or URL. The configuration is cached as
usual, based on modification time of `config.ttl` only.

See NatLibFi#1403 for discussion.
@sonarcloud
Copy link

sonarcloud bot commented Mar 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 14 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@nichtich
Copy link
Contributor Author

  1. The test are passing, but there is now some extra output Error: $prefix should only contain alpha-numeric characters, as can be seen here in the CI output under "Run PHPUnit tests". I think this happens because EasyRdf doesn't like namespace prefixes with hyphens (only letters, numbers and underscores are allowed). I did a little digging and found out that the problematic prefix is multiple-schemes: but I have no idea where that comes from. Could you take a look?

I doubt this is related to this isse because the multiple-schemes: prefix was already in the code before and only in other tests (see grep -r multiple-schemes tests).

@MikkoAleksanteri MikkoAleksanteri added this to Selected for analysis in NatLibFi Skosmos Backlog via automation Apr 6, 2023
@MikkoAleksanteri MikkoAleksanteri added the size-small max 2 hours label Apr 6, 2023
@MikkoAleksanteri MikkoAleksanteri moved this from Selected for analysis to Analysis and size estimate done in NatLibFi Skosmos Backlog Apr 6, 2023
@MikkoAleksanteri MikkoAleksanteri moved this from Analysis and size estimate done to NatLibFi priority Medium in NatLibFi Skosmos Backlog Apr 6, 2023
@osma osma added the Skosmos 2.X Relevant for Skosmos 2 label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement size-small max 2 hours Skosmos 2.X Relevant for Skosmos 2
Projects
NatLibFi Skosmos Backlog
NatLibFi priority Medium
Development

Successfully merging this pull request may close these issues.

Feature request: include configuration from URL
3 participants