Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions crates/dropshot-api-manager/src/doc_files_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ impl LocalApiDocFile {
Self::Unparseable(_) => None,
}
}

/// Returns true if this file is unparseable.
pub fn is_unparseable(&self) -> bool {
matches!(self, Self::Unparseable(_))
}
}

impl DocFileInfo for LocalApiDocFile {
Expand Down
266 changes: 152 additions & 114 deletions crates/dropshot-api-manager/src/resolved.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/dropshot-api-manager/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

pub use crate::output::CheckResult;
#[doc(hidden)]
pub use crate::resolved::{ProblemKind, ProblemSummary};
pub use crate::resolved::{FileValidity, ProblemKind, ProblemSummary};
use crate::{
apis::ManagedApis,
cmd::{
Expand Down
29 changes: 19 additions & 10 deletions crates/integration-tests/tests/integration/git_stub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ use camino::Utf8PathBuf;
use dropshot_api_manager::{
ManagedApis,
test_util::{
CheckResult, ProblemKind, ProblemSummary, check_apis_up_to_date,
check_apis_with_render, check_apis_with_summaries,
CheckResult, FileValidity, ProblemKind, ProblemSummary,
check_apis_up_to_date, check_apis_with_render,
check_apis_with_summaries,
},
};
use integration_tests::{
Expand Down Expand Up @@ -2086,7 +2087,8 @@ fn test_stale_hash_resolvable_git_stub_deleted() -> Result<()> {
// The unparseable Git stub is treated as an extra document.
ProblemKind::BlessedVersionExtraLocalDoc {
basename: "versioned-health-2.0.0-ffffff.json.gitstub"
.to_owned()
.to_owned(),
validity: FileValidity::Unparseable,
},
)],
);
Expand Down Expand Up @@ -2173,23 +2175,26 @@ fn test_stale_hash_git_stubs_deleted() -> Result<()> {
"9.9.9",
ProblemKind::LocalDocFileOrphaned {
basename: "versioned-health-9.9.9-aaaaaa.json.gitstub"
.to_owned()
.to_owned(),
validity: FileValidity::Unparseable,
},
),
ProblemSummary::new(
"versioned-health",
"9.9.9",
ProblemKind::LocalDocFileOrphaned {
basename: "versioned-health-9.9.9-bbbbbb.json.gitstub"
.to_owned()
.to_owned(),
validity: FileValidity::Unparseable,
},
),
ProblemSummary::new(
"versioned-health",
"2.0.0",
ProblemKind::BlessedVersionExtraLocalDoc {
basename: "versioned-health-2.0.0-eeeeee.json.gitstub"
.to_owned()
.to_owned(),
validity: FileValidity::Unparseable,
},
),
],
Expand Down Expand Up @@ -3513,7 +3518,8 @@ fn test_rebase_blessed_version_missing_local_git_stub() -> Result<()> {
basename: v3_extra_path
.file_name()
.expect("v3_extra_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
],
Expand Down Expand Up @@ -3557,7 +3563,8 @@ fn test_merge_blessed_version_missing_local_git_stub() -> Result<()> {
basename: v3_extra_path
.file_name()
.expect("v3_extra_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
],
Expand Down Expand Up @@ -3607,7 +3614,8 @@ fn test_jj_rebase_blessed_version_missing_local_git_stub() -> Result<()> {
basename: v3_extra_path
.file_name()
.expect("v3_extra_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
],
Expand Down Expand Up @@ -3656,7 +3664,8 @@ fn test_jj_merge_blessed_version_missing_local_git_stub() -> Result<()> {
basename: v3_extra_path
.file_name()
.expect("v3_extra_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
],
Expand Down
32 changes: 21 additions & 11 deletions crates/integration-tests/tests/integration/versioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ use camino::Utf8PathBuf;
use dropshot_api_manager::{
ManagedApi, ManagedApis,
test_util::{
CheckResult, ProblemKind, ProblemSummary, check_apis_up_to_date,
check_apis_with_render, check_apis_with_summaries,
CheckResult, FileValidity, ProblemKind, ProblemSummary,
check_apis_up_to_date, check_apis_with_render,
check_apis_with_summaries,
},
};
use integration_tests::*;
Expand Down Expand Up @@ -604,7 +605,8 @@ fn test_removing_api_version_fails_check() -> Result<()> {
basename: v3_orphan_path
.file_name()
.expect("v3_orphan_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
ProblemSummary::for_api(
Expand Down Expand Up @@ -673,7 +675,8 @@ fn test_removing_api_version_unparseable_doc_fails_check() -> Result<()> {
basename: v3_orphan_path
.file_name()
.expect("v3_orphan_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Unparseable,
},
),
ProblemSummary::for_api(
Expand Down Expand Up @@ -803,7 +806,8 @@ fn test_retiring_latest_blessed_version() -> Result<()> {
basename: v3_orphan_path
.file_name()
.expect("v3_orphan_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
ProblemSummary::for_api(
Expand Down Expand Up @@ -963,7 +967,8 @@ fn test_retiring_older_blessed_version() -> Result<()> {
basename: v2_orphan_path
.file_name()
.expect("v2_orphan_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
)],
);
Expand Down Expand Up @@ -1239,7 +1244,8 @@ fn test_blessed_version_extra_local_doc() -> Result<()> {
basename: env2_path
.file_name()
.expect("env2_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
)],
);
Expand Down Expand Up @@ -1885,7 +1891,8 @@ fn test_rebase_blessed_version_missing_local() -> Result<()> {
basename: v3_extra_path
.file_name()
.expect("v3_extra_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
],
Expand Down Expand Up @@ -1929,7 +1936,8 @@ fn test_merge_blessed_version_missing_local() -> Result<()> {
basename: v3_extra_path
.file_name()
.expect("v3_extra_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
],
Expand Down Expand Up @@ -1979,7 +1987,8 @@ fn test_jj_rebase_blessed_version_missing_local() -> Result<()> {
basename: v3_extra_path
.file_name()
.expect("v3_extra_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
],
Expand Down Expand Up @@ -2028,7 +2037,8 @@ fn test_jj_merge_blessed_version_missing_local() -> Result<()> {
basename: v3_extra_path
.file_name()
.expect("v3_extra_path has a file name")
.to_owned()
.to_owned(),
validity: FileValidity::Valid,
},
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
-------
Checking 3 OpenAPI documents...
Stale versioned-health (versioned v1.0.0 (blessed)): Versioned Health API
problem: Local file for this blessed version is corrupted (possibly due to
merge conflict markers). This tool can regenerate the file from
the blessed version for you.
problem: Local file for this blessed version is corrupted: Git stub
"versioned-health/versioned-health-1.0.0-da85d6.json.gitstub"
needs to be rewritten to canonical format (forward slashes,
trailing newline). This tool can regenerate the file from the
blessed version for you.
fix: will regenerate versioned-health/versioned-health-1.0.0-
da85d6.json.gitstub from blessed content as Git stub
Fresh versioned-health (versioned v2.0.0 (blessed)): Versioned Health API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
fix: will update symlink to point to versioned-health-2.0.0-511899.json

Other problems not associated with a specific supported API version:
problem: A local OpenAPI document was found that does not correspond to a
supported version of this API: versioned-health/versioned-health-
3.0.0-05def5.json. This is unusual, but it could happen if you're
either retiring an older version of this API or if you created
this version in this branch and later merged with upstream and had
to change your local version number. In either case, this tool
can remove the unused file for you.
problem: A local file was found that does not correspond to a supported
version of this API and could not be parsed: versioned-health/
versioned-health-3.0.0-05def5.json (file "versioned-health/
versioned-health-3.0.0-05def5.json": parsing as JSON: expected
value at line 1 column 1). This can happen if a merge left
conflict markers in a file for a version that was renumbered or
retired. This tool can remove the unused file for you.
fix: will delete file: versioned-health/versioned-health-3.0.0-
05def5.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
3.0.0-05def5.json. This is unusual, but it could happen if you're
either retiring an older version of this API or if you created
this version in this branch and later merged with upstream and had
to change your local version number. In either case, this tool
can remove the unused file for you.
to change your local version number. If this is unexpected, check
the list of supported versions in Rust for a possible mismerge.
In either case, this tool can remove the unused file for you.
fix: will delete file: versioned-health/versioned-health-3.0.0-
05def5.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
Stale versioned-health (versioned v2.0.0 (blessed)): Versioned Health API
problem: For this blessed version, found an extra OpenAPI document that
does not match the blessed (upstream) OpenAPI document: versioned-
health/versioned-health-2.0.0-ffffff.json.gitstub. This can
happen if you created this version of the API in this branch, then
merged with an upstream commit that also added the same version
number. In that case, you likely already bumped your local
version number (when you merged the list of supported versions in
Rust) and this file is vestigial. This tool can remove the unused
file for you.
health/versioned-health-2.0.0-ffffff.json.gitstub (could not
be parsed: Git stub "versioned-health/versioned-health-2.0.0-
ffffff.json.gitstub": resolved contents have hash "511899", but
Comment on lines 11 to +14

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.

the duplicate file name here will be fixed in a subsequent commit

file name has different hash "ffffff"). This can happen if you
created this version of the API in this branch, then merged with
an upstream commit that also added the same version number. In
that case, you likely already bumped your local version number
(when you merged the list of supported versions in Rust) and this
file is vestigial. This tool can remove the unused file for you.
fix: will delete file: versioned-health/versioned-health-2.0.0-
ffffff.json.gitstub
Fresh versioned-health (versioned v3.0.0 (blessed)): Versioned Health API
Expand Down
Loading