Expand description
Pure domain rules: roles, lifecycle states, numbering and validation.
Nothing in here touches the database, which keeps the rules easy to unit test.
The rules are split by area; everything is re-exported here, so callers
keep using crate::domain::Name.
Structs§
- Number
Context - The values a scheme is expanded with.
- Number
Scheme - A numbering scheme for generated item numbers, e.g.
{PROJECT}-{TYPE}-{YYYY}-{SEQ:4}→ROVER-PRT-2026-0007. - Review
Requirement - What the review policies of all affected project groups ask of a change. The default asks for nothing beyond “every reviewer approves”.
- Role
Requirement - A project group that must be represented among the approvals (a role
group such as QA):
membersare the people whose approval counts. - Server
File - The server side of a file for the concurrency checks.
- Skin
- A selectable look of the UI. The colours live in
static/style.css([data-skin="<id>"]), the logos inmedia/. - Transition
Rule - One allowed lifecycle transition: how it happens and who may trigger it.
The services enforce these rules; this table documents them in the UI and
is checked against
LifecycleState::can_transition_toby a unit test.
Enums§
- Admin
Read - How administrators who are not members read a restricted group (the
need-to-know policy,
project_policies.admin_read). - Approval
Reauth - Whether a review decision in the browser needs a fresh sign-in
(
TEAMCRAFT_APPROVAL_REAUTH, #152 step 4). API tokens are not asked: approving needs theapprovetoken scope instead. - Attribute
Condition - A search condition on one attribute.
- Attribute
Type - Data type of a custom attribute.
- Base
Conflict - Why a check-in with a stated base is refused, if it is.
- Base
Version - The server version a client based a change of a file on – the version it checked out, by number or by content hash. A check-in that names a base is refused when the file moved on since (optimistic concurrency).
- Basis
Role - What a simulation takes from the revision it is based on.
- Change
Status - Classification
- Make, buy or standard part – master data of an item.
- Decision
- Deviation
Kind - What a deviation of the built unit from its design concerns.
- Disposition
- The decision about a deviation (the disposition of a nonconformance).
- File
Retention - What happens to the old versions of a file when a newer one is uploaded
(
files.retention). - File
Sync State - State of a workspace file compared with the server.
- Files
Hint - The way to add files that the Files card shows.
- Item
Type - Lifecycle
State - Line
Action - What a line of a change order does when the change is released.
- Notification
Kind - What a notification is about. Users can mute every kind except
Test. - Priority
- Project
Visibility - Who may read the data of a project group.
- Reference
Kind - How a revision references another item besides the BOM.
- Request
Decision - The decision of the triage on a change request.
- Request
Reason - Why a change is requested.
- Request
Status - Status of an engineering change request.
- Result
Filter - Which result values the item search looks for (latest revision of a simulation): within or outside their limits.
- Result
Status - Whether a result value is within its limits.
- Review
Conflict - Why somebody may not review a change order (separation of duties).
- Review
Outcome - Outcome of evaluating all review decisions of a change.
- Revision
Rule - Decides which revision of a child item is shown in a BOM.
- Role
- Global user role. Ordering matters:
Viewer < Editor < Admin. - Scheme
- The colour scheme of a skin.
- Sign
OffMethod - How a reviewer confirmed a decision (stored with the review).
- Token
Scope - What a personal access token may do with the rights of its user.
- Webhook
Event - An event an outgoing webhook can subscribe to (
webhooks.events; the CHECK constraint in migration 0022 lists the same names).
Constants§
- COMMON_
UNITS - Common units of measure offered in the UI. Free text is accepted as well.
- DEFAULT_
NUMBER_ SCHEME - Numbering scheme used when a project group has none: the type prefix and a
six-digit sequence, e.g.
PRT-000042. - DEFAULT_
SKIN - LIFECYCLE_
RULES - MAX_
ATTRIBUTE_ TEXT - Longest text value of an attribute.
- MAX_
FOLDER_ DEPTH - Deepest folder nesting of a file.
- MAX_
FOLDER_ LEN - Longest folder path of a file (characters).
- MAX_
FOLDER_ SEGMENT - Longest single folder name.
- MAX_
SIGN_ OFF_ MEANING - Longest stated meaning of a sign-off (“approved as design owner”).
- MCP_
PATH - The path of the MCP endpoint (the only one an
mcp_onlytoken reaches). - MIN_
PASSWORD_ LEN - SKINS
- TEAMCRAFT_
ICON - The TeamCraft icon (shown in the header, the footer and as favicon).
Functions§
- attainable
- The part of the requirement the assigned
reviewerscan still meet. Reviewers are only changed in Draft, so a policy or a group that changed after submit must not make an in-review change undecidable. - attribute_
input_ text - An API value as the text
parse_attribute_valuereads (null→ empty). - avatar_
tint - A stable avatar tint 1..=6 (
--avatar-Nin skins.css) from the username. - check_
base - Checks an upload against the current server file. Identical content is never a conflict (nothing would be overwritten).
- combine_
min_ approvals - Combines the minimum approvals of several groups: a group without a value wants all reviewers, so the strictest wins.
- conflicting_
reviewer - Four-eyes check: the reviewer must be neither the author, nor the person
who submitted the change (an administrator acting for the author), nor
anyone who changed the affected revisions (
editors). - files_
hint editable: the user holds the check-out and may modify (the rule ofensure_editable);can_work: the user may check out (project group, role, revision in work, not locked by someone else).- files_
type_ hint - What to put on an item of this type (the
item_typetext value). - format_
age 3 days,5 h,12 min,just now– the age of a lock or an event.- format_
change_ number - Formats an automatically generated change number, e.g.
CHG-000007. - format_
request_ number - Formats an automatically generated change request number, e.g.
ECR-000007. - initials
- Up to two initials for the avatar: first letters of the first and last word of the display name (the username when the name is empty).
- is_
approval - Whether a request approves or releases something: the review of a change
order (its approval releases the revisions), the decision on a change
request and making a revision obsolete. Needs the
approveright of a token, i.e. scopefull. - is_skin
- like_
pattern - Escapes
%,_and\so user input can be used inside a LIKE pattern. - limit_
text - Trims a text and checks it is at most
maxcharacters. - normalize_
attribute_ key - Attribute keys:
a-z 0-9 _, starting with a letter, at most 40 characters (vendor,length_mm). Upper case and spaces/dashes are folded (Order No.→order_no). - normalize_
folder - Normalises the folder of a file inside its project group – the place it
gets in the desktop working folder
<workspace>/<GROUP>/<folder>/<file>. - normalize_
item_ number - Item numbers: 1–64 characters
A-Z 0-9 . _ -, starting with a letter or digit. They are normalised to upper case. - normalize_
project_ code - Project codes: 1–32 characters
A-Z 0-9 _ -, normalised to upper case. - normalize_
username - Usernames: 2–64 characters
a-z 0-9 . _ -, normalised to lower case. - number_
context - The values for an item of
item_typein project groupprojectcreated atat. - parse_
attribute_ choices - The choices of a choice attribute from free text (one per line or
separated by
;), trimmed, without duplicates. - parse_
attribute_ condition - Parses a search value for an attribute of
data_type: empty = has a value; text and choices match as substring; yes/no; numbers accept12,>=10,<=20and10..20(no10-20, which would clash with negative numbers). - parse_
attribute_ value - Validates one attribute value given as text (form field, or an API value converted to text) and returns it as JSON; empty input removes the value.
- parse_
decimal - Parses user supplied decimal numbers, accepting both
1.5and1,5. Empty input yieldsNone. - policy_
shortfalls - Why a set of reviewers can never satisfy the policy (empty = it can).
submitrefuses a change with any of these. - require_
text - Requires a non-empty, trimmed text of at most
maxcharacters. - result_
status - Pass when
lower <= value <= upper(limits inclusive, either may be missing), fail otherwise;ResultStatus::NoLimitswithout limits. - review_
outcome - A single rejection rejects the change; all reviewers must approve.
- review_
outcome_ with - Outcome of a change under a review policy. A single rejection still
rejects; the change is approved when enough reviewers approved, every
required person did, and every role group is represented. With the
default requirement this equals
review_outcome. - revision_
code - Converts a 1-based revision sequence number into its revision code:
1 →
A, 2 →B, …, 20 →Y, 21 →AA, 22 →AB, … - revision_
seq - Inverse of
revision_code. ReturnsNonefor invalid codes. - rules_
from - The rules that lead away from
state. - skin_
is_ light - Whether a skin is always light (the System skin is not: it may be dark).
- skin_
or_ default - Returns the skin id if it is known, otherwise the default skin.
- skin_
scheme - The colour scheme of a skin (unknown ids: the default skin).
- sync_
state - Compares a local file (
local_sha256) with the server file. - truncate_
chars - The first
maxcharacters ofs, with “…” if it was cut. - validate_
non_ negative - Validates an optional non-negative number such as a mass or a cost.
- validate_
password - validate_
quantity - Validates a BOM quantity.
- validate_
result_ numbers - Validates a result value and its limits (finite numbers, lower ≤ upper).