Skip to content

feat(skills): add otif-analysis skill - #2519

Closed
gulmezeren2-byte wants to merge 1 commit into
affaan-m:mainfrom
gulmezeren2-byte:feat/otif-analysis-skill
Closed

gulmezeren2-byte wants to merge 1 commit into
affaan-m:mainfrom
gulmezeren2-byte:feat/otif-analysis-skill

Conversation

@gulmezeren2-byte

@gulmezeren2-byte gulmezeren2-byte commented Jul 14, 2026 •

Copy link
Copy Markdown

Summary

Adds otif-analysis — a delivery-performance measurement skill: the OTIF metric ladder (tolerant reported KPI → strict on-time-in-full), the definition choices that inflate on-time numbers (date anchor, tolerance window, partial shipments, cancellations), driver decomposition, and raw-row reconciliation before reporting.

Fills a gap next to the existing inventory-demand-planning and logistics-exception-management skills; both are cross-referenced under Related Skills.

All surfaces wired: agent.yaml, manifests/install-modules.json (supply-chain-domain module), package.json files, and the catalog/doc counts (278 → 279 in the 11 places catalog:check tracks).

Type

  • Skill
  • Agent
  • Hook
  • Command

Testing

  • node scripts/ci/catalog.js --text → documentation counts match the repository catalog (279)
  • node tests/scripts/npm-publish-surface.test.js → passes (package.json files aligned to the module graph)
  • Full npm test on my Windows machine shows only the same pre-existing environment failures as a clean main checkout (shell-probe and ENOBUFS suites) — no new failures introduced by this change
  • Lockfiles untouched
  • Skill follows the checklist: "When to Activate", copy-pasteable example, Anti-Patterns, folded description scalar, name matches directory, well under 500 lines. It is the ECC-adapted version of a skill I maintain and use; a reference implementation with reproducible numbers is linked in the SKILL.md.

Checklist

  • Follows format guidelines
  • Tested with Claude Code
  • No sensitive info (API keys, paths)
  • Clear descriptions

@ecc-tools

ecc-tools Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added an OTIF analysis skill for auditing delivery performance.
    • Includes guidance for data validation, metric calculation, gap analysis, lateness-tail analysis, and reconciliation.
    • Documents OTIF definitions, common measurement pitfalls, recommended outputs, and a Python/pandas example.
  • Packaging
    • Included the new OTIF analysis skill in installed and published packages.

Walkthrough

Adds a new otif-analysis skill describing OTIF metric-ladder analysis, reference calculations, anti-patterns, and output requirements. Registers the skill for agent discovery, module installation, and npm package publication.

Changes

OTIF analysis skill

Layer / File(s) Summary
OTIF analysis workflow
skills/otif-analysis/SKILL.md
Defines required order data, OTIF metric rungs, analysis workflow, pandas calculations, anti-patterns, output format, and related skills.
Skill registration and packaging
agent.yaml, manifests/install-modules.json, package.json
Adds otif-analysis to the skill list, supply-chain module paths, and the npm package files whitelist.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • affaan-m/ECC#2202: Adds another skill directory to the npm package files whitelist.
  • affaan-m/ECC#2277: Adds a new skill directory to installation and package whitelists.

Suggested reviewers: affaan-m

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: adding the new otif-analysis skill.
Description check ✅ Passed The description matches the changeset and mentions the new skill plus the registration updates and testing.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a new OTIF analysis skill and wires it into the catalog. The main changes are:

  • New skills/otif-analysis/SKILL.md workflow content.
  • Registration in agent.yaml, package.json, and manifests/install-modules.json.
  • Skill-count updates across English and Chinese docs plus plugin metadata.

Confidence Score: 4/5

The new skill is mostly wired correctly, but the external reference needs a clearer third-party boundary before merging.

  • Skill registration and catalog-count updates line up with the new directory.
  • The new skill points to a personal GitHub repository from an ECC-origin instruction surface.
  • A short disclaimer or official-surface replacement would make the provenance clear.

skills/otif-analysis/SKILL.md

Security Review

The new skill includes an agent-facing link to a non-ECC GitHub repository without a clear third-party warning, which can create supply-chain trust confusion.

Important Files Changed

Filename Overview
skills/otif-analysis/SKILL.md Adds the OTIF workflow, examples, anti-patterns, and related skills; the external reference should be clearly marked as third-party.
agent.yaml Registers otif-analysis in the skill list.
manifests/install-modules.json Adds the new skill to the supply-chain-domain install module.
package.json Adds the new skill directory to the package files surface.
README.md Updates tracked English skill-count references to 279.
AGENTS.md Updates workspace skill-count references to 279.
README.zh-CN.md Updates the Chinese quick-start skill count to 279.
docs/zh-CN/README.md Updates tracked Chinese README skill-count references to 279.
docs/zh-CN/AGENTS.md Updates Chinese workspace skill-count references to 279.
.claude-plugin/plugin.json Updates the plugin description skill count to 279.
.claude-plugin/marketplace.json Updates the marketplace description skill count to 279.

Reviews (1): Last reviewed commit: "feat(skills): add otif-analysis skill" | Re-trigger Greptile

2. Three finding sentences, each: what moved / where it concentrates / what decision it needs
3. A definitions footnote stating anchor date, tolerance, in-full rule and cancellation treatment — so the number cannot be misread

Reference implementation with reproducible numbers and charts: <https://github.com/gulmezeren2-byte/otif-analytics>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security Third-Party Reference Looks Official

This ECC-origin skill labels a personal GitHub repository as the reproducible reference implementation. When an agent uses the skill to help a user reproduce the analysis, it can present that repo as ECC-endorsed and lead the user toward code outside the official distribution surfaces.

Suggested change
Reference implementation with reproducible numbers and charts: <https://github.com/gulmezeren2-byte/otif-analytics>
Third-party reference implementation with reproducible numbers and charts: <https://github.com/gulmezeren2-byte/otif-analytics>. Review this repository before using or running any code from it; it is not an official ECC distribution surface.

Rule Used: Ensure package and distribution claims only list o... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@daltino daltino left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR adds a new skill, increasing the total skill count from 278 to 279, and updates related documentation for consistency across the plugin and repo files. The changes are straightforward, align with the contribution guidelines, and maintain consistency throughout .claude-plugin files, documentation, and translation files. Everything looks good to merge.

Rebuilt on current main. The previous revision also bumped the hand-maintained
"278 skills" counter across seven doc and manifest files; that number changes
whenever anyone adds a skill, so the PR conflicted on nearly every upstream
commit. Dropped it — it is maintainer-swept state rather than part of this
contribution — leaving the skill plus its three registration lines.
@gulmezeren2-byte
gulmezeren2-byte force-pushed the feat/otif-analysis-skill branch from 9de8d4e to 42fb620 Compare July 27, 2026 13:42
@ecc-tools

ecc-tools Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@gulmezeren2-byte

Copy link
Copy Markdown
Author

Rebuilt on current main — this is now mergeable.

I also dropped the hard-coded skill-count bumps (278 → 279) that the earlier revision made across README.md, README.zh-CN.md, AGENTS.md, docs/zh-CN/*, plugin.json and marketplace.json. That counter changes whenever anyone adds a skill, so those seven files were the entire conflict, and the PR would have re-conflicted on essentially every upstream commit. It seemed like maintainer-swept state rather than part of this contribution — happy to add the bump back if you would rather it ride along with the PR.

What is left is the skill itself plus three registration lines:

  • skills/otif-analysis/SKILL.md
  • agent.yaml, package.json, manifests/install-modules.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@skills/otif-analysis/SKILL.md`:
- Line 17: Update the opening thesis sentence in SKILL.md to say companies do
not have just a delivery problem, while preserving the following
measurement-problem clause and the rest of the paragraph unchanged.
- Around line 29-35: Add order_date to the required order-level input contract
in the Required Data section so the validation step can reliably flag
actual_delivery_date values before order_date. Keep the existing impossible-date
validation and reporting requirements unchanged.
- Around line 35-39: The OTIF analysis workflow must expose its audit gates
instead of only filtering rows and reporting percentages. Update the
implementation around the validation, metric-ladder, and reconciliation steps to
count duplicate rows, impossible dates, and cancelled orders, state cancellation
treatment, and report these in a data-quality section; recompute the headline
OTIF directly from raw rows and confirm or flag mismatches before reporting.
Apply the same requirements to the related sections covering the metric output
and reconciliation flow, or explicitly label the snippet as metric-only.
- Around line 60-70: The OTIF ladder currently mixes invalid delivered rows and
uses an inconsistent denominator. Update the ladder computation around `d`,
`late_prom`, `late_req`, and `in_full` to define explicit valid populations and
status/missing-data policies for each rung, excluding rows with missing required
dates or fields; ensure requested-date rungs skip missing
`requested_delivery_date` values, use the intended total-order count for
cancellation-inclusive rung 5, and guard every percentage against zero
denominators.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 51ff6846-ffa6-4efa-aa02-ff8f541751bd

📥 Commits

Reviewing files that changed from the base of the PR and between 9de8d4e and 42fb620.

📒 Files selected for processing (4)
  • agent.yaml
  • manifests/install-modules.json
  • package.json
  • skills/otif-analysis/SKILL.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp,properties,yml,yaml,json,env,config}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager

Files:

  • package.json
  • manifests/install-modules.json
  • agent.yaml
{package.json,*.config.js,scripts/**/*.js}

📄 CodeRabbit inference engine (CLAUDE.md)

Package manager detection should support npm, pnpm, yarn, and bun, with configuration via CLAUDE_PACKAGE_MANAGER environment variable or project config.

Files:

  • package.json
**/*.{js,ts,jsx,tsx,json,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not hardcode secrets, API keys, passwords, or tokens

Files:

  • package.json
  • manifests/install-modules.json
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Use specialized agents proactively for planning, implementation review, testing, security review, build resolution, and domain-specific tasks; run independent operations in parallel.
Write tests before implementation, follow the RED-GREEN-IMPROVE TDD workflow, and maintain at least 80% coverage.
Never compromise security: validate all inputs, prevent injection and XSS, enable CSRF protection, verify authentication and authorization, rate-limit endpoints, and avoid leaking sensitive error details.
Never hardcode secrets; use environment variables or a secret manager, validate required secrets at startup, and rotate exposed secrets immediately.
If a security issue is found, stop, use the security-reviewer agent, fix critical issues, rotate exposed secrets, and search for similar vulnerabilities.
Always create new objects and never mutate existing ones.
Organize code by feature or domain with high cohesion and low coupling; prefer many small files over a few large files, typically 200–400 lines and no more than 800 lines.
Handle errors at every level, show user-friendly messages in UI code, log detailed context server-side, and never silently swallow errors.
Validate all user input at system boundaries using schema-based validation; fail fast with clear messages and never trust external data.
Keep functions under 50 lines, files focused and under 800 lines, avoid nesting deeper than four levels, avoid hardcoded values, and use readable, well-named identifiers.
All required tests include unit tests for functions, utilities, and components; integration tests for APIs and databases; and E2E tests for critical user flows.
Troubleshoot test failures by checking isolation, verifying mocks, and fixing implementation rather than tests unless the tests are incorrect.
Before committing, use Conventional Commits format: <type>: <description>, with types such as feat, fix, refactor, docs, test, chore, perf, and ci.
For pull requests, analyze the full commit history, draf...

Files:

  • package.json
  • manifests/install-modules.json
  • agent.yaml
  • skills/otif-analysis/SKILL.md
skills/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples.

Files:

  • skills/otif-analysis/SKILL.md
{agents,skills,commands}/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Use lowercase filenames with hyphens (e.g., python-reviewer.md, tdd-workflow.md) for agents, skills, and commands.

Files:

  • skills/otif-analysis/SKILL.md
skills/**

📄 CodeRabbit inference engine (AGENTS.md)

Treat skills/ as the canonical workflow surface; add new workflow contributions there first.

Files:

  • skills/otif-analysis/SKILL.md
{skills,commands,agents,rules}/**

⚙️ CodeRabbit configuration file

{skills,commands,agents,rules}/**: Focus on prompt-injection resilience, tool-permission scope, destructive action guards, and secret exfiltration risks.

Files:

  • skills/otif-analysis/SKILL.md
🧠 Learnings (2)
📚 Learning: 2026-03-15T19:02:43.245Z
Learnt from: imrobinsingh
Repo: affaan-m/everything-claude-code PR: 503
File: skills/data-scraper-agent/SKILL.md:1-748
Timestamp: 2026-03-15T19:02:43.245Z
Learning: In this repository, skill folders should use a lowercase-hyphen name (e.g., data-scraper-agent, claude-api) and the skill description file inside each folder should be named SKILL.md (uppercase). Do not flag SKILL.md as a naming violation; treat SKILL.md as the canonical file name inside each skill directory.

Applied to files:

  • skills/otif-analysis/SKILL.md
📚 Learning: 2026-04-15T15:52:59.963Z
Learnt from: manja316
Repo: affaan-m/everything-claude-code PR: 1360
File: skills/security-bounty-hunter/SKILL.md:11-18
Timestamp: 2026-04-15T15:52:59.963Z
Learning: In this repository’s skills documentation (skills/**/SKILL.md), use the canonical auto-activation skill section header `## When to Activate`—do not use `## When to Use`. CONTRIBUTING.md and docs/SKILL-DEVELOPMENT-GUIDE.md confirm the required header, and existing skills follow this convention. This header is important for the auto-activation mechanism to detect the correct section.

