Commit Graph

730 Commits

Author SHA1 Message Date
Mayuresh
e6accc3f26 feat(benchmarks): auto-generate BENCHMARK_REPORT.md at end of run
- Add benchmarks/reports/REPORT_TEMPLATE.md — template with __MARKER__
  placeholders for all auto-populated fields (latency, throughput,
  percentiles, cache delta, benchstat block, environment, ONIX version)

- Add benchmarks/tools/generate_report.go — reads latency_report.csv,
  throughput_report.csv, benchstat_summary.txt and run1.txt metadata,
  fills the template, and writes BENCHMARK_REPORT.md to the results dir.
  ONIX version sourced from the latest git tag (falls back to 'dev').

- Update run_benchmarks.sh to call generate_report.go after parse_results.go;
  also derive ONIX_VERSION from git tag and pass to generator

- Update README and directory layout to reflect new files and workflow
2026-04-09 22:01:56 +05:30
Mayuresh
1c47276aed feat(benchmarks): display total runtime at end of run_benchmarks.sh 2026-04-09 21:34:50 +05:30
Mayuresh
beb0a3205e fix(go.mod): revert accidental go 1.25.0 toolchain bump to go 1.24.6
go mod tidy bumped the directive from 1.24.6 to 1.25.0 because the local
machine runs Go 1.25. Nothing in the benchmark code requires 1.25. Pinning
back to 1.24.6 keeps this PR consistent with the CI workflows
(beckn_ci.yml, beckn_ci_test.yml, build-and-deploy-plugins.yml) which all
pin to Go 1.24.x.
2026-04-09 17:03:49 +05:30
Mayuresh
23e39722d2 fix(benchmarks): fix three parsing bugs in parse_results.go and bench_test.go
- parse_results.go: fix metric extraction order — Go outputs custom metrics
  (p50_µs, p95_µs, p99_µs, req/s) BEFORE B/op and allocs/op on the benchmark
  line. The old positional regex had B/op first, so p50/p95/p99 were always
  empty in latency_report.csv. Replaced with separate regexps for each field
  so order no longer matters.

- parse_results.go: remove p95_latency_ms column from throughput_report.csv —
  parallel sweep files only emit ns/op and req/s, never p95 data. The column
  was structurally always empty.

- bench_test.go: remove fmt.Printf from BenchmarkBAPCaller_RPS — the debug
  print raced with Go's own benchmark output line, garbling the result to
  'BenchmarkRPS-N  RPS: N over Ns' which the framework could not parse,
  causing req/s to never appear in the structured output. b.ReportMetric
  alone is sufficient.
2026-04-09 17:01:13 +05:30
Mayuresh
1a6acfc260 chore: gitignore create_benchmark_issues.sh utility script 2026-04-09 12:07:55 +05:30
Mayuresh
497e4b86a4 feat(benchmarks): add benchmark report, fix gitignore and README
- Add benchmarks/reports/REPORT_ONIX_v150.md — baseline report
  (Apple M5, darwin/arm64, Beckn v2.0.0, GOMAXPROCS=10)
- Gitignore benchmarks/results/ — runtime output from run_benchmarks.sh
- Update README: directory layout with reports/ vs results/, Reports
  section with workflow for adding new reports, fix benchstat invocation
  to use `go tool benchstat`
- Remove internal task marker from setup_test.go comment
2026-04-09 12:07:55 +05:30
Mayuresh
bccb381bfa scripts to run benchmarks 2026-04-09 12:07:55 +05:30
Mayuresh
b7081477c0 benchmarking tools added 2026-04-09 12:07:55 +05:30
Mayuresh
dab54b574c Revert "fix(schemav2validator): conditionally strip @context/@type based on schema properties"
The fix in the previous PR is no longer required because the protocol is changed to solve the root cause, reverting this change.
2026-04-08 13:15:16 +05:30
Mayuresh A Nirhali
4d1a9b8e15 Merge pull request #646 from beckn/fix/context-type-check
fix(schemav2validator): conditionally strip @context/@type based on s…
2026-04-07 14:10:24 +05:30
Mayuresh
2f1bfa23a7 fix(schemav2validator): conditionally strip @context/@type based on schema properties
Previously, @context and @type were always stripped from domain data before
validation. This caused failures when a schema explicitly declares these as
required properties, resulting in "missing required field" errors. The fix
checks whether each field is declared in the schema's properties before
deciding to strip it.
2026-04-07 12:54:18 +05:30
Mayuresh A Nirhali
83d8a1acfc Merge pull request #641 from nirmalnr/feat/network_allowlist
Add network ID allowlist support to DeDi registry plugin
2026-04-02 12:03:48 +05:30
Nirmal N R
8997b0e802 refactor: remove unused ctx from resolveAllowedNetworkIDs function and related tests 2026-04-02 10:54:38 +05:30
Nirmal N R
db330663bd feat: enhance network membership validation and add tests for extractStringSlice function 2026-04-01 18:54:31 +05:30
Nirmal N R
d2d211031b fix: update docs and emit deprecation error for old config key 2026-04-01 18:47:05 +05:30
Nirmal N R
1be114188d chore: update registry URL in docs 2026-03-27 11:15:29 +05:30
Nirmal N R
67bbac7728 chore: updated error message 2026-03-27 10:58:49 +05:30
Mayuresh A Nirhali
f774d09711 Merge pull request #640 from beckn/new-context
fix(reqpreprocessor): support camelCase context attributes (bapId, bppId, transactionId, messageId)
2026-03-25 20:27:47 +05:30
Mayuresh
c2e357fd1e reverting changes from schemav2validator plugin 2026-03-25 20:15:51 +05:30
Mayuresh A Nirhali
cc5d347a05 Merge pull request #639 from beckn/camelcase
fix(router): support camelCase context attributes (bppUri, bapUri) fo…
2026-03-25 19:36:08 +05:30
Mayuresh
72593d2ab6 fix(router): support camelCase context attributes (bppUri, bapUri) for beckn spec migration
Replace fixed JSON struct tags for bpp_uri and bap_uri with a map-based parse of
the context object. A new getContextString() helper checks the snake_case key first
and falls back to the camelCase key, so routing works transparently for both the
legacy beckn spec and the new camelCase convention.

