Skip to content

feature: implement functional instrumentation and compatibility metrics#1830

Merged
RobertvanderHulst merged 3 commits intodevfrom
feature/vfp-metrics-instrumentation
Mar 1, 2026
Merged

feature: implement functional instrumentation and compatibility metrics#1830
RobertvanderHulst merged 3 commits intodevfrom
feature/vfp-metrics-instrumentation

Conversation

@Irwin1985
Copy link
Contributor

Overview

This PR introduces a formal Functional Instrumentation and Metric System for the Visual FoxPro dialect. The goal is to move away from ad-hoc progress estimates and provide a data-driven, weighted measurement of the VFP Runtime's compatibility.

Key Changes

  • Formal Instrumentation: Decorated 240+ functions with the new FoxProFunctionAttribute. This metadata includes Category, Engine, Status and Criticality.
  • Criticality-Weighted Metrics: Implemented a logic where core functions (eg: TABLEUPDATE(), ALLTRIM()) impact the compatibility score more significantrly than fringe utilities.
  • VfpCompatMetrics Tool: Included a new CLI utility located in src/Tools/VfpTools that performs reflection-based audits on XSharp.VFP.dll generating detailed reports on progress, thecnical debt and consistency errors like duplicated names.

Current instrumentation shows an initial 50.54% weighed compatibility score providing a clear baseline for future sprints.

- Decorated 240+ functions with FoxProFunctionsAttribute for formal auditing.
- Categorized functions by Engine, Category, Status and Criticality.
- Integrated VfpCompatMetrics tool to calculate weighted compatibility scores.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a formal instrumentation layer for the Visual FoxPro (VFP) runtime functions and adds a CLI tool that reflects over XSharp.VFP.dll to compute weighted compatibility metrics and detect instrumentation consistency issues.

Changes:

  • Added FoxProFunctionAttribute (+ supporting enums) to encode function metadata (category/engine/status/criticality/notes).
  • Decorated a large set of VFP runtime functions (including stubs and not-supported functions) with FoxProFunctionAttribute.
  • Added a new VfpCompatMetrics CLI tool/solution to load an assembly, extract metadata, validate it, and print a compatibility report.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/Tools/VfpTools/XSharp.Vfp.Tools.slnx Adds a solution wrapper for the new VFP tools project(s).
src/Tools/VfpTools/VfpCompatMetrics/VfpCompatMetrics.xsproj Adds the build project for the new metrics CLI tool.
src/Tools/VfpTools/VfpCompatMetrics/Properties/AssemblyInfo.prg Adds assembly metadata for the new CLI tool.
src/Tools/VfpTools/VfpCompatMetrics/Program.prg Implements assembly loading, attribute extraction, validation, scoring, and console reporting.
src/Runtime/XSharp.VFP/XSharp.VFP.xsproj Includes the new attribute source file and Types folder in the runtime build.
src/Runtime/XSharp.VFP/Types/Attributes.prg Introduces FoxProFunctionAttribute and enums used to instrument runtime functions.
src/Runtime/XSharp.VFP/ArrayFunctions.prg Adds instrumentation attributes to array-related runtime functions.
src/Runtime/XSharp.VFP/BitFunctions.prg Adds instrumentation attributes to bitwise runtime functions.
src/Runtime/XSharp.VFP/ClassFunctions.prg Adds instrumentation attributes to class/object helper runtime functions.
src/Runtime/XSharp.VFP/DateFunctions.prg Adds instrumentation attributes to date/time runtime functions and adjusts nearby comments.
src/Runtime/XSharp.VFP/FileFunctions.prg Adds instrumentation attributes to file/IO runtime functions.
src/Runtime/XSharp.VFP/FinancialFunctions.prg Adds instrumentation attributes to financial runtime functions.
src/Runtime/XSharp.VFP/Functions.prg Adds instrumentation attributes to core object/utility runtime functions.
src/Runtime/XSharp.VFP/GetWord.prg Adds instrumentation attributes to word parsing runtime functions.
src/Runtime/XSharp.VFP/Keyboard.prg Adds instrumentation attributes to keyboard state runtime functions.
src/Runtime/XSharp.VFP/MiscFunctions.prg Adds instrumentation attributes to miscellaneous runtime functions.
src/Runtime/XSharp.VFP/NotSupported.prg Adds instrumentation attributes to explicitly not-supported runtime functions.
src/Runtime/XSharp.VFP/NumericFunctions.prg Adds instrumentation attributes to numeric runtime functions.
src/Runtime/XSharp.VFP/PrinterFunctions.prg Adds instrumentation attributes to printer-related runtime functions.
src/Runtime/XSharp.VFP/StringFunctions.prg Adds instrumentation attributes to string runtime functions and updates some doc comments.
src/Runtime/XSharp.VFP/SystemFunctions.prg Adds instrumentation attributes to system runtime functions.
src/Runtime/XSharp.VFP/TextOutPut.prg Adds instrumentation attributes to text output/merge runtime functions.
src/Runtime/XSharp.VFP/UIFunctions.prg Adds instrumentation attributes to UI-related runtime functions.
src/Runtime/XSharp.VFP/WindowFunctions.prg Adds instrumentation attributes to window-related runtime functions.
src/Runtime/XSharp.VFP/ToDo-A.prg Adds instrumentation attributes to stubbed “A*” functions.
src/Runtime/XSharp.VFP/ToDo-B.prg Adds instrumentation attributes to stubbed “B*” functions.
src/Runtime/XSharp.VFP/ToDo-C.prg Adds instrumentation attributes to stubbed “C*” functions.
src/Runtime/XSharp.VFP/ToDo-D.prg Adds instrumentation attributes to stubbed “D*” functions.
src/Runtime/XSharp.VFP/ToDo-EF.prg Adds instrumentation attributes to stubbed “E/F*” functions.
src/Runtime/XSharp.VFP/ToDo-G.prg Adds instrumentation attributes to stubbed “G*” functions.
src/Runtime/XSharp.VFP/ToDo-HI.prg Adds instrumentation attributes to stubbed “H/I*” functions.
src/Runtime/XSharp.VFP/ToDo-KLM.prg Adds instrumentation attributes to stubbed “K/L/M*” functions.
src/Runtime/XSharp.VFP/ToDo-NOP.prg Adds instrumentation attributes to stubbed “N/O/P*” functions.
src/Runtime/XSharp.VFP/ToDo-QR.prg Adds instrumentation attributes to stubbed “Q/R*” functions.
src/Runtime/XSharp.VFP/ToDo-S.prg Adds instrumentation attributes to stubbed “S*” functions.
src/Runtime/XSharp.VFP/ToDo-TUVWX.prg Adds instrumentation attributes to stubbed “T/U/V/W/X*” functions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +116 to +125
VAR nameSet := HashSet<STRING>{}

