Skip to content

Render known-good binaries in text output#249

Closed
sbneto wants to merge 2 commits into
developfrom
known-good-instance-rendering
Closed

Render known-good binaries in text output#249
sbneto wants to merge 2 commits into
developfrom
known-good-instance-rendering

Conversation

@sbneto

@sbneto sbneto commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

TL;DR

  • The text formatter now renders a known-good binary specially: when the SDK resource exposes a non-empty known_good_sources, the Detections line reads "This artifact is a known-good binary (flagged by: …); it is not scanned." and the Status line reads "Known good".
  • Replaces the misleading "no engines responded — rescan now" message a window-closed, no-assertion instance would otherwise show.
  • Read defensively with getattr(..., None), so a CLI running against an older SDK renders exactly as before. Non-known-good output is byte-for-byte unchanged; JSONOutput needs no change (it dumps .json, which already carries the raw known_good array).

Tests

Pure-unit formatter tests: a known-good instance renders the sorted feed list + "Status: Known good" and no rescan prompt; a normal instance is unchanged (still "Status: Assertion window closed"). Full CLI suite green (74 passed) — no golden-output cassette shifts. Spec 03-formatters.md updated in the same change set.

Requires

  • polyswarm-api PR #306 (adds ArtifactInstance.known_good / known_good_sources, the attribute this rendering reads). Backward-compatible via getattr, but the known-good rendering only activates once that SDK change is released.

sbneto added 2 commits June 16, 2026 13:35
When an artifact instance is a known-good binary (the SDK exposes
known_good_sources), the text formatter now reports "This artifact is a
known-good binary (flagged by: …); it is not scanned." and "Status: Known good"
instead of the misleading "no engines responded — rescan now" a window-closed,
no-assertion instance would otherwise show. Read with getattr(..., None) so a
CLI on an older SDK renders exactly as before; non-known-good output is
unchanged. JSON output already carries the raw known_good array via .json.
@claude

claude Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review

Clean against AGENTS.md and specs/03-formatters.md / specs/05-sdk-contract.md. No blocking issues.

Correctness — gating is consistent: Detections uses known_good_sources and not instance.failed, and the Status branch (elif known_good_sources:) sits after if instance.failed:, so both effectively require not-failed. Known-good correctly takes precedence over the community == 'stream' and window-closed branches, which is the stated fix. The getattr(..., None) or [] defensive read is right.

Spec / contract03-formatters.md updated in the same PR; JSONOutput left unchanged (dumps .json); only the documented resources.ArtifactInstance surface is consumed, with the SDK PR linked under ## Requires. No CLI version bump — correct for a feature PR. Base is develop — gitflow OK.

Tests — new path exercised both ways (known-good renders sorted feeds + Status: Known good and suppresses the rescan prompt; normal instance unchanged).

One non-blocking note (just confirming the spec-05 gate is honored): the new test depends on ArtifactInstance.known_good_sources existing, so it only passes once SDK #306 is on the SDK's develop (CI's branch-archive fallback). Don't merge ahead of that.

@sbneto sbneto closed this Jun 16, 2026
@sbneto sbneto deleted the known-good-instance-rendering branch June 16, 2026 16:57
@sbneto

sbneto commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #250 — the branch was renamed to known-good-feed-metadata to match the companion polyswarm-api branch so CI's $CI_COMMIT_BRANCH SDK-archive install resolves the paired SDK (the GitHub branch-rename closed this PR rather than retargeting it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant