/** * A write may not silently delete what it was not asked to touch. * * The bridge's write path is Read → mutate → `IMetadataProvider.Update()`. That * round trip goes through the metamodel, so anything the deserializer failed to * read — a misordered element, a property this server patched onto the file * after the provider's last rebuild — is simply absent from the object it * serialises back. Both writes report success. The file is quietly poorer than * it was, and "Verified: on disk" only ever asked whether a file exists. * * The 2026-08-31 capture run of L4-headerlines-document-slice hit it twice in * one session (CacheLookup=None, then DeleteAction=Cascade) and neither the * 5,779-test suite nor the golden diff could see it: the metadata built with 0 * errors and read back as plausible. * * Both root causes are fixed at source — the delete-action element order in * directXmlWriters.ts, the refresh ordering in createD365File.ts. This module is * the guard that makes the CLASS of defect non-silent, including the instances * nobody has found yet: * * • compare the file before and after the write; * • an element the operation did not target and that lost its value is put * back, in the position it held; * • what happened is reported in the write's own response. * * Deliberately narrow, because a wrong restore is worse than a missing one: * • only TOP-LEVEL LEAF elements (`None`) — never a * collection, whose contents an operation legitimately rewrites; * • never for a `remove-*` operation, and never for the property a * modify-property call names — those are asked-for deletions; * • never for an element the operation ADDED or CHANGED, only for one that * vanished outright. */ /** * Top-level leaf elements of the root, in document order: name → raw text. * * Structure, not indentation, and certainly not "the document with the comments * deleted" — that strip is the bug xmlScan.ts exists to stop, and it was flagged * here as js/incomplete-multi-character-sanitization on this module's first CI * run. A property inside a comment is not a property, and a property nested in a * collection is not top-level; scanXmlLeaves distinguishes both. */ export declare function readTopLevelLeaves(xml: string): Map; export interface PreservationResult { /** The document to write, with anything restored put back. */ xml: string; /** Elements restored, as `Name=value`. */ restored: string[]; } /** * Put back the top-level properties the write dropped without being asked to. * * `targetedProperty` is the element the operation itself is about (the * propertyPath of a modify-property) — that one is the caller's to change or * clear, so it is never restored. */ export declare function preserveDroppedProperties(before: string, after: string, operation: string, targetedProperty?: string): PreservationResult; /** The note a restore earns in the write's response. Empty when nothing moved. */ export declare function renderPreservationNote(restored: readonly string[]): string; /** * Did the value the operation CLAIMED to write actually survive to disk? * * "✅ Verified: on disk (2,143 bytes)" answers a question nobody was asking. The * file existed before the write too. Both silent corruptions in the 2026-08-31 * capture run were reported with that line under them, and it was true both * times — the bytes were on disk, just not the ones the caller asked for. * * Only operations whose result is a single unambiguous element are checked. A * marker that cannot be derived returns null, and a check that cannot be made is * not reported as one that passed. */ export declare function claimedMarkerFor(operation: string, args: Record): { label: string; pattern: RegExp; } | null; /** The warning an unfulfilled claim earns. Empty when the claim held (or none was checkable). */ export declare function renderClaimCheck(marker: { label: string; pattern: RegExp; } | null, postImage: string | null): string; //# sourceMappingURL=preserveMetadataElements.d.ts.map