Skip to content

Add private checkbox to check repositories#134

Open
subhanLabs wants to merge 8 commits into
mainfrom
feature/private-resources
Open

Add private checkbox to check repositories#134
subhanLabs wants to merge 8 commits into
mainfrom
feature/private-resources

Conversation

@subhanLabs

@subhanLabs subhanLabs commented Jun 22, 2026

Copy link
Copy Markdown
Member

closes #100

Add Do not share publicly checkbox per repository entry in the CODECHECK metadata form. Private repositories are stored with an isPrivate flag and filtered from the generated codecheck.yml. Backward compatible with existing comma-separated repository format.

image

Repository excluded from the yml preview & download:
image

Private excluded from the article landing page:
image

Add 'Do not share publicly' checkbox per repository entry in the
CODECHECK metadata form. Private repositories are stored with an
isPrivate flag and filtered from the generated codecheck.yml.
Backward compatible with existing comma-separated repository format.
@nuest
nuest marked this pull request as draft June 22, 2026 11:27
@nuest

nuest commented Jun 22, 2026

Copy link
Copy Markdown
Member

@subhanLabs please check exposure of data to the landing page (and other exports), then remove the "draft" status again.

@nuest
nuest marked this pull request as ready for review June 29, 2026 11:06
@nuest
nuest self-requested a review June 29, 2026 11:07

@nuest nuest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • Please add a couple of screenshots how this looks in the UI.
  • Please add multiple test cases that ensures correct access to the information in any form or API endpoint or export.

This is a seemingly small feature, but it is one that can really break the trust in the tool for authors and editors if it is not perfect.

? parsed
: data.codecheck.repository.split(',').map(r => ({ url: r.trim(), isPrivate: false })).filter(r => r.url);
} catch {
// Backward compat: old plain comma-separated string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For what is this backward compatibility important? We do not have a release of the software yet, so no existing installations do have the "old" data stored.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point, removed the backward compat code in the refactor commit.

Comment thread locale/en/locale.po
@nuest

nuest commented Jul 6, 2026

Copy link
Copy Markdown
Member

@subhanLabs Same here - let's resolve the merge conflicts before the review.

This also looks like you have some boilerplae code going for the addtional check box about the source of the codecheck.yml, which is good!

@subhanLabs

Copy link
Copy Markdown
Member Author
  • Please add a couple of screenshots how this looks in the UI.
  • Please add multiple test cases that ensures correct access to the information in any form or API endpoint or export.

This is a seemingly small feature, but it is one that can really break the trust in the tool for authors and editors if it is not perfect.

Screenshots added above showing the checkbox in the UI with the tooltip visible on hover.

For test cases: added three PHPUnit unit tests for the buildYaml() method covering the three meaningful cases, private repos filtered from YAML, all-private repos resulting in no repository key in YAML at all, and all-public repos all included. Also added three Cypress component tests verifying the checkbox default state, checking/unchecking behaviour, and that the private flag is independent per repository row.

Regarding API/export exposure, checked CodecheckGithubRegisterApiClient::addIssue() and confirmed repository URLs are not included in the GitHub register issue body at all (only journal name and submission ID are posted there), so no additional filtering was needed on that side.

Private repositories were being exposed on the article landing page
sidebar because getRepository() was returning the raw JSON string.
Now parses the new {repositories, repoWithCodecheckYaml} format and
returns only public URLs as a comma-separated string.
@subhanLabs
subhanLabs requested a review from nuest July 14, 2026 00:02

$decoded = json_decode($raw, true);

if (is_array($decoded) && isset($decoded['repositories']) && is_array($decoded['repositories'])) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if the structure here is not as expected?

At least add an else clause with an error/warning log that something is not working as expected.

fn($r) => isset($r->url) ? $r->url : '',
array_filter($repository->repositories, fn($r) => empty($r->isPrivate))
));
$publicUrls = array_filter($publicUrls);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a debug log statement here to the effect of "filtered out x of n repositories because they are marked as private".

public function getRepository(): string
{
return $this->data['repository'] ?? '';
$raw = $this->data['repository'] ?? '';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggest to rename item to repositories for clarity, and to not return an empty string but to return an empty array as the "no values" option.


cy.get('.repo-private-checkbox').eq(0).should('be.checked');
cy.get('.repo-private-checkbox').eq(1).should('not.be.checked');
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add one more test here: click save, and then the state should be properly preserved. Ideally do not match bit index number, but by the value entered in the field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a "Mark as private" checkbox to resources related to the check

2 participants