Skip to content

test(activity): grade the DIVE-3419 PARTIAL banner at the presenter seam (DIVE-3421) - #649

Open
5dive-bot wants to merge 1 commit into
dive-3419-usage-middle-wildcardfrom
dive-3421-activity-partial-banner
Open

test(activity): grade the DIVE-3419 PARTIAL banner at the presenter seam (DIVE-3421)#649
5dive-bot wants to merge 1 commit into
dive-3419-usage-middle-wildcardfrom
dive-3421-activity-partial-banner

Conversation

@5dive-bot

Copy link
Copy Markdown
Collaborator

The gap

DIVE-3419 (#648) gave activity_collect a reporting contract: .partial names every level it
could not read, and cmd_activity prints a ⚠ PARTIAL — N level(s) could not be read banner above
the counts, so a short trail can never be mistaken for a quiet one.

tests/usage_middle_wildcard_unit.sh (23 arms) grades that at the collector seam — the JSON
field, in python, from a fixture tree. It cannot see the presenter. The banner is bash+jq and
cmd_activity calls require_root, so it was undrivable from the seat that wrote it and shipped
with no arm at all. A .partial that is populated correctly and never rendered is the same
silence DIVE-3419 exists to remove, and a jq typo in the banner would have been caught by nothing.

Named by the maker at delivery rather than left for a reader to find as an oversight (DIVE-3421).

What this adds

One file, tests/activity_presenter_partial_unit.sh, 19 arms, core tier (no # TIER: marker),
0.42s. It sources src/cmd_usage.sh and drives the real cmd_activity with only
activity_collect stubbed — tests/usage_presenter_coverage_unit.sh (DIVE-1937) is the precedent
and the shape. require_root is stubbed because it is the reason this seam was untested, not the
subject; stubbing it is what buys the arms any-uid coverage.

group arms what it holds
anchor 2 a complete read renders its specific non-zero counts and the trail itself — so every "no banner" arm below is a statement about the banner and not about a dead renderer
the banner 7 it exists; it is on stdout, not stderr; it carries the array's length; it says SHORT of the truth, not low; it names every level verbatim, each on its own indented line; and it prints before the counts it qualifies
the DIVE-3419 decision 1 a partial read still renders the whole trail and exits 0 — this reader owes a reporting contract, not the fail-closed NOT-REACHED its spend-scanning sibling owes
the idle case 2 an empty trail with an unread level still warns; 0 is what reads as "did nothing"
over-fire control 1 collector JSON with no .partial field at all: no banner, no crash, trail intact, rc=0 (grades the // [] default)
--json 3 the field travels with the counts it shortened, causes unmangled, and the banner does not leak into the stream
--task 1 the banner prints on the task-clipped view too, not only the rolling window

Two of those are load-bearing in a way worth naming. The stdout arm: a warning on the other
stream is gone the moment anyone pipes the trail it qualifies. The position arm: both line
numbers are required to exist, because an absent banner leaves an empty string, which bash reads
as 0 in an arithmetic test and would pass the ordering check vacuously.

Grade

uid 1015, unprivileged, same harness both sides.

fixed tree (this branch)                         19 passed,  0 failed   0.42s
NEGATIVE CONTROL — origin/main's cmd_usage.sh    10 passed,  9 failed

Re-run the control:

mkdir -p /tmp/prebanner
git show origin/main:src/cmd_usage.sh > /tmp/prebanner/cmd_usage.sh
USAGE_SRC_DIR=/tmp/prebanner bash tests/activity_presenter_partial_unit.sh   # must FAIL

The pre-banner cmd_activity is byte-identical apart from the banner block, so the control does not
merely error out: the anchor and trail arms stay green there and only the banner arms red. A
control that dies on line one grades nothing, and 9/19 red with the anchor green is the difference.

Two mutations on the fixed tree, each reddening only its own arms — the arms are independently
graded, not co-satisfied:

mutation result
banner prints (.partial // [])[0:1] (first level only) named levels + level layout red — 17/2
banner block moved below the counts (a footnote) banner position red only — 18/1

Verdict wiring: HARNESS-RC=1 whenever an arm reds (the changed-harnesses probe's property).
shellcheck -S error — the required context — is clean; the three -S warning hits are the same
three the precedent harness carries (SC2154/SC2164 on the shared trap+cd preamble, SC2034).

Siblings unmoved on this tree: usage_presenter_coverage 26/0, usage_middle_wildcard 23/0,
usage_coverage 11/0, usage_dispatch_flag 15/0, usage_enumeration_completeness 9/0,
heartbeat_usage_heal 27/0.

Not covered, named rather than hidden

  1. activity_collect's own emission of .partial is not re-graded here — that is the collector
    seam and fix(usage): the middle wildcard is a read too — usage_collect + activity_collect (DIVE-3419) #648's harness owns it. The two together close the round trip; neither alone does.
  2. The collector and presenter in one process against a real unreadable dir is still unreached
    from any non-root seat, because cmd_activity calls require_root for real. Stubbing it buys
    presenter coverage at any uid; it is not evidence that the root path resolves a real agent's home.
  3. No src/ change. One CHANGELOG bullet under the existing DIVE-3419 Unreleased section.

Ordering

Stacked on dive-3419-usage-middle-wildcard (#648), and based on it here. The banner this grades
does not exist on main, so this cannot land first — merged before #648 it would be 9 red arms
against code that is not there. 5dive-cli does not auto-deploy (deliberate release-cut), so
neither merge is a ship.

…eam (DIVE-3421)

DIVE-3419 gave activity_collect a reporting contract — .partial names every
level it could not read, and cmd_activity prints it above the counts. The
collector harness (tests/usage_middle_wildcard_unit.sh, 23 arms) asserts the
JSON field only. The banner is bash+jq behind require_root, so it had no arm at
all: a .partial that is populated correctly and never rendered is the same
silence DIVE-3419 exists to remove, and a jq typo in it would be caught by
nothing.

19 arms against the REAL cmd_activity with only activity_collect stubbed
(tests/usage_presenter_coverage_unit.sh is the precedent and the shape). Anchor
first — a complete read renders its specific non-zero counts — so that every
absence arm below is a statement about the banner and not about a dead
renderer. Then: the banner exists, on STDOUT (a warning on the other stream is
gone the moment anyone pipes the trail), carries the array's LENGTH, says SHORT
of the truth rather than low, names EVERY level verbatim on its own indented
line, and prints BEFORE the counts it qualifies (both line numbers must exist —
an absent banner leaves an empty string, which bash reads as 0). Then the
DIVE-3419 decision itself: a partial read still renders the whole trail and
exits 0, because this reader owes a reporting contract and not the fail-closed
one its spend-scanning sibling owes. Plus the idle case (an empty trail with an
unread level still warns — 0 is what reads as "did nothing"), an over-fire
control (no .partial field at all: no banner, no crash), --json (the field
travels, the banner does not leak into the stream), and the --task view.

GRADE, uid 1015 unprivileged, same harness both sides. 19/0 on this tree in
0.42s (core tier, no TIER marker). NEGATIVE CONTROL against the pre-banner
cmd_usage.sh at origin/main (78b6a6a), which is byte-identical apart from the
banner block: 10 passed, 9 failed — the anchor and trail arms stay GREEN there,
so the control reaches its assertions rather than erroring out. Two mutations
on the fixed tree, each reddening only its own arms: printing [0:1] of .partial
reds "named levels" + "level layout" (17/2); moving the block below the counts
reds "banner position" only (18/1). Siblings unmoved: usage_presenter_coverage
26/0, usage_middle_wildcard 23/0, usage_coverage 11/0, usage_dispatch_flag
15/0, usage_enumeration_completeness 9/0, heartbeat_usage_heal 27/0.

Stacked on dive-3419-usage-middle-wildcard (PR #648, open): the banner it
grades does not exist on main, so this cannot land before it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants