Skip to content

Walk Track: Add contract tests for NodePresenter JSON boundary #141

@nikhil2611

Description

@nikhil2611

Context

Walk Ex5 added 11-assertion contract tests for StatusPresenter#summarize_json with a golden file. NodePresenter (used by knife node show --format json) has no schema contract — shape regressions go undetected.

Code Paths

  • lib/chef/knife/core/node_presenter.rbformat_for_display JSON path
  • spec/unit/knife/core/node_presenter_spec.rb — add contract describe block
  • spec/data/node_presenter_contract.json — new golden file

Acceptance Criteria

  • At least 8 assertions covering required JSON keys (name, chef_environment, run_list, normal)
  • Golden file committed with non-deterministic fields (ohai_time) zeroed or omitted
  • Contract test runs in bundle exec rake spec with 0 failures
  • ai-track-docs/contract-test.md updated with NodePresenter section

Dependencies

Follows pattern from Walk Ex5 (StatusPresenter contract). No blocking deps.

Size

Small — one PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions