Megacorp Documentation v2.0-beta

Listing entities

A .. entity-table:: asks the entity graph a question and renders the answer. Its rows come from the project index rather than from this document, so a table lists entities declared anywhere in the site — including the requirements and audit events on the neighbouring pages.

.. needtable:: is accepted as a second spelling of the same directive, so a project migrating from sphinx-needs keeps its documents unchanged.

Every entity in the project

With no :filter:, a table lists everything. The default columns are the three fields every entity has, whatever its type declares.

ID Type Title
BYFILTER_PLAT_REQ_2 req The platform survives a power cut
BYID_PLAT_REQ_2 req The platform survives a power cut
BYKEY_PLAT_SPEC_1 spec Boot sequence
COMP_HAL component Hardware abstraction layer
COMP_HEATER component Heater
COMP_SAFETY component Safety monitor
COMP_UI component User interface
IMPL_001 impl Staged boot loader
IMPL_002 impl Boot-timing self-check
MSG_ARM message arm()
MSG_HALT message emergency_stop
MSG_HEATER_UP message heating
MSG_INIT message init()
MSG_INIT_OK message init_ok
MSG_POLL message poll_sensors()
MSG_READING message temp=22°C
MSG_READY message ready
MSG_START_HEATER message start()
OLD_PLAT_REQ_1 req Retired: the platform boots
PLAT_REQ_1 req The platform boots within one second
PLAT_REQ_2 req The platform survives a power cut
PLAT_SPEC_1 spec Boot sequence
REQ_001 req The system shall boot within two seconds
REQ_BOOT req The bootloader shall verify the kernel signature
REQ_req-4444f5cf req Shut down cleanly on power loss
SPEC_001 spec Boot sequence
SPEC_002 spec Structured logging format
TAGGED_PLAT_REQ_2 req The platform survives a power cut
TEST_001 test Boot timing regression test
open audit-event open
os.system audit-event os.system

Choosing columns

:columns: names the fields to show, in the order to show them. A column may name a built-in field, an attribute, an outgoing relation, or a back-link derived from one — verified_by is declared nowhere, and falls out of test.verifies pointing at a requirement.

ID Title Status Owner Verified by
BYFILTER_PLAT_REQ_2 The platform survives a power cut open platform-team
BYID_PLAT_REQ_2 The platform survives a power cut open platform-team
OLD_PLAT_REQ_1 Retired: the platform boots closed platform-team
PLAT_REQ_1 The platform boots within one second closed platform-team
PLAT_REQ_2 The platform survives a power cut open platform-team
REQ_001 The system shall boot within two seconds in_progress platform Boot timing regression test
REQ_BOOT The bootloader shall verify the kernel signature open platform
REQ_req-4444f5cf Shut down cleanly on power loss open platform
TAGGED_PLAT_REQ_2 The platform survives a power cut open platform-team

Headings come from the schema's own labels, so a column is never a second copy of a name that can drift from it.

Filtering

A filter is a small typed expression language with Python's spelling. It supports ==, !=, in, not in, is None, is not None, and, or, not and parentheses, over field names, strings, whole numbers and True/False.

in means what it means in Python: a substring test over text, and a membership test over a list.

ID Title Tags
REQ_001 The system shall boot within two seconds boot, safety-critical

Conditions combine, and parentheses group them:

ID Title Status
BYFILTER_PLAT_REQ_2 The platform survives a power cut open
BYID_PLAT_REQ_2 The platform survives a power cut open
PLAT_REQ_2 The platform survives a power cut open
REQ_001 The system shall boot within two seconds in_progress
REQ_BOOT The bootloader shall verify the kernel signature open
REQ_req-4444f5cf Shut down cleanly on power loss open
TAGGED_PLAT_REQ_2 The platform survives a power cut open

A filter may also test whether a field was written at all:

ID Event Added in
open open 3.8
os.system os.system 3.8

Anything outside this language is reported by name — len(tags) > 0 is refused as "function calls are not supported here", pointing at len, rather than silently matching nothing.

Sorting and layout

:sort: orders rows by one field; without it, rows are in id order, which keeps a rendered page byte-identical between builds. The presentation options every other table directive takes work here too, and sphinx-needs' :colwidths: is accepted as a spelling of :widths:.

ID Title Status
OLD_PLAT_REQ_1 Retired: the platform boots closed
REQ_req-4444f5cf Shut down cleanly on power loss open
REQ_BOOT The bootloader shall verify the kernel signature open
PLAT_REQ_1 The platform boots within one second closed
BYFILTER_PLAT_REQ_2 The platform survives a power cut open
BYID_PLAT_REQ_2 The platform survives a power cut open
PLAT_REQ_2 The platform survives a power cut open
TAGGED_PLAT_REQ_2 The platform survives a power cut open
REQ_001 The system shall boot within two seconds in_progress

That table registers an ordinary target, so requirements-by-title links to it.