Repository navigation
--schema FILE: one schema governs, whatever the files declare - #24
Conversation
A model whose declared release is not at hand stopped with `no schema compiled`, and the way round was to copy a schema under a declared name. Now the schema is stated: `--schema FILE` on the commands that read by a schema, `schema` in a model file, `OpenOptions.schema` in the library. It governs every file of its target namespace, those declaring nothing too; nothing is inferred from a directory or a file name. `policy --schema` keeps its meaning, so the parser asks which command it is reading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 632b4f5ef0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for k in out.undeclared.keys() { | ||
| if declared_schema(m.set.docs[k]).ns == ns { | ||
| one.docs << k | ||
| out.undeclared.delete(k) |
There was a problem hiding this comment.
Preserve a valid schema location when exporting undeclared inputs
When merge --schema FILE reads a document without xsi:schemaLocation, adding it to one.docs breaks the assumption in export.v:root_location that these documents actually declare the governing schema. That function reads the first document's empty declared location and emits xsi:schemaLocation="urn:arxmodel:test:lib ", which is not a valid namespace/location pair and is rejected on a subsequent normal load. Inputs declaring another release likewise retain that release's location despite being merged by the explicit schema. Update export to distinguish explicitly governed documents from declarations and use the selected schema's location.
Useful? React with 👍 / 👎.
| // the schema directory. | ||
| fn setup_rules_file(o Opts, repo string, top string) string { | ||
| dir := '--schema-dir ${os.quoted_path(os.real_path(o.schema_dir))}' | ||
| dir := '${schema_flag(o)} ${os.quoted_path(os.real_path(o.schema_dir))}' |
There was a problem hiding this comment.
Retain explicit-schema semantics in installed Git drivers
For a repository with tracked ARXML files that declare no schema, git-setup --schema FILE successfully compiles the selected schema but setup_rules_file then replaces the option with --rules. The installed drivers consequently call rules_file_check, which rejects those same documents with 0 namespaces declared; one model has one. A schema with an unranked filename or a different release family similarly fails the rules-file checks even though direct --schema accepts it. Preserve --schema for these drivers, or carry its namespace-only governing semantics into the cached rules, rather than silently reverting to declaration-based validation.
Useful? React with 👍 / 👎.
| if one.docs.len > 0 { | ||
| one.docs.sort() | ||
| compile_use(one, opts.policy) | ||
| out.uses.prepend(one) |
There was a problem hiding this comment.
Choose a nonempty version when comparing with an explicit schema
When comparing an added document that has no schema declaration, diff --schema FILE /dev/null bare.arxml fails with 0 namespaces declared; one model has one instead of reporting the addition. choice.v:choose still selects its input through newest_declaring, which defaults to the first version when neither version declares a release; that version is empty here, so this guard skips compiling the explicitly selected schema and leaves no governing entry. The same path makes git-diff --schema fall back to a textual diff for such additions. Explicit-schema comparisons should select a nonempty matching version rather than depend on release declarations.
Useful? React with 👍 / 👎.
Each of these assumed the files declare their schema. An export now names the stated schema by its file name, where it wrote an empty location for a file declaring none; git-setup keeps --schema, since a cached rules file is held to what the files declare; and a version with no documents is read by the stated schema too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Replaces #23. Files declaring only releases that are not in the schema directory stop with
no schema compiled, and the way round was to copy a schema under a declared name. #23 picked the newest schema of the family from the directory, which is a guess that changes when the directory does. Here the schema is stated instead.--schema FILEworks wherever--schema-dirdoes, and is refused beside it,--rulesor--no-schema.serveworkers andgit-setupcarry it on.schema = "x.xsd", and the libraryOpenOptions.schema;compile_schemasalso takes a schema file for its directory.no schema governs urn:a: X.xsd is of namespace urn:b.no schema compilednow says a schema can be named.mergewrites the schema by its file name as the output's location, andgit-setupkeeps--schemain the drivers rather than caching a rules file, since a rules file is held to what the files declare.arxmodel policy --schemaalready existed as a flag and keeps its meaning, soparse_optsnow takes the command.schemawas also the example of an unknown model file setting inopen_test.v; that test now usesschemas.blobly_net reads
schema_dirfrom a model file to list its inputs, so a model file usingschemaneeds that read too when it next vendors arxmodel.rule_filesalready names the schema.Tests:
v test .passes, as doscripts/inputs_cli_test.shandscripts/git_driver_test.sh, which now cover--schema, its refusals,policy --schemaandgit-setup. New cases inreleases_test.vcover a file that declares another release, one declaring none, a schema of another namespace and the model file key.🤖 Generated with Claude Code