amos af9199f1e1 Add 2 HARD tasks after Qwen top-ups: lwIP UDP routing and NuttX float layout
With top-up attempts from batch 26 commit 7f99538 added, lwIP UDP route
and validation passed 1 of 3 valid attempts and NuttX floating format
layout 0 of 3; Qwen ran out of context in most failures. Each comes from
the measured commit, its digest matches, and it is still present at the
batch branch head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 17:15:42 +08:00

11 KiB
Raw Permalink Blame History

Task specification: numeric-nuttx-floating-format-layout

1. Identity and source

  • Route D; family numeric-reliability; C; split group apache/nuttx.
  • Upstream: https://github.com/apache/nuttx .
  • Frozen commit: 6b11672310283d7cf2d644479502cb060424d030.
  • First fix: abfdffd87940c01dd9c6dc97401bfb2e4d47235c (10 production changed lines).
  • Second fix: 9856eae61f6c06f592d6d20ce9f66112c99b3eac (6 production added lines).
  • source: oss/apache/nuttx@abfdffd87940.
  • Licenses: original formatter/dtoa/integer conversion files are BSD-3-Clause; most supporting files are Apache-2.0; include/lzf.h is BSD-2-Clause. The repository's full LICENSE and NOTICE and every original file header are retained.
  • This is a software formatting reliability problem. It does not model hardware, security, real-time scheduling, training, or a complete C printf implementation.

2. Frozen workspace and provenance

All upstream files are byte-identical to the frozen commit, including complete source files and headers; no helper body or dtoa engine is substituted. The formatter alone has 1081 nonblank, noncomment lines (comments stripped before counting). It is the task's independently retained code body, above the 500-line minimum. The include and implementation call chain provides real context.

File Provenance License / purpose
LICENSE upstream frozen, unchanged repository license material
NOTICE upstream frozen, unchanged repository license material
include/nuttx/compiler.h upstream frozen, unchanged Apache-2.0
include/nuttx/streams.h upstream frozen, unchanged Apache-2.0
include/nuttx/allsyms.h upstream frozen, unchanged Apache-2.0
include/nuttx/symtab.h upstream frozen, unchanged Apache-2.0
include/lzf.h upstream frozen, unchanged BSD-2-Clause
libs/libc/stdio/lib_libvsprintf.c upstream frozen, unchanged BSD-3-Clause
libs/libc/stdio/lib_dtoa_engine.c upstream frozen, unchanged BSD-3-Clause
libs/libc/stdio/lib_dtoa_engine.h upstream frozen, unchanged BSD-3-Clause
libs/libc/stdio/lib_dtoa_data.c upstream frozen, unchanged BSD-3-Clause
libs/libc/stdio/lib_ultoa_invert.c upstream frozen, unchanged BSD-3-Clause
libs/libc/stdio/lib_ultoa_invert.h upstream frozen, unchanged BSD-3-Clause
libs/libc/stdio/lib_snprintf.c upstream frozen, unchanged Apache-2.0
libs/libc/stdio/lib_vsnprintf.c upstream frozen, unchanged Apache-2.0
libs/libc/stream/lib_memoutstream.c upstream frozen, unchanged Apache-2.0
libs/libc/stream/lib_nulloutstream.c upstream frozen, unchanged Apache-2.0
libs/libc/stream/lib_libnoflush.c upstream frozen, unchanged Apache-2.0
port/nuttx/config.h supplemental ordinary floating-point / long-long enabled; mountpoints disabled
port/compat.h supplemental host declarations, DEBUGASSERT, and va_format integration
port/libc.h supplemental host libc include integration; no conversion code
port/nuttx/fs/fs.h supplemental unused filesystem include and OK constant; no filesystem operations
Makefile supplemental direct GCC build, original source chain, normal-path smoke
smoke.c supplemental public build check using ordinary fixed precision and integer formatting
README.md supplemental build instructions, collected file, environment scope
docs/format-contract.md supplemental public C formatting and bounded task contract

The template has 26 files. Mountpoint, all-symbol, LZF, and numbered argument features are off. No upstream code was compiled or run on the host. The public entry points are the real supplied snprintf and vsnprintf, which call the real lib_vsprintf, dtoa engine, integer conversion, and memory/null streams. Compiler options disable builtins to prevent host snprintf substitution.

3. Defects and reference composition

  1. The alternate fixed-point, zero-precision decimal point was emitted before the last integer digit. The first complete production hunk moves it after that digit. This affects plain fields and the interpretation of field widths.
  2. Scientific notation emitted a one-digit exponent without its leading zero. The second complete production hunk emits that zero for exponent magnitude 0 through 9. This affects both e and E, positive and negative exponents.

The frozen file matches the first fix's parent file. Between the first fix and the second fix's parent, this candidate file is unchanged. Gold is byte-identical to the second fixed upstream source, so no intervening changes from other files are imported. The only-decimal and only-exponent fixtures each contain just one production fix. Removing the exponent insertion from gold reproduces the first fix, and removing it from the exponent-only fixture reproduces base; therefore the independent transformations commute. Exact composition facts are recorded in the author's patch-evidence.json.

4. Acceptance oracle and evidence mapping

