feat(managed): add retained metadata overview and pages (#2413)
Add caller-selected managed metadata summaries and original collection pages while preserving complete CLI/MCP defaults and previous-runtime Evidence. Real SDK replies shrink substantially; actual Codex token/latency results remain mixed and are documented without a token-saving claim. Validated focused SDK/domain tests, full static/docs checks, real two-assembly repeated workflows and portable old Evidence, real SQLite WASM, and all exact-head CI checks. Raw experimental artifacts remain private. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
parent
f43fc02475
commit
82cfcee19f
@@ -27,6 +27,11 @@ Follow-up: [EVM descriptor lifecycle acceptance](evm-lifecycle.md) verifies actu
|
||||
worker replies, late SDK cancellation, permission-induced cleanup failures,
|
||||
healthy WASM peers and old CLI parity with explicit runtime and platform scope.
|
||||
|
||||
Follow-up: [managed artifact delivery and retained views](managed-artifact-summary.md)
|
||||
records two shipped assembly checks, previous-runtime portable Evidence, and four
|
||||
actual Codex trials. Selected replies shrink substantially; observed model input
|
||||
tokens increase and latency is mixed, so model-token savings are not claimed.
|
||||
|
||||
The 12 detailed checkpoint receipts were archived byte-for-byte before removal
|
||||
from the final PR tree. The archive `review-receipts-00d51e0fc-20261012` is in the
|
||||
private experiment lab outside the checkout; its `archive-index.json` records
|
||||
|
||||
@@ -27,6 +27,7 @@ const sameSettings = [
|
||||
"retained_verification",
|
||||
"native_question",
|
||||
"javascript_question",
|
||||
"managed_question",
|
||||
"provider_settings_sha256",
|
||||
"provider_search_path_sha256",
|
||||
"provider_environment_policy_sha256",
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
# Managed artifact delivery and retained views
|
||||
|
||||
Continues [#2016](https://github.com/morluto/rea/issues/2016) after
|
||||
[#2404](https://github.com/morluto/rea/pull/2404) merged. This checkpoint pins
|
||||
the complete managed workflow before implementing another optional view.
|
||||
The baseline below precedes implementation; the follow-up adds explicit summary
|
||||
delivery and portable collection pages while preserving complete defaults.
|
||||
|
||||
## Frozen control and analyst question
|
||||
|
||||
Control source is merged main `ae8051302b5834322fa00cfa31c968ae74ab6ed9`,
|
||||
Node 24.18.0, matching locked dependencies and actual compiled stdio MCP.
|
||||
The frozen `dist/`/`bridge/` file-table SHA-256 is
|
||||
`7a4cec0fa4f7e929356b50a6b13472f80bd6f526221e427125370cca3ef98d00`.
|
||||
Measurement source SHA-256 is
|
||||
`a95d8d8e9f72c0b2b885c61907ed13054ebf7d1642f6f13b0126163840b1221a`.
|
||||
|
||||
Use the digest-pinned shipped ShareX DLL from [the corpus](corpus.json),
|
||||
2,162,688 bytes, SHA-256
|
||||
`191a191be964e434daf0f9d76d1e0d8ddce90d7e248cba2a6b5ac9577f288d53`.
|
||||
The [existing model question](questions/managed.txt) requests exact identity,
|
||||
complete managed classification and its evidence, frameworks and every declared
|
||||
native ModuleRef/PInvoke boundary with coverage and limitations. It explicitly
|
||||
excludes unrelated resource/custom-attribute inventories. Analysis reads PE/CLI
|
||||
metadata without loading or executing the assembly.
|
||||
|
||||
The current complete result has exactly the same normalized facts as the earlier
|
||||
real managed checkpoint linked from [the EVM descriptor study](evm-descriptor.md).
|
||||
This comparison does not equate fresh Evidence IDs, provider versions or whole
|
||||
catalogs. Original target bytes remain unchanged; SDK-converted named schemas
|
||||
and actual replies validate in the public measurement workflow.
|
||||
|
||||
## Observed data costs
|
||||
|
||||
| Public operation | SDK result JSON UTF-8 bytes | Tool milliseconds |
|
||||
| ----------------------------------- | --------------------------: | ----------------: |
|
||||
| `inspect_managed_artifact` | 1,270,839 | 450.306 |
|
||||
| `inspect_managed_native_boundaries` | 27,913 | 142.663 |
|
||||
|
||||
The complete workflow, including connection/discovery and both calls, takes
|
||||
3.721 seconds. The full discovered catalog is 2,482,204 compact JSON bytes;
|
||||
its input definitions are 527,569 bytes. These costs include the current main
|
||||
changes and are not silently substituted for an older catalog baseline.
|
||||
|
||||
The artifact inspection's normalized payload alone is 607,605 compact JSON UTF-8
|
||||
bytes, measured with actual Node `JSON.stringify`:
|
||||
|
||||
| Returned collection | Rows | Compact JSON UTF-8 bytes |
|
||||
| ------------------- | ----: | -----------------------: |
|
||||
| References | 38 | 12,153 |
|
||||
| Resources | 36 | 10,357 |
|
||||
| Custom attributes | 1,945 | 582,586 |
|
||||
|
||||
Custom attributes dominate the payload. The remaining identity, PE/CLI,
|
||||
classification, metadata, framework and coverage facts are comparatively small.
|
||||
`raw_result` is null. SDK result size includes both structured and text
|
||||
representations; it is not the exact context a model receives or a token count.
|
||||
|
||||
The serial owned scope takes 4.852 seconds including the driver, samples
|
||||
520,110,080 peak family bytes and records 4.699 last-observed CPU seconds.
|
||||
One CPU, 4 GiB hard memory, unchanged 3 GiB early-stop, no swap and 192 tasks
|
||||
remain in effect. No guard abort occurs. Final cgroup counters disappear and
|
||||
remain unknown; sampled zero events are not final no-OOM proof.
|
||||
|
||||
## Bounded candidate and acceptance
|
||||
|
||||
Evaluate an explicit overview on the first artifact inspection, retaining the
|
||||
unchanged complete source and returning a distinct linked view. Keep complete
|
||||
identity/classification, metadata status, nullable module/MVID, assembly,
|
||||
frameworks, original coverage/issues/limitations and returned-collection counts
|
||||
inline. Typed pages can expose original references/resources/attributes with
|
||||
their nulls, token coordinates, offsets, order and values. Returned-array
|
||||
coverage must remain distinct from whole-metadata completeness.
|
||||
|
||||
Reuse the existing managed schemas, retained Evidence application workflow and
|
||||
named registration hooks. Keep omitted/complete requests, other managed tools,
|
||||
selected target/provider behavior and original export/import identities usable.
|
||||
Do not strengthen historical admission to require a non-null subject or
|
||||
reinterpret foreign recorded paths through this host's filesystem. Delivery
|
||||
selection must not be passed to the PE/CLI parser as an analysis option.
|
||||
|
||||
At the baseline checkpoint the candidate was not implemented or measured. Compare the
|
||||
same completed analyst question, actual discovery/results, full default
|
||||
compatibility and retained paging without producer reruns. Follow with other
|
||||
shipped managed inputs, partial/unavailable metadata and real Codex trials with
|
||||
strict factual/reference checks. Preserve failed or truncated transcripts.
|
||||
Count total/cached/uncached input, output, calls/retries, whole-task time, CPU
|
||||
and family memory before recommending a token or latency improvement. A smaller
|
||||
reply alone is insufficient.
|
||||
|
||||
## Reproduce the control
|
||||
|
||||
Build and freeze the explicit source revision before editing production code.
|
||||
Supply the original shipped DLL and an explicit string-valued provider dictionary
|
||||
in a fresh private receipt directory:
|
||||
|
||||
```bash
|
||||
python3 experiments/analysis-efficiency/resource-run.py -- \
|
||||
node experiments/analysis-efficiency/measure.mjs \
|
||||
--runtime-root /absolute/control-ae805 \
|
||||
--revision ae8051302b5834322fa00cfa31c968ae74ab6ed9 \
|
||||
--artifact sharex.dll --path /absolute/ShareX.dll \
|
||||
--providers /absolute/explicit-providers.json --schemas selected \
|
||||
--output /absolute/new-control-receipts
|
||||
```
|
||||
|
||||
Raw replies, runtime copies, fingerprints and detailed resource receipts stay
|
||||
outside Git. No new provider, plugin SDK, database cache or target execution is
|
||||
introduced by this baseline.
|
||||
|
||||
## Implemented candidate and real SDK observations
|
||||
|
||||
Candidate `8bc1601ca51e417ca472d90ea0367e9418a1a0f2` adds
|
||||
`inspect_managed_artifact({path, detail: "summary"})` and managed collection pages
|
||||
through the existing `inspect_analysis_view` contract. The complete parser result
|
||||
remains retained. Omitted detail and explicit `complete` keep complete output;
|
||||
other managed tools do not acquire this selector. CLI inspection stays complete.
|
||||
The frozen candidate runtime file-table SHA-256 is
|
||||
`9e7380f537301bf0cfe2926f5619011af848af7c220750e75189498e65d825e1`.
|
||||
The revised measurement driver SHA-256 is
|
||||
`8c22f59e931fdc347dea1204ea0faf91330578db684357261ec6f03bd0efa85e`.
|
||||
|
||||
Use `--managed-question identity` on **both** sides, with `--delivery complete`
|
||||
for the control and `--delivery summary` for the candidate. The original default
|
||||
`inventory` recipe remains unchanged. Both identity recipes make the same two
|
||||
public calls, validate their advertised SDK schemas, and compare complete
|
||||
identity/classification, frameworks, coverage and native-boundary facts.
|
||||
|
||||
| Artifact | Complete metadata bytes | Summary metadata bytes | Complete two-call bytes | Summary two-call bytes |
|
||||
| --------------------- | ----------------------: | ---------------------: | ----------------------: | ---------------------: |
|
||||
| ShareX.dll | 1,270,839 | 10,549 | 1,298,752 | 38,462 |
|
||||
| ShareX.HelpersLib.dll | 1,296,839 | 10,937 | 1,586,970 | 301,068 |
|
||||
|
||||
The helper assembly is a second shipped member of the same pinned ShareX release,
|
||||
1,076,224 bytes, SHA-256
|
||||
`e91bd1ec904e2bb8a1add4bb6187443b878bf33d24fe9e27f0b799bfee9de33d`.
|
||||
It is not an independent application or a new runtime/provider lane. Its native
|
||||
boundary report remains comparatively large and unchanged. Metadata reply bytes
|
||||
fall by about 99.17% and 99.16%; two-call totals fall by about 97.04% and 81.03%.
|
||||
The first committed-candidate observations take 3.699 and 3.838 seconds, versus
|
||||
3.809 and 3.925 seconds for controls. These timings include discovery and do not
|
||||
establish a general latency improvement. The full candidate catalog grows from
|
||||
2,482,204 to 2,497,635 bytes; input definitions grow from 527,569 to 528,862.
|
||||
|
||||
An earlier dirty prototype produced the same runtime file-table hash and a
|
||||
separate provenance receipt. Its observations remain separate; a clean baseline
|
||||
commit is never presented as the source of uncommitted production changes.
|
||||
|
||||
## Actual Codex findings: token benefit is not established
|
||||
|
||||
Four sequential trials use actual Codex CLI 0.161.0, requested model
|
||||
`gpt-5.6-terra`, high reasoning, the unchanged question above and the same two
|
||||
enabled tools. The requested alias does not prove a resolved server model ID.
|
||||
Order is control, candidate, candidate, control. Both candidate trials independently
|
||||
select summary; all trials preserve dependency order, make two successful calls,
|
||||
leave the artifact unchanged and remove temporary profiles.
|
||||
|
||||
| Trial | Input tokens | Cached input | Uncached input | Output tokens | Wall seconds |
|
||||
| ----------- | -----------: | -----------: | -------------: | ------------: | -----------: |
|
||||
| Control 1 | 54,821 | 29,184 | 25,637 | 1,782 | 63.207 |
|
||||
| Candidate 1 | 77,594 | 50,432 | 27,162 | 1,583 | 46.685 |
|
||||
| Candidate 2 | 82,426 | 49,408 | 33,018 | 2,120 | 67.379 |
|
||||
| Control 2 | 55,296 | 29,184 | 26,112 | 2,361 | 62.159 |
|
||||
|
||||
Uncached input is reported input minus cached input. **Candidate input and
|
||||
uncached input are higher in both comparisons.** Latency is mixed. This feature
|
||||
demonstrates smaller selected delivery, not measured model-token savings or a
|
||||
stable whole-task speedup. Event result bytes are also not a measurement of the
|
||||
exact context presented to the model. No hidden truncation/cache mechanism is
|
||||
inferred from these aggregates. Keep further model-context investigation separate
|
||||
from this additive view implementation.
|
||||
|
||||
The question prescribes a `coverage` field without prescribing its nested labels.
|
||||
The grader now accepts only explicit equivalent artifact/native scope names;
|
||||
conflicting duplicate scopes still fail. Original failure receipts remain intact.
|
||||
Control 1 and both candidates pass the selected factual checks after that
|
||||
correction. Control 2 omits `classification.container` and does not report
|
||||
separate artifact/native coverage in the expected representation; it fails these
|
||||
strict selected checks. The prompt did not specify every nested key, so this is
|
||||
also an answer-representation limitation. It is not counted as a fully acceptable
|
||||
control answer or repaired by assuming ambiguous flat coverage. Original
|
||||
limitations were additionally reviewed against producer replies.
|
||||
|
||||
All four reports still fail the **complete** selected gate because final physical
|
||||
resource counters are unavailable. The factual subset is reported separately;
|
||||
it does not turn unknown final resource counters into a pass. Trial guards remain
|
||||
unchanged, no guard abort is observed, and sampled peaks stay below the 3 GiB
|
||||
early-stop threshold. A sampled zero OOM count is not final no-OOM proof.
|
||||
|
||||
## Previous-runtime Evidence compatibility
|
||||
|
||||
Complete actual producer Evidence from control `ae8051302b5834322fa00cfa31c968ae74ab6ed9`
|
||||
for both shipped assemblies is passed, unchanged, through the candidate's public
|
||||
SDK inline view. Each artifact makes 14 view calls: a summary, all original
|
||||
reference/resource/attribute pages at a caller-selected 256 rows, and exhausted
|
||||
pages for each collection. Summary facts, every row and order, source coverage,
|
||||
parent ID, links and target digest match; the original Evidence stays unchanged.
|
||||
ShareX has 38/36/1,945 reported rows and HelpersLib has 49/17/1,988. No producer
|
||||
operation or target mutation is requested by this portable workflow.
|
||||
|
||||
The private verification driver SHA-256 is
|
||||
`7bb1f24b488beda012b1e78132de29b868fe1ea91a5e1499d7f271801fa40380`;
|
||||
the receipt scope takes 5.860 seconds, samples 642,244,608 peak family bytes and
|
||||
5.619 last-observed CPU seconds, with no guard abort. Final counters remain unknown.
|
||||
These are actual previous-runtime records, unlike the separate synthetic
|
||||
null-subject compatibility test. They do not prove every historical release.
|
||||
|
||||
Focused SDK/domain checks cover first-call summary, complete defaults, selected
|
||||
target reuse, paging after the source disappears, malformed metadata, historical
|
||||
null subjects, digest mismatch, portable projection and unavailable retention
|
||||
before file access. The exact candidate CI passes all checks after only the
|
||||
browser cleanup and Apple `hdiutil` jobs are retried on the same source revision;
|
||||
their original failures remain recorded in the private team handoff.
|
||||
|
||||
## Committed-runtime repetition and complete defaults
|
||||
|
||||
A second SDK pair reverses the order (candidate before control) for both
|
||||
assemblies. Result byte totals repeat exactly. ShareX workflow times are
|
||||
3.644 versus 3.687 seconds; HelpersLib times are 3.714 versus 3.859 seconds.
|
||||
Both pairs preserve selected settings/facts and have no tool errors. Two pairs
|
||||
per assembly, sharing one application and host, remain a narrow descriptive
|
||||
sample rather than a general performance claim.
|
||||
|
||||
Actual omitted-detail calls on the candidate additionally reproduce **all**
|
||||
normalized metadata inventories and native-boundary facts from both controls,
|
||||
not just the identity recipe's selected subset. Their canonical complete
|
||||
Evidence IDs also match. This verifies the recorded old request and complete
|
||||
result path alongside the explicit new delivery option.
|
||||
|
||||
The changed shared projector also handles an actual shipped SQLite WASM run
|
||||
through the candidate's SDK summary workflow, with real configured WABT:
|
||||
two calls, 18,687 result JSON bytes, 5.614 seconds and no tool failure. This
|
||||
checks that neighboring dispatch path; it does not establish a new WASM
|
||||
performance improvement or additional operating-system/provider coverage.
|
||||
@@ -26,6 +26,7 @@ const { values } = parseArgs({
|
||||
"verify-retained": { type: "boolean", default: false },
|
||||
"native-question": { type: "string", default: "entry" },
|
||||
"javascript-question": { type: "string", default: "inventory" },
|
||||
"managed-question": { type: "string", default: "inventory" },
|
||||
schemas: { type: "string", default: "default" },
|
||||
},
|
||||
});
|
||||
@@ -42,6 +43,12 @@ if (
|
||||
) ||
|
||||
!["inventory", "selected"].includes(values["javascript-question"]) ||
|
||||
!["default", "selected"].includes(values.schemas) ||
|
||||
!["inventory", "identity"].includes(values["managed-question"]) ||
|
||||
(!["sharex.dll", "sharex.helpers.dll"].includes(values.artifact) &&
|
||||
values["managed-question"] !== "inventory") ||
|
||||
(["sharex.dll", "sharex.helpers.dll"].includes(values.artifact) &&
|
||||
values.delivery === "summary" &&
|
||||
values["managed-question"] !== "identity") ||
|
||||
(values["verify-retained"] &&
|
||||
!["weth.hex", "uniswap-v3.factory.hex", "uniswap-v3.pool.hex"].includes(
|
||||
values.artifact,
|
||||
@@ -243,15 +250,55 @@ const targetSha = (value) => value.subject?.digest.sha256;
|
||||
const inventoryPaths = ["package.json", "main.js", "preload.js"];
|
||||
const unique = (values) => [...new Set(values)].sort();
|
||||
const inspectManagedTarget = async () => {
|
||||
const info = await call("inspect_managed_artifact", { path: values.path });
|
||||
const arguments_ = {
|
||||
path: values.path,
|
||||
...(values.delivery === "summary" ? { detail: "summary" } : {}),
|
||||
};
|
||||
const definition = catalogDefinitions.get("inspect_managed_artifact");
|
||||
if (definition === undefined)
|
||||
throw new Error("Managed inspection is not advertised");
|
||||
const accepted = new Ajv2020({
|
||||
strict: false,
|
||||
validateFormats: false,
|
||||
}).compile(definition.inputSchema)(arguments_);
|
||||
if (!accepted)
|
||||
throw new Error(
|
||||
"Selected managed delivery is not advertised by this runtime",
|
||||
);
|
||||
const info = await call("inspect_managed_artifact", arguments_);
|
||||
const boundaries = await call("inspect_managed_native_boundaries", {
|
||||
path: values.path,
|
||||
});
|
||||
const received = normalized(info);
|
||||
const report = received.kind === "summary" ? received.summary : received;
|
||||
let artifact = report;
|
||||
if (values["managed-question"] === "identity") {
|
||||
const {
|
||||
references,
|
||||
resources,
|
||||
attributes,
|
||||
reported_counts,
|
||||
identity_scope: _scope,
|
||||
...identity
|
||||
} = report;
|
||||
artifact = {
|
||||
...identity,
|
||||
reported_counts: reported_counts ?? {
|
||||
references: references.length,
|
||||
resources: resources.length,
|
||||
attributes: attributes.length,
|
||||
},
|
||||
};
|
||||
}
|
||||
return {
|
||||
artifact_sha256: targetSha(info),
|
||||
artifact: normalized(info),
|
||||
artifact,
|
||||
boundaries: normalized(boundaries),
|
||||
evidence_ids: [info.evidence_id, boundaries.evidence_id],
|
||||
evidence_ids: [
|
||||
info.evidence_id,
|
||||
...(received.kind === "summary" ? [received.parent_evidence_id] : []),
|
||||
boundaries.evidence_id,
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
@@ -766,6 +813,11 @@ const report = {
|
||||
: null,
|
||||
javascript_question:
|
||||
values.artifact === "obsidian.asar" ? values["javascript-question"] : null,
|
||||
managed_question: ["sharex.dll", "sharex.helpers.dll"].includes(
|
||||
values.artifact,
|
||||
)
|
||||
? values["managed-question"]
|
||||
: null,
|
||||
provider_settings_sha256: sha(JSON.stringify(selectedProviders)),
|
||||
provider_search_path_sha256: sha(
|
||||
selectedProviders.PATH ?? process.env.PATH ?? "",
|
||||
|
||||
@@ -39,6 +39,19 @@ def decode(result):
|
||||
return None
|
||||
|
||||
|
||||
def named_scope(value, names):
|
||||
"""Accept explicit equivalent scope labels; contradictory duplicates stay a failure."""
|
||||
if not isinstance(value, dict):
|
||||
return None
|
||||
selected = {name: value[name] for name in names if name in value}
|
||||
values = list(selected.values())
|
||||
if not values:
|
||||
return None
|
||||
if all(entry == values[0] for entry in values):
|
||||
return values[0]
|
||||
return {'conflicting_reported_scopes': selected}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--domain', choices=['wasm', 'evm', 'android', 'managed', 'managed-nonempty', 'firmware', 'inventory', 'javascript', 'native', 'browser'], required=True)
|
||||
@@ -120,8 +133,8 @@ def main():
|
||||
check(key, answer.get(key), n[key])
|
||||
for key in ['module_refs', 'pinvoke_imports']:
|
||||
check(key, answer.get('native_boundaries', {}).get(key), reference['boundaries'][key])
|
||||
check('artifact_coverage', answer.get('coverage', {}).get('artifact'), n['coverage'])
|
||||
check('native_boundaries_coverage', answer.get('coverage', {}).get('native_boundaries'), reference['boundaries']['coverage'])
|
||||
check('artifact_coverage', named_scope(answer.get('coverage'), ['artifact', 'managed_artifact', 'managed_metadata']), n['coverage'])
|
||||
check('native_boundaries_coverage', named_scope(answer.get('coverage'), ['native_boundaries', 'native_boundary_declarations']), reference['boundaries']['coverage'])
|
||||
elif domain == 'managed-nonempty':
|
||||
n = reference['boundaries']
|
||||
check('module_mvid', answer.get('module_mvid'), n['module']['mvid'])
|
||||
@@ -280,6 +293,7 @@ def main():
|
||||
status = str(event['status'])
|
||||
statuses[status] = statuses.get(status, 0) + 1
|
||||
check('network_response_statuses', network['observed_response_statuses'], statuses)
|
||||
factual_checks = dict(checks)
|
||||
scopes = [json.loads(line) for line in args.resource_log.read_text().splitlines() if line.startswith('{')]
|
||||
scope = next(value for value in reversed(scopes) if 'resource_scope' in value)
|
||||
checks['no_resource_abort'] = scope['abort'] is None
|
||||
@@ -298,6 +312,7 @@ def main():
|
||||
report = {
|
||||
'review_source_sha256': hashlib.sha256(Path(__file__).read_bytes()).hexdigest(),
|
||||
'domain': domain, 'checks': checks, 'all_selected_checks_pass': all(checks.values()),
|
||||
'factual_checks': factual_checks, 'all_factual_checks_pass': all(factual_checks.values()),
|
||||
'differences': differences, 'tool_errors': tool_errors, 'summary': summary,
|
||||
'fingerprints': {key: value for key, value in settings.items() if 'sha256' in key or key in ['runtime_revision', 'enabled_tools', 'authority']},
|
||||
'answer_file_sha256': hashlib.sha256((args.trial / 'answer.txt').read_bytes()).hexdigest(),
|
||||
|
||||
Reference in New Issue
Block a user