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
34 changes: 17 additions & 17 deletions container/oracle/initdb.d/03_sqa_elements.sql

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions container/oracle/sqa_elements_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
from before the SQAP gave them, is refused). A file whose "draft" is true is not a released revision of
the plan: it is refused unless --draft is given, and then the version says that it is a draft.

Each element links to the section of the plan that holds its table: on the plan's website, in the
revision's folder, for a released revision; in the plan's source on code.jlab.org, at the revision's
commit, for a draft, which the website doesn't publish (its "latest" is the last release, whose
tables may lack the draft's elements). GitLab gives a heading the same anchor as the website.

For a database that already has elements, write the upgrade script by hand from this output:
an element's id never changes, so update the rows whose id is already there and insert the rest.
"""
Expand All @@ -22,6 +27,15 @@
import sys

SITE = "https://pages.jlab.org/acc/iac/docs/sqap"
SOURCE = "https://code.jlab.org/acc/iac/docs/sqap/-/blob"


def section_url(data: dict, url: str) -> str:
"""Where an element's section is: url is relative to the file, such as "04-…/#441-requirements"."""
if not data["draft"]:
return f"{SITE}/v{data['version']}/{url}"
page, _, anchor = url.partition("/#")
return f"{SOURCE}/{data['revision']}/docs/{page}.md#{anchor}"
LEVELS = ("minimal", "partial", "significant", "full")
REQUIREMENTS = {"required": "REQUIRED", "recommended": "RECOMMENDED", None: None}

Expand All @@ -37,10 +51,8 @@ def sql(data: dict, allow_draft: bool) -> str:
raise SystemExit("The file is a draft, not a released revision of the plan (--draft loads it anyway)")
if data["draft"]:
version = f"draft {data['revision']} after {data['version']}"
folder = "latest" # A draft has no folder of its own on the site
else:
version = data["version"]
folder = f"v{data['version']}"
lines = [
"alter session set container = XEPDB1;",
"",
Expand All @@ -62,7 +74,7 @@ def sql(data: dict, allow_draft: bool) -> str:
literal(element["short"]),
literal(element["phase"]),
literal(element["section"]["number"]),
literal(f"{SITE}/{folder}/{element['section']['url']}"),
literal(section_url(data, element["section"]["url"])),
str(weight),
*(literal(REQUIREMENTS[element["levels"][level]]) for level in LEVELS),
literal(version),
Expand Down
27 changes: 27 additions & 0 deletions container/oracle/upgrade/2.11.1_sqap_draft_section_links.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- Link each SQA element to its section in the SQAP's source at the loaded draft revision
-- (8905d54) on code.jlab.org, in place of the website's "latest", which is the last released
-- revision (1.0.0) and lacks most of the draft's elements. Run once, as SIM_OWNER, on a database at
-- 2.11.0. The links match container/oracle/initdb.d/03_sqa_elements.sql, which
-- container/oracle/sqa_elements_sql.py writes; nothing else changes.

SET DEFINE OFF;

update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#441-requirements' where ELEMENT_ID = 'ratings-recorded';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#441-requirements' where ELEMENT_ID = 'requirements-specification';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#442-design' where ELEMENT_ID = 'design-documented';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#442-design' where ELEMENT_ID = 'design-specification';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#442-design' where ELEMENT_ID = 'acs-dependencies-recorded';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#443-development' where ELEMENT_ID = 'source-documentation';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#443-development' where ELEMENT_ID = 'version-control';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#444-testing-and-verification' where ELEMENT_ID = 'test-plan';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#445-deployment' where ELEMENT_ID = 'user-guide';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#445-deployment' where ELEMENT_ID = 'installed-version';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#445-deployment' where ELEMENT_ID = 'installed-read-only';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#446-maintenance' where ELEMENT_ID = 'issue-tracking';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#446-maintenance' where ELEMENT_ID = 'two-maintainers';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/06-reviews-and-audits.md#615-required-sqa-elements' where ELEMENT_ID = 'dependencies-recorded';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/06-reviews-and-audits.md#615-required-sqa-elements' where ELEMENT_ID = 'versions-pinned';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/06-reviews-and-audits.md#615-required-sqa-elements' where ELEMENT_ID = 'acquired-choice-recorded';
update SIM_OWNER.SQA_ELEMENT set SECTION_URL = 'https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/06-reviews-and-audits.md#615-required-sqa-elements' where ELEMENT_ID = 'advisories-watched';

COMMIT;
12 changes: 7 additions & 5 deletions docs/user-guide/risk-assessment.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ a run or during Scheduled Accelerator Maintenance. Rate each input for the softw
and reassess when the software or its use changes. Software not yet written, or a new version
that a coming operations program needs, can be rated too.

The SQAP defines the two inputs that give the control level, so this guide doesn't repeat them:
The SQAP defines the two inputs that give the control level, so this guide doesn't repeat them.
Its links go to the SQAP revision this release of SIM loads, a draft (8905d54) whose text is on
code.jlab.org; the SQAP's website has only released revisions.

- **Ops Impact**: [SQAP §4.3.1](https://pages.jlab.org/acc/iac/docs/sqap/latest/04-software-development-life-cycle/#431-ops-impact).
- **Code Complexity**: [SQAP §4.3.2](https://pages.jlab.org/acc/iac/docs/sqap/latest/04-software-development-life-cycle/#432-code-complexity).
- **Ops Impact**: [SQAP §4.3.1](https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#431-ops-impact).
- **Code Complexity**: [SQAP §4.3.2](https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#432-code-complexity).

Who rates the software, and when, is in [SQAP
§4.3.4](https://pages.jlab.org/acc/iac/docs/sqap/latest/04-software-development-life-cycle/#434-recording-the-control-level).
§4.3.4](https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#434-recording-the-control-level).
The other four inputs are SIM's own, and only set fragility and attention.

### Past Downtime Rate
Expand Down Expand Up @@ -96,7 +98,7 @@ technology and subject.
The SQA control level says how much process the SQAP asks for when the software changes: 0
**Minimal**, 1 **Partial**, 2 **Significant** or 3 **Full**. SIM derives it from Ops Impact and
Code Complexity with the SQAP's [control level
table](https://pages.jlab.org/acc/iac/docs/sqap/latest/04-software-development-life-cycle/#433-control-level-table),
table](https://code.jlab.org/acc/iac/docs/sqap/-/blob/8905d54/docs/04-software-development-life-cycle.md#433-control-level-table),
and the dialog shows the result as you change them.

An **override** replaces the derived level with another, for an exception the SQAP allows. The
Expand Down
4 changes: 3 additions & 1 deletion docs/user-guide/sqa-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ elements, and so does the line above the table, so a change of level shows in th
Each element has the SQAP's short label, such as **Dependency choices recorded**; hover over it
for the SQAP's full wording, such as "Choice recorded: purpose, source, license, maintenance
status". Under the label are the element's phase and a link to the section of the SQAP that
describes it.
describes it, in the revision SIM loaded the elements from. While that is a draft, the link opens
the SQAP's source on code.jlab.org at that revision: the SQAP's website publishes only released
revisions, and the latest of those may not have the draft's elements.

The checklist holds the elements a product has or lacks as a whole, such as a Software
Requirements Specification, a User Guide, version control and issue tracking. What the SQAP asks
Expand Down
28 changes: 28 additions & 0 deletions src/integration/java/org/jlab/sim/PagesIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,34 @@ void elementsShowTheirShortLabelWithTheFullRowOnHover() throws Exception {
assertEquals("Version control", provided.attr("title"));
}

/**
* Each SQA element links to its section in the revision of the SQAP it was loaded from, as do the
* dialogs' links to sections 4.4 and 4.3: for a draft, the plan's source at the draft's commit,
* since the website's latest is the last released revision, whose tables may lack the draft's
* elements.
*/
@Test
void elementsLinkToTheSqapRevisionTheyCameFrom() throws Exception {
Document directory = Sim.page("/directory", null);
String footer = directory.selectFirst("#elements-footer").text();
String section =
directory
.selectFirst("#elements-table tr[data-element-id=two-maintainers] .element-meta a")
.attr("href");
String stages = directory.selectFirst("#elements-dialog .dialog-links a").attr("href");
String levels = directory.selectFirst("#risk-dialog .dialog-links a").attr("href");

assertTrue(footer.contains("draft "), "the test data is a draft revision: " + footer);
String revision = footer.replaceAll(".*draft (\\S+) after.*", "$1");
String page =
"https://code.jlab.org/acc/iac/docs/sqap/-/blob/"
+ revision
+ "/docs/04-software-development-life-cycle.md";
assertEquals(page + "#446-maintenance", section);
assertEquals(page + "#44-life-cycle-stages", stages);
assertEquals(page + "#43-software-control-levels", levels);
}

/** The elements a workflow's row lists, by the workflow's name exactly. */
private static String provided(Document page, String workflow) {
for (Element row : page.select("tbody tr")) {
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/org/jlab/sim/presentation/controller/Directory.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public class Directory extends HttpServlet {
/** The workflow filter's value for software that has no workflow, where an id names one */
private static final String NO_WORKFLOW = "NONE";

// Section 4 of the SQAP, when no element says which revision it is from
private static final String SQAP_SECTION_4 =
"https://pages.jlab.org/acc/iac/docs/sqap/latest/04-software-development-life-cycle/";

@EJB SoftwareService softwareService;
@EJB RepositoryService repositoryService;
@EJB TopicService topicService;
Expand Down Expand Up @@ -271,6 +275,9 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
request.setAttribute("checklistJson", checklistJson);
request.setAttribute(
"sqapVersion", elementList.isEmpty() ? null : elementList.get(0).getSqapVersion());
request.setAttribute("sqapStagesUrl", sectionFourUrl(elementList, "44-life-cycle-stages"));
request.setAttribute(
"sqapControlLevelsUrl", sectionFourUrl(elementList, "43-software-control-levels"));

if (isLooseModeRequested(request)) {
request.getRequestDispatcher("/WEB-INF/views/directory-loose.jsp").forward(request, response);
Expand All @@ -279,6 +286,24 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
}
}

/**
* A heading of the SQAP's section 4, such as 4.4 Life Cycle Stages, in the revision the elements
* were loaded from: on the page of an element of a 4.4 subsection, whose link goes to the
* website's folder for a released revision and to the source at its commit for a draft.
*
* @param anchor The heading's anchor, the same on the website and in the source
*/
static String sectionFourUrl(List<SqaElement> elements, String anchor) {
for (SqaElement element : elements) {
if (element.getSectionNumber() != null && element.getSectionNumber().startsWith("4.4.")) {
String url = element.getSectionUrl();
int hash = url.indexOf('#');
return (hash < 0 ? url : url.substring(0, hash)) + "#" + anchor;
}
}
return SQAP_SECTION_4 + "#" + anchor;
}

/**
* What is provided for a product without being recorded on it: what its workflow provides for all
* the software released with it, then what its repository provides for all its software, each
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/tags/directory-page.tag
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
<fieldset>
<legend>SQA Control Level = lookup(Impact, Complexity)</legend>
<div class="dialog-links">
<a target="_blank" href="https://pages.jlab.org/acc/iac/docs/sqap/latest/04-software-development-life-cycle/#43-software-control-levels">SQAP &sect;4.3</a>
<a target="_blank" href="${fn:escapeXml(sqapControlLevelsUrl)}">SQAP &sect;4.3</a>
|
<a target="_blank" href="https://jeffersonlab.github.io/sim/v${initParam.releaseNumber}/risk-assessment/#rating-the-risk-inputs">Guidance</a>
</div>
Expand Down Expand Up @@ -483,7 +483,7 @@
<section>
<input type="hidden" id="elements-software-id"/>
<div class="dialog-links">
<a target="_blank" href="https://pages.jlab.org/acc/iac/docs/sqap/latest/04-software-development-life-cycle/#44-life-cycle-stages">SQAP &sect;4.4</a>
<a target="_blank" href="${fn:escapeXml(sqapStagesUrl)}">SQAP &sect;4.4</a>
</div>
<p id="elements-intro">The SQA elements the SQAP asks of a product at control level <span id="elements-level"></span>: <span id="elements-counts"></span>. An element nobody has recorded is not a gap. Hover over an element for the SQAP's wording.</p>
<%-- Not a data-table: the Directory is the page's only one, which its scripts and tests rely on.
Expand Down
Loading