Repository navigation
Conversation
|
|
||
| ## Document Structure | ||
|
|
||
| - All specifications must be written exclusively using the following required sections in the order they appear in: |
There was a problem hiding this comment.
This seems overly prescriptive. We should suggest but not require all sections. We should require the order is the same, and require a subset of sections.
For example:
Specifications must use the following sections, in this order, when present. Abstract, META, Specification, and Changelog are required.
There was a problem hiding this comment.
Fair enough, no use in having empty sections just to fit a structure.
|
|
||
| ## Style and formatting | ||
|
|
||
| - All prose must use proper English grammar: write in complete sentences, start with a capital letter, use correct |
There was a problem hiding this comment.
Do we intend to follow RFC 2119 in the contributing guidelines? If not, it's worth calling out that this document does not follow RFC 2119, since drivers devs are used to reading spec documents with "MUST".
There was a problem hiding this comment.
You mean that we should explicitly call out that RFC 2119 keywords are exempt from this rule?
There was a problem hiding this comment.
Re-reading I see what you mean. I would prefer to not use RFC 2119 here since all of these rules are effectively MUST.
There was a problem hiding this comment.
I don't think that's true: re all rules being effectively "MUST" - there is a mix of requirements and "soft" recommendations, e.g. "consider", "prefer".
Moreover, the current list of bullet points mixes directives with statements. Using "MUST" in a lot of places might feel like too loud, but I think it would make this easier to read and follow (i.e., harder to misinterpret intent or argue down the line about whether something is a soft guideline vs a hard requirement). It would also make the standards page more cohesive with the specs themselves.
There was a problem hiding this comment.
Fair enough. I read all of them as having an implicit "MUST" (e.x. "MUST consider..."), but that's less explicit than actually having the words there.
Co-authored-by: Matt Dale <9760375+matthewdale@users.noreply.github.com>
Co-authored-by: Matt Dale <9760375+matthewdale@users.noreply.github.com>
|
|
||
| - Prefer unified tests over prose tests whenever possible. | ||
| - Specify all environmental and topological requirements for each test. | ||
| - Tests belong in a separate `tests/README.md` file within the specification directory, not in the specification itself. |
There was a problem hiding this comment.
Consider expanding this, something like:
- Add tests to a
testsdirectory
** Add prose tests to a README.md file in thetestsdirectory
** Add unified tests to aunifieddirectory in thetestsdirectory
| - Authors SHOULD add pseudocode following a numbered list of MUST steps that defines an algorithm or a description of a | ||
| schema. | ||
| - Comments MUST follow the standards above for prose style. | ||
| - Authors MUST use Python syntax for algorithms and Typescript syntax for BSON and wire documents. |
There was a problem hiding this comment.
[question] What is the historical reasoning for Javascript / Typescript pseudocode? These seem to be the widely used language for algorithms in the specifications.
Do we anticipate that this rule is forward-only, or does it mean we plan to convert the existing algorithm blocks? If we plan to convert, we should create a ticket and link it here as a future effort.
Edit: python syntax is the most common for algorithms if you don't count BSON / mongosh.
There was a problem hiding this comment.
I assume because they have minimal syntax overhead and are widely readable regardless of language knowledge, but @jyemin might have a more historical answer.
We do plan to convert the existing blocks. I'll create a ticket to track that work. I'm not sure we need to link it in this document since it doesn't relate for future specification work.
There was a problem hiding this comment.
I assume because they have minimal syntax overhead and are widely readable regardless of language knowledge
What does python syntax improve on this?
I'm not sure we need to link it in this document since it doesn't relate for future specification work.
If we plan to convert the existing blocks, that conversion is a consequence of this rule so it does relate to this document. Unless we decided to make this forward-only. Either works for me, but I'd like the document to say which, since future PRs against existing non-python syntax will have to guess. e.g. "if the spec PR modifies a few lines of an existing JS algorithm, is the author expected to convert the entire block?"
There is precedent to linking driver tickets for future work in specifications, https://github.com/search?q=repo%3Amongodb%2Fspecifications+DRIVERS-&type=code
There was a problem hiding this comment.
What does python syntax improve on this?
I don't understand the question. Python is as close as languages get to being English text with some syntax, making it very easy to read psuedocode.
If we plan to convert the existing blocks, that conversion is a consequence of this rule so it does relate to this document. Unless we decided to make this forward-only. Either works for me, but I'd like the document to say which, since future PRs against existing non-python syntax will have to guess. e.g. "if the spec PR modifiees a few lines of an existing JS algorithm, is the author expected to convert the entire block?"
There is precedence to linking driver tickets for future work in specifications, https://github.com/search?q=repo%3Amongodb%2Fspecifications+DRIVERS-&type=code
We'll have a single PR to update all of the existing psuedocode to these standards so authors won't have to determine that. I'd prefer to keep transient references like tickets out of a standards document.
There was a problem hiding this comment.
Suggest deferring the pseudocode decision to the DRIVERS ticket so that the style guide and existing specs change together.
sanych-sun
left a comment
There was a problem hiding this comment.
Should we mention that each change MUST have related Drivers ticket?
|
|
||
| ## Style and formatting | ||
|
|
||
| - All prose MUST use proper English grammar: write in complete sentences, start with a capital letter, use correct |
There was a problem hiding this comment.
Should we mention md format is required for all specs?
| @@ -0,0 +1,125 @@ | |||
| # Specification standards | |||
There was a problem hiding this comment.
Should we add link to the CONTRIBUTING.md from the README.md, and probably move some content from README into this document? For example: "Writing Documents", "Prose Test Numbering", "Automated Test Best Practices" sections sounds like they are belong to the CONTRIBUTING.md too.
jyemin
left a comment
There was a problem hiding this comment.
A few other things to consider before merging:
- RFT 8174 clarifies usage of all-caps MUST, SHOULD etc. Consider referencing it
- The AGENTS.md file has several recommendations that more properly belong here, e.g. 120-char GFM line width, never hand-edit generated JSON/YAML is source of truth, always use the lowest schema version that works, prose tests use relative 1. numbering and new tests append at the end (drivers reference by number), test isolation (omit irrelevant fields), don't modify existing tests unless they test wrong behavior, PR requirements (DRIVERS ticket, driver implementation PR links in description).
- Mention the automated enforcement layer in
.pre-commit-config.yamland.github/workflows/lint.yml
I've moved all content that fits from |
| them as such. | ||
| - Authors MUST use `runOnRequirements` (for unified tests) or instructions on skipping (for other tests) to ensure tests | ||
| are only executed when supported. | ||
| - Tests not run by any driver MUST be deleted. |
There was a problem hiding this comment.
[question] Is this intended for all tests or just unified tests? If prose tests are included, then we should define some mechanism to make it not conflict with L63. E.g. "Since drivers reference prose tests by number, once a prose test has been removed by all drivers then its contents MAY be replaced with a note such as Removed."
| cluster, and load balanced. | ||
| - Authors MUST make manual changes to `.yml` test files and then generate the `.json` versions using | ||
| [these instructions](./README.md#converting-to-json). | ||
| - Authors MUST NOT make manual changes to `.json` test files. |
There was a problem hiding this comment.
[blocking] Not all files have a yaml source, e.g. bson-corpus/tests.
| - Authors MUST NOT make manual changes to `.json` test files. | |
| - Authors MUST NOT make manual changes to `.json` test files generated from a `.yml` source. |
| behaviors. | ||
| - Authors MUST number prose tests starting with `1.`. | ||
| - Authors MUST add new tests to the end of list of prose tests. | ||
| - Authors MUST not modify existing tests unless to fix correctness issues. Create new tests instead of modifying |
There was a problem hiding this comment.
| - Authors MUST not modify existing tests unless to fix correctness issues. Create new tests instead of modifying | |
| - Authors MUST NOT modify existing tests unless to fix correctness issues. Create new tests instead of modifying |
| - Tests MUST be in a separate `tests/` directory within specification directory, not in the specification itself. | ||
| - Prose tests MUST be in a `tests/README.md` file. | ||
| - Unified tests MUST be in a `tests/unified` subdirectory. | ||
| - Authors MUST not remove deprecated prose tests, but instead strike through their content or otherwise explicitly mark |
There was a problem hiding this comment.
| - Authors MUST not remove deprecated prose tests, but instead strike through their content or otherwise explicitly mark | |
| - Authors MUST NOT remove deprecated prose tests, but instead strike through their content or otherwise explicitly mark |
| - Pseudocode MUST be purely explanatory, not normative. It cannot substitute for a prose description of a required | ||
| behavior. | ||
|
|
||
| ## Tests |
There was a problem hiding this comment.
[question] What do you think about adding labels to the test standards to make them referenceable, similar to prose tests?
- **T1.** Tests MUST cover every behavior required in the specification.
| @@ -0,0 +1,162 @@ | |||
| # Specification standards | |||
There was a problem hiding this comment.
Suggest we note somewhere that specifications are self-defining: "A specification is a document under source/ whose header block includes a Status line". That way we can still have markdown files (or whatever) in source without it falling under the requirements of this standard.
| - Authors MUST test changes in at least one language driver. | ||
| - Authors MUST include links to the driver implementation PRs in the PR description (e.g., | ||
| `Python implementation: https://github.com/mongodb/mongo-python-driver/pull/…`). |
There was a problem hiding this comment.
[blocking] These requirements can't be satisfied by editorial PRs (such as this one). Suggest that we state that somewhere: e.g., "PRs that do not change driver behavior or tests, such as editorial changes, are exempt from the driver requirements above."
Or if this change is accepted: https://github.com/mongodb/specifications/pull/1992/changes#r4200664929, something like: "PRs that do not change driver behavior or tests, such as editorial changes, are exempt from the driver requirements PR2 and PR3."
Please complete the following before merging:
[ ] Update changelog.[ ] Test changes in at least one language driver.[ ] Test these changes against all server versions and topologies (including standalone, replica set, and shardedclusters).