105 lines
6.0 KiB
Markdown
105 lines
6.0 KiB
Markdown
# Isolated source-default policy, 2026-09-13
|
||
|
||
**Experimental field-map implementation; production formatting and editing are
|
||
unchanged.** This is the next implementation experiment for
|
||
[issue 11](http://217.177.34.108:3000/sorokin.oleg.edu/ARCADIA-Studio/issues/11)
|
||
on `codex/text-defaults-9e8r6t`, owned by Codex-9e8r6t `/root`.
|
||
|
||
## Result and interface
|
||
|
||
The [prototype](prototypes/source-defaults-20260913.rs) implements the ordinary
|
||
source-7 field policy proposed in the [candidate design](text-default-omission-design-20260913.md).
|
||
It exposes one pure function:
|
||
|
||
```rust
|
||
fields(Context, &serde_json::Map<String, Value>, Mode) -> Map<String, Value>
|
||
```
|
||
|
||
`Context` selects Element(Kind), Relation(RelationKind), Diagram, Node, Artifact
|
||
or Trace. `CompleteForEdit` restores the three existing serializer skips in the
|
||
applicable typed records: Exchange operation, node port anchors and baseline
|
||
semantic value. It retains populated fields and does not hydrate arbitrary
|
||
partial source. `Compact` removes only known source-context defaults, including
|
||
verified nested omissions. It normalizes a composite and its declared default
|
||
under the same nested rules before comparing them; required payloads and unknown
|
||
fields prevent inappropriate removal of a whole composite.
|
||
|
||
Input is the declaration-field map already extracted from a typed model, as
|
||
the current formatter constructs it. Headers/identities/names are outside this
|
||
interface; element descriptions/parents and node diagram references are inside.
|
||
Non-null flat parents remain. Lexical nesting, project header/description,
|
||
source-version dispatch, private analysis constructors and historical semantic
|
||
formatting remain the caller's separate responsibilities.
|
||
|
||
This policy uses explicit source defaults rather than GUI factories or recursive
|
||
value-shape pruning. In particular, source Scenario defaults to MixedLegacy;
|
||
DataField maximum defaults to 1; relation orientation depends on its kind;
|
||
selected constructors retain their required fields. Empty optional values,
|
||
present unresolved operation records, empty selectors and historical baseline
|
||
content preserve their distinctions. Negative coordinate zero is compared by
|
||
bits and retained. Unknown/multikey constructor wrappers are not reinterpreted.
|
||
|
||
## Evidence and review
|
||
|
||
The independent [test file](../crates/oa-core/tests/default_omission_policy.rs)
|
||
includes the prototype directly. Initial Windows execution passed **16 tests**
|
||
and strict targeted Clippy. A fresh critic found no blocking defect or important
|
||
oracle overconstraint, but identified a gap in nested unknown-field preservation
|
||
coverage. Two additional tests now cover otherwise-default String/Exchange/view
|
||
options with unknown fields, plus unknown and multi-key constructor wrappers.
|
||
Final execution passes **18 tests**, and strict targeted Clippy passes again.
|
||
The prototype is byte-identical between these two iterations; only its test
|
||
file changed.
|
||
|
||
All 39 element kinds and 25 relation kinds receive common-field checks. Focused
|
||
maps separately check declaration and nested defaults, constructor-required
|
||
payloads, orientation/multiplicity, flat parent retention, signed coordinate bits,
|
||
present empty values, unresolved operation intent and untouched historical data.
|
||
Each compact oracle also checks input immutability and policy idempotence.
|
||
|
||
These are independent literal field-map oracles. Symbolic identity strings,
|
||
unknown-field sentinels and the synthetic historical payload are not claimed to
|
||
be admitted model/source fixtures. The earlier
|
||
[nested admission result](text-default-omission-admission-20260913.md) remains the
|
||
separate public-parser evidence for its bounded set of omissions. The three
|
||
[authored-preservation failures](text-default-omission-baseline-20260913.md)
|
||
remain unfixed until production update wiring consumes the complete comparison
|
||
policy and passes those exact regressions.
|
||
|
||
All four captured gates identify starting HEAD
|
||
`136917b47e50f7c07da975b93f879493cab81e21` plus the new prototype/test, with
|
||
**608 exact unchanged inputs**, including the externally included prototype.
|
||
The original capture runner was adapted explicitly to include `harness/prototypes`;
|
||
the previous fixture-only scope would have missed compiled code.
|
||
Windows gnullvm Rust/Cargo 1.98.1, LLVM-MinGW, one Cargo job, incremental disabled,
|
||
locked offline dependencies. Final tests ran 10:14:58–10:15:02 UTC and final
|
||
strict Clippy 10:15:04–10:15:07 UTC on 2026-09-13.
|
||
|
||
```text
|
||
cargo test --locked --offline -p oa-core --test default_omission_policy --message-format=json -- --nocapture
|
||
cargo clippy --locked --offline -p oa-core --test default_omission_policy --message-format=json -- -D warnings
|
||
```
|
||
|
||
The [portable evidence](experiments/default-policy-20260913/README.md) retains
|
||
all four runs, input ZIPs, raw streams/receipts, the exact runner and independent
|
||
reviews. Its read-only verifier checks recorded integrity and outcomes; parent
|
||
also checks the staged Git blobs against final executed inputs and archive pins.
|
||
Test binaries are not included; their hashes are historical runner receipts.
|
||
|
||
## Required integration work
|
||
|
||
The prototype duplicates the parser's ordinary default inventory for this
|
||
experiment; production integration should share the source-default contract
|
||
without inheriting GUI-only defaults. It must connect real typed serialization,
|
||
compact flat/modular output, complete edit comparison, and compact inserted or
|
||
replaced fragments. The final result still needs full persistent-model round
|
||
trips, signed-zero checks, the constructor/header-change counterexamples,
|
||
unchanged authored source and real graphical/text/API workflows. A populated
|
||
operation/nonempty-anchor CompleteForEdit oracle is still worth adding at that
|
||
integration boundary; current preservation support there is inspected code.
|
||
|
||
The named source8 interface/ownership boundary is still pending in Gitea issue 7.
|
||
No shared formatter, source_project, analysis writer, normative reference, GUI,
|
||
API, release or Linux behavior changed in this experiment. These gates do not
|
||
establish full-suite or release acceptance and do not close issue 11.
|