Applied to files:

  • skills/otif-analysis/SKILL.md
🔇 Additional comments (4)
skills/otif-analysis/SKILL.md (1)

1-13: LGTM!

Also applies to: 15-16, 19-25, 41-50, 75-96

agent.yaml (1)

108-108: LGTM!

manifests/install-modules.json (1)

898-898: LGTM!

package.json (1)

264-264: LGTM!


# OTIF Analysis

Most companies don't have a delivery problem *and* a measurement problem — they have a measurement problem that hides the delivery problem. Before recommending any operational fix, establish the honest number and show which definition choices inflate the reported one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the contradictory opening sentence.

“Most companies don't have a delivery problem and a measurement problem” contradicts the following clause. Change it to “Most companies don't have just a delivery problem…” so the thesis is unambiguous.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/otif-analysis/SKILL.md` at line 17, Update the opening thesis sentence
in SKILL.md to say companies do not have just a delivery problem, while
preserving the following measurement-problem clause and the rest of the
paragraph unchanged.

Comment on lines +29 to +35
Order-level rows with: `order_id`, `requested_delivery_date` (what the customer asked for), `promised_delivery_date` (what was confirmed), `actual_delivery_date`, completeness info (lines or quantities ordered vs delivered), and a status/cancelled flag. Useful cuts: carrier, region, customer, product family.

If `requested_delivery_date` is missing, say so explicitly: only the promised-date rungs are computable and the analysis cannot see sales padding. Recommend capturing the requested date going forward.

## Core Workflow

1. **Validate before computing.** Count duplicated rows; flag impossible dates (actual before order date); count cancelled orders and state how they will be treated. Report these counts in the output — an audit that silently cleans data is not an audit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Add order_date to the required input contract.

The workflow requires flagging actual_delivery_date before the order date, but Required Data never asks for order_date; that validation cannot be performed reliably. Require the field or remove/replace this check.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/otif-analysis/SKILL.md` around lines 29 - 35, Add order_date to the
required order-level input contract in the Required Data section so the
validation step can reliably flag actual_delivery_date values before order_date.
Keep the existing impossible-date validation and reporting requirements
unchanged.

Comment on lines +35 to +39
1. **Validate before computing.** Count duplicated rows; flag impossible dates (actual before order date); count cancelled orders and state how they will be treated. Report these counts in the output — an audit that silently cleans data is not an audit.
2. **Compute the metric ladder** on the same population, strictest last (table below). Present it with the delta and the cause of each drop.
3. **Decompose the gap.** For the dimension with the largest spread (carrier, region, month, customer), show OTIF per segment and name the concentrated driver, not just the average.
4. **Analyze the tail, not the mean.** Report the share of orders 4+ days late and the worst decile — those are the orders customers remember.
5. **Reconcile before reporting.** Recompute the headline OTIF once more directly from raw rows and confirm it matches. If it does not, stop and find out why.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Make the audit gates visible in the implementation and output.

The workflow requires duplicate/impossible-date/cancellation counts and raw-row reconciliation, but the example only filters rows and prints percentages. Add those checks and a data-quality/reconciliation section, or explicitly label this as a metric-only snippet.

Also applies to: 56-72, 84-88

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/otif-analysis/SKILL.md` around lines 35 - 39, The OTIF analysis
workflow must expose its audit gates instead of only filtering rows and
reporting percentages. Update the implementation around the validation,
metric-ladder, and reconciliation steps to count duplicate rows, impossible
dates, and cancelled orders, state cancellation treatment, and report these in a
data-quality section; recompute the headline OTIF directly from raw rows and
confirm or flag mismatches before reporting. Apply the same requirements to the
related sections covering the metric output and reconciliation flow, or
explicitly label the snippet as metric-only.

Comment on lines +60 to +70
d = df[df.status == "delivered"]
late_prom = (d.actual_delivery_date - d.promised_delivery_date).dt.days
late_req = (d.actual_delivery_date - d.requested_delivery_date).dt.days
in_full = d.lines_delivered_complete >= d.lines_total

ladder = {
"1 promised +3d (reported)": (late_prom <= 3).mean(),
"2 promised, strict": (late_prom <= 0).mean(),
"3 requested, strict": (late_req <= 0).mean(),
"4 OTIF (requested + in-full)": ((late_req <= 0) & in_full).mean(),
"5 OTIF incl. cancellations": ((late_req <= 0) & in_full).sum() / len(df),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
python - <<'PY'
import pandas as pd

late = pd.Series([pd.NaT], dtype="timedelta64[ns]")
result = late <= pd.Timedelta(days=0)
print("comparison:", result.tolist())
print("mean:", result.mean())
PY

Repository: affaan-m/ECC

Length of output: 269


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file =="
fd -a 'SKILL\.md$' . | sed 's#^\./##' | grep 'skills/otif-analysis/SKILL.md$' || true

echo "== inspect relevant file =="
if [ -f skills/otif-analysis/SKILL.md ]; then
  wc -l skills/otif-analysis/SKILL.md
  sed -n '1,120p' skills/otif-analysis/SKILL.md | cat -n
fi

echo "== search otif mentions =="
rg -n "requested_delivery_date|actual_delivery_date|promised_delivery_date|ladder|OTIF|delivered_only|missing|not computable|Line 31|Line 55|Line 60" skills/otif-analysis -S || true

echo "== deterministic pandas semantics probe from installed packages =="
python3 - <<'PY'
import importlib.util
samples = {
    "pandas_available": importlib.util.find_spec("pandas") is not None,
}
if samples["pandas_available"]:
    import pandas as pd
    late = pd.Series([pd.NaT], dtype="timedelta64[ns]")
    result = late <= pd.Timedelta(days=0)
    samples.update({
        "comparison": result.tolist(),
        "mean": result.mean(),
        "isna_comparison_means": 1 / 4 if result.isna().mean() == 0.25 else result.isna().mean(),
    })
else:
    samples.update({"note": "Pandas not installed"})
for k, v in samples.items():
    print(f"{k}={v!r}")
PY

Repository: affaan-m/ECC

Length of output: 9426


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== external pandas comparison behavior for missing date arithmetic =="
python3 - <<'PY'
try:
    import urllib.request
    url = "https://raw.githubusercontent.com/pandas-dev/pandas/v2.2.3/pandas/tests/series/methods/test_replace.py"
    urllib.request.urlretrieve(url, "/tmp/pandas_replace_test.py")
except Exception as e:
    print(f"could_not_fetch:{e!r}")
PY

python3 - <<'PY'
# Static semantic probe: pandas timedelta subtraction with MissingValue produces pd.NaT.
# The <= comparison is a datetime/timedelta comparison with missing value in the source docs:
# https://pandas.pydata.org/docs/reference/api/pandas.Series.lt.html
# It is documented as producing a boolean Series with missing values in the positions where the source is missing.
print("Need_pandas_doc: pandas.NaT comparison results in missing bool values, so .mean() excludes missing rows.")
PY

echo "== deterministic behavior probe from installed dependency packages without executing repository code =="
python3 - <<'PY'
import importlib.util
for name in ["numpy", "dateutil"]:
    spec = importlib.util.find_spec(name)
    print(f"{name}={spec.name if spec else None}")
PY

Repository: affaan-m/ECC

Length of output: 630


🌐 Web query:

pandas Series comparison missing value TrueFalseMissing mean excludes missing rows documentation

💡 Result:

In pandas, the behavior of comparisons and reductions regarding missing values varies depending on the specific method and data type used [1][2]. Equality Comparisons (==,.eq) When performing element-wise equality comparisons (e.g., s1 == s2 or s1.eq(s2)), missing values like np.nan typically do not compare as equal to each other [3][4][5]. Specifically, np.nan!= np.nan returns True, meaning equality checks against NaN usually yield False [3][2]. However, when using the newer, experimental nullable data types (such as the nullable boolean type with pd.NA), comparisons propagate NA, which means the result of an operation involving NA is often NA (unknown) rather than just False [1][2]. For checking if two Series are identical, including the placement of missing values, use the.equals method [6][5]. The.equals method is designed to return a single True or False value and considers NaNs in the same location to be equal [6]. Reductions (e.g.,.mean) For reduction methods like.mean,.sum, and.min, pandas defaults to skipping missing values (skipna=True) [2][7]. This means missing rows are excluded from the calculation, effectively ignoring them rather than treating them as zeros or propagating them as missing [8][2]. This default behavior can be overridden by setting skipna=False if you wish to include missing values in the result (which typically results in NA if any missing values are present) [2]. Summary of Key Differences: - Comparisons (==): Generally treat np.nan as unequal to itself (returns False) [3][2]. Nullable types (pd.NA) propagate NA [1][2]. - Identity Checks (.equals): Considers missing values in the same location as equal [6]. - Reductions (.mean): Excludes missing values by default (skipna=True) [8][2].

Citations:


🌐 Web query:

pandas TimedeltaNaT <= timedelta64 comparison result

💡 Result:

In pandas, comparisons between pd.NaT and other objects, including timedelta64 or Timedelta, generally return False for inequality operators (e.g., <=, <, >, >=) [1]. Specifically, when you perform a comparison such as pd.NaT <= some_timedelta_value, the result is False [1]. This behavior is consistent with the design of NaT (Not-a-Time) in pandas, which is intended to represent missing or null values; it does not behave like a standard number that would trigger an exception or NaN in numerical comparisons [2]. Key points regarding these comparisons: 1. Equality and Inequality: pd.NaT == anything (including other NaT values) typically returns False, and pd.NaT!= anything returns True [3][1]. 2. Order Comparisons: Comparison operators like <, <=, >, and >= involving pd.NaT return False [1]. 3. Implementation: This behavior is enforced by the internal implementation of the NaTType class in pandas [1], which explicitly defines comparison methods to return constant results (False for ordering, False for equality) rather than raising errors or returning non-boolean values [3][1]. 4. Consistency: Users should be aware that while this behavior is stable for scalar pd.NaT values [1], performing these comparisons on pandas Series or Index objects containing NaT can sometimes lead to unexpected results or inconsistencies depending on the version and the specific operation involved [3][4]. For reliable code, it is recommended to explicitly check for missing values using pd.isna or similar methods before performing comparisons rather than relying on the result of a direct comparison with NaT [2].

Citations:


🌐 Web query:

"pandas Series.mean" "skipna" "True by default" documentation

💡 Result:

The pandas Series.mean method includes a skipna parameter, which defaults to True [1]. This means that by default, the method automatically excludes NA/null values when computing the mean [1][2]. As stated in the official pandas documentation, the syntax is as follows [1]: Series.mean(*, axis=0, skipna=True, numeric_only=False, kwargs) When skipna is set to True (the default behavior), missing data points do not affect the calculation of the mean [1][2]. If you wish to include NA/null values in the calculation—which would result in NaN if any null values are present—you can explicitly set skipna=False [2][3].

Citations:


🌐 Web query:

"pandas Series comparison pd.NaT" returns False in documentation

💡 Result:

In pandas, an equality comparison involving pd.NaT—such as pd.NaT == pd.NaT—returns False [1][2][3]. This behavior is consistent with how NaN (Not a Number) values are handled in numerical data, where equality comparisons are not reflexive [1][4][3]. The pandas documentation highlights that equality comparisons involving missing value indicators like np.nan, pd.NaT, and pd.NA do not behave like the Python None singleton, which compares as True when tested against itself (None == None) [1][2][4]. Because of this, using standard equality operators (==) to check for missing values is discouraged [1][2]. To reliably detect missing values in a Series or DataFrame, you should use the dedicated methods pd.isna or pd.notna [1][4]. Key distinctions to note: - pd.NaT == pd.NaT returns False [1][2][3]. - np.nan == np.nan returns False [1][2][4]. - pd.NA == pd.NA returns pd.NA (a nullable boolean indicator), reflecting its propagation behavior [1][2][4]. If you need to compare two objects to see if they contain the same elements, including missing values in the same positions, the.equals method is the recommended approach, as it treats NaNs and NaTs at the same location as equal [5].

Citations:


🌐 Web query:

"https://github.com/pandas-dev/pandas/issues/26039" "pd.NaT <= timedelta" "False"

💡 Result:

The behavior observed in pandas issue #26039, where comparisons between pd.NaT and pd.Timedelta were inconsistent or resulted in a TypeError, was addressed and resolved in pandas version 0.25.0 [1][2]. Prior to this fix, expressions like pd.Timedelta(0) > pd.NaT would raise a TypeError because the comparison logic did not correctly handle the interaction between the NaT scalar and Timedelta objects [1]. Following the fix, comparisons involving pd.NaT and a Timedelta object (e.g., pd.NaT <= pd.Timedelta(0) or pd.Timedelta(0) > pd.NaT) consistently evaluate to False, aligning with standard expectations for missing value comparisons in pandas [2][3]. This change was implemented to ensure that these comparisons do not raise exceptions and return a predictable boolean result [2]. You can verify this behavior in current versions of pandas by running code such as: import pandas as pd print(pd.NaT <= pd.Timedelta(0)) # Output: False print(pd.Timedelta(0) > pd.NaT) # Output: False The fix was incorporated via pull request #26046, and the corrected behavior is covered by regression tests in the pandas codebase [2][3].

Citations:


🌐 Web query:

"pandas Series <= NaT" comparison result

💡 Result:

In pandas, when comparing a Series containing NaT (Not a Time) using the less-than-or-equal (<=) operator against a scalar or another Series, the result for the NaT entry is typically False [1][2]. General Behavior: 1. Comparison with Scalars: For a Series with datetime or timedelta dtype, comparing a NaT value against a valid scalar timestamp or timedelta via <, <=, >, or >= generally returns False [1][2]. 2. Comparison with other Series: Similarly, comparisons between two Series where one has NaT at a specific position typically result in False for that position [1][2]. 3. Consistency: This behavior aligns with standard numerical comparisons in pandas where operations involving NaT (like those involving NaN) do not return True in relational comparisons [1][3]. Best Practices: Because equality comparisons (==) with NaT also return False (or potentially unexpected results depending on the context and data type), you should not use relational operators to detect missing values [4][5]. To reliably identify NaT values in a Series, use the built-in pandas methods: - pd.isna(series) or series.isna [4][5] - series.notna [4][5] Note: Historically, there have been bugs where comparisons involving NaT in DataFrames (rather than Series) exhibited inconsistent behavior, sometimes returning True [2][6][7]. While these issues have been largely resolved in modern versions of pandas [2], it is always recommended to use.isna or.notna for missing data handling to ensure clear and reliable code [4][5].

Citations:


🌐 Web query:

"Series.mean" "skipna" "True" "pandas" "reference/api/pandas.Series.mean"

💡 Result:

In the pandas library, the Series.mean method includes a skipna parameter, which determines how missing (NA/null) values are handled during the calculation of the mean [1][2]. Parameter Details: - Name: skipna - Type: bool - Default Value: True Functionality: When skipna is set to True (the default), the method excludes all NA/null values from the calculation [1][3]. If skipna is set to False, the presence of any NA/null value in the Series will result in a NaN (Not a Number) output [1][2]. API Signature (general): Series.mean(*, axis=0, skipna=True, numeric_only=False, kwargs) [1] For Series objects, the axis parameter is effectively unused and defaults to 0 [1][2]. The numeric_only parameter is used to control whether only float, int, and boolean data types are included in the operation [1][2].

Citations:


🌐 Web query:

"pandas NaT comparison return False" "TimedeltaNaT"

💡 Result:

In pandas, an equality comparison between pd.NaT and a Timedelta (or any other value) returns False [1]. This behavior is intentional, consistent with how NaN values function in numerical operations, where they do not equate to themselves or any other value [2][3]. For clarity on why NaT behaves this way: 1. Sentinel Nature: pd.NaT (Not-a-Time) serves as a sentinel value for missing data in datetime and timedelta contexts [3][4]. Similar to np.nan, it propagates through operations, but equality comparisons (==) are designed to return False because a missing value is inherently "unknown" rather than equal to another missing or known value [3][5]. 2. Historical Context: In older versions of pandas, comparing pd.NaT with other objects sometimes led to inconsistent results, such as TypeError in one direction and False in the other [1]. Improvements in later pandas versions have standardized this behavior so that scalar equality comparisons with NaT consistently return False [1][6]. 3. Comparison with Arrays: When comparing NaT against a numpy array, pandas typically returns a boolean array of False values for equality checks (==) and True values for inequality checks (!=), reflecting that NaT is not equal to any of the elements [7][6]. 4. Detecting NaT: Because equality comparisons return False, you should not use == pd.NaT to check for missing values [2][3]. Instead, use the pandas-provided functions pd.isna(value) or the .isna() method on Series/DataFrame objects, which are designed to correctly identify both NaT and NaN values [2][3]. For developers, if you encounter TypeError when performing comparison operations (like > or <) involving NaT, it is usually because those operations are not supported between a NaTType and non-compatible types [6]. The isna() utility is the most robust way to handle these values in your code [3].

Citations:


🌐 Web query:

"TimedeltaNaT" "comparisons" "NaT" "False"

💡 Result:

In pandas, an equality comparison between pd.NaT and itself (pd.NaT == pd.NaT) results in False [1][2]. This behavior is consistent with np.nan == np.nan in NumPy, where equality comparisons with missing values do not return True [1][2]. Because NaT (Not-a-Time) is used to represent missing or null values in datetime and timedelta contexts, it is not considered equal to itself in direct equality operations [3][1]. To detect missing values (including NaT), you should use the dedicated isna() or notna() methods rather than equality comparisons [4][1][2]. When working with pandas structures like DataFrame or Series, equality checks can sometimes behave inconsistently depending on whether you are comparing scalars or entire containers [5]. For reliable detection of missing values, always prefer the isna() method [1][2].

Citations:


🌐 Web query:

"TimedeltaNaT" "lt" "NaT" "False"

💡 Result:

In pandas, the expression Timedelta(None) < NaT (which resolves to NaT < NaT) returning False is expected behavior consistent with how comparison operators handle missing values (NaT/NaN) [1][2]. In pandas, NaT (Not-a-Time) serves as the sentinel value for missing data in datetime and timedelta objects [1][2]. Similar to the behavior of np.nan in numerical contexts, comparisons involving NaT generally return False [2][3]. Specifically: 1. Equality: pd.NaT == pd.NaT evaluates to False [2][3]. 2. Comparisons: Comparisons such as <, <=, >, or >= involving NaT typically result in False [4][2]. While these results are consistent, users have noted that comparisons between specific types and NaT can sometimes lead to inconsistencies or TypeErrors depending on the order of the operands or the specific pandas version, as the internal handling of different types (Timestamp vs. Timedelta) sharing the same NaT sentinel can be complex [4][5]. It is generally recommended to use specialized methods like pd.isna or pd.notna to check for missing values rather than relying on direct equality or comparison operators [2][3].

Citations:


Use explicit valid populations for every rung.

In the shown code, missing requested_delivery_date values fall into the delivered-only DataFrame and become False in late_req <= 0, letting requested-date rungs compute rather than skipping them per Line 31. Rung 5 also uses a delivered-only numerator with len(df), which can include open/non-delivered rows; use the intended total-order count for that denominator. Define per-rung missing-data and status policies, and guard zero denominators.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/otif-analysis/SKILL.md` around lines 60 - 70, The OTIF ladder
currently mixes invalid delivered rows and uses an inconsistent denominator.
Update the ladder computation around `d`, `late_prom`, `late_req`, and `in_full`
to define explicit valid populations and status/missing-data policies for each
rung, excluding rows with missing required dates or fields; ensure
requested-date rungs skip missing `requested_delivery_date` values, use the
intended total-order count for cancellation-inclusive rung 5, and guard every
percentage against zero denominators.

@haelyra

haelyra commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Thank you for contributing this. The honest OTIF ladder and its focus on definition choices are genuinely useful for ECC’s supply-chain surface. I’m sorry the PR waited this long for a complete review.

We would love another focused pass on the analysis contract:

  • Make validation inputs executable. The workflow says to flag deliveries before order_date, but order_date is absent from both the required-data contract and parsed columns. Add it and make the example count and report duplicate orders, impossible dates, and cancellations before calculating metrics.
  • Define each rung’s eligible population. The current pandas comparisons silently treat missing dates as failures, while rung five divides delivered successes by every raw status. Explicitly report missing required fields, name each denominator, include only the intended cancellation population, and guard empty cohorts.
  • Make the example perform the promised audit. It calculates percentages but does not emit the data-quality section or independently reconcile the headline against raw rows. Implement those steps, or clearly label the snippet as metric-only and provide a validated audit example separately.
  • Restore current catalog and provenance wiring. npm run catalog:check currently fails all 11 skill-count references. Regenerate those surfaces after rebasing, and label the linked personal repository clearly as a third-party reference or replace it with an ECC-owned fixture.

If you do not have bandwidth for the update, we can carry the skill concept forward internally. We should not publish the current numeric example because it can produce a misleading KPI on common missing-date or mixed-status datasets.

@github-actions

Copy link
Copy Markdown

This PR is stale due to inactivity.

@github-actions github-actions Bot added the stale No activity for 30+ days label Sep 14, 2026
@github-actions github-actions Bot removed the stale No activity for 30+ days label Sep 28, 2026
@haelyra

haelyra commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Thank you for contributing this, and I am sorry the full review took as long as it did. The honest OTIF ladder is a genuinely useful idea: making each definition choice explicit is exactly where on-time-in-full numbers usually go wrong, and we have noted auditable operational metrics as a community signal.

We are going to close this version because the August review items are still open, and they affect the headline number. The example counts rows with a missing requested date as late (a NaT difference compares as false), rung five divides by every raw row including still-open orders, order_date is used in validation but is missing from the data contract, and the promised data-quality audit is not emitted. A skill that publishes a KPI cannot ship while common datasets can produce a misleading result. A focused follow-up would be very welcome: the same ladder with explicit per-rung eligible populations and denominators, missing-field reporting, and a small fixture showing the audit output.

@haelyra haelyra closed this Nov 17, 2026
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.

3 participants