Repository navigation
fix(console,eval): truthful console totals/hint; eval text prints object values - #402
Merged
Merged
Conversation
console: `--help`'s Output shape now names `summary.total` as every captured
message and the top-level `total` as the --level/--pattern match count. A
read that matched none of N captured messages gets its own hint
("N console messages captured, none matched --pattern '…'") instead of the
false "No console messages captured", which stays for an empty cache.
eval: `--format text` evaluates the way --stringify does, so an object prints
as its JSON value instead of grip metadata, and no generic
`-> ff-rdp console --level error` hint line follows the value. A default
JSON result that is an object grip carries a top-level `hint` naming
--stringify. One sentence after eval's `Output:` line documents text mode.
Ticks both kb/backlog.md lines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…stringify
Review of the first commit: forcing --stringify under --format text re-wrapped
the script (breaking --no-isolate scope sharing and statement completion
values like `if (1) { 2 }`) and turned DOM nodes, functions, BigInt and
`window` into `{}`, undefined or an error.
Now --format text (without --jq) sends the script exactly as JSON mode does.
A plain Object/Array grip is read through its object actors
(prototypeAndProperties, depth 6, at most 200 reads) and printed as pretty
JSON; any other result prints as before. The generic hint line stays off in
text mode. The object-grip `hint` is limited to Object/Array grips and
honours --no-hints. The console zero-match hint shell-quotes the pattern.
PrototypeAndProperties::own_properties is now a Vec in Firefox's order
(was a BTreeMap, which sorted keys alphabetically), so text output keeps
JSON.stringify's key order; inspect re-sorts into its own map and is
unchanged. New fixtures recorded from Firefox 161 by
live_eval_object_nested_properties; new live test live_eval_text_values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…adata Second review of #402. --format text no longer claims JSON.stringify semantics: - a value cut at a cap (6 levels, 200 object reads, 100000 array items) prints a stderr warning naming the caps and --stringify; - nested BigInt/Symbol print as "[BigInt 10]"/"[Symbol k]" instead of raw grip metadata; functions, Date and DOM nodes stay "[Kind]"; - arrays pad with null up to `length` (capped), an accessor index is "[Getter]"; - the object-grip hint is skipped under --format text (also on the read fallback) and --jq, so existing --jq filters see the old envelope; - the console hint single-quotes an empty --level. The eval help sentence now states the caps and the placeholders and points to --stringify for exact JSON.stringify output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two
kb/backlog.mdlines (both ticked in this PR).Cause
--helpdocumented bothsummary.totaland the top-leveltotalasN, but the top-leveltotalis the--level/--patternmatch count. The empty-result hint fired whenevertotal == 0, however many messages had been captured, so 0-of-3 matched said "No console messages captured".--format text, an object result printed as its raw grip (actor id, preview,propertyNames), followed by the generic-> ff-rdp console --level errortip. A default JSON object result gave no pointer to--stringify.Fix
console
console.rs:empty_result_hint(raw_total, level, pattern)says "N console message(s) captured, none matched --level X --pattern '…'. Run without the filter to see them."'becomes'\'').--levelis quoted unless it is a non-empty alphanumeric word, so--level ''stays visible.args.rs, consoleOutput:line only: the shape now readssummary.total: ALL,total: M, with a legend for ALL, M and Z. JSON field names are unchanged.eval
--format text(without--jq) does not change what runs: the script goes out exactly as in JSON mode.ObjectorArraygrip is read throughprototypeAndPropertiesand printed as pretty JSON of its own enumerable properties, in Firefox's order. This is notJSON.stringify, and neither the help nor the code claims it is."[Kind]"placeholders:"[Function]","[Date]","[HTMLBodyElement]","[BigInt 10]","[Symbol k]". Grip or actor metadata never reaches the output."[Getter]".undefineddrops out of objects; NaN and ±Infinity print asnull.nullup tolength."[Object]","[Array]"or"[truncated]", and stderr gets a warning that names the caps and suggests--stringify.window) prints as before.hintnaming--stringifyappears only on an Object/Array grip result. It is never added under--stringify,--no-hints,--jq(so existing--jqfilters see the same envelope as before) or--format text.args.rs, eval: one sentence afterOutput:, stating the caps and placeholders and pointing to--stringifyfor exactJSON.stringifyoutput. I did not restructure any prose.ff-rdp-core (outside my file set; the smallest change that works)
actors/object.rs:PrototypeAndProperties::own_propertiesis now aVec<(String, PropertyDescriptor)>in Firefox's order, instead of aBTreeMapthat sorted keys alphabetically.inspectre-sorts into its ownBTreeMap, so its output does not change.propertyNamesnow follows Firefox's order.Proofs (headless Firefox 161.0, isolated
FF_RDP_HOME,--port 6271, sandbox off; launched pid 73543, stopped byff-rdp stop)Every command exited 0, and none of the text-mode runs printed a
->hint line.Tests
plain_value_reads_nested_objects_and_arrays_in_order: key order, non-enumerable keys,undefined, NaN, the DOM, BigInt and Symbol placeholders, getters at a key and at an index, padding tolength.plain_value_stops_at_the_depth_cap_on_a_cycleandplain_value_reports_an_exhausted_read_budget: both assert thattruncatedis set.plain_array_caps_a_far_sparse_index_and_a_huge_length.grip_hint_only_for_plain_containers_when_not_suppressed.empty_result_hint_distinguishes_filtered_out_from_nothing_captured: also covers quoting and an empty--level.parse_prototype_and_properties_keeps_firefox_order.eval_text_object_prints_json_value: replays the recorded nested fixtures and asserts that no--stringifywrap is sent.eval_text_with_jq_keeps_the_grip,eval_object_no_hints_drops_grip_hint,eval_text_scalar_has_no_hint_lineandeval_stringify_json_has_no_grip_hint.eval_object_resultnow also checks the grip hint.console_pattern_no_match_hint_names_the_filterandconsole_nothing_captured_hint.live_eval_text_valuescovers:--no-isolateacross two calls andif (1) { 2 };document.body,10nandwindow;--format text --jqand--no-hints;eval_{immediate,result}_object_nested.jsonandprototype_and_properties_{object,array,inner}_nested.json. They were recorded against Firefox 161 by the newlive_eval_object_nested_propertiesrecorder. The e2e test re-addresses the recorded evaluationResult'sfromto the console actor inget_target_response.json, the same replay adaptation the mock already applies to replies.-D warnings, skill_drift bless (no files changed) andcargo test --workspace -qare all green. The liveevalandconsolemodules pass withFF_RDP_LIVE_TESTS=1.Trade-offs / not done
windowstill prints its full grip, including a longpropertyNameslist.ownSymbolsis not read.new Array(200000)prints as["[truncated]"]plus the warning; holes past the cap are not padded.hints_evalis unchanged, so passing--hintsexplicitly in JSON mode still shows the console tip.supply-chainis red on RUSTSEC-2026-0592 (url2.5.8). It fails on main too and is fixed separately in fix(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 #404; this branch will mergeorigin/mainonce fix(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 #404 lands.🤖 Generated with Claude Code