The C harness accepts runtime input and prints only the return value and the raw 192-byte output storage. It has no expected strings, assertions, or reference formatter. It calls the public APIs with actual va_list/variadic arguments; it never calls private formatter helpers. Both public entry points are checked with full buffers, and short capacities rotate between them. Fixed-seed tags, multiple fields, signs, padding, and varying capacities reject symptom constants.

The parent computes results independently from Decimal.from_float, decimal scaling, nearest rounding, exponent magnitude, flag precedence, and field padding. No gold output, source pattern, or host printf output serves as the oracle. Sentinel bytes expose observable capacity behavior. All capacities are at most 192, and all full records fit in that array. Positive and negative exponent magnitudes include one- and two-digit boundaries.

Check group Public contract and standard basis
Public snprintf and vsnprintf, actual arguments, multiple fields and literal text template/docs/format-contract.md:6 R01, :62 R11; C11 7.21.6.5 and 7.21.6.12
Finite exact binary64 inputs, normal numeric range, precision domain template/docs/format-contract.md:12 R02; task scope
Fixed conversion digits, zero filling, precision 0 and 1–12, default precision template/docs/format-contract.md:21 R03; C11 7.21.6.1 f/F
Scientific digits, exponent signs, exponent 0, magnitudes <10 and >=10, e/E case template/docs/format-contract.md:26 R04; C11 7.21.6.1 e/E
Alternate point with zero and nonzero precision, f/F/e/E template/docs/format-contract.md:33 R05; C11 7.21.6.1 flag #
Negative zero, negative values, plus and space precedence template/docs/format-contract.md:37 R06; C11 7.21.6.1 sign flags
Wide, short and zero widths; sign-aware zero padding; left precedence; width 48 template/docs/format-contract.md:41 R07; C11 7.21.6.1 flags and width
Dynamic width/precision, negative width, same field semantics template/docs/format-contract.md:47 R08; C11 7.21.6.1 argument order
Null buffer at zero capacity, capacities 1/2/7, near output length, full buffer, unchanged trailing storage template/docs/format-contract.md:52 R09; C11 7.21.6.5 paragraph 2
Complete return length despite truncation, field-internal truncation, surrounding text template/docs/format-contract.md:58 R10; C11 7.21.6.5 paragraph 3, 7.21.6.12

The standard source is the public WG14 N1570 draft at https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf . The scope and build integration are project agreements stated publicly.

5. Fixtures

Fixture Expected Purpose
gold PASS both complete upstream production fixes
valid_loop PASS emits terminal fixed digit and optional point within the loop; forms two-digit small exponents using quotient/remainder
template FAIL both original defects
noop FAIL formatter returns zero without output
cheat FAIL hardcodes only the public smoke record
onlyfix_decimal FAIL first upstream fix only; scientific failures remain
onlyfix_exponent FAIL second upstream fix only; alternate fixed failures remain
cheat_symptom FAIL handles alternate form only for value 3 and leading zero only for exponent zero
cheat_read_grader FAIL private判据读取校准对照

Every fixture contains only the declared candidate file. The source body and headers retain their copyright notices. There are nine classes, five trials each, using a fresh current-task candidate per trial.

6. Isolation and execution

verify.py is an unchanged copy of rollout/bos_verify.py. Only check.py plus the non-Python support.tar are private grader attachments. The archive contains the immutable dependency sources/headers and host integration, not the candidate. The verifier protects private files and drops every compiler/candidate process to UID/GID 65534. Formal grading uses trace6 at the fixed manifest digest, no network. The parent never executes candidate code.

The checker uses mkdtemp without chmodding its root. Before its first subprocess, including GCC, it writes every support file and harness, copies the candidate, constructs all input and expected values, and creates argv/cwd strings. After that point the parent only handles process input/output in memory; it never reads, writes, traverses, stats, or deletes scratch. Compilation is limited to 30 seconds, observations to 20 seconds, and the task limit is 90 seconds.

7. Actual validation and limitations

The ordinary smoke passed in trace6 under UID 65534. Preliminary gold and valid_loop observation probes passed. Formal receipt and current digest are recorded in the author report after calibration; no host calibration is used.

Gold's existing halfway-rounding behavior was independently reproduced without any extra gold patch: %#.1f with the exactly represented value 1.25 produced 1.3, while independently computed nearest-even output is 1.2. That probe is preserved in the author's scope_probe.py and its unique Docker JSON receipt. Halfway inputs are therefore excluded publicly in R02. Non-halfway rounding, including fractional fixed-point precision zero, remains checked. No observed failing in-scope gold case was removed.

Development probe failures are retained: the first build lacked the unused filesystem include required by the real noflush file; the second build used a noexec tmpfs. A small include bridge and executable tmpfs resolved them without changing upstream files. All probe receipts include exact container names, command lines, raw output, and confirmed post-removal inspection.

Difficulty is unmeasured. There is no model rollout or hardware validation. Independent root review and repository-wide tests belong to the coordinator. The task is not admitted to real sampling solely by author calibration.

Final author calibration: runs/20261102-D-oss-fix-26/nuttx-abfdffd/calibration-a7a59d5a3bef4e449a9c7ed0b6f7b247 is PASS, all 45 trials match expectations, cleanup confirmed. Current task digest is 45b9241e29c299259b4bdff5ae4f77836a8214ed3f4c48cc2901e4759de09320. Each positive trial compares 33328 observations. All 98 exact development and calibration container names were independently inspected absent; see the author cleanup-verification.json.