Repository navigation
fix: adversarial inputs of the public API are refused early or answered on both kernel paths - #41
Conversation
…ed on both kernel paths
An adversarial probe of the public API (cable YAML, compute_fatigue,
compute_mkappa, compute_neutral_axes, export_bending_law, compute_thermal,
the sea-state batch, the CSV readers; edge and invalid values, with and
without the compiled kernels) found:
- mu = 1e6 overflowed the capstan factor of the reference return map ("wire
history exceeds floating-point range") while the compiled kernels held the
wires stuck. The reference bound is now held at a value no wire stress
reaches, so both paths give the stuck answer, that of mu = 1.
- The critical fibre, wire and layer were an argmax over values equal to
round-off at symmetric fibres: 63 deg on one kernel path, 243 deg on the
other. Values within 1e-12 of the largest are a tie, won by the first.
- compute_thermal took a negative current and temperatures below absolute
zero, and n_cores = 0 divided by zero.
- export_bending_law raised numpy's TypeError for a fractional n_points.
- A layer's schema error was titled with the union of every layer kind and
located within the kind; it now names the layer, its index and the file.
- read_series_csv raised UnicodeDecodeError on a file that is not UTF-8 and
stopped on a row of spaces; both CSV readers took 1_0 as 10.
- SeaStateBatchOptions left n_fibres, chunk_rows, mu, exposure_years and
design_fatigue_factor to be checked after every run had been evaluated;
SeaStateRun did not check line_id.
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f0c9d1355
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A row of separators with more cells than the header put the surplus cells under None as a list, and the blank-row check raised AttributeError on it. Such a row is skipped when every cell is blank and refused with CableSchemaError, naming the line, when a surplus cell holds a value. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b739149bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Both CSV readers split the text into lines before the CSV parser saw it, so
a quoted cell holding a newline had its parts joined ("1" and "0" read as
10). They now parse a newline-preserving stream and refuse such a cell.
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
… fractional core count thermal_network built a network of NaN temperatures from a NaN ambient and took an ambient below absolute zero and n_cores = 1.5; its steady, transient and matrix states took negative currents and such ambients. They are refused as compute_thermal refuses them; the core count check is shared. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
After the Yun shear stack of an armour layer stops at its support (dev 7e14481), the 33 kV template's wires slip at mu = 1 on this loop, so it is no longer the stuck reference. At mu = 100 the friction-limited wires stick and the loop equals the mu = 1e6 one exactly on both kernel paths, slip fractions included; the test compares with it. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
An adversarial probe of the public API before 0.2.0: about 320 cases over the cable YAML (every numeric field of every layer of the bundled 33 kV single-core cable set to 0, negative, NaN, inf, a string or removed; lay angles 0 to 89.99°; 1 to 10 000 wires),
compute_fatigue(zero, constant, one-sample, 200 000-sample, NaN/inf, mismatched, 2-D, integer and list histories; μ = 0 to 1e6; every option),compute_mkappa,compute_neutral_axes,export_bending_law,compute_thermal, the sea-state batch options and both CSV readers (CRLF, BOM, blank rows, exponent forms, short rows, non-monotonic time, UTF-16, Latin-1), each with and without the compiled kernels. Every case either gave a finite answer or a CableXSec error naming the input, except the ones below, which are fixed here with a test each (tests/test_robustness_inputs.py).compute_fatigue(..., mu=1e6)CABLEXSEC_DISABLE_NUMBA=1):CableInputError: wire history exceeds floating-point rangemu = 1to 1e-12compute_mkappa(..., mu=1e6)CableInputError: wire history exceeds floating-point rangeon both pathsmu = 100, where the friction-limited wires already stick, slip fractions includedphi_critical_deg63° with numba, 243° without (argmax of a round-off difference)compute_thermal(n_cores=0)ZeroDivisionErrorCableInputErrornamingn_cores(also1.5,True)compute_thermal(current_A=-1),ambient_C=-300,conductor_temp_C=-274thermal_network(ambient_C=nan),ambient_C=-400,n_cores=1.5;steady_state(-600),transient(..., ambient_C=-280)export_bending_law(n_points=20.5)TypeErrorCableInputErrorValidationErrortitledtagged-union[function-after[...HelicalLayer]...], locatedhelical.d_wire_mlayer 6 'inner_armour' of cable.yaml, locatedlayers.6.helical...(stillpydantic.ValidationError, as documented)read_series_csvof a UTF-16 or Latin-1 fileUnicodeDecodeErrorCableSchemaErrorread_series_csvwith a row of spaces or commasCableSchemaError1_0(either reader)SeaStateBatchOptions(exposure_years=0, design_fatigue_factor=0.5, n_fibres=2, chunk_rows=4, mu=-0.1)SeaStateRun(line_id=0)orTrueDetails
Capstan overflow.
wire_slip_stress_boundsforms the tension boundσ₀ g expm1(μ |sin α| ψ). For μ = 1e6 the exponent overflows; the compiled bounds (fast_slip) returninfand the wires stick, the reference path raised on the overflow. The reference bound is now held at 1e300 Pa, a bound no wire stress reaches, so both paths stick. The damage of the probe history at μ = 1e6 equals that at μ = 1 (where the wires already stick on that history, at 200 kN) on both paths. Thecompute_mkappaloop, which raised on both paths before, equals the loop at μ = 100 on the 33 kV template at 100 kN. Before dev 7e14481 (#39) it also equalled the loop at μ = 1. Since the Yun shear stack stops at the layer's support, the wires slip at μ = 1 on that loop, so the test compares with μ = 100.Ties.
compute_fatiguetakes the critical fibre per wire, the critical wire per layer and the critical layer with_first_maximum: the first index whose value is within1e-12 × |max|of the maximum (_TIE_RTOL). Damage is unchanged; only the reported location of a tie is now deterministic across kernel paths.Not changed (intended).
compute_neutral_axesreturns NaN directions and offsets where they are undefined (documented). A round-wire layer that overfills its radius (n_wires = 10000) warns (WireFillWarning, documented, kept for the pinned legacy definitions).compute_fatigueon a constant curvature with the distributed model gives 1e-58 damage with the compiled kernels and 0 without (round-off cycles of an iterative solve; the reported critical angle of an all-zero damage is not meaningful).Gates
On 01322d0 (dev caca014 merged in: #40, #42, #43, #46, #48, #49):
pytest(full suite, venv with the CI wheels,NUMBA_NUM_THREADS=1): 4822 passed, 4 skipped.CABLEXSEC_DISABLE_NUMBA=1: 4706 passed, 120 skipped.python -m mypy: no issues in 119 source files.ruff checkandruff format --checkonsrc tests examples validation release doc: clean.--collect-onlyIDs per marker): no marked test added; counts unchanged (1248 / 77 / 59).sea_state_batch.py: this PR's early option checks and dev'scurvature_check_*checks inSeaStateBatchOptions.__post_init__. Both are kept.