Skip to content

First-use friction: plain task durations, n_draws vs mc_samples, a fast first diagram, cost and beta-factor docs - #501

Merged
derrynknife merged 2 commits into
devfrom
build/usertest-friction
Nov 21, 2026
Merged

derrynknife merged 2 commits into
devfrom
build/usertest-friction

Conversation

@derrynknife

Copy link
Copy Markdown
Owner

Summary

Small fixes for traps a first-time user hits.

  • A task's duration as a number. A preventive or inspection task's "duration" may be a plain number, a fixed time (surpyval's ExactEventTime); 0 is 'instant'. A negative or non-finite number (or a bool or text) is refused, naming the task. Done once in _spec._duration, used by both specs.
  • n_draws is kept, and mc_samples= is refused naming it. The *_uncertainty methods, uncertainty_importance and optimal_replacement_intervals draw the uncertain models' parameters and work each draw out without simulating it, so n_draws counts something different from mc_samples. They took mc_samples= with a bare "unexpected keyword"; deprecation.refuses_removed_names now refuses it (and the names 0.12 removed) with a message naming n_draws. FaultTree gets @refuse_removed_names like the diagrams. Recorded in CLAUDE.md's API conventions.
  • The first diagram of a session took about 2 s (later ones about 1 ms). The cause: checking whether a node is a joint model or a degradation process imported surpyval.univariate.joint and surpyval.degradation, and with them surpyval's regression code, pandas and formulaic. No model can be one of those before its module has been imported, so the check now returns early while the module is not in sys.modules. The first build now takes about 0.05 s. test_first_build.py checks, in a fresh interpreter, that building and analysing plain diagrams imports neither module.
  • BetaFactor's basis. The docstring now opens by saying which basis to use: the default "probability" for a mission or proof-test interval, "rate" for a whole life (MTTF, simulations, Q past 0.1). The warning past Q = 0.1 names the default basis it is about.
  • Which cost is charged when. The costs guide has a table of which cost is charged at each event. The component spec says replace_cost is the replacement on failure, while a planned replacement is charged its "preventive" task's "cost".

Type of change

  • Bug fix
  • New feature
  • Documentation

Checklist

  • Tests added/updated: test_refused_inputs.py (a number gives the same exact values and seeded simulations as ExactEventTime, for both tasks; bad durations are refused; mc_samples/N on sf_uncertainty and mean_uncertainty are refused naming n_draws), test_first_build.py
  • black, isort, flake8 and mypy on the changed files; tests of what changed (test_refused_inputs, test_first_build, test_ccf_lifetime, test_joint_node, test_degradation, test_messages, test_help, test_removed_in_0_12, test_safety_edges, and the doctests of the changed modules)
  • CHANGELOG.md updated under [Unreleased]
  • No seeded result changes: a number maps to the ExactEventTime model users already passed

Notes for reviewers

The repair time ("repairability") still refuses a plain number. That refusal is deliberate, because a number there is ambiguous between an MTTR and a fixed time, and its message already names both models.


Generated by Claude Code

…; lazy joint and degradation checks

- A preventive or inspection task's duration may be a number, a fixed
  time (ExactEventTime); 0 is instant; a negative or non-finite number is
  refused naming the task.
- The *_uncertainty methods keep n_draws (draws of parameters, each worked
  out without simulating) and refuse mc_samples or a removed name, naming
  n_draws. FaultTree refuses the removed names as the diagrams do.
- A session's first diagram no longer imports surpyval's joint and
  degradation models to check its nodes (about 2 s, now about 0.05 s).
- BetaFactor says first which basis to use; the warning past Q = 0.1
  names the default basis.
- The costs guide has a table of which cost is charged when; the spec
  says replace_cost is the replacement on failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants