Skip to content

Add myHerb sustainability shift guidance prototype#20

Merged
myHerbDev merged 1 commit intomainfrom
codex/develop-sustainability-guidance-application
Mar 28, 2026
Merged

Add myHerb sustainability shift guidance prototype#20
myHerbDev merged 1 commit intomainfrom
codex/develop-sustainability-guidance-application

Conversation

@myHerbDev
Copy link
Copy Markdown
Owner

Motivation

  • Provide a lightweight prototype to help founders assess sustainability maturity across core pillars and prioritize next steps.
  • Enable a reproducible, testable baseline for myHerb-style sustainability shift guidance within DevSphere.
  • Surface a simple scoring and tiering model that can be extended into more advanced advisory features.

Description

  • Add apps/myherb_shift_advisor.py, which defines PILLARS, a PillarAssessment dataclass with input validation, generate_shift_report that computes a weighted score (using default weights), assigns a maturity tier, and returns the top-3 priority recommendations.
  • Implement _default_weights() and _tier_from_score() helpers and round the aggregated score to two decimal places.
  • Add unit tests in apps/test_myherb_shift_advisor.py that check report generation (tier, weighted score, and priorities) and validate that invalid weight sums raise ValueError.
  • Update README.md with a new "myHerb Sustainability Shift Guidance (Prototype)" section including quick run and test instructions.

Testing

  • Ran the unit tests with cd apps && python -m unittest test_myherb_shift_advisor.py.
  • Initial test run revealed an expectation mismatch for the weighted score, the test expected 71.25 but the implementation produced 71.75, so the expected value in the test was updated to 71.75.
  • Final test run: 2 tests run and all tests passed (OK).

Codex Task

@codesandbox
Copy link
Copy Markdown

codesandbox bot commented Mar 27, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd03f01e4e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if seen != set(PILLARS):
raise ValueError("Assessments must include each pillar exactly once")

resolved_weights = weights or _default_weights()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat empty custom weights as invalid input

Using weights or _default_weights() makes an empty dict ({}) fall back to defaults instead of failing validation, so callers with misloaded/empty config silently get a report computed with unintended weights. In this case the "Weights must include all pillars" guard is never reached, which hides input errors and can produce incorrect guidance without any exception.

Useful? React with 👍 / 👎.

Comment on lines +90 to +92
total_weight = sum(resolved_weights.values())
if abs(total_weight - 1.0) > 1e-9:
raise ValueError("Weights must sum to 1.0")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce valid weight ranges before scoring

The current validation only checks that weights sum to 1.0, so invalid distributions like a negative weight offset by a >1 weight (or NaN values) can pass and yield nonsensical aggregate scores and tiers. This affects any caller providing custom weights, and it can silently corrupt the report output; each weight should be validated as finite and within an expected range (typically 0..1).

Useful? React with 👍 / 👎.

@myHerbDev myHerbDev merged commit fa0f8fa into main Mar 28, 2026
@myHerbDev myHerbDev self-assigned this Mar 28, 2026
@myHerbDev myHerbDev added the enhancement New feature or request label Mar 28, 2026
@github-project-automation github-project-automation bot moved this to 🆕 New Ideas in DevSphere Mar 28, 2026
@github-project-automation github-project-automation bot moved this from 🆕 New Ideas to ✅ Ready to Share in DevSphere Mar 28, 2026
@myHerbDev myHerbDev added this to the merge milestone Mar 28, 2026
@myHerbDev myHerbDev linked an issue Mar 28, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex enhancement New feature or request

Projects

Status: ✅ Ready to Share

Development

Successfully merging this pull request may close these issues.

EcoSense v11.3 BETA

1 participant