FOREACH item AS FoxFunctionMetadata IN data
// 1. Empty name
IF String.IsNullOrWhiteSpace(item:Name)
issues:Add(ValidationIssue{}{ Level := "ERROR", FunctionName := "<Unknown>", Message := "Unnamed attribute in the technical method: " + item:MethodName })
ELSE
// 2. Duplicated names
VAR upperName := item:Name:ToUpper()
IF nameSet:Contains(upperName)
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

Duplicate-name detection uses item:Name:ToUpper() with a default HashSet comparer, which is culture-sensitive and can produce incorrect results in some locales (e.g., Turkish-I). Prefer HashSet(StringComparer.OrdinalIgnoreCase) (or ToUpperInvariant) to make the duplicate check stable and deterministic.

Copilot uses AI. Check for mistakes.
Comment on lines +268 to +270
IF args:Length == 0
Console.WriteLine("Usage: vfpCompatMetrics <path_to_XSharp_VFP_dll>")
RETURN 1
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

The usage text hardcodes an executable name ("vfpCompatMetrics") that may not match the actual built output (currently OutputName=VfpTools). Keep the usage string in sync with the produced exe name to avoid confusing CLI users.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
<Solution>
<Project Path="VfpCompatMetrics/VfpCompatMetrics.xsproj" Type="aa6c8d78-22ff-423a-9c7c-5f2393824e04" Id="e3bdfa61-2018-4dd7-8a02-c053bb73ede2" />
</Solution>
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

The .slnx file omits the standard and structure used by other .slnx solutions in this repo (e.g., src/RuntimeNet8.slnx). If the build/IDE tooling expects those sections, this minimal form may not load or build correctly; consider aligning this file’s structure with the existing .slnx format.

Copilot uses AI. Check for mistakes.
Comment on lines +58 to +60
<RunPostBuildEvent />
</PropertyGroup>
</Project> No newline at end of file
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

This .xsproj is missing the / block that all other Tools .xsproj files include (and which is annotated as required). Without it, solution/project configuration discovery may break in MSBuild/VS; add the same ProjectExtensions block used in other tool projects.

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +13
[assembly: AssemblyTitle("VfpTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VfpTools")]
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

Assembly metadata (AssemblyTitle/Product) is set to "VfpTools" even though this project is VfpCompatMetrics. This will make the produced assembly/exe identity misleading in file properties and logs; consider using "VfpCompatMetrics" consistently.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link
Member

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Comment on lines +264 to +265
// 7. CLI entry poitn
// =========================================================================
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

Typo in comment: "CLI entry poitn" → "CLI entry point".

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Mar 1, 2026

@RobertvanderHulst I've opened a new pull request, #1831, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Mar 1, 2026

@RobertvanderHulst I've opened a new pull request, #1832, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Mar 1, 2026

@RobertvanderHulst I've opened a new pull request, #1833, to work on those changes. Once the pull request is ready, I'll request review from you.

@RobertvanderHulst RobertvanderHulst merged commit a88ea30 into dev Mar 1, 2026
1 check passed
@RobertvanderHulst RobertvanderHulst deleted the feature/vfp-metrics-instrumentation branch March 1, 2026 13:52
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.

4 participants