Skip to content

Manage integrity checkers on repo types from the CLI - #1105

Merged
nmkedziora merged 12 commits into
masterfrom
repo-type-create-integrity-checkers
Oct 14, 2026
Merged

nmkedziora merged 12 commits into
masterfrom
repo-type-create-integrity-checkers

Conversation

@nmkedziora

@nmkedziora nmkedziora commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Repo types can now set integrity checkers from the CLI, the same way repositories already can.

  • repo-type-create --integrity-check stores the checkers with the new type.
  • repo-type-update --integrity-check replaces the whole set. Leave the flag off to keep the current checkers. Pass an empty value (-it "") to clear them.
  • repo-type-view prints each checker as extension:TYPE.
  • repo-type-list shows how many checkers a type has. Add --verbose to print each one on its own line.
  • Command help for --integrity-check lists every IntegrityCheckerType, including types that were missing from the old hardcoded list.

Test

1. Create a repository type with integrity checkers

mojito-local repo-type-create -n TestType \
  -d "Lorem ipsum..." \
  -it "properties:MESSAGE_FORMAT,properties:TRAILING_WHITESPACE"

2. List repository types

By default, the command displays the number of configured integrity checkers.

mojito-local repo-type-list

Example output:

Repo type id --> 1
Name --> TestType
Integrity checkers --> contains 2 values

Use --verbose to display each checker separately.

mojito-local repo-type-list --verbose

Example output:

Integrity checkers --> properties:MESSAGE_FORMAT
properties:TRAILING_WHITESPACE

3. View a repository type

mojito-local repo-type-view -n TestType

Example output:

Integrity checkers --> properties:MESSAGE_FORMAT,properties:TRAILING_WHITESPACE

4. Update or clear integrity checkers

Pass an empty value to --integrity-check to remove all configured checkers.

mojito-local repo-type-update -n TestType -it ""

Verify that the checkers have been removed.

mojito-local repo-type-view -n TestType

The output no longer contains an Integrity checkers entry.

5. Assign a repository type

Create a repository using the repository type.

mojito-local repo-create -n TestRepo --repo-type TestType -l fr-FR

Verify the assignment.

mojito-local repo-view -n TestRepo

Example output:

Repository id --> 1
Repository type --> TestType
Repository locales --> fr-FR

6. Delete a repository type

A repository type cannot be deleted while it is assigned to one or more repositories.

mojito-local repo-type-delete -n TestType

Remove the repository type assignment.

mojito-local repo-update -n TestRepo --repo-type ""

Delete the repository type.

mojito-local repo-type-delete -n TestType

@CLAassistant

CLAassistant commented Oct 8, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment on lines +77 to +83
static final String INTEGRITY_CHECK_DESCRIPTION =
"Replaces integrity checkers for this repo type, comma separated format: \"FILE_EXTENSION_1:CHECKER_TYPE_1,FILE_EXTENSION_2:CHECKER_TYPE_2\"\n "
+ "Omitting the flag leaves existing checkers unchanged. An empty value clears them.\n "
+ "Available Checker types: "
+ IntegrityCheckerCli.AVAILABLE_CHECKER_TYPES_TOKEN
+ "\n "
+ "For example: \"properties:MESSAGE_FORMAT,properties:TRAILING_WHITESPACE\"";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Suggestion] Add a help-text test for the {availableCheckerTypes} placeholder
Files: cli/.../L10nJCommander.java (L199–210), RepoCommand.java (L16–22), RepoTypeCreateCommand.java (L73–78), RepoTypeUpdateCommand.java (L77–83)

This also changes the help output of repo-create and repo-update, but nothing tests the substitution. If a future usage path skips L10nJCommander.usage(String), users will see a literal {availableCheckerTypes}. Could we add a test that runs repo-create -h and repo-type-create -h and asserts that:

  • the output does not contain {availableCheckerTypes}
  • the output contains a type that was missing from the old hardcoded list (e.g. FLUENT or MISC_AI_TRANSLATE)

Also worth mentioning in the PR description: the help list now shows all 21 enum values instead of the previous 13.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added help tests for repo-create -h and repo-type-create -h. Both go through L10nJCommander.usage, which replaces {availableCheckerTypes} with every IntegrityCheckerType.

The tests assert the placeholder is gone and that the output includes types missing from the old hardcoded list (FLUENT, MISC_AI_TRANSLATE). I also noted in the PR description that command help now lists every checker type from the enum, including those that were missing before.

Comment on lines +58 to +71
String[] param = StringUtils.delimitedListToStringArray(integrityCheckerParam, ":");
if (param.length != 2) {
throw new ParameterException(
"Invalid integrity checker format [" + integrityCheckerParam + "]");
}
String fileExtension = param[0];
String checkerType = param[1];
IntegrityChecker integrityChecker = new IntegrityChecker();
integrityChecker.setAssetExtension(fileExtension);
try {
integrityChecker.setIntegrityCheckerType(IntegrityCheckerType.valueOf(checkerType));
} catch (IllegalArgumentException ex) {
throw new ParameterException("Invalid integrity checker type [" + checkerType + "]");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Suggestion] Throw CommandException from IntegrityCheckerCli.parse instead of ParameterException
Files: cli/.../IntegrityCheckerCli.java (L58–71), RepoTypeCreateCommand.java (L101–102), RepoTypeUpdateCommand.java (L126–127)

parse declares throws CommandException, but it actually throws the unchecked ParameterException. The repo-type commands catch and wrap it, so they print a short error. The repo-* commands don't, so repo-create -it properties:NOPE still ends up in L10nJCommander's catch (Throwable) and prints "Unexpected error" plus a stack trace.

Since the parser is shared now, throwing CommandException directly would give both command families the same short error and remove the two catch (ParameterException ex) blocks. Fine as a follow-up if you'd rather keep repo-* behaviour unchanged in this PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'd rather keep repo-* behavior unchanged in this PR

I checked all callers and the repo-* commands already handle this case. Both RepoCreateCommand and RepoUpdateCommand catch ParameterException and wrap it in CommandException, so an invalid checker produces the same short CLI error and does not reach L10nJCommander’s catch (Throwable).

That handling predates this PR. The new repo-type-* callers perform the same mapping explicitly. ParameterException also remains consistent with the existing CLI parsers for malformed parameter values, so I’d prefer to keep the current exception type.

I added explicit regression tests for invalid checkers on repo-create and repo-update, but changing the exception type would not change the user-visible behavior.

Comment thread docs/internal/Architecture.md Outdated
- At least one of `--new-name`, `--description`, `--ai-prompt`, `--ai-prompt-file`, or `--integrity-check` / `-it` is required; otherwise `Must provide at least one of the following options: --new-name, --description, --ai-prompt, --ai-prompt-file, --integrity-check`.
- PATCH body sets only the fields the user passed; omitted flags stay `null` so the server leaves those columns unchanged (see [PATCH semantics](#6-patch-null-means-leave-unchanged)).
- Checkers: `integrityCheckers` is left Java `null` so `NON_NULL` omits the property (unchanged). A non-null empty set would serialize as `[]` and clear them. There is no checkers CLI flag yet.
- Omitted `--integrity-check` / `-it` leaves Java `integrityCheckers` null, so `NON_NULL` omits the property and existing checkers stay. A present value replaces the full set, same `FILE_EXTENSION:CHECKER_TYPE` list as create. The same pair twice, including a leading dot on the extension, is stored once. An empty value sends `[]` and clears every checker. An unknown checker type fails before the request with `Invalid integrity checker type [<type>]`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Suggestion] Validate --integrity-check before looking up the repo type in repo-type-update
Files: cli/.../RepoTypeUpdateCommand.java (L106–111), docs/internal/Architecture.md (Update section, ~L401)

commandHelper.findRepoTypeByName(nameParam) runs before IntegrityCheckerCli.parse(...). So a bad -it value still costs a GET, and if the type name is also wrong, the user sees "not found" instead of the input error. Parsing (and resolving the AI prompt) before the lookup would fail fast with no network call, and would make the doc line "An unknown checker type fails before the request" accurate for update as well as create.

@nmkedziora nmkedziora Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kkuliczkowski-box
Thanks — the lookup-before-local-validation order predates this change.

repo-type-update already resolves the existing type before validating the AI prompt or reading the prompt file.

repo-update follows a similar lookup-before-parse sequence.

This PR preserves existing behavior while adding integrity-check parsing.
Moving only checker validation would make validation order inconsistent, while moving all local validation would be a broader behavioral refactor.

I’ll clarify the architecture wording to say the invalid checker fails before the PATCH request.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done. The Update section now says an unknown checker type fails before the PATCH request with Invalid integrity checker type [<type>]. The name lookup can still issue a GET first.

…epo create.

Build the available checker names from the enum so the help text stays aligned with the types the CLI accepts.
Omitting the flag leaves the set unchanged, and an empty value sends an empty list so the type's checkers are cleared.
Print each extension and checker type on one line, and omit that line when the type has none.
…erbose.

The default line is a count so a long catalog stays short, and --verbose prints each extension and checker type.
…eft as a placeholder.

repo-create -h and repo-type-create -h must not print the placeholder and must include checker types missing from the old hardcoded list.
… record that the CLI sets them.

Also lock the singular list count and drop the unrelated .conduit ignore entry.
repo-update and repo-type-update -h must substitute the placeholder with every IntegrityCheckerType, the same way create already does.
@nmkedziora
nmkedziora force-pushed the repo-type-create-integrity-checkers branch from b477f14 to 5d674db Compare October 14, 2026 12:14
Document repository types for CLI usage
@nmkedziora
nmkedziora merged commit 61ef781 into master Oct 14, 2026
6 checks passed
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.

3 participants