Also adds a nil-context guard so a missing context field returns a clear error
instead of a panic.

Test coverage:
- Two new cases in TestRouteSuccess for bppUri and bapUri camelCase payloads
- TestGetContextString: 5 table-driven cases covering snake, camel, precedence,
  missing, and empty-snake-fallthrough scenarios
- TestRouteNilContext: confirms clear error on missing context field

Fixes #636

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 15:41:16 +05:30
Mayuresh
1be757a165 fix(reqpreprocessor): support camelCase context attributes for beckn spec migration
- Add transactionId and messageId as camelCase aliases in model.go contextKeys map,
  pointing to the same ContextKeyTxnID and ContextKeyMsgID constants. This allows
  adapter configs to reference either form without failing startup validation.

- In reqpreprocessor, add firstNonNil() helper for subscriber/caller ID lookups
  so bap_id/bapId and bpp_id/bppId are both resolved correctly regardless of
  which beckn spec version the payload uses. snake_case takes precedence when both
  are present.

- Add snakeToCamel() helper used in the context key loop so a single config entry
  (e.g. transaction_id) automatically also checks the camelCase form (transactionId)
  without requiring any config file changes.

- Add TestSnakeToCamel, TestCamelCaseSubscriberID, TestCamelCaseContextKeys to
  cover all new code paths.

Fixes #637

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 15:40:36 +05:30
Mayuresh A Nirhali
f5825e9e23 Merge pull request #615 from 711ayush711/feat/policyEnforcer
Implement Policy Enforcer Plugin
2026-03-25 15:31:07 +05:30
Ritesh
97e63cf7d2 fix: remove unsupported map fallback in policy result parsing 2026-03-25 14:47:04 +05:30
Nirmal N R
d81c49efb2 chore: better examples in dedi registry plugin docs 2026-03-25 14:06:19 +05:30
Nirmal N R
c7b15aa1a2 fix(docs): updated docs to show network membership as domain of parent 2026-03-25 14:03:10 +05:30
Ritesh
13a7a18e17 Fix: address policy checker review feedback 2026-03-24 17:59:48 +05:30
Nirmal N R
424dc1c64c feat: added network ID allowlist in DeDi registry plugin 2026-03-24 11:33:11 +05:30
711ayush711
1707fb5b02 Merge branch 'beckn:main' into feat/policyEnforcer 2026-03-23 10:21:55 +05:30
Ayush Rawat
80e7b299f1 Refactor Policy Enforcer to Policy Checker
- Renamed the `PolicyEnforcer` interface and related implementations to `PolicyChecker` for clarity and consistency.
- Updated configuration keys in YAML files to reflect the new `checkPolicy` terminology.
- Adjusted related code, tests, and documentation to support the new naming convention and ensure compatibility.
- Enhanced comments and examples for the `checkPolicy` configuration to improve usability.
2026-03-23 04:08:13 +05:30
Mayuresh Nirhali
6d4f45a632 #621 Fixed docker image for onix and tested obs setup 2026-03-12 06:35:14 +00:00
Ayush Rawat
ff4d909b7e Enhance Policy Enforcer Configuration and Add Benchmark Tests
- Added detailed comments and examples for the `policyPaths` configuration in both BAP and BPP YAML files to improve clarity on usage.
- Introduced a new benchmark test suite for the Policy Enforcer to evaluate performance under varying rule counts, measuring both evaluation and compilation times.
2026-03-05 15:31:34 +05:30
Ayush Rawat
dfbaf5c6c5 Refactor Policy Enforcer to Use Unified PolicyPaths
- Updated the Policy Enforcer to consolidate policy source configuration under a single `policyPaths` key, allowing for auto-detection of URLs, directories, and files.
- Removed deprecated keys such as `policyFile` and `policyUrls` from the configuration structure.
- Adjusted related code and tests to ensure compatibility with the new configuration format.
- Enhanced documentation to clarify the usage of `policyPaths` and provide examples for various configurations.
2026-03-03 18:49:17 +05:30
Ayush Rawat
a806af3228 Update Policy Enforcer Configuration Keys
- Changed configuration key from `policyDir` to `policyPaths` across multiple YAML files and related code to standardize the naming convention.
- Updated documentation to reflect the new key name and its usage for specifying local directories containing `.rego` policy files.
- Adjusted tests to ensure compatibility with the updated configuration structure.
2026-03-03 15:02:04 +05:30
Ayush Rawat
e22b79e137 Refactor Policy Enforcer Configuration
- Updated the Policy Enforcer configuration across multiple YAML files to use a unified `policyDir` instead of individual policy sources.
- Changed the step name from `enforcePolicy` to `policyEnforcer` for consistency.
- Enhanced the documentation to clarify the use of `policyUrls`, `policyDir`, and `policyFile` for policy sources.
- Adjusted related code and tests to accommodate the new configuration structure.
- Added documentation for using YAML folded scalar (>-) to keep long comma-separated policyUrls values readable across multiple lines.
2026-03-03 10:04:22 +05:30
Ayush Rawat
3617c9b4a6 Implement Policy Enforcer Plugin
- Added a new Policy Enforcer plugin to evaluate incoming messages against OPA policies.
- Configurable via YAML with options for policy sources, actions, and query.
- Integrated into existing configuration files for BAP and BPP.
- Updated related tests and documentation for the new functionality.
- Enhanced plugin manager to support Policy Enforcer instantiation.
2026-03-02 20:09:33 +05:30
Mayuresh A Nirhali
fe541227b9 Merge pull request #614 from ssd532/fix/test-failures
Fix test failures in reqmapper and simplekeymanager plugins
2026-03-02 17:30:53 +05:30
Mayuresh A Nirhali
01f959a25b Update affiliations from FIDE to Beckn Labs and adding NPCI contributors
Update affiliations from FIDE to Beckn Labs and adding NPCI contributors
2026-02-27 21:59:21 +05:30
Mayuresh A Nirhali
434e0e99d7 Merge pull request #605 from Beckn-One/feat/issues_585
Feat: Network Observability - OTelSetup plugin, Instrumentation in Core.
2026-02-27 21:15:30 +05:30
Manendra Pal Singh
59aa058920 Feat: update the pr as per comment 2026-02-27 19:05:09 +05:30
Manendra Pal Singh
1293c241f7 Fix : update the config 2026-02-26 15:00:28 +05:30
Manendra Pal Singh
80f1cc0f10 Fix : update the config 2026-02-26 14:57:38 +05:30
Manendra Pal Singh
9d57d3b8f1 Feat : Update PR as comment 2026-02-26 14:45:35 +05:30
Sachin Divekar
34954ce83a Fix test failures in reqmapper and simplekeymanager plugins
- reqmapper/cmd: Add missing mappingsFile to TestProviderNewSuccess config
- simplekeymanager/cmd: Fix wantErr for partial config (keyId-only) case
- simplekeymanager/cmd: Use valid base64 key values in TestConfigMapping
- simplekeymanager: Remove incorrect SubscriberID assertion from TestGenerateKeyset
  (GenerateKeyset generates raw keys, subscriber identity is assigned separately)
2026-02-24 20:04:10 +05:30
Manendra Pal Singh
18303eb1b5 Fix : update the matric arrtibute 2026-02-24 13:35:44 +05:30
Manendra Pal Singh
c2f3dbce2c fix: sender and recipient.id 2026-02-23 23:16:49 +05:30
Manendra Pal Singh
ab89102711 Feat: configure audit fields and metrics for onix adapter and add local configuration for onix adapterZ 2026-02-23 16:08:44 +05:30
Mayuresh A Nirhali
9d6004502e Update SETUP.md
#542 - Change the AWS specific link to point to new repo where aws specific tools are maintained.
2026-01-30 20:00:26 +05:30
Mayuresh A Nirhali
b8023e1f6e Merge pull request #606 from nirmalnr/beckn-io-url-update
Update registry URLs in example configuration files to use beckn.io domain
2026-01-30 11:42:52 +05:30
Nirmal N R
0a0e5377ef Update registry URLs in local configuration files to use beckn.io domain 2026-01-30 10:45:25 